Exemple #1
0
def new_dim_codec_nbt() -> nbt.TAG_Compound:
    return nbt.TAG_Compound(
        "",
        [
            nbt.TAG_Compound(
                "minecraft:dimension_type",
                [  # dimension type registry
                    nbt.TAG_String("type", "minecraft:dimension_type"),
                    nbt.TAG_List(
                        "value",
                        [  # list of compounds
                            nbt.TAG_Compound(
                                None,
                                [
                                    nbt.TAG_String("name",
                                                   "minecraft:overworld"),
                                    nbt.TAG_Int("id", 0),
                                    nbt.TAG_Compound(
                                        "element",
                                        new_dim_codec_value_elem(
                                            0,
                                            1,
                                            0,
                                            "minecraft:infiniburn_overworld",
                                            0,
                                            1,
                                            1,
                                            "minecraft:overworld",
                                            1,
                                            256,
                                            1,
                                            0,
                                            0,
                                        ),
                                    ),
                                ],
                            ),
                            nbt.TAG_Compound(
                                None,
                                [
                                    nbt.TAG_String(
                                        "name", "minecraft:overworld_caves"),
                                    nbt.TAG_Int("id", 1),
                                    nbt.TAG_Compound(
                                        "element",
                                        new_dim_codec_value_elem(
                                            0,
                                            1,
                                            0,
                                            "minecraft:infiniburn_overworld",
                                            0,
                                            1,
                                            1,
                                            "minecraft:overworld",
                                            1,
                                            256,
                                            1,
                                            0,
                                            1,
                                        ),
                                    ),
                                ],
                            ),
                            nbt.TAG_Compound(
                                None,
                                [
                                    nbt.TAG_String("name",
                                                   "minecraft:the_nether"),
                                    nbt.TAG_Int("id", 2),
                                    nbt.TAG_Compound(
                                        "element",
                                        new_dim_codec_value_elem(
                                            1,
                                            0,
                                            0.1,
                                            "minecraft:infiniburn_nether",
                                            1,
                                            0,
                                            0,
                                            "minecraft:the_nether",
                                            0,
                                            128,
                                            8,
                                            1,
                                            1,
                                            fixed_time=18000,
                                        ),
                                    ),
                                ],
                            ),
                        ],
                    ),
                ],
            ),
            nbt.TAG_Compound("minecraft:worldgen/biome", []),  # biome registry
        ],
    )
