general Block* code cleanup

This commit is contained in:
Sen 2025-05-25 14:45:04 +02:00
parent 7fd8879c73
commit 7299ab8e5c
221 changed files with 1000 additions and 1340 deletions

View file

@ -4,6 +4,7 @@ import common.biome.Biome;
import common.biome.IBiome;
import common.block.Block;
import common.block.BlockColored;
import common.block.Material;
import common.block.foliage.BlockFlower;
import common.block.foliage.BlockSapling;
import common.block.foliage.BlockTallGrass;
@ -26,7 +27,6 @@ import common.entity.npc.EntityZombie;
import common.init.Blocks;
import common.init.WoodType;
import common.log.Log;
import common.material.Material;
import common.rng.PerlinGen;
import common.rng.Random;
import common.rng.WeightedList;
@ -554,7 +554,7 @@ public abstract class GenBiome implements IBiome {
Block worldBlock = worldState.getBlock();
State worldAlt = worldIn.dimension.getAltFiller1();
State liquid = worldIn.getSurfaceLiquid();
boolean freeze = liquid.getBlock().getMaterial() == Material.water;
boolean freeze = liquid.getBlock().getMaterial() == Material.WATER;
State iblockstate = this.topBlock;
State iblockstate1 = this.fillerBlock;
int j = -1;

View file

@ -4,9 +4,9 @@ import java.util.Iterator;
import java.util.List;
import common.block.Block;
import common.block.Material;
import common.block.artificial.BlockDoor;
import common.collect.Lists;
import common.material.Material;
import common.nbt.NBTTagCompound;
import common.nbt.NBTTagList;
import common.util.BlockPos;
@ -245,7 +245,7 @@ public class VillageCollection
private boolean isWoodDoor(WorldServer world, BlockPos doorPos)
{
Block block = world.getState(doorPos).getBlock();
return block instanceof BlockDoor ? block.getMaterial() == Material.wood : false;
return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false;
}
public NBTTagCompound writeToNBT()

View file

@ -16,6 +16,7 @@ import java.util.function.Predicate;
import common.biome.Biome;
import common.block.Block;
import common.block.BlockFalling;
import common.block.Material;
import common.block.artificial.BlockDoor;
import common.block.liquid.BlockLiquid;
import common.block.natural.BlockSnow;
@ -38,7 +39,6 @@ import common.init.SoundEvent;
import common.init.UniverseRegistry;
import common.item.ItemDoor;
import common.log.Log;
import common.material.Material;
import common.model.ParticleType;
import common.nbt.NBTLoader;
import common.nbt.NBTTagCompound;
@ -2381,10 +2381,10 @@ public final class WorldServer extends AWorldServer {
return true;
}
boolean flag = this.getState(pos.west()).getBlock().getMaterial() == Material.water &&
this.getState(pos.east()).getBlock().getMaterial() == Material.water &&
this.getState(pos.north()).getBlock().getMaterial() == Material.water &&
this.getState(pos.south()).getBlock().getMaterial() == Material.water;
boolean flag = this.getState(pos.west()).getBlock().getMaterial() == Material.WATER &&
this.getState(pos.east()).getBlock().getMaterial() == Material.WATER &&
this.getState(pos.north()).getBlock().getMaterial() == Material.WATER &&
this.getState(pos.south()).getBlock().getMaterial() == Material.WATER;
if(!flag) {
return true;
@ -2435,7 +2435,7 @@ public final class WorldServer extends AWorldServer {
blockpos1 = blockpos.down();
Material material = chunk.getBlock(blockpos1).getMaterial();
if(material.blocksMovement() && material != Material.leaves) {
if(material.blocksMovement() && material != Material.LEAVES) {
break;
}
}

View file

@ -1,10 +1,10 @@
package server.worldgen;
import common.block.Material;
import common.init.Blocks;
import common.init.Items;
import common.item.RngLoot;
import common.log.Log;
import common.material.Material;
import common.rng.Random;
import common.rng.WeightedList;
import common.tileentity.TileEntity;

View file

@ -1,8 +1,8 @@
package server.worldgen;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.LightType;
@ -199,7 +199,7 @@ public class FeatureLakes
}
}
if (this.block.getMaterial() == Material.water)
if (this.block.getMaterial() == Material.WATER)
{
for (int k2 = 0; k2 < 16; ++k2)
{

View file

@ -1,9 +1,9 @@
package server.worldgen.feature;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.item.RngLoot;
import common.material.Material;
import common.rng.Random;
import common.rng.WeightedList;
import common.tileentity.TileEntity;
@ -33,7 +33,7 @@ public class WorldGenAbandonedChest extends FeatureGenerator
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
{
Block block;
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.leaves) && position.getY() > 1)
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.LEAVES) && position.getY() > 1)
{
position = position.down();
}

View file

