Posted May 22, 20205 yr Hello. I have a basin TileEntity that stores a liquid, and when two items from a crafting recipe are placed in the block, the block changes states to allow the fluid to tint according to the recipe JSON as specified. This tint is working appropriately and the state is updating immediately (as seen in F3) however the actual visual tint won't take effect until a block near the basin is broken. Any advice on how to force the client to update their IBlockColor? entity.output = crafting.getRecipeOutput().copy(); entity.stirsRemaining = crafting.getStirs(); entity.fluidColor = crafting.getColor(); world.setBlockState(pos, state.with(STATUS, BathStatus.success), 3); entity.sendUpdates(); public TileEntityALMBase(TileEntityType<?> tileEntityTypeIn) { super(tileEntityTypeIn); } @Override public SUpdateTileEntityPacket getUpdatePacket() { return new SUpdateTileEntityPacket(this.pos, -1, this.getUpdateTag()); } @Override public CompoundNBT getUpdateTag() { return write(new CompoundNBT()); } @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { super.onDataPacket(net, pkt); handleUpdateTag(pkt.getNbtCompound()); } public void sendUpdates() { world.markBlockRangeForRenderUpdate(pos, getBlockState(), getBlockState()); world.notifyBlockUpdate(pos, getBlockState(), getBlockState(), 2); markDirty(); } event.getBlockColors().register(new IBlockColor() { @Override public int getColor(BlockState state, ILightReader reader, BlockPos pos, int tint) { if(reader != null && pos != null) { if(state.get(BlockFluidBath.STATUS) == BathStatus.success) { TileEntity te = reader.getTileEntity(pos); if(te != null && te instanceof TEFluidBath) { TEFluidBath tef = (TEFluidBath) te; return tef.getFluidColor(); } }else { if(state.get(BlockFluidBath.FLUID) == BathFluid.lava) { return 0xcb3d07; }else { return BiomeColors.getWaterColor(reader, pos); } } } return 0xffffff; } }, getBlock("fluid_bath")); ...
May 22, 20205 yr Author I've confirmed the client is receiving the data packet containing the color code as expected and at the correct time, however it is not being translated to the color of the water in the basin. @Override public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) { super.onDataPacket(net, pkt); System.out.println("[DEBUG] Received data packet: " + pkt.getNbtCompound().getInt("assemblylinemachines:fluidcolor")); handleUpdateTag(pkt.getNbtCompound()); } [m[32m[20:59:08] [Render thread/INFO] [STDOUT/]: [me.haydenb.assemblylinemachines.block.BlockFluidBath$TEFluidBath:onDataPacket:300]: [DEBUG] Received data packet: 11597296 ...
May 22, 20205 yr Assuming the water is modeled in a json file, did you set the tintindex to 0? This would apply to any face of an element in the json model.
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.