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.entity.projectile.EntityPotion;
import common.init.Items; import common.init.Items;
import common.item.ItemPotion;
import common.item.ItemStack; import common.item.ItemStack;
public class RenderPotion extends RenderItemEntity<EntityPotion> public class RenderPotion extends RenderItemEntity<EntityPotion>
@ -13,6 +14,6 @@ public class RenderPotion extends RenderItemEntity<EntityPotion>
public ItemStack getStack(EntityPotion entityIn) 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.BlockRenderer;
import client.renderer.GlState; import client.renderer.GlState;
import client.renderer.texture.TextureMap; import client.renderer.texture.TextureMap;
import common.block.tech.BlockTNT; import common.block.Block;
import common.entity.item.EntityTnt; import common.entity.item.EntityTnt;
import common.init.Blocks; import common.init.BlockRegistry;
import common.util.ExtMath; import common.util.ExtMath;
@ -17,12 +17,8 @@ public class RenderTntPrimed extends Render<EntityTnt>
public RenderTntPrimed(RenderManager renderManagerIn) public RenderTntPrimed(RenderManager renderManagerIn)
{ {
super(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) public void doRender(EntityTnt entity, double x, double y, double z, float partialTicks)
{ {
BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher(); 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; float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(entity); this.bindEntityTexture(entity);
GL11.glTranslatef(-0.5F, -0.5F, 0.5F); 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); GL11.glTranslatef(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0) 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.color(1.0F, 1.0F, 1.0F, f2);
GlState.doPolygonOffset(-3.0F, -3.0F); GlState.doPolygonOffset(-3.0F, -3.0F);
GlState.enablePolygonOffset(); 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.doPolygonOffset(0.0F, 0.0F);
GlState.disablePolygonOffset(); GlState.disablePolygonOffset();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F); 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); 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) protected String getEntityTexture(EntityTnt entity)
{ {
return TextureMap.locationBlocksTexture; return TextureMap.locationBlocksTexture;

View file

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

View file

@ -8,6 +8,7 @@ import java.util.Set;
import common.block.Block; import common.block.Block;
import common.block.artificial.BlockBed; import common.block.artificial.BlockBed;
import common.block.artificial.BlockDoor; import common.block.artificial.BlockDoor;
import common.block.foliage.BlockFlower;
import common.color.DyeColor; import common.color.DyeColor;
import common.init.BlockRegistry; import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
@ -49,7 +50,9 @@ public abstract class ReorderRegistry {
PLACE_LAST.add(Blocks.tallgrass); PLACE_LAST.add(Blocks.tallgrass);
PLACE_LAST.add(Blocks.deadbush); PLACE_LAST.add(Blocks.deadbush);
PLACE_LAST.add(Blocks.piston_head); PLACE_LAST.add(Blocks.piston_head);
PLACE_LAST.add(Blocks.flower); for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
PLACE_LAST.add(BlockFlower.getByType(type));
}
PLACE_LAST.add(Blocks.brown_mushroom); PLACE_LAST.add(Blocks.brown_mushroom);
PLACE_LAST.add(Blocks.red_mushroom_block); PLACE_LAST.add(Blocks.red_mushroom_block);
PLACE_LAST.add(Blocks.torch); PLACE_LAST.add(Blocks.torch);
@ -138,7 +141,9 @@ public abstract class ReorderRegistry {
addAttach(Blocks.piston_head.getStateFromMeta(offset + 1), Facing.DOWN); addAttach(Blocks.piston_head.getStateFromMeta(offset + 1), Facing.DOWN);
addCardinals(Blocks.piston_head, offset + 2, offset + 5, offset + 3, offset + 4); addCardinals(Blocks.piston_head, offset + 2, offset + 5, offset + 3, offset + 4);
} }
addAttach(Blocks.flower, Facing.DOWN); for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
addAttach(BlockFlower.getByType(type), Facing.DOWN);
}
addAttach(Blocks.brown_mushroom, Facing.DOWN); addAttach(Blocks.brown_mushroom, Facing.DOWN);
addAttach(Blocks.red_mushroom, Facing.DOWN); addAttach(Blocks.red_mushroom, Facing.DOWN);
for (Block blockId : new Block[] { Blocks.torch, Blocks.redstone_torch, Blocks.unlit_redstone_torch }) { for (Block blockId : new Block[] { Blocks.torch, Blocks.redstone_torch, Blocks.unlit_redstone_torch }) {

View file

@ -9,7 +9,6 @@ import common.block.Block;
import common.block.BlockRotatedPillar; import common.block.BlockRotatedPillar;
import common.block.artificial.BlockDoor; import common.block.artificial.BlockDoor;
import common.block.artificial.BlockPortal; import common.block.artificial.BlockPortal;
import common.block.artificial.BlockQuartz;
import common.block.foliage.BlockLog; import common.block.foliage.BlockLog;
import common.block.tech.BlockLever; import common.block.tech.BlockLever;
import common.block.tech.BlockRail; import common.block.tech.BlockRail;
@ -76,9 +75,9 @@ public abstract class RotationRegistry {
else if(prop == BlockLog.LOG_AXIS) { else if(prop == BlockLog.LOG_AXIS) {
axis = ((BlockLog.EnumAxis)v).getAxis(); axis = ((BlockLog.EnumAxis)v).getAxis();
} }
else if(prop == BlockQuartz.VARIANT) { // else if(prop == BlockQuartz.VARIANT) { // TODO: fix quartz
axis = ((BlockQuartz.EnumType)v).getAxis(); // axis = ((BlockQuartz.EnumType)v).getAxis();
} // }
else if(prop == BlockLever.FACING) { else if(prop == BlockLever.FACING) {
dv = ((BlockLever.EnumOrientation)v).getFacing().getDirectionVec(); dv = ((BlockLever.EnumOrientation)v).getFacing().getDirectionVec();
} }

View file

@ -212,7 +212,11 @@ public class MapGenCaves extends MapGenBase
if (iblockstate2.getBlock() == Blocks.sand) if (iblockstate2.getBlock() == Blocks.sand)
{ {
p_180702_5_.set(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE) : Blocks.sandstone.getState()); //TODO: check! p_180702_5_.set(j3, j2 + 1, i2, Blocks.sandstone.getState()); //TODO: check!
}
else if (iblockstate2.getBlock() == Blocks.red_sand)
{
p_180702_5_.set(j3, j2 + 1, i2, Blocks.orange_stained_hardened_clay.getState()); //TODO: check!
} }
if (flag1 && p_180702_5_.get(j3, j2 - 1, i2).getBlock() == this.top) if (flag1 && p_180702_5_.get(j3, j2 - 1, i2).getBlock() == this.top)

View file

@ -1,7 +1,6 @@
package server.worldgen.feature; package server.worldgen.feature;
import common.block.artificial.BlockSlab; import common.block.artificial.BlockSlab;
import common.block.natural.BlockSand;
import common.init.Blocks; import common.init.Blocks;
import common.rng.Random; import common.rng.Random;
import common.util.BlockPos; import common.util.BlockPos;
@ -24,7 +23,7 @@ public class WorldGenDesertWells extends FeatureGenerator
} }
State state = worldIn.getState(position); State state = worldIn.getState(position);
if (state.getBlock() != Blocks.sand || state.getValue(BlockSand.VARIANT) != BlockSand.EnumType.SAND) if (state.getBlock() != Blocks.sand)
{ {
return false; return false;
} }

