remove (useless) flammabilty registry

This commit is contained in:
Sen 2025-06-22 13:01:09 +02:00
parent 3ae27fc27f
commit e3e9598fc5
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
19 changed files with 41 additions and 86 deletions

View file

@ -171,6 +171,8 @@ public class Block {
protected int lightValue;
protected int miningLevel;
protected int shearsEfficiency;
protected int encouragement;
protected int flammability;
protected float blockHardness;
protected float blockResistance;
protected float radiation;
@ -356,6 +358,12 @@ public class Block {
return this;
}
public Block setFlammable(int encouragement, int flammability) {
this.encouragement = encouragement;
this.flammability = flammability;
return this;
}
public boolean isFullBlock() {
return this.fullBlock;
}
@ -995,4 +1003,12 @@ public class Block {
public boolean onShot(World world, BlockPos pos, State state, Entity projectile) {
return this.material.blocksMovement();
}
public final int getFlammability() {
return this.flammability;
}
public final int getEncouragement() {
return this.encouragement;
}
}

View file

@ -16,6 +16,7 @@ public class BlockBookshelf extends Block
{
super(Material.WOOD);
this.setTab(CheatTab.DECORATION);
this.setFlammable(30, 20);
}
/**

View file

@ -30,6 +30,7 @@ public class BlockCarpet extends Block
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
this.setTab(CheatTab.DECORATION);
this.setBlockBoundsFromMeta();
this.setFlammable(60, 20);
CARPETS[color.ordinal()] = this;
}

View file

@ -19,6 +19,7 @@ public class BlockHay extends BlockRotatedPillar
super(Material.LOOSE);
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y));
this.setTab(CheatTab.BLOCKS);
this.setFlammable(60, 20);
}
/**

View file

@ -21,6 +21,7 @@ public class BlockWool extends Block {
super(Material.BURNABLE);
this.color = color;
this.setTab(CheatTab.BLOCKS);
this.setFlammable(30, 60);
WOOLS[color.ordinal()] = this;
}

View file

@ -24,6 +24,7 @@ public class BlockDeadBush extends BlockBush
super(Material.BUSH);
float f = 0.4F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
this.setFlammable(60, 100);
}
// /**

View file

@ -47,6 +47,7 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable
this.setDefaultState(this.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, Facing.NORTH));
this.setHardness(0.0F);
this.setStepSound(SoundType.GRASS);
this.setFlammable(60, 100);
PLANTS[type.ordinal()] = this;
}

View file

@ -19,6 +19,7 @@ public class BlockDryLeaves extends BlockLeavesBase
this.setHardness(0.2F);
this.setLightOpacity(1);
this.setStepSound(SoundType.GRASS);
this.setFlammable(60, 100);
}
/**

View file

@ -23,6 +23,7 @@ public class BlockFlower extends BlockBush
public BlockFlower(EnumFlowerType type)
{
this.type = type;
this.setFlammable(60, 100);
FLOWERS[type.ordinal()] = this;
}

View file

@ -56,6 +56,7 @@ public class BlockLeaves extends BlockLeavesBase
this.setHardness(0.2F);
this.setLightOpacity(1);
this.setStepSound(SoundType.GRASS);
this.setFlammable(30, 60);
LEAVES.add(this);
MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()] = this;
}

View file

@ -28,6 +28,7 @@ public class BlockLog extends BlockRotatedPillar
this.setTab(CheatTab.WOOD);
this.setHardness(2.0F);
this.setStepSound(SoundType.WOOD);
this.setFlammable(5, 5);
}
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)

View file

@ -33,6 +33,7 @@ public class BlockSapling extends BlockBush implements IGrowable
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.setTab(CheatTab.PLANTS);
this.type = type;
this.setFlammable(15, 100);
SAPLINGS.add(this);
}

View file

@ -36,6 +36,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable
this.type = type;
float f = 0.4F;
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
this.setFlammable(60, 100);
BUSHES[type.ordinal()] = this;
}

View file

@ -42,6 +42,7 @@ public class BlockVine extends Block
this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
this.setTickRandomly();
this.setTab(CheatTab.PLANTS);
this.setFlammable(15, 100);
}
/**

View file

@ -5,7 +5,6 @@ import java.util.Map;
import common.block.Block;
import common.block.Material;
import common.init.Blocks;
import common.init.FlammabilityRegistry;
import common.init.SoundEvent;
import common.model.BlockLayer;
import common.model.Model;
@ -238,7 +237,7 @@ public class BlockFire extends Block
protected void catchOnFire(World world, BlockPos pos, int chance, Random rand, int age)
{
int i = FlammabilityRegistry.getFlammability(world.getState(pos).getBlock());
int i = world.getState(pos).getBlock().getFlammability();
if (rand.zrange(chance) < i)
{
@ -293,7 +292,7 @@ public class BlockFire extends Block
for (Facing enumfacing : Facing.values())
{
i = Math.max(FlammabilityRegistry.getEncouragement(worldIn.getState(pos.offset(enumfacing)).getBlock()), i);
i = Math.max(worldIn.getState(pos.offset(enumfacing)).getBlock().getEncouragement(), i);
}
return i;
@ -313,7 +312,7 @@ public class BlockFire extends Block
*/
public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos)
{
return FlammabilityRegistry.getEncouragement(worldIn.getState(pos).getBlock()) > 0;
return worldIn.getState(pos).getBlock().getEncouragement() > 0;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)