Exemple #2
0
 def new_nbt(uuid_: uuid.UUID, spawn: tuple, dimension: str) -> nbt.TAG:
     return nbt.TAG_Compound(
         "",
         [
             nbt.TAG_List("Pos", [
                 nbt.TAG_Double(None, 0),
                 nbt.TAG_Double(None, 0),
                 nbt.TAG_Double(None, 0)
             ]),
             nbt.TAG_List("Motion", [
                 nbt.TAG_Double(None, 0),
                 nbt.TAG_Double(None, 0),
                 nbt.TAG_Double(None, 0)
             ]),
             nbt.TAG_List("Rotation",
                          [nbt.TAG_Float(None, 0),
                           nbt.TAG_Float(None, 0)]),
             nbt.TAG_Float("FallDistance", 0),
             nbt.TAG_Short("Fire", -20),
             nbt.TAG_Short("Air", 300),
             nbt.TAG_Byte("OnGround", 1),
             nbt.TAG_Byte("NoGravity", 0),
             nbt.TAG_Byte("Invulnerable", 0),
             nbt.TAG_Int("PortalCooldown", 0),
             nbt.TAG_Int_Array("UUID", struct.unpack(">iiii", uuid_.bytes)),
             nbt.TAG_String("CustomName", ""),
             nbt.TAG_Byte("CustomNameVisible", 0),
             nbt.TAG_Byte("Silent", 0),
             nbt.TAG_List("Passengers", []),
             nbt.TAG_Byte("Glowing", 0),
             nbt.TAG_List("Tags", []),
             nbt.TAG_Float("Health", 20),
             nbt.TAG_Float("AbsorptionAmount", 0),
             nbt.TAG_Short("HurtTime", 0),
             nbt.TAG_Int("HurtByTimestamp", 0),
             nbt.TAG_Short("DeathTime", 0),
             nbt.TAG_Byte("FallFlying", 0),
             # nbt.TAG_Int('SleepingX', 0),
             # nbt.TAG_Int('SleepingY', 0),
             # nbt.TAG_Int('SleepingZ', 0),
             nbt.TAG_Compound("Brain", [nbt.TAG_Compound("memories", [])]),
             nbt.TAG_List(
                 "ivaributes",
                 [
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name", "generic.max_health"),
                             nbt.TAG_Double("Base", 20),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name", "generic.follow_range"),
                             nbt.TAG_Double("Base", 32),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name",
                                            "generic.knockback_resistance"),
                             nbt.TAG_Double("Base", 0),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name",
                                            "generic.movement_speed"),
                             nbt.TAG_Double("Base", 1),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name",
                                            "generic.attack_damage"),
                             nbt.TAG_Double("Base", 2),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name", "generic.armor"),
                             nbt.TAG_Double("Base", 0),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name",
                                            "generic.armor_toughness"),
                             nbt.TAG_Double("Base", 0),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name",
                                            "generic.attack_knockback"),
                             nbt.TAG_Double("Base", 0),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name", "generic.attack_speed"),
                             nbt.TAG_Double("Base", 4),
                             nbt.TAG_List("Modifiers", []),
                         ],
                     ),
                     nbt.TAG_Compound(
                         None,
                         [
                             nbt.TAG_String("Name", "generic.luck"),
                             nbt.TAG_Double("Base", 0),
                             nbt.TAG_List("Modifiers", [])
                         ],
                     ),
                 ],
             ),
             nbt.TAG_List("ActiveEffects", []),
             nbt.TAG_Int("DataVersion", 2586),
             nbt.TAG_Int("playerGameType", 0),
             nbt.TAG_Int("previousPlayerGameType", -1),
             nbt.TAG_Int("Score", 0),
             nbt.TAG_String("Dimension", dimension),
             nbt.TAG_Int("SelectedItemSlot", 0),
             nbt.TAG_Compound(
                 "SelectedItem",
                 [
                     nbt.TAG_Byte("Count", 1),
                     nbt.TAG_String("id", "minecraft:air"),
                     nbt.TAG_Compound("tag", [])
                 ],
             ),
             nbt.TAG_String("SpawnDimension", "overworld"),
             nbt.TAG_Int("SpawnX", spawn[0]),
             nbt.TAG_Int("SpawnY", spawn[1]),
             nbt.TAG_Int("SpawnZ", spawn[2]),
             nbt.TAG_Byte("SpawnForced", 0),
             nbt.TAG_Int("foodLevel", 20),
             nbt.TAG_Float("foodExhaustionLevel", 0),
             nbt.TAG_Float("foodSaturationLevel", 5),
             nbt.TAG_Int("foodTickTimer", 0),
             nbt.TAG_Int("XpLevel", 0),
             nbt.TAG_Float("XpP", 0),
             nbt.TAG_Int("XpTotal", 0),
             nbt.TAG_Int("XpSeed", random.randint(-2147483648, 2147483647)),
             nbt.TAG_List("Inventory", []),
             nbt.TAG_List("EnderItems", []),
             nbt.TAG_Compound(
                 "abilities",
                 [
                     nbt.TAG_Float("walkSpeed", 0.1),
                     nbt.TAG_Float("flySpeed", 0.05),
                     nbt.TAG_Byte("mayfly", 0),
                     nbt.TAG_Byte("flying", 0),
                     nbt.TAG_Byte("invulnerable", 0),
                     nbt.TAG_Byte("mayBuild", 1),
                     nbt.TAG_Byte("instabuild", 0),
                 ],
             ),
             # nbt.TAG_Compound('enteredNetherPosition', [nbt.TAG_Double('x', 0), nbt.TAG_Double('y', 0), nbt.TAG_Double('z', 0)]),
             # nbt.TAG_Compound('RootVehicle', [
             #     nbt.TAG_Int_Array('Attach', [0, 0, 0, 0]),
             #     nbt.TAG_Compound('Entity', [])
             # ]),
             nbt.TAG_Byte("seenCredits", 0),
             nbt.TAG_Compound(
                 "recipeBook",
                 [
                     nbt.TAG_List("recipes", []),
                     nbt.TAG_List("toBeDisplayed", []),
                     nbt.TAG_Byte("isFilteringCraftable", 0),
                     nbt.TAG_Byte("isGuiOpen", 0),
                     nbt.TAG_Byte("isFurnaceFilteringCraftable", 0),
                     nbt.TAG_Byte("isFurnaceGuiOpen", 0),
                     nbt.TAG_Byte("isBlastingFurnaceFilteringCraftable", 0),
                     nbt.TAG_Byte("isBlastingFurnaceGuiOpen", 0),
                     nbt.TAG_Byte("isSmokerFilteringCraftable", 0),
                     nbt.TAG_Byte("isSmokerGuiOpen", 0),
                 ],
             ),
         ],
     )
