add a BlockRegister class to let rev not shoot himself trying to register blocks

This commit is contained in:
2026-06-17 11:13:31 -05:00
parent 105e33da39
commit 0c10c9bf4e
4 changed files with 99 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package net.minecraft.src;
import java.util.List;
import java.util.Random;
import net.minecraft.src.mml.BlockLoader;
public class Block {
private CreativeTabs displayOnCreativeTab;
@@ -181,6 +182,10 @@ public class Block {
public static final Block stairsNetherQuartz = (new BlockStairs(156, blockNetherQuartz, 0)).setUnlocalizedName("stairsQuartz");
public static final Block railActivator = (new BlockRailPowered(157)).setHardness(0.7F).setStepSound(soundMetalFootstep).setUnlocalizedName("activatorRail");
public static final Block dropper = (new BlockDropper(158)).setHardness(3.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("dropper");
public static BlockLoader Loader = new BlockLoader();
public final int blockID;
protected float blockHardness;
protected float blockResistance;
@@ -201,7 +206,7 @@ public class Block {
private String unlocalizedName;
protected Icon blockIcon;
protected Block(int var1, Material var2) {
public Block(int var1, Material var2) {
if(blocksList[var1] != null) {
throw new IllegalArgumentException("Slot " + var1 + " is already occupied by " + blocksList[var1] + " when adding " + this);
} else {

View File

@@ -0,0 +1,15 @@
package net.minecraft.src.mml;
import net.minecraft.src.Block;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.Material;
public class BlockLoader {
public Block registerBlock(int BlockID, Material material, String unlocalizedName) {
Block InternalBlock = (new Block(BlockID, material));
InternalBlock.setCreativeTab(CreativeTabs.tabBlock);
InternalBlock.setUnlocalizedName(unlocalizedName);
return InternalBlock;
}
}