View file

@ -1,16 +1,15 @@
package server.worldgen.foliage; package server.worldgen.foliage;
import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockDoublePlant;
import common.init.Blocks;
import common.rng.Random; import common.rng.Random;
import common.util.BlockPos; import common.util.BlockPos;
import server.world.WorldServer; import server.world.WorldServer;
public class FeatureDoublePlant public class FeatureDoublePlant
{ {
private BlockDoublePlant.EnumPlantType type; private BlockDoublePlant type;
public void setPlantType(BlockDoublePlant.EnumPlantType type) public void setPlantType(BlockDoublePlant type)
{ {
this.type = type; this.type = type;
} }
@ -23,9 +22,9 @@ public class FeatureDoublePlant
{ {
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && Blocks.double_plant.canPlaceBlockAt(worldIn, blockpos)) if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && this.type.canPlaceBlockAt(worldIn, blockpos))
{ {
Blocks.double_plant.placeAt(worldIn, blockpos, this.type, 2); this.type.placeAt(worldIn, blockpos, 2);
flag = true; flag = true;
} }
} }

View file

@ -10,17 +10,17 @@ import server.worldgen.FeatureGenerator;
public class WorldGenFlowers extends FeatureGenerator public class WorldGenFlowers extends FeatureGenerator
{ {
private BlockFlower flower; private BlockFlower flower;
private State field_175915_b; private State state;
public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_) public WorldGenFlowers(BlockFlower block)
{ {
this.setGeneratedBlock(p_i45632_1_, p_i45632_2_); this.setGeneratedBlock(block);
} }
public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_) public void setGeneratedBlock(BlockFlower block)
{ {
this.flower = p_175914_1_; this.flower = block;
this.field_175915_b = p_175914_1_.getState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_); this.state = block.getState();
} }
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
@ -29,9 +29,9 @@ public class WorldGenFlowers extends FeatureGenerator
{ {
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b)) if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.state))
{ {
worldIn.setState(blockpos, this.field_175915_b, 2); worldIn.setState(blockpos, this.state, 2);
} }
} }

