block cleanup #3

This commit is contained in:
Sen 2025-06-20 23:54:12 +02:00
parent 473ef16043
commit 734279ad95
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
12 changed files with 50 additions and 45 deletions

View file

@ -2,6 +2,7 @@ package client.renderer.entity;
import common.entity.projectile.EntityPotion;
import common.init.Items;
import common.item.ItemPotion;
import common.item.ItemStack;
public class RenderPotion extends RenderItemEntity<EntityPotion>
@ -13,6 +14,6 @@ public class RenderPotion extends RenderItemEntity<EntityPotion>
public ItemStack getStack(EntityPotion entityIn)
{
return new ItemStack(this.item, 1, entityIn.getPotionDamage());
return new ItemStack(ItemPotion.getPotionItem(entityIn.getPotionDamage()));
}
}

View file

@ -6,9 +6,9 @@ import client.Client;
import client.renderer.BlockRenderer;
import client.renderer.GlState;
import client.renderer.texture.TextureMap;
import common.block.tech.BlockTNT;
import common.block.Block;
import common.entity.item.EntityTnt;
import common.init.Blocks;
import common.init.BlockRegistry;
import common.util.ExtMath;
@ -17,12 +17,8 @@ public class RenderTntPrimed extends Render<EntityTnt>
public RenderTntPrimed(RenderManager renderManagerIn)
{
super(renderManagerIn);
// this.shadowSize = 0.5F;
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityTnt entity, double x, double y, double z, float partialTicks)
{
BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher();
@ -42,7 +38,8 @@ public class RenderTntPrimed extends Render<EntityTnt>
float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(entity);
GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), entity.getBrightness(partialTicks));
Block tnt = BlockRegistry.getRegisteredBlock("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize));
blockrendererdispatcher.renderBlockBrightness(tnt.getState(), entity.getBrightness(partialTicks));
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0)
@ -54,7 +51,7 @@ public class RenderTntPrimed extends Render<EntityTnt>
GlState.color(1.0F, 1.0F, 1.0F, f2);
GlState.doPolygonOffset(-3.0F, -3.0F);
GlState.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), 1.0F);
blockrendererdispatcher.renderBlockBrightness(tnt.getState(), 1.0F);
GlState.doPolygonOffset(0.0F, 0.0F);
GlState.disablePolygonOffset();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
@ -67,9 +64,6 @@ public class RenderTntPrimed extends Render<EntityTnt>
super.doRender(entity, x, y, z, partialTicks);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityTnt entity)
{
return TextureMap.locationBlocksTexture;

View file

@ -20,6 +20,7 @@ import common.init.ItemRegistry;
import common.init.Items;
import common.init.SoundEvent;
import common.item.ItemDye;
import common.item.ItemPotion;
import common.log.Log;
import common.model.ParticleType;
import common.rng.Random;
@ -661,13 +662,14 @@ public class WorldClient extends AWorldClient
float f1 = 1.0F;
float f2 = 1.0F;
if((data & 16383) != 0) {
int j1 = Items.potion.getColorFromDamage(data);
ItemPotion potion = ItemPotion.getPotionItem(data);
int j1 = potion.getColorFromDamage();
f = (float)(j1 >> 16 & 255) / 255.0F;
f1 = (float)(j1 >> 8 & 255) / 255.0F;
f2 = (float)(j1 >> 0 & 255) / 255.0F;
enumparticletypes = ParticleType.SPELL;
if (Items.potion.isEffectInstant(data))
if (potion.isEffectInstant())
{
enumparticletypes = ParticleType.SPELL_INSTANT;
}