Exemple #3
0
def new_level_nbt(version: tuple, level_name: str, spawn: tuple,
                  seed: int) -> nbt.TAG_Compound:
    return nbt.TAG_Compound(
        "",
        [
            nbt.TAG_Compound(
                "Data",
                [
                    nbt.TAG_Byte("allowCommands", 0),
                    nbt.TAG_Double("BorderCenterX", 0),
                    nbt.TAG_Double("BorderCenterZ", 0),
                    nbt.TAG_Double("BorderDamagePerBlock", 0.2),
                    nbt.TAG_Double("BorderSize", 29999984),
                    nbt.TAG_Double("BorderSafeZone", 5),
                    nbt.TAG_Double("BorderSizeLerpTarget", 29999984),
                    nbt.TAG_Long("BorderSizeLerpTime", 0),
                    nbt.TAG_Double("BorderWarningBlocks", 5),
                    nbt.TAG_Double("BorderWarningTime", 15),
                    nbt.TAG_Double("clearWeatherTime", 0),
                    nbt.TAG_Compound("CustomBossEvents", []),
                    nbt.TAG_Compound("DataPacks", [
                        nbt.TAG_List("Disabled", []),
                        nbt.TAG_List("Enabled", [])
                    ]),
                    nbt.TAG_Int("DataVersion", version[0]),
                    nbt.TAG_Long("DayTime", 0),
                    nbt.TAG_Byte("Difficulty", 2),
                    nbt.TAG_Byte("DifficultyLocked", 0),
                    nbt.TAG_Compound(
                        "DimensionData",
                        [
                            nbt.TAG_Compound(
                                "1",
                                [
                                    nbt.TAG_Compound(
                                        "DragonFight",
                                        [
                                            nbt.TAG_Compound(
                                                "ExitPortalLocation",
                                                [
                                                    nbt.TAG_Byte("X", 0),
                                                    nbt.TAG_Byte("Y", 100),
                                                    nbt.TAG_Byte("Z", 0),
                                                ],
                                            ),
                                            nbt.TAG_List(
                                                "Gateways",
                                                [
                                                    nbt.TAG_Int(None, i)
                                                    for i in range(19)
                                                ],
                                            ),
                                            nbt.TAG_Byte("DragonKilled", 0),
                                            nbt.TAG_Long("DragonUUIDLeast", 0),
                                            nbt.TAG_Long(
                                                "DragonKilledUUIDMost", 0),
                                            nbt.TAG_Byte(
                                                "PreviouslyKilled", 0),
                                        ],
                                    )
                                ],
                            )
                        ],
                    ),
                    nbt.TAG_Compound(
                        "GameRules",
                        [
                            nbt.TAG_String("announceAdvancements", "true"),
                            nbt.TAG_String("commandBlockOutput", "true"),
                            nbt.TAG_String("disableElytraMovementCheck",
                                           "false"),
                            nbt.TAG_String("disableRaids", "false"),
                            nbt.TAG_String("doDaylightCycle", "true"),
                            nbt.TAG_String("doEntityDrops", "true"),
                            nbt.TAG_String("doFireTick", "true"),
                            nbt.TAG_String("doInsomnia", "true"),
                            nbt.TAG_String("doImmediateRespawn", "false"),
                            nbt.TAG_String("doLimitedCrafting", "false"),
                            nbt.TAG_String("doMobLoot", "true"),
                            nbt.TAG_String("doMobSpawning", "true"),
                            nbt.TAG_String("doPatrolSpawning", "true"),
                            nbt.TAG_String("doTileDrops", "true"),
                            nbt.TAG_String("doTraderSpawning", "true"),
                            nbt.TAG_String("doWeatherCycle", "true"),
                            nbt.TAG_String("drowningDamage", "true"),
                            nbt.TAG_String("fallDamage", "true"),
                            nbt.TAG_String("fireDamage", "true"),
                            nbt.TAG_String("forgiveDeadPlayers", "true"),
                            nbt.TAG_String("keepInventory", "false"),
                            nbt.TAG_String("logAdminCommands", "true"),
                            nbt.TAG_String("maxCommandChainLength", "65536"),
                            nbt.TAG_String("maxEntityCramming", "24"),
                            nbt.TAG_String("mobGriefing", "true"),
                            nbt.TAG_String("naturalRegeneration", "true"),
                            nbt.TAG_String("randomTickSpeed", "3"),
                            nbt.TAG_String("reducedDebugInfo", "false"),
                            nbt.TAG_String("sendCommandFeedback", "true"),
                            nbt.TAG_String("showDeathMessages", "true"),
                            nbt.TAG_String("spawnRadius", "10"),
                            nbt.TAG_String("spectatorsGenerateChunks", "true"),
                            nbt.TAG_String("universalAnger", "false"),
                        ],
                    ),
                    nbt.TAG_Compound(
                        "WorldGenSettings",
                        [
                            nbt.TAG_Byte("bonus_chest", 0),
                            nbt.TAG_Long("seed", seed),
                            nbt.TAG_Byte("generate_features", 1),
                            nbt.TAG_Compound("dimensions", []),
                        ],
                    ),
                    nbt.TAG_Int("GameType", 0),
                    nbt.TAG_Byte("hardcore", 0),
                    nbt.TAG_Byte("initialized", 0),
                    nbt.TAG_Long("LastPlayed", int(time.time() * 1000)),
                    nbt.TAG_Long("LevelName", level_name),
                    nbt.TAG_Byte("MapFeatures", 1),
                    nbt.TAG_Byte("raining", 0),
                    nbt.TAG_Int("rainTime",
                                random.randint(1, 3) * 24000),
                    nbt.TAG_Long("RandomSeed", seed),
                    nbt.TAG_Long("SizeOnDisk", 0),
                    nbt.TAG_Int("SpawnX", spawn[0]),
                    nbt.TAG_Int("SpawnY", spawn[1]),
                    nbt.TAG_Int("SpawnZ", spawn[2]),
                    nbt.TAG_Byte("thundering", 0),
                    nbt.TAG_Int("thunderTime",
                                random.randint(1, 3) * 24000),
                    nbt.TAG_Long("Time", 0),
                    nbt.TAG_Int("version", version[2]),
                    nbt.TAG_Compound(
                        "Version",
                        [
                            nbt.TAG_Int("Id", version[0]),
                            nbt.TAG_String("Name", version[1]),
                            nbt.TAG_Byte("Snapshot", 0),
                        ],
                    ),
                    nbt.TAG_Int_Array("WanderingTraderId", [0, 0, 0, 0]),
                    nbt.TAG_Int("WanderingTraderSpawnChance", 50),
                    nbt.TAG_Int("WanderingTraderSpawnDelay", 10000),
                ],
            ),
        ],
    )