View file

@ -12,11 +12,13 @@ import server.worldgen.FeatureGenerator;
public class WorldGenTallGrass extends FeatureGenerator public class WorldGenTallGrass extends FeatureGenerator
{ {
private final BlockTallGrass tallGrass;
private final State tallGrassState; private final State tallGrassState;
public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_) public WorldGenTallGrass(BlockTallGrass block)
{ {
this.tallGrassState = Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, p_i45629_1_); this.tallGrass = block;
this.tallGrassState = block.getState();
} }
public boolean generate(WorldServer worldIn, Random rand, BlockPos position) public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
@ -32,7 +34,7 @@ public class WorldGenTallGrass extends FeatureGenerator
{ {
BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8));
if (worldIn.isAirBlock(blockpos) && Blocks.tallgrass.canBlockStay(worldIn, blockpos, this.tallGrassState)) if (worldIn.isAirBlock(blockpos) && this.tallGrass.canBlockStay(worldIn, blockpos, this.tallGrassState))
{ {
worldIn.setState(blockpos, this.tallGrassState, 2); worldIn.setState(blockpos, this.tallGrassState, 2);
} }

View file

@ -554,9 +554,9 @@ public class StructureScattered
this.setBlockState(worldIn, Blocks.mossy_cobblestone.getState(), 8, -3, 5, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.mossy_cobblestone.getState(), 8, -3, 5, structureBoundingBoxIn);
this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, -1, 1, 9, -1, 5, false, randomIn, junglePyramidsRandomScatteredStones); this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, -1, 1, 9, -1, 5, false, randomIn, junglePyramidsRandomScatteredStones);
this.fillWithAir(worldIn, structureBoundingBoxIn, 8, -3, 8, 10, -1, 10); this.fillWithAir(worldIn, structureBoundingBoxIn, 8, -3, 8, 10, -1, 10);
this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 8, -2, 11, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.stonebrick_chiseled.getState(), 8, -2, 11, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 9, -2, 11, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.stonebrick_chiseled.getState(), 9, -2, 11, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 10, -2, 11, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.stonebrick_chiseled.getState(), 10, -2, 11, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 8, -2, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 8, -2, 12, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 9, -2, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 9, -2, 12, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 10, -2, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 10, -2, 12, structureBoundingBoxIn);
@ -649,7 +649,7 @@ public class StructureScattered
this.setBlockState(worldIn, Blocks.air.getState(), 1, 3, 4, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 1, 3, 4, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 4, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 4, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 5, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 5, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.flower_pot.getState().withProperty(BlockFlowerPot.CONTENTS, 2 + BlockFlower.EnumFlowerType.BLACK_LOTUS.getMeta()), 1, 3, 5, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.flowerpot_black_lotus.getState(), 1, 3, 5, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.workbench.getState(), 3, 2, 6, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.workbench.getState(), 3, 2, 6, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.cauldron.getState(), 4, 2, 6, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.cauldron.getState(), 4, 2, 6, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 1, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 1, structureBoundingBoxIn);

View file

@ -1349,11 +1349,11 @@ public class StructureStronghold
if (f < 0.2F) if (f < 0.2F)
{ {
this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CRACKED_META); this.blockstate = Blocks.stonebrick_cracked.getState();
} }
else if (f < 0.5F) else if (f < 0.5F)
{ {
this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.MOSSY_META); this.blockstate = Blocks.stonebrick_mossy.getState();
} }
// else if (f < 0.55F) // else if (f < 0.55F)
// { // {