This commit is contained in:
Sen 2025-07-16 16:01:56 +02:00
parent 5a69c0545b
commit cf37d48292
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
122 changed files with 633 additions and 2384 deletions

View file

@ -1082,7 +1082,7 @@ public class Client implements IThreadListener {
if(this.pointed != null && this.pointed.block != null) {
State state = this.world.getState(this.pointed.block);
if(state.getBlock() != Blocks.air) {
Item item = state.getBlock().getItem(this.world, this.pointed.block);
Item item = state.getBlock().getItem();
if(item != null) {
GL11.glPopMatrix();
GL11.glPushMatrix();
@ -1450,14 +1450,12 @@ public class Client implements IThreadListener {
return;
}
item = block.getItem(this.world, blockpos);
item = block.getItem();
if (item == null)
{
return;
}
Block block1 = item instanceof ItemBlock && !block.isPickStrict() ? item.getBlock() : block;
}
else
{

View file

@ -88,7 +88,6 @@ import common.packet.SPacketTabComplete;
import common.packet.SPacketUpdateEntityTags;
import common.packet.SPacketAnimation;
import common.packet.SPacketBiome;
import common.packet.SPacketBlockAction;
import common.packet.SPacketBlockBreakAnim;
import common.packet.SPacketBlockChange;
import common.packet.SPacketCamera;
@ -1376,18 +1375,6 @@ public class ClientPlayer implements IClientPlayer
this.gm.show(null);
}
/**
* Triggers Block.onBlockEventReceived, which is implemented in BlockPistonBase for extension/retraction, BlockNote
* for setting the instrument (including audiovisual feedback) and in BlockContainer to set the number of players
* accessing a (Ender)Chest
*/
public void handleBlockAction(SPacketBlockAction packetIn)
{
NetHandler.checkThread(packetIn, this, this.gm, this.world);
if(packetIn.getBlockType() != null)
this.gm.world.addBlockEvent(packetIn.getBlockPosition(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2());
}
/**
* Updates all registered IWorldAccess instances with destroyBlockInWorldPartially
*/

View file

@ -21,6 +21,7 @@ import client.renderer.tileentity.TileEntityRendererDispatcher;
import client.renderer.tileentity.TileEntitySpecialRenderer;
import client.world.WorldClient;
import common.block.Block;
import common.block.ITileEntityProvider;
import common.collect.Maps;
import common.collect.Sets;
import common.model.BlockLayer;
@ -153,7 +154,7 @@ public class RenderChunk
lvt_10_1_.func_178606_a(blockpos$mutableblockpos);
}
if (block.hasTileEntity())
if (block instanceof ITileEntityProvider)
{
TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos));
TileEntitySpecialRenderer<TileEntity> tileentityspecialrenderer = TileEntityRendererDispatcher.instance.<TileEntity>getSpecialRenderer(tileentity);

View file

@ -2,7 +2,6 @@ package client.renderer.tileentity;
import common.block.tech.BlockChest;
import common.item.ItemStack;
import common.item.block.ItemChest;
import common.tileentity.TileEntityChest;
import common.util.Facing;
import common.world.State;
@ -23,8 +22,8 @@ public class TileEntityItemStackRenderer {
};
public void renderByItem(ItemStack stack) {
if(stack.getItem() instanceof ItemChest chest) {
this.state = chest.getBlock().getState().withProperty(BlockChest.FACING, Facing.SOUTH);
if(stack.getItem() != null && stack.getItem().getBlock() instanceof BlockChest chest) {
this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH);
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F);
}
}

View file

@ -1,80 +0,0 @@
package client.renderer.tileentity;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.BlockRenderer;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.ItemRenderer;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.texture.TextureMap;
import common.block.Block;
import common.block.tech.BlockPistonBase;
import common.block.tech.BlockPistonHead;
import common.init.Blocks;
import common.tileentity.TileEntityPiston;
import common.util.BlockPos;
import common.world.State;
import common.world.World;
public class TileEntityPistonRenderer extends TileEntitySpecialRenderer<TileEntityPiston>
{
private final BlockRenderer blockRenderer = Client.CLIENT.getBlockRendererDispatcher();
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
BlockPos blockpos = te.getPos();
State iblockstate = te.getPistonState();
Block block = iblockstate.getBlock();
if (block != Blocks.air && te.getProgress(partialTicks) < 1.0F)
{
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
this.bindTexture(TextureMap.BLOCKS);
ItemRenderer.disableStandardItemLighting();
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.enableBlend();
GlState.disableCull();
// if (Game.getGame().isAmbientOcclusionEnabled())
// {
// GlState.shadeModel(GL11.GL_SMOOTH);
// }
// else
// {
GlState.shadeModel(GL11.GL_FLAT);
// }
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
World world = this.getWorld();
if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F)
{
iblockstate = iblockstate.withProperty(BlockPistonHead.SHORT, Boolean.valueOf(true));
this.blockRenderer.renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
}
else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
{
BlockPistonHead.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT;
State iblockstate1 = Blocks.piston_head.getState().withProperty(BlockPistonHead.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonHead.FACING, iblockstate.getValue(BlockPistonBase.FACING));
iblockstate1 = iblockstate1.withProperty(BlockPistonHead.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
this.blockRenderer.renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true);
worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
this.blockRenderer.renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
}
else
{
this.blockRenderer.renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false);
}
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
Tessellator.draw();
ItemRenderer.enableStandardItemLighting();
}
}
}

View file

@ -11,7 +11,6 @@ import common.entity.Entity;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.tileentity.TileEntityDisplay;
import common.tileentity.TileEntityPiston;
import common.tileentity.TileEntitySign;
import common.util.BlockPos;
import common.world.World;
@ -47,7 +46,6 @@ public class TileEntityRendererDispatcher
{
this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer());
this.mapSpecialRenderers.put(TileEntityDisplay.class, new TileEntityDisplayRenderer());
this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())

View file

@ -22,6 +22,7 @@ import common.rng.Random;
import common.sound.MovingSoundMinecart;
import common.sound.PositionedSound;
import common.tileentity.TileEntity;
import common.tileentity.TileEntityChest;
import common.util.BlockPos;
import common.util.ChunkPos;
import common.util.ExtMath;
@ -658,6 +659,12 @@ public class WorldClient extends AWorldClient
case 2005:
ItemDye.spawnBonemealParticles(this, blockPosIn, data);
break;
case 2016:
TileEntity te = this.getTileEntity(blockPosIn);
if(te instanceof TileEntityChest chest)
chest.setUsing(data);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

View file

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 238 B

After

Width:  |  Height:  |  Size: 238 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 226 B

After

Width:  |  Height:  |  Size: 226 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 209 B

Before After
Before After