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

@ -8,6 +8,7 @@ import java.util.Set;
import common.block.Block;
import common.block.artificial.BlockBed;
import common.block.artificial.BlockDoor;
import common.block.foliage.BlockFlower;
import common.color.DyeColor;
import common.init.BlockRegistry;
import common.init.Blocks;
@ -49,7 +50,9 @@ public abstract class ReorderRegistry {
PLACE_LAST.add(Blocks.tallgrass);
PLACE_LAST.add(Blocks.deadbush);
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.red_mushroom_block);
PLACE_LAST.add(Blocks.torch);
@ -138,7 +141,9 @@ public abstract class ReorderRegistry {
addAttach(Blocks.piston_head.getStateFromMeta(offset + 1), Facing.DOWN);
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.red_mushroom, Facing.DOWN);
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.artificial.BlockDoor;
import common.block.artificial.BlockPortal;
import common.block.artificial.BlockQuartz;
import common.block.foliage.BlockLog;
import common.block.tech.BlockLever;
import common.block.tech.BlockRail;
@ -76,9 +75,9 @@ public abstract class RotationRegistry {
else if(prop == BlockLog.LOG_AXIS) {
axis = ((BlockLog.EnumAxis)v).getAxis();
}
else if(prop == BlockQuartz.VARIANT) {
axis = ((BlockQuartz.EnumType)v).getAxis();
}
// else if(prop == BlockQuartz.VARIANT) { // TODO: fix quartz
// axis = ((BlockQuartz.EnumType)v).getAxis();
// }
else if(prop == BlockLever.FACING) {
dv = ((BlockLever.EnumOrientation)v).getFacing().getDirectionVec();
}

View file

@ -212,7 +212,11 @@ public class MapGenCaves extends MapGenBase
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)

View file

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

View file

@ -1,16 +1,15 @@
package server.worldgen.foliage;
import common.block.foliage.BlockDoublePlant;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
public class FeatureDoublePlant
{
private BlockDoublePlant.EnumPlantType type;
private BlockDoublePlant type;
public void setPlantType(BlockDoublePlant.EnumPlantType type)
public void setPlantType(BlockDoublePlant 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));
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;
}
}

View file

@ -10,17 +10,17 @@ import server.worldgen.FeatureGenerator;
public class WorldGenFlowers extends FeatureGenerator
{
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.field_175915_b = p_175914_1_.getState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_);
this.flower = block;
this.state = block.getState();
}
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));
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
{
private final BlockTallGrass tallGrass;
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)
@ -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));
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);
}

View file

@ -554,9 +554,9 @@ public class StructureScattered
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.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.getStateFromMeta(BlockStoneBrick.CHISELED_META), 9, -2, 11, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 10, -2, 11, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stonebrick_chiseled.getState(), 8, -2, 11, structureBoundingBoxIn);
this.setBlockState(worldIn, Blocks.stonebrick_chiseled.getState(), 9, -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())))), 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);
@ -649,7 +649,7 @@ public class StructureScattered
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, 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.cauldron.getState(), 4, 2, 6, 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)
{
this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CRACKED_META);
this.blockstate = Blocks.stonebrick_cracked.getState();
}
else if (f < 0.5F)
{
this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.MOSSY_META);
this.blockstate = Blocks.stonebrick_mossy.getState();
}
// else if (f < 0.55F)
// {