@ -1,9 +1,9 @@
package server.worldgen.foliage;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockHugeMushroom;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
@ -56,7 +56,7 @@ public class WorldGenBigMushroom extends FeatureGenerator
{
Block block = worldIn.getState(blockpos$mutableblockpos.set(l, j, i1)).getBlock();
if (block != Blocks.air && block.getMaterial() != Material.leaves)
if (block != Blocks.air && block.getMaterial() != Material.LEAVES)
{
flag = false;
}

View file

@ -1,8 +1,8 @@
package server.worldgen.foliage;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
@ -14,7 +14,7 @@ public class WorldGenDeadBush extends FeatureGenerator
{
Block block;
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.LEAVES) && position.getY() > 0)
{
position = position.down();
}

View file

@ -1,7 +1,7 @@
package server.worldgen.foliage;
import common.block.Material;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
@ -19,7 +19,7 @@ public class WorldGenReed extends FeatureGenerator
{
BlockPos blockpos1 = blockpos.down();
if (worldIn.getState(blockpos1.west()).getBlock().getMaterial() == Material.water || worldIn.getState(blockpos1.east()).getBlock().getMaterial() == Material.water || worldIn.getState(blockpos1.north()).getBlock().getMaterial() == Material.water || worldIn.getState(blockpos1.south()).getBlock().getMaterial() == Material.water)
if (worldIn.getState(blockpos1.west()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.east()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.north()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.south()).getBlock().getMaterial() == Material.WATER)
{
int j = 2 + rand.zrange(rand.zrange(3) + 1);

View file

@ -1,9 +1,9 @@
package server.worldgen.foliage;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
@ -26,7 +26,7 @@ public class WorldGenShrub extends WorldGenBaseTree
{
Block block;
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.LEAVES) && position.getY() > 0)
{
position = position.down();
}

View file

@ -1,9 +1,9 @@
package server.worldgen.foliage;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockTallGrass;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
@ -23,7 +23,7 @@ public class WorldGenTallGrass extends FeatureGenerator
{
Block block;
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.LEAVES) && position.getY() > 0)
{
position = position.down();
}

View file

@ -1,11 +1,11 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockCocoa;
import common.block.foliage.BlockLeaves;
import common.block.foliage.BlockVine;
import common.init.Blocks;
import common.material.Material;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
@ -116,7 +116,7 @@ public class WorldGenBaseTree extends WorldGenTree
BlockPos blockpos = new BlockPos(k1, i3, i2);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos)));
}
@ -129,7 +129,7 @@ public class WorldGenBaseTree extends WorldGenTree
{
Block block2 = worldIn.getState(position.up(j3)).getBlock();
if (block2 == Blocks.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine)
if (block2 == Blocks.air || block2.getMaterial() == Material.LEAVES || block2.getMaterial() == Material.BUSH)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
@ -172,7 +172,7 @@ public class WorldGenBaseTree extends WorldGenTree
{
blockpos$mutableblockpos1.set(l4, k3, i5);
if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves)
if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.LEAVES)
{
BlockPos blockpos2 = blockpos$mutableblockpos1.west();
BlockPos blockpos3 = blockpos$mutableblockpos1.east();

View file

@ -3,11 +3,11 @@ package server.worldgen.tree;
import java.util.List;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.block.foliage.BlockLog;
import common.collect.Lists;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
@ -127,7 +127,7 @@ public class WorldGenBigTree extends WorldGenTree
BlockPos blockpos = p_181631_1_.add(j, 0, k);
Block block = this.world.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_);
}

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
@ -101,7 +101,7 @@ public class WorldGenBirch extends WorldGenTree
BlockPos blockpos = new BlockPos(i3, i2, k1);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos)));
}
@ -114,7 +114,7 @@ public class WorldGenBirch extends WorldGenTree
{
Block block2 = worldIn.getState(position.up(j2)).getBlock();
if (block2 == Blocks.air || block2.getMaterial() == Material.leaves)
if (block2 == Blocks.air || block2.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(j2), logBlock);
}

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
@ -68,7 +68,7 @@ public class WorldGenDarkOak extends WorldGenTree
BlockPos blockpos1 = new BlockPos(k1, k2, l1);
Block block1 = worldIn.getState(blockpos1).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.leaves)
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
{
this.func_181639_b(worldIn, blockpos1);
this.func_181639_b(worldIn, blockpos1.east());

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
@ -121,7 +121,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
BlockPos blockpos = p_175925_2_.add(j, 0, k);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos)));
}
@ -143,7 +143,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree
BlockPos blockpos = p_175928_2_.add(j, 0, k);
Block block = worldIn.getState(blockpos).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos)));
}

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.natural.BlockDirt;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
@ -39,7 +39,7 @@ public class WorldGenPine extends WorldGenHugeTree
{
Block block = worldIn.getState(position.up(j)).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata);
}
@ -48,21 +48,21 @@ public class WorldGenPine extends WorldGenHugeTree
{
block = worldIn.getState(position.add(1, j, 0)).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata);
}
block = worldIn.getState(position.add(1, j, 1)).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata);
}
block = worldIn.getState(position.add(0, j, 1)).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata);
}

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
@ -97,7 +97,7 @@ public class WorldGenSavanna extends WorldGenTree
BlockPos blockpos = new BlockPos(i3, i2, j1);
Block block1 = worldIn.getState(blockpos).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.leaves)
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
{
this.func_181642_b(worldIn, blockpos);
k1 = i2;
@ -151,7 +151,7 @@ public class WorldGenSavanna extends WorldGenTree
BlockPos blockpos1 = new BlockPos(i3, j2, j1);
Block block1 = worldIn.getState(blockpos1).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.leaves)
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
{
this.func_181642_b(worldIn, blockpos1);
k1 = j2;
@ -211,7 +211,7 @@ public class WorldGenSavanna extends WorldGenTree
{
Block block = worldIn.getState(p_175924_2_).getBlock();
if (block == Blocks.air || block.getMaterial() == Material.leaves)
if (block == Blocks.air || block.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(p_175924_2_)));
}