View file

@ -40,6 +40,7 @@ public class BlockTNT extends Block
this.power = power;
this.setDefaultState(this.getBaseState().withProperty(EXPLODE, Boolean.valueOf(false)));
this.setTab(CheatTab.TECHNOLOGY);
this.setFlammable(15, 100);
TNTS[power] = this;
}

View file

@ -267,7 +267,7 @@ public abstract class BlockRegistry {
.setStepSound(SoundType.STONE).setDisplay(color.getSubject(null) + " gefärbter Ton"));
}
registerBlock("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE));
.setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE).setFlammable(5, 5));
registerBlock("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Roter Sand").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable());
@ -577,21 +577,21 @@ public abstract class BlockRegistry {
registerBlock("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD).setDisplay("Holzfalltür"));
registerBlock("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD).setDisplay("Holzfalltür").setFlammable(5, 20));
for(WoodType wood : WoodType.values()) {
Block planks = (new Block(Material.WOOD)).setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD)
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD);
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20);
registerBlock(wood.getName() + "_planks", planks);
registerBlock(wood.getName() + "_stairs", (new BlockStairs(planks.getState()))
.setDisplay(wood.getDisplay() + "holztreppe"));
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
registerBlock(wood.getName() + "_slab", (new BlockSlab(Material.WOOD, wood.getName() + "_planks"))
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzstufe"));
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20));
registerBlock(wood.getName() + "_fence", (new BlockFence(Material.WOOD, wood.getName() + "_planks"))
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun"));
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20));
registerBlock(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F).setResistance(5.0F)
.setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor"));
.setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20));
registerBlock(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD)
.setDisplay(wood.getDisplay() + "holztür"));
.setDisplay(wood.getDisplay() + "holztür").setFlammable(5, 20));
}

View file

@ -1,73 +0,0 @@
package common.init;
import java.util.Map;
import common.block.Block;
import common.block.artificial.BlockCarpet;
import common.block.artificial.BlockWool;
import common.block.foliage.BlockDoublePlant;
import common.block.foliage.BlockFlower;
import common.block.foliage.BlockLeaves;
import common.block.foliage.BlockTallGrass;
import common.block.foliage.LeavesType;
import common.block.tech.BlockTNT;
import common.collect.Maps;
public abstract class FlammabilityRegistry {
private static final Map<Block, Integer> ENCOURAGEMENT = Maps.<Block, Integer>newIdentityHashMap();
private static final Map<Block, Integer> FLAMMABILITY = Maps.<Block, Integer>newIdentityHashMap();
private static void setFlammable(Block block, int encouragement, int flammability) {
ENCOURAGEMENT.put(block, encouragement);
FLAMMABILITY.put(block, flammability);
}
static void register() {
for(WoodType wood : WoodType.values()) {
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_planks"), 5, 20);
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_slab"), 5, 20);
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_stairs"), 5, 20);
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence"), 5, 20);
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence_gate"), 5, 20);
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), 5, 5);
for(LeavesType type : LeavesType.values()) {
setFlammable(BlockLeaves.getLeavesBlock(wood, type), 30, 60);
}
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"), 15, 100);
}
for(BlockTNT block : BlockTNT.TNTS) {
setFlammable(block, 15, 100);
}
for(BlockTallGrass block : BlockTallGrass.BUSHES) {
setFlammable(block, 60, 100);
}
for(BlockDoublePlant block : BlockDoublePlant.PLANTS) {
setFlammable(block, 60, 100);
}
for(BlockFlower block : BlockFlower.FLOWERS) {
setFlammable(block, 60, 100);
}
for(BlockWool block : BlockWool.WOOLS) {
setFlammable(block, 30, 60);
}
for(BlockCarpet block : BlockCarpet.CARPETS) {
setFlammable(block, 60, 20);
}
setFlammable(Blocks.bookshelf, 30, 20);
setFlammable(Blocks.deadbush, 60, 100);
setFlammable(Blocks.dry_leaves, 60, 100);
setFlammable(Blocks.vine, 15, 100);
setFlammable(Blocks.coal_block, 5, 5);
setFlammable(Blocks.hay_block, 60, 20);
}
public static int getFlammability(Block block) {
Integer value = FLAMMABILITY.get(block);
return value == null ? 0 : value.intValue();
}
public static int getEncouragement(Block block) {
Integer value = ENCOURAGEMENT.get(block);
return value == null ? 0 : value.intValue();
}
}

View file

@ -4,7 +4,6 @@ public abstract class Registry {
public static void register() {
NameRegistry.register();
BlockRegistry.register();
FlammabilityRegistry.register();
SpeciesRegistry.register();
EntityRegistry.registerEggs();
ItemRegistry.register();