Jump to content

[1.14.4] [Resolved] TileEntity reset internal data when loaded.


DefbeatCZ

Recommended Posts

Hello,

I would like to ask for help with the following problem - I have TileEntity attached to a block, trying to make it work with one private int variable. When writing NBT on server, the actual internal value is used. When loading from NBT during world load, the saved value is used. The problem is that afterwards the value is zero-ed as if the TileEntity is constructed a new ...

 

Is there anything I need to do in the TE constructor? Or is there an init function I am missing?

 

Thanks in advance !

 

Code is on my GitHub https://github.com/DefbeatCZ/Minecraft-Arcana   

The problem is within the EntropyBlockProducer.java

Edited by DefbeatCZ
Link to comment
Share on other sites

17 minutes ago, DefbeatCZ said:

The problem is within the EntropyBlockProducer.java

Post the log where the log statements are.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

This is my console output. I made mine debug traces bold. The only warning I got is from ModelBaker about missing blockstates.

 

 

2019-09-06 01:03:44,465 main WARN Advanced terminal features are not available in this environment
[01:03:44] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20190829.143755, --fml.mcVersion, 1.14.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 28.0.83, --version, MOD_DEV, --assetIndex, 1.14, --assetsDir, C:\Users\a\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ????????, --userProperties, {}]
[01:03:44] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 3.2.0+60+b86c1d4 starting: java version 1.8.0_191 by Oracle Corporation
[01:03:45] [main/INFO] [ne.mi.fm.lo.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[01:03:45] [main/INFO] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\a\.gradle\caches\forge_gradle\assets, --assetIndex, 1.14, --username, Dev, --accessToken, ????????, --userProperties, {}]
[01:03:47] [Client thread/INFO] [minecraft/Minecraft]: Setting user: Dev
[01:03:57] [Client thread/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[01:03:57] [Client thread/INFO] [minecraft/Minecraft]: LWJGL Version: 3.2.2 build 10
[01:04:00] [modloading-worker-3/INFO] [ne.mi.co.ForgeMod/FORGEMOD]: Forge mod loading, version 28.0.83, for MC 1.14.4 with MCP 20190829.143755
[01:04:00] [modloading-worker-3/INFO] [ne.mi.co.MinecraftForge/FORGE]: MinecraftForge v28.0.83 Initialized
[01:04:04] [Client thread/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
[01:04:04] [Thread-1/FATAL] [ne.mi.co.ForgeConfig/CORE]: Forge config just got changed on the file system!
[01:04:04] [Forge Version Check/INFO] [ne.mi.fm.VersionChecker/]: [forge] Starting version check at https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[01:04:05] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
[01:04:05] [Forge Version Check/INFO] [ne.mi.fm.VersionChecker/]: [forge] Found status: BETA_OUTDATED Current: 28.0.83 Target: 28.0.93
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: mcarcana:blockstates/tepa.json: java.io.FileNotFoundException: mcarcana:blockstates/tepa.json
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'mcarcana:blockstates/tepa.json' missing model for variant: 'mcarcana:tepa#'
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: mcarcana:blockstates/tepb.json: java.io.FileNotFoundException: mcarcana:blockstates/tepb.json
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'mcarcana:blockstates/tepb.json' missing model for variant: 'mcarcana:tepb#'
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: mcarcana:blockstates/tep.json: java.io.FileNotFoundException: mcarcana:blockstates/tep.json
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'mcarcana:blockstates/tep.json' missing model for variant: 'mcarcana:tep#'
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'mcarcana:tepa#inventory' referenced from: mcarcana:tepa#inventory: java.io.FileNotFoundException: mcarcana:models/item/tepa.json
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'mcarcana:tepb#inventory' referenced from: mcarcana:tepb#inventory: java.io.FileNotFoundException: mcarcana:models/item/tepb.json
[01:04:08] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'mcarcana:tep#inventory' referenced from: mcarcana:tep#inventory: java.io.FileNotFoundException: mcarcana:models/item/tep.json
[01:04:10] [Client thread/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[01:04:10] [Client thread/INFO] [minecraft/SoundSystem]: OpenAL initialized.
[01:04:10] [Client thread/INFO] [minecraft/SoundEngine]: Sound engine started
[01:04:10] [Client thread/INFO] [minecraft/AtlasTexture]: Created: 1024x512 textures-atlas
[01:04:11] [Client thread/INFO] [minecraft/AtlasTexture]: Created: 256x256 textures/particle-atlas
[01:04:11] [Client thread/INFO] [minecraft/AtlasTexture]: Created: 256x256 textures/painting-atlas
[01:04:11] [Client thread/INFO] [minecraft/AtlasTexture]: Created: 128x128 textures/mob_effect-atlas
[01:04:19] [Client thread/WARN] [minecraft/Commands]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[01:04:19] [Client thread/WARN] [minecraft/Commands]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[01:04:19] [Client thread/WARN] [minecraft/Commands]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[01:04:19] [Client thread/WARN] [minecraft/Commands]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[01:04:19] [Client thread/WARN] [minecraft/Commands]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[01:04:19] [Server thread/INFO] [minecraft/IntegratedServer]: Starting integrated minecraft server version 1.14.4
[01:04:19] [Server thread/INFO] [minecraft/IntegratedServer]: Generating keypair
[01:04:19] [Thread-1/FATAL] [ne.mi.co.ForgeConfig/CORE]: Forge config just got changed on the file system!
[01:04:19] [Server thread/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, main, forge-1.14.4-28.0.83_mapped_snapshot_20190719-1.14.3-recomp.jar
[01:04:20] [Server thread/INFO] [minecraft/RecipeManager]: Loaded 6 recipes
[01:04:22] [Server thread/INFO] [minecraft/AdvancementList]: Loaded 811 advancements
[01:04:23] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for dimension minecraft:overworld
[01:04:24] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 0%
[01:04:24] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 0%
[01:04:24] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 0%
[01:04:24] [Server thread/INFO] [mcarcana/]: READ {val_int:126,keepPacked:0b,x:17,y:68,z:71,id:"mcarcana:aaaa"}
[01:04:26] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 83%
[01:04:26] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 83%
[01:04:26] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 83%
[01:04:26] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 90%
[01:04:26] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 90%
[01:04:27] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 91%
[01:04:27] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Preparing spawn area: 94%
[01:04:28] [Client thread/INFO] [minecraft/LoggingChunkStatusListener]: Time elapsed: 4749 ms
[01:04:28] [Server thread/INFO] [mcarcana/]: tick! 1
[01:04:28] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[01:04:28] [Server thread/INFO] [minecraft/ChunkManager]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:1}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:2}

[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:3}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:4}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:5}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:6}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:7}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:8}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:9}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:10}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:11}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:12}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:13}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:14}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:15}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:16}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:17}
[01:04:28] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:18}
[01:04:29] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:19}
[01:04:29] [Server thread/INFO] [mcarcana/]: getUpdatePacket{val_int:20}

Link to comment
Share on other sites

47 minutes ago, DefbeatCZ said:

The problem is that afterwards the value is zero-ed as if the TileEntity is constructed a new ...

The problem is your use of iTag.hasUniqueId you can always be assured that the tag wont be null so dont do it. And the get methods will always return a value even if it's not present.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.