Exemple #4
0
 def new_nbt(chunk_x: int, chunk_z: int) -> nbt.TAG_Compound:
     return nbt.TAG_Compound(
         "",
         [
             nbt.TAG_Int("DataVersion", 2586),
             nbt.TAG_Compound(
                 "Level",
                 [
                     nbt.TAG_Int_Array("Biomes", [127] * 1024),
                     nbt.TAG_Compound(
                         "CarvingMasks",
                         [
                             nbt.TAG_Byte_Array("AIR", []),
                             nbt.TAG_Byte_Array("LIQUID", [])
                         ],
                     ),
                     nbt.TAG_List("Entities", []),
                     nbt.TAG_Compound(
                         "Heightmaps",
                         [
                             nbt.TAG_Long_Array("MOTION_BLOCKING", []),
                             nbt.TAG_Long_Array("MOTION_BLOCKING_NO_LEAVES",
                                                []),
                             nbt.TAG_Long_Array("OCEAN_FLOOR", []),
                             nbt.TAG_Long_Array("OCEAN_FLOOR_WG", []),
                             nbt.TAG_Long_Array("WORLD_SURFACE", []),
                             nbt.TAG_Long_Array("WORLD_SURFACE_WG", []),
                         ],
                     ),
                     nbt.TAG_Long("LastUpdate", 0),
                     nbt.TAG_List(
                         "Lights",
                         [nbt.TAG_List(None, []) for _ in range(16)]),
                     nbt.TAG_List(
                         "LiquidsToBeTicked",
                         [nbt.TAG_List(None, []) for _ in range(16)]),
                     nbt.TAG_List("LiquidTicks", []),
                     nbt.TAG_Long("InhabitedTime", 0),
                     nbt.TAG_List(
                         "PostProcessing",
                         [nbt.TAG_List(None, []) for _ in range(16)]),
                     nbt.TAG_List("Sections", []),
                     nbt.TAG_String("Status", "empty"),
                     nbt.TAG_List("TileEntities", []),
                     nbt.TAG_List("TileTicks", []),
                     nbt.TAG_List(
                         "ToBeTicked",
                         [nbt.TAG_List(None, []) for _ in range(16)]),
                     nbt.TAG_Compound(
                         "Structures",
                         [
                             nbt.TAG_Compound("References", []),
                             nbt.TAG_Compound("Starts", [])
                         ],
                     ),
                     nbt.TAG_Int("xPos", chunk_x),
                     nbt.TAG_Int("zPos", chunk_z),
                 ],
             ),
         ],
     )