#minecraft:rotation -> minecraft:transformation python script

1 messages · Page 1 of 1 (latest)

unreal totem
#

Here

#
import json

def upgrade_rotation_to_transformation(file_path):
    with open(file_path, 'r') as file:
        data = json.load(file)

    if isinstance(data, dict) and 'minecraft:block' in data:
        block_data = data['minecraft:block']
        upgrade_rotation_in_components(block_data)
        upgrade_rotation_in_permutations(block_data)

    with open(file_path, 'w') as file:
        json.dump(data, file, indent=4)
        print(f"Upgraded {file_path}")

def upgrade_rotation_in_components(block_data):
    if 'components' in block_data:
        components = block_data['components']
        if 'minecraft:rotation' in components:
            rotation = components['minecraft:rotation']
            components['minecraft:transformation'] = {
                'rotation': rotation
            }
            del components['minecraft:rotation']

def upgrade_rotation_in_permutations(block_data):
    if 'permutations' in block_data:
        permutations = block_data['permutations']
        for permutation in permutations:
            if 'components' in permutation:
                components = permutation['components']
                if 'minecraft:rotation' in components:
                    rotation = components['minecraft:rotation']
                    components['minecraft:transformation'] = {
                        'rotation': rotation
                    }
                    del components['minecraft:rotation']

def find_json_files(folder_path):
    for root, _, files in os.walk(folder_path):
        for file_name in files:
            if file_name.endswith('.json'):
                file_path = os.path.join(root, file_name)
                upgrade_rotation_to_transformation(file_path)

folder_path = input("Enter the folder path: ")
find_json_files(folder_path)
print("Upgrade process completed.")
#

chatgpt made it

#

MAKE A BACKUP BEFORE USING

shy rover
#

anyway y python doe

#

python sucks lol

unreal totem
broken karma
#

chatgpt.. bruh.

#

bro always mixes up bedrock and java

#

plus terrible anyway

shy rover
#

chatgpt sucks

#

also i love how people call it "ai" when its just a gpt (generative pre-trained transformer)

#

its even in the name bruh lmao

#

making an actual ai isnt really possible

#

well not with just computers

unreal totem
#

Yah I agree with everything yout saying but it has nothing to do with this.

#

It's not like I typed in a prompt and copied the first thing that came out. I tested each iteration of the script and have confirmed that is functions as intended

#

I provided examples of components, block structure and permutations.

shy rover
#

ye im just saying

viral coral
#

I tried that,but I think i fed it too much

#

It started writing things about java and python

broken karma
#

i think it is good as a sort of "starting point" for any kind of project, if you don't wanna create a whole project from scratch. but once you've got something of a base going (and assuming you have a decent amount of experience with the technologies at hand) its better to go off on your own.

It likely won't give perfect results to very specific requirements and the perfection will go on to crumple the more edge cases you add. On top of that, accuracy will go down the more niche things you want to implement (let's say, you want to know the difference between i++ and ++i in machine code). Not many people care about what they translate to in machine language. So there are less people talking about it. So the AI has less data to base answers off of.