Fix ClassCastExeption

This commit is contained in:
Motschen
2021-01-23 19:58:36 +01:00
parent 792e81f4ca
commit c2306d7fa6
3 changed files with 16 additions and 12 deletions

View File

@@ -58,6 +58,7 @@ public class VisualOverhaulClient implements ClientModInitializer {
}
});
ClientSidePacketRegistryImpl.INSTANCE.register(UPDATE_POTION_BOTTLES,
(packetContext, attachedData) -> {
BlockPos pos = attachedData.readBlockPos();

View File

@@ -62,7 +62,7 @@ public class FurnaceBlockEntityRenderer extends BlockEntityRenderer<FurnaceBlock
@Override
public void render(FurnaceBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (VisualOverhaulClient.VO_CONFIG.furnace) {
if (VisualOverhaulClient.VO_CONFIG.furnace && blockEntity.getCachedState().getBlock().is(Blocks.FURNACE)) {
BlockState blockState = blockEntity.getCachedState();
int lightAtBlock = WorldRenderer.getLightmapCoordinates(blockEntity.getWorld(), blockEntity.getPos().offset(blockState.get(AbstractFurnaceBlock.FACING)));
ItemStack item1 = blockEntity.getStack(0);

View File

@@ -4,6 +4,7 @@ import eu.midnightdust.visualoverhaul.VisualOverhaul;
import io.netty.buffer.Unpooled;
import net.fabricmc.fabric.api.server.PlayerStream;
import net.fabricmc.fabric.impl.networking.ServerSidePacketRegistryImpl;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -31,6 +32,7 @@ public abstract class MixinAbstractFurnaceBlockEntity extends LockableContainerB
@Inject(at = @At("TAIL"), method = "tick")
public void tick(CallbackInfo ci) {
if (this.world.getBlockState(this.pos).getBlock().is(Blocks.FURNACE)) {
if (!this.world.isClient && (invUpdate || world.getPlayers().size() == playerUpdate)) {
Stream<PlayerEntity> watchingPlayers = PlayerStream.watching(world, getPos());
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
@@ -45,6 +47,7 @@ public abstract class MixinAbstractFurnaceBlockEntity extends LockableContainerB
}
playerUpdate = world.getPlayers().size();
}
}
@Inject(at = @At("RETURN"), method = "getStack", cancellable = true)
public void getStack(int slot, CallbackInfoReturnable cir) {