View file

@ -1,10 +1,10 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.block.foliage.BlockVine;
import common.init.Blocks;
import common.material.Material;
import common.properties.PropertyBool;
import common.rng.Random;
import common.util.BlockPos;
@ -28,7 +28,7 @@ public class WorldGenSwamp extends WorldGenTree
{
int i;
for (i = rand.zrange(4) + 5; worldIn.getState(position.down()).getBlock().getMaterial() == Material.water; position = position.down())
for (i = rand.zrange(4) + 5; worldIn.getState(position.down()).getBlock().getMaterial() == Material.WATER; position = position.down())
{
;
}
@ -61,7 +61,7 @@ public class WorldGenSwamp extends WorldGenTree
{
Block block = worldIn.getState(blockpos$mutableblockpos.set(l, j, i1)).getBlock();
if (block != Blocks.air && block.getMaterial() != Material.leaves)
if (block != Blocks.air && block.getMaterial() != Material.LEAVES)
{
if (block != Blocks.water && block != Blocks.flowing_water)
{
@ -123,7 +123,7 @@ public class WorldGenSwamp extends WorldGenTree
{
Block block2 = worldIn.getState(position.up(i2)).getBlock();
if (block2 == Blocks.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water)
if (block2 == Blocks.air || block2.getMaterial() == Material.LEAVES || block2 == Blocks.flowing_water || block2 == Blocks.water)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(i2), field_181648_a);
}
@ -141,7 +141,7 @@ public class WorldGenSwamp extends WorldGenTree
{
blockpos$mutableblockpos1.set(i4, j2, j4);
if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves)
if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.LEAVES)
{
BlockPos blockpos3 = blockpos$mutableblockpos1.west();
BlockPos blockpos4 = blockpos$mutableblockpos1.east();

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
@ -115,7 +115,7 @@ public class WorldGenTaiga1 extends WorldGenTree
{
Block block1 = worldIn.getState(position.up(i3)).getBlock();
if (block1 == Blocks.air || block1.getMaterial() == Material.leaves)
if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a);
}

View file

@ -1,9 +1,9 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLeaves;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.world.State;
@ -55,7 +55,7 @@ public class WorldGenTaiga2 extends WorldGenTree
{
Block block = worldIn.getState(blockpos$mutableblockpos.set(k1, i1, l1)).getBlock();
if (block != Blocks.air && block.getMaterial() != Material.leaves)
if (block != Blocks.air && block.getMaterial() != Material.LEAVES)
{
flag = false;
}
@ -130,7 +130,7 @@ public class WorldGenTaiga2 extends WorldGenTree
{
Block block2 = worldIn.getState(position.up(k4)).getBlock();
if (block2 == Blocks.air || block2.getMaterial() == Material.leaves)
if (block2 == Blocks.air || block2.getMaterial() == Material.LEAVES)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a);
}

View file

@ -1,10 +1,10 @@
package server.worldgen.tree;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockLog;
import common.block.foliage.BlockSapling;
import common.init.Blocks;
import common.material.Material;
import common.rng.Random;
import common.util.BlockPos;
import server.world.WorldServer;
@ -19,7 +19,7 @@ public abstract class WorldGenTree extends FeatureGenerator
protected boolean canBeReplaced(Block block)
{
return block == Blocks.air || block.getMaterial() == Material.leaves || block == Blocks.grass || block == Blocks.dirt || block instanceof BlockLog || block instanceof BlockSapling || block == Blocks.vine;
return block == Blocks.air || block.getMaterial() == Material.LEAVES || block == Blocks.grass || block == Blocks.dirt || block instanceof BlockLog || block instanceof BlockSapling || block == Blocks.vine;
}
public void prepare()