Posted October 13, 20214 yr I'm implementing the IChestLid interface, and doing everything basically the same as in the vanilla chest and in the iron chests mod, yet still whenever it gets the openness value in the tile entity renderer it's always 0. This is where I get the openness value: Spoiler float f1 = iCallbackWrapper.apply(TabulatedChest.getLid(tileEntity)).get(partialTicks); And everywhere I set the value of the lid angle Spoiler @Override public void tick() { int i = this.worldPosition.getX(); int j = this.worldPosition.getY(); int k = this.worldPosition.getZ(); ++this.ticksSinceSync; this.numPlayersUsing = getNumberOfPlayersUsing(this.level, this, this.ticksSinceSync, i, j, k, this.numPlayersUsing); this.prevLidAngle = this.lidAngle; float f = 0.1F; if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F) { this.playSound(SoundEvents.CHEST_OPEN); } if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { float f1 = this.lidAngle; if (this.numPlayersUsing > 0) { this.lidAngle += 0.1F; } else { this.lidAngle -= 0.1F; } if (this.lidAngle > 1.0F) { this.lidAngle = 1.0F; } float f2 = 0.5F; if (this.lidAngle < 0.5F && f1 >= 0.5F) { this.playSound(SoundEvents.CHEST_CLOSE); } if (this.lidAngle < 0.0F) { this.lidAngle = 0.0F; } } } And lastly where I get the value: Spoiler @Override public float getOpenNess(float time) { return MathHelper.lerp(time, prevLidAngle, lidAngle); } @OnlyIn(Dist.CLIENT) public static TileEntityMerger.ICallback<TabulatedTile, Float2FloatFunction> getLid(final IChestLid lid) { return new TileEntityMerger.ICallback<TabulatedTile, Float2FloatFunction>() { @Override public Float2FloatFunction acceptDouble(TabulatedTile firstTile, TabulatedTile secondTile) { return (p_226921_2_) -> Math.max(firstTile.getOpenNess(p_226921_2_), secondTile.getOpenNess(p_226921_2_)); } @Override public Float2FloatFunction acceptSingle(TabulatedTile p_225538_1_) { return p_225538_1_::getOpenNess; } @Override public Float2FloatFunction acceptNone() { return lid::getOpenNess; } }; } Any help's appreciated
October 13, 20214 yr Author Fixed it, just had to override the triggerEvent method in the blocks class so it'd happen in the tile entity, so that the lid data would be synced between the client and server
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.