remove block metadata TEMP

This commit is contained in:
Sen 2025-06-27 16:27:16 +02:00
parent 1e104d5db8
commit 30a78ad279
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
83 changed files with 1088 additions and 1177 deletions

View file

@ -1926,7 +1926,7 @@ public class Client implements IThreadListener {
} }
StringBuilder str = new StringBuilder( StringBuilder str = new StringBuilder(
"Schaue auf: " + BlockRegistry.getNameFromBlock(block.getBlock()) + "\n" + "Schaue auf: " + BlockRegistry.getName(block.getBlock()) + "\n" +
String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ()) String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ())
); );
for(Entry<Property, Comparable> entry : block.getProperties().entrySet()) { for(Entry<Property, Comparable> entry : block.getProperties().entrySet()) {
@ -1954,7 +1954,7 @@ public class Client implements IThreadListener {
(((EntityLiving)entity).deathTime != 0 ? "Tod: " + ((EntityLiving)entity).deathTime + "t, " : "") + "Rüstung: " + ((EntityLiving)entity).getTotalArmorValue() + ", Pfeile: " + ((EntityLiving)entity).getArrowCountInEntity() (((EntityLiving)entity).deathTime != 0 ? "Tod: " + ((EntityLiving)entity).deathTime + "t, " : "") + "Rüstung: " + ((EntityLiving)entity).getTotalArmorValue() + ", Pfeile: " + ((EntityLiving)entity).getArrowCountInEntity()
: "Rüstung: n/a, Pfeile: n/a") + "\n" + : "Rüstung: n/a, Pfeile: n/a") + "\n" +
(held != null ? (held != null ?
"Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size : "Gegens.: n/a") + "\n" + "Gegens.: " + ItemRegistry.getName(held.getItem()) + " x" + held.size : "Gegens.: n/a") + "\n" +
"Eigens.: " + (entity.dead ? "D" : "") + (entity.noClip ? "N" : "") + (entity.onGround ? "G" : "") "Eigens.: " + (entity.dead ? "D" : "") + (entity.noClip ? "N" : "") + (entity.onGround ? "G" : "")
+ (entity.canBeCollidedWith() ? "C" : "") + (entity.canBePushed() ? "P" : "") + (entity.canBeCollidedWith() ? "C" : "") + (entity.canBePushed() ? "P" : "")
+ (entity.isBurning() ? "B" : "") + (entity.isPlayer() ? "S" : "") + (entity.isBurning() ? "B" : "") + (entity.isPlayer() ? "S" : "")

View file

@ -517,7 +517,7 @@ public class ClientPlayer implements IClientPlayer
} }
else else
{ {
player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i)); player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.byId(i));
} }
player.setPositionAndRotation(x, y, z, yaw, pitch); player.setPositionAndRotation(x, y, z, yaw, pitch);
@ -1165,7 +1165,7 @@ public class ClientPlayer implements IClientPlayer
} }
else else
{ {
Block block = BlockRegistry.getRegisteredBlock(id); Block block = BlockRegistry.byName(id);
if(block instanceof BlockWorkbench bench) { if(block instanceof BlockWorkbench bench) {
this.gm.displayGuiScreen(new GuiCrafting(player.inventory, player.worldObj, bench)); this.gm.displayGuiScreen(new GuiCrafting(player.inventory, player.worldObj, bench));
} }
@ -1377,6 +1377,7 @@ public class ClientPlayer implements IClientPlayer
public void handleBlockAction(SPacketBlockAction packetIn) public void handleBlockAction(SPacketBlockAction packetIn)
{ {
NetHandler.checkThread(packetIn, this, this.gm, this.world); NetHandler.checkThread(packetIn, this, this.gm, this.world);
if(packetIn.getBlockType() != null)
this.gm.world.addBlockEvent(packetIn.getBlockPosition(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2()); this.gm.world.addBlockEvent(packetIn.getBlockPosition(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2());
} }

View file

@ -409,7 +409,7 @@ public class BlockRenderer
{ {
TextureMap texturemap = Client.CLIENT.getTextureMapBlocks(); TextureMap texturemap = Client.CLIENT.getTextureMapBlocks();
for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) { for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) {
String name = BlockRegistry.getNameFromBlock(liquid.first()); String name = BlockRegistry.getName(liquid.first());
TextureAtlasSprite[] sprites = new TextureAtlasSprite[] {texturemap.getAtlasSprite("blocks/" + name + "_still"), texturemap.getAtlasSprite("blocks/" + name + "_flow")}; TextureAtlasSprite[] sprites = new TextureAtlasSprite[] {texturemap.getAtlasSprite("blocks/" + name + "_still"), texturemap.getAtlasSprite("blocks/" + name + "_flow")};
this.fluids.put(liquid.second(), sprites); this.fluids.put(liquid.second(), sprites);
this.fluids.put(liquid.first(), sprites); this.fluids.put(liquid.first(), sprites);

View file

@ -24,7 +24,7 @@ public class ItemModelMesher {
public IBakedModel getItemModel(ItemStack stack) { public IBakedModel getItemModel(ItemStack stack) {
Item item = stack.getItem(); Item item = stack.getItem();
IBakedModel model = this.models.get(ItemRegistry.getIdFromItem(item)); IBakedModel model = this.models.get(ItemRegistry.getId(item));
if(model == null) if(model == null)
model = this.manager.getMissingModel(); model = this.manager.getMissingModel();
return model; return model;
@ -36,8 +36,8 @@ public class ItemModelMesher {
public void rebuildCache() { public void rebuildCache() {
this.models.clear(); this.models.clear();
for(Item item : ItemRegistry.REGISTRY) { for(Item item : ItemRegistry.items()) {
this.models.put(ItemRegistry.getIdFromItem(item), this.manager.getModel("item/" + ItemRegistry.getNameFromItem(item).toString())); this.models.put(ItemRegistry.getId(item), this.manager.getModel("item/" + ItemRegistry.getName(item).toString()));
} }
} }
} }

View file

@ -39,7 +39,7 @@ public abstract class ModelBakery
static { static {
for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) { for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) {
String name = BlockRegistry.getNameFromBlock(liquid.first()); String name = BlockRegistry.getName(liquid.first());
BUILTINS.add("blocks/" + name + "_flow"); BUILTINS.add("blocks/" + name + "_flow");
BUILTINS.add("blocks/" + name + "_still"); BUILTINS.add("blocks/" + name + "_still");
} }
@ -57,15 +57,15 @@ public abstract class ModelBakery
models.put(MISSING, (ModelBlock)new ModelBlock(null).add().all()); models.put(MISSING, (ModelBlock)new ModelBlock(null).add().all());
variants.add(MISSING); variants.add(MISSING);
for(Entry<State, String> entry : map.entrySet()) { for(Entry<State, String> entry : map.entrySet()) {
ModelBlock model = (ModelBlock)entry.getKey().getBlock().getModel(ModelBlock.PROVIDER, BlockRegistry.getNameFromBlock(entry.getKey().getBlock()) ModelBlock model = (ModelBlock)entry.getKey().getBlock().getModel(ModelBlock.PROVIDER, BlockRegistry.getName(entry.getKey().getBlock())
.toString(), entry.getKey()); .toString(), entry.getKey());
models.put(entry.getValue(), model); models.put(entry.getValue(), model);
variants.add(entry.getValue()); variants.add(entry.getValue());
} }
for (Item item : ItemRegistry.REGISTRY) for (Item item : ItemRegistry.items())
{ {
String loc = "item/" + ItemRegistry.getNameFromItem(item); String loc = "item/" + ItemRegistry.getName(item);
models.put(loc, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item))); models.put(loc, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getName(item)));
itemLocations.add(loc); itemLocations.add(loc);
String[] extra = item.getSprites(); String[] extra = item.getSprites();
if(extra != null) { if(extra != null) {

View file

@ -26,7 +26,7 @@ public class ModelManager
public ModelManager(TextureMap textures) public ModelManager(TextureMap textures)
{ {
this.texMap = textures; this.texMap = textures;
for(Block block : BlockRegistry.REGISTRY) { for(Block block : BlockRegistry.blocks()) {
if(block.getRenderType() != 3) { if(block.getRenderType() != 3) {
this.builtin.add(block); this.builtin.add(block);
// Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block)); // Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block));
@ -113,7 +113,7 @@ public class ModelManager
public Map<State, String> getMap() { public Map<State, String> getMap() {
Map<State, String> map = Maps.<State, String>newIdentityHashMap(); Map<State, String> map = Maps.<State, String>newIdentityHashMap();
for(Block block : BlockRegistry.REGISTRY) { for(Block block : BlockRegistry.blocks()) {
if(!this.builtin.contains(block)) { if(!this.builtin.contains(block)) {
StateMap mapper = this.mappers.get(block); StateMap mapper = this.mappers.get(block);
if(mapper == null) if(mapper == null)

View file

@ -30,7 +30,7 @@ public class MultiStateMap extends StateMap
if (this.name == null) if (this.name == null)
{ {
s = BlockRegistry.getNameFromBlock(state.getBlock()); s = BlockRegistry.getName(state.getBlock());
} }
else else
{ {

View file

@ -8,6 +8,6 @@ public class SingleStateMap extends StateMap
{ {
protected String getResourceLocation(State state) protected String getResourceLocation(State state)
{ {
return BlockRegistry.getNameFromBlock(state.getBlock()).toString() + '#' + this.getPropertyString(state.getProperties()); return BlockRegistry.getName(state.getBlock()).toString() + '#' + this.getPropertyString(state.getProperties());
} }
} }

View file

@ -11,6 +11,6 @@ public class RenderDynamite extends RenderItemEntity<EntityDynamite> {
public ItemStack getStack(EntityDynamite entityIn) public ItemStack getStack(EntityDynamite entityIn)
{ {
return new ItemStack(ItemRegistry.getRegisteredItem("dynamite" + (entityIn.explosionSize <= 0 || entityIn.explosionSize >= 8 ? "" : "_" + entityIn.explosionSize))); return new ItemStack(ItemRegistry.byName("dynamite" + (entityIn.explosionSize <= 0 || entityIn.explosionSize >= 8 ? "" : "_" + entityIn.explosionSize)));
} }
} }

View file

@ -38,7 +38,7 @@ 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);
Block tnt = BlockRegistry.getRegisteredBlock("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize)); Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize));
blockrendererdispatcher.renderBlockBrightness(tnt.getState(), entity.getBrightness(partialTicks)); blockrendererdispatcher.renderBlockBrightness(tnt.getState(), entity.getBrightness(partialTicks));
GL11.glTranslatef(0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, 0.0F, 1.0F);

View file

@ -18,8 +18,8 @@ public class EntityBlockDustFX extends EntityDiggingFX
{ {
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{ {
State iblockstate = BlockRegistry.getStateById(p_178902_15_[0]); State iblockstate = BlockRegistry.byId(p_178902_15_[0]);
return iblockstate.getBlock().getRenderType() == -1 ? null : (new EntityBlockDustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).calculateColor(); return iblockstate == null || iblockstate.getBlock().getRenderType() == -1 ? null : (new EntityBlockDustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).calculateColor();
} }
} }
} }

View file

@ -70,7 +70,7 @@ public class EntityBreakingFX extends EntityFX
{ {
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{ {
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0])); return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.byId(p_178902_15_[0]));
} }
} }

View file

@ -118,7 +118,8 @@ public class EntityDiggingFX extends EntityFX
{ {
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{ {
return (new EntityDiggingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, BlockRegistry.getStateById(p_178902_15_[0]))).calculateColor(); State state = BlockRegistry.byId(p_178902_15_[0]);
return state == null ? null : (new EntityDiggingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state)).calculateColor();
} }
} }
} }

View file

@ -41,7 +41,7 @@ public class TextureMap extends Texture
Map<String, Object> map = Maps.newHashMap(); Map<String, Object> map = Maps.newHashMap();
Map<TextureAnimation, Class<? extends TextureTicked>> anim = Maps.newHashMap(); Map<TextureAnimation, Class<? extends TextureTicked>> anim = Maps.newHashMap();
RenderRegistry.registerAnimations(anim); RenderRegistry.registerAnimations(anim);
for(Block block : BlockRegistry.REGISTRY) { for(Block block : BlockRegistry.blocks()) {
block.getAnimatedTextures(map); block.getAnimatedTextures(map);
} }
for(Entry<String, Object> entry : map.entrySet()) { for(Entry<String, Object> entry : map.entrySet()) {

View file

@ -10,6 +10,7 @@ import client.Client;
import client.renderer.GlState; import client.renderer.GlState;
import client.renderer.model.ModelBanner; import client.renderer.model.ModelBanner;
import client.renderer.texture.LayeredColorMaskTexture; import client.renderer.texture.LayeredColorMaskTexture;
import common.block.tile.BlockBannerStanding;
import common.collect.Lists; import common.collect.Lists;
import common.collect.Maps; import common.collect.Maps;
import common.color.DyeColor; import common.color.DyeColor;
@ -17,6 +18,7 @@ import common.init.Blocks;
import common.tileentity.TileEntityBanner; import common.tileentity.TileEntityBanner;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.ExtMath; import common.util.ExtMath;
import common.world.State;
public class TileEntityBannerRenderer extends TileEntitySpecialRenderer<TileEntityBanner> public class TileEntityBannerRenderer extends TileEntitySpecialRenderer<TileEntityBanner>
{ {
@ -28,7 +30,12 @@ public class TileEntityBannerRenderer extends TileEntitySpecialRenderer<TileEnti
{ {
boolean flag = te.getWorld() != null; boolean flag = te.getWorld() != null;
boolean flag1 = !flag || te.getBlockType() == Blocks.banner; boolean flag1 = !flag || te.getBlockType() == Blocks.banner;
int i = flag ? te.getBlockMetadata() : 0; int i = 0;
if(flag) {
State state = te.getBlockState();
if(state.getBlock() == Blocks.banner)
i = state.getValue(BlockBannerStanding.ROTATION);
}
// long j = flag ? te.getWorld().getTime() : 0L; // long j = flag ? te.getWorld().getTime() : 0L;
double j = flag ? (double)(System.nanoTime() / 1000L) / 50000.0 /* te.getWorld().getTime() */ : (double)partialTicks; double j = flag ? (double)(System.nanoTime() / 1000L) / 50000.0 /* te.getWorld().getTime() */ : (double)partialTicks;
GL11.glPushMatrix(); GL11.glPushMatrix();

View file

@ -5,9 +5,9 @@ import org.lwjgl.opengl.GL11;
import client.renderer.GlState; import client.renderer.GlState;
import client.renderer.model.ModelChest; import client.renderer.model.ModelChest;
import client.renderer.model.ModelLargeChest; import client.renderer.model.ModelLargeChest;
import common.block.Block;
import common.block.tech.BlockChest; import common.block.tech.BlockChest;
import common.tileentity.TileEntityChest; import common.tileentity.TileEntityChest;
import common.world.State;
public class TileEntityChestRenderer extends TileEntitySpecialRenderer<TileEntityChest> public class TileEntityChestRenderer extends TileEntitySpecialRenderer<TileEntityChest>
@ -44,21 +44,19 @@ public class TileEntityChestRenderer extends TileEntitySpecialRenderer<TileEntit
GlState.enableDepth(); GlState.enableDepth();
GlState.depthFunc(GL11.GL_LEQUAL); GlState.depthFunc(GL11.GL_LEQUAL);
GlState.depthMask(true); GlState.depthMask(true);
int i; int i = 0;
if (!te.hasWorldObj()) if (te.hasWorldObj())
{ {
i = 0; State state = te.getBlockState();
if(state.getBlock() instanceof BlockChest) {
i = state.getValue(BlockChest.FACING).getIndex();
if (i == 0)
{
((BlockChest)state.getBlock()).checkForSurroundingChests(te.getWorld(), te.getPos(), te.getWorld().getState(te.getPos()));
i = state.getValue(BlockChest.FACING).getIndex();
} }
else
{
Block block = te.getBlockType();
i = te.getBlockMetadata();
if (block instanceof BlockChest && i == 0)
{
((BlockChest)block).checkForSurroundingChests(te.getWorld(), te.getPos(), te.getWorld().getState(te.getPos()));
i = te.getBlockMetadata();
} }
te.checkForAdjacentChests(); te.checkForAdjacentChests();

View file

@ -6,8 +6,11 @@ import client.renderer.Drawing;
import client.renderer.GlState; import client.renderer.GlState;
import client.renderer.model.ModelSign; import client.renderer.model.ModelSign;
import common.block.Block; import common.block.Block;
import common.block.tile.BlockStandingSign;
import common.block.tile.BlockWallSign;
import common.init.Blocks; import common.init.Blocks;
import common.tileentity.TileEntitySign; import common.tileentity.TileEntitySign;
import common.world.State;
public class TileEntitySignRenderer extends TileEntitySpecialRenderer<TileEntitySign> public class TileEntitySignRenderer extends TileEntitySpecialRenderer<TileEntitySign>
@ -23,16 +26,17 @@ public class TileEntitySignRenderer extends TileEntitySpecialRenderer<TileEntity
GL11.glPushMatrix(); GL11.glPushMatrix();
float f = 0.6666667F; float f = 0.6666667F;
State state = te.getBlockState();
if (block == Blocks.sign) if (block == Blocks.sign)
{ {
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F);
float f1 = (float)(te.getBlockMetadata() * 360) / 16.0F; float f1 = state.getBlock() == Blocks.sign ? (float)(state.getValue(BlockStandingSign.ROTATION) * 360) / 16.0F : 0.0F;
GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F);
this.model.signStick.showModel = true; this.model.signStick.showModel = true;
} }
else else
{ {
int k = te.getBlockMetadata(); int k = state.getBlock() == Blocks.wall_sign ? state.getValue(BlockWallSign.FACING).getIndex() : 0;
float f2 = 0.0F; float f2 = 0.0F;
if (k == 2) if (k == 2)

View file

@ -50,7 +50,7 @@ public class PlayerController {
return false; return false;
} }
else { else {
world.playAuxSFX(2001, pos, BlockRegistry.getStateId(state)); world.playAuxSFX(2001, pos, BlockRegistry.getId(state));
boolean flag = world.setBlockToAir(pos); boolean flag = world.setBlockToAir(pos);
if(flag) { if(flag) {

View file

@ -29,7 +29,7 @@ public class ChunkEmpty extends ChunkClient {
private final Block dummyBlock; private final Block dummyBlock;
static { static {
for(Block block : BlockRegistry.REGISTRY) { for(Block block : BlockRegistry.blocks()) {
STATES.addAll(block.getValidStates()); STATES.addAll(block.getValidStates());
} }
XSTRETCH = ExtMath.ceilf(ExtMath.sqrtf((float)STATES.size())); XSTRETCH = ExtMath.ceilf(ExtMath.sqrtf((float)STATES.size()));

View file

@ -7,7 +7,6 @@ import client.Client;
import client.renderer.particle.EntityFX; import client.renderer.particle.EntityFX;
import client.renderer.particle.EntityFirework; import client.renderer.particle.EntityFirework;
import common.biome.Biome; import common.biome.Biome;
import common.block.Block;
import common.collect.Lists; import common.collect.Lists;
import common.collect.Sets; import common.collect.Sets;
import common.dimension.Dimension; import common.dimension.Dimension;
@ -637,14 +636,14 @@ public class WorldClient extends AWorldClient
return; return;
case 2001: case 2001:
Block block = BlockRegistry.getBlockById(data & 4095); State state = BlockRegistry.byId(data);
if (block != Blocks.air) if (state != null && state.getBlock() != Blocks.air)
{ {
this.gm.getSoundManager().playSound(new PositionedSound(block.sound.getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F)); this.gm.getSoundManager().playSound(new PositionedSound(state.getBlock().sound.getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F));
} }
if(state != null)
this.gm.effectRenderer.addBlockDestroyEffects(blockPosIn, block.getStateFromMeta(data >> 12 & 255)); this.gm.effectRenderer.addBlockDestroyEffects(blockPosIn, state);
break; break;
case 2002: case 2002:
@ -654,7 +653,7 @@ public class WorldClient extends AWorldClient
for (int i1 = 0; i1 < 8; ++i1) for (int i1 = 0; i1 < 8; ++i1)
{ {
this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.getShouldIgnoreRange(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, new int[] {ItemRegistry.getIdFromItem(Items.potion)}); this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.getShouldIgnoreRange(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, new int[] {ItemRegistry.getId(Items.potion)});
} }
ParticleType enumparticletypes = ParticleType.WATER_SPLASH; ParticleType enumparticletypes = ParticleType.WATER_SPLASH;

View file

@ -102,7 +102,7 @@ public class EntityAIEatGrass extends EntityAIBase
{ {
if (Vars.mobGrief) if (Vars.mobGrief)
{ {
this.entityWorld.playAuxSFX(2001, blockpos1, BlockRegistry.getIdFromBlock(Blocks.grass)); this.entityWorld.playAuxSFX(2001, blockpos1, BlockRegistry.getId(Blocks.grass.getState()));
this.entityWorld.setState(blockpos1, Blocks.dirt.getState(), 2); this.entityWorld.setState(blockpos1, Blocks.dirt.getState(), 2);
} }

View file

@ -12,10 +12,10 @@ public interface IBiome {
public IBiome getBiome(Biome base) { public IBiome getBiome(Biome base) {
return new IBiome() { return new IBiome() {
public State getFiller() { public State getFiller() {
return BlockRegistry.getRegisteredBlock("air").getState(); return BlockRegistry.byName("air").getState();
} }
public State getTop() { public State getTop() {
return BlockRegistry.getRegisteredBlock("air").getState(); return BlockRegistry.byName("air").getState();
} }
public void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand) { public void growGrass(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
} }

View file

@ -1030,7 +1030,7 @@ public class Block {
if(item == null) if(item == null)
return null; return null;
if(item.getBlock() != this) if(item.getBlock() != this)
throw new IllegalArgumentException("Gegenstand für Block " + BlockRegistry.getNameFromBlock(this) + " stimmt nicht überein"); throw new IllegalArgumentException("Gegenstand für Block " + BlockRegistry.getName(this) + " stimmt nicht überein");
this.item = item; this.item = item;
return item; return item;
} }

View file

@ -113,7 +113,7 @@ public class BlockBed extends Block implements Rotatable {
} }
public Item getItemDropped(State state, Random rand, int fortune) { public Item getItemDropped(State state, Random rand, int fortune) {
return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : ItemRegistry.getRegisteredItem(this.color.getName() + "_bed"); return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : ItemRegistry.byName(this.color.getName() + "_bed");
} }
private void setBedBounds() { private void setBedBounds() {
@ -169,7 +169,7 @@ public class BlockBed extends Block implements Rotatable {
} }
public Item getItem(World worldIn, BlockPos pos) { public Item getItem(World worldIn, BlockPos pos) {
return ItemRegistry.getRegisteredItem(this.color.getName() + "_bed"); return ItemRegistry.byName(this.color.getName() + "_bed");
} }
// public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) { // public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) {

View file

@ -7,8 +7,6 @@ import common.block.Rotatable;
import common.block.Material; import common.block.Material;
import common.collect.Lists; import common.collect.Lists;
import common.entity.npc.EntityNPC; import common.entity.npc.EntityNPC;
import common.init.Blocks;
import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.block.ItemDoor; import common.item.block.ItemDoor;
import common.model.BlockLayer; import common.model.BlockLayer;
@ -278,7 +276,7 @@ public class BlockDoor extends Block implements Rotatable
*/ */
public Item getItemDropped(State state, Random rand, int fortune) public Item getItemDropped(State state, Random rand, int fortune)
{ {
return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : this.getDoorItem(); return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : this.getItem();
} }
/** /**
@ -300,30 +298,33 @@ public class BlockDoor extends Block implements Rotatable
return 1; return 1;
} }
public static int combineMetadata(IBlockAccess worldIn, BlockPos pos) private static int combineMetadata(IBlockAccess worldIn, BlockPos pos) {
{ State state = worldIn.getState(pos);
State iblockstate = worldIn.getState(pos); int meta = getMetadata(state);
int i = iblockstate.getBlock().getMetaFromState(iblockstate); boolean top = isTop(meta);
boolean flag = isTop(i); State down = worldIn.getState(pos.down());
State iblockstate1 = worldIn.getState(pos.down()); int dmeta = getMetadata(down);
int j = iblockstate1.getBlock().getMetaFromState(iblockstate1); int m1 = top ? dmeta : meta;
int k = flag ? j : i; State up = worldIn.getState(pos.up());
State iblockstate2 = worldIn.getState(pos.up()); int umeta = getMetadata(up);
int l = iblockstate2.getBlock().getMetaFromState(iblockstate2); int m2 = top ? meta : umeta;
int i1 = flag ? i : l; boolean right = (m2 & 1) != 0;
boolean flag1 = (i1 & 1) != 0; boolean power = (m2 & 2) != 0;
boolean flag2 = (i1 & 2) != 0; return removeHalfBit(m1) | (top ? 8 : 0) | (right ? 16 : 0) | (power ? 32 : 0);
return removeHalfBit(k) | (flag ? 8 : 0) | (flag1 ? 16 : 0) | (flag2 ? 32 : 0); }
private static int getMetadata(State state) {
if(!(state.getBlock() instanceof BlockDoor))
return 0;
else if(state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER)
return 8 | (state.getValue(HINGE) == BlockDoor.EnumHingePosition.RIGHT ? 1 : 0) | (state.getValue(POWERED) ? 2 : 0);
else
return state.getValue(FACING).rotateY().getHorizontalIndex() | (state.getValue(OPEN) ? 4 : 0);
} }
public Item getItem(World worldIn, BlockPos pos) public Item getItem(World worldIn, BlockPos pos)
{ {
return this.getDoorItem(); return this.getItem();
}
private Item getDoorItem()
{
return this == Blocks.iron_door ? Items.iron_door : (this == Blocks.spruce_door ? Items.spruce_door : (this == Blocks.birch_door ? Items.birch_door : (this == Blocks.jungle_door ? Items.jungle_door : (this == Blocks.acacia_door ? Items.acacia_door : (this == Blocks.dark_oak_door ? Items.dark_oak_door : (this == Blocks.cherry_door ? Items.cherry_door : (this == Blocks.maple_door ? Items.maple_door : Items.oak_door)))))));
} }
// public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) // public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player)

View file

@ -157,7 +157,7 @@ public class BlockFlowerPot extends Block
} }
else else
{ {
worldIn.setState(pos, BlockRegistry.getRegisteredBlock("flowerpot_" + BlockRegistry.getNameFromBlock(block)).getState(), 2); worldIn.setState(pos, BlockRegistry.byName("flowerpot_" + BlockRegistry.getName(block)).getState(), 2);
// tileentityflowerpot.setFlowerPotData(itemstack.getItem(), itemstack.getMetadata()); // tileentityflowerpot.setFlowerPotData(itemstack.getItem(), itemstack.getMetadata());
// tileentityflowerpot.markDirty(); // tileentityflowerpot.markDirty();
// worldIn.markBlockForUpdate(pos); // worldIn.markBlockForUpdate(pos);
@ -231,7 +231,7 @@ public class BlockFlowerPot extends Block
else if(this.content == Blocks.cactus) else if(this.content == Blocks.cactus)
return flower_pot_cactus; return flower_pot_cactus;
else { else {
String plant = BlockRegistry.getNameFromBlock(this.content); String plant = BlockRegistry.getName(this.content);
return provider.getModel("flower_pot") return provider.getModel("flower_pot")
.add(5, 0, 5, 6, 6, 11) .add(5, 0, 5, 6, 6, 11)
.d().uv(5, 5, 6, 11) .d().uv(5, 5, 6, 11)

View file

@ -814,7 +814,7 @@ public class BlockStairs extends Block implements Rotatable
} }
public Model getModel(ModelProvider provider, String name, State state) { public Model getModel(ModelProvider provider, String name, State state) {
String primary = this.modelBlock.getModel(provider, BlockRegistry.getNameFromBlock(this.modelBlock).toString(), this.modelState) String primary = this.modelBlock.getModel(provider, BlockRegistry.getName(this.modelBlock).toString(), this.modelState)
.getPrimary(); .getPrimary();
return provider.getModel(primary) return provider.getModel(primary)
.stairs(state.getValue(HALF) == EnumHalf.TOP, state.getValue(SHAPE) == EnumShape.INNER_RIGHT || .stairs(state.getValue(HALF) == EnumHalf.TOP, state.getValue(SHAPE) == EnumShape.INNER_RIGHT ||

View file

@ -246,7 +246,7 @@ public class BlockLeaves extends BlockLeavesBase
*/ */
public Item getItemDropped(State state, Random rand, int fortune) public Item getItemDropped(State state, Random rand, int fortune)
{ {
return ItemRegistry.getRegisteredItem(this.type.getName() + "_sapling"); return ItemRegistry.byName(this.type.getName() + "_sapling");
} }
/** /**
@ -287,7 +287,7 @@ public class BlockLeaves extends BlockLeavesBase
} }
if(this.type.getItem() != null && worldIn.rand.chance(i)) // np if(this.type.getItem() != null && worldIn.rand.chance(i)) // np
spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.getRegisteredItem(this.type.getItem()))); spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.byName(this.type.getItem())));
} }
} }

View file

@ -315,12 +315,12 @@ public class BlockDynamicLiquid extends BlockLiquid
} }
public void getAnimatedTextures(Map<String, Object> map) { public void getAnimatedTextures(Map<String, Object> map) {
map.put(BlockRegistry.getNameFromBlock(this.staticBlock) + "_flow", this.animation); map.put(BlockRegistry.getName(this.staticBlock) + "_flow", this.animation);
} }
public String getFallbackTexture() { public String getFallbackTexture() {
if(this.cachedTexture == null) if(this.cachedTexture == null)
this.cachedTexture = BlockRegistry.getNameFromBlock(this.staticBlock) + "_still"; this.cachedTexture = BlockRegistry.getName(this.staticBlock) + "_still";
return this.cachedTexture; return this.cachedTexture;
} }
} }

View file

@ -114,12 +114,12 @@ public class BlockStaticLiquid extends BlockLiquid
} }
public void getAnimatedTextures(Map<String, Object> map) { public void getAnimatedTextures(Map<String, Object> map) {
map.put(BlockRegistry.getNameFromBlock(this) + "_still", this.animation); map.put(BlockRegistry.getName(this) + "_still", this.animation);
} }
public String getFallbackTexture() { public String getFallbackTexture() {
if(this.cachedTexture == null) if(this.cachedTexture == null)
this.cachedTexture = BlockRegistry.getNameFromBlock(this) + "_still"; this.cachedTexture = BlockRegistry.getName(this) + "_still";
return this.cachedTexture; return this.cachedTexture;
} }
} }

View file

@ -404,7 +404,7 @@ public class BlockPistonBase extends Block implements Directional
} }
worldIn.setState(pos, Blocks.piston_extension.getState().withProperty(BlockPistonMoving.FACING, enumfacing).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT), 3); worldIn.setState(pos, Blocks.piston_extension.getState().withProperty(BlockPistonMoving.FACING, enumfacing).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonHead.EnumPistonType.STICKY : BlockPistonHead.EnumPistonType.DEFAULT), 3);
worldIn.setTileEntity(pos, BlockPistonMoving.newTileEntity(this.getStateFromMeta(eventParam), enumfacing, false, true)); worldIn.setTileEntity(pos, BlockPistonMoving.newTileEntity(this.getState().withProperty(FACING, getFacing(eventParam)).withProperty(EXTENDED, (eventParam & 8) > 0), enumfacing, false, true));
if (this.isSticky) if (this.isSticky)
{ {

View file

@ -75,7 +75,7 @@ public class BlockWorkbench extends Block
public String getGuiID() public String getGuiID()
{ {
return BlockRegistry.getNameFromBlock(this.block); return BlockRegistry.getName(this.block);
} }
} }
} }

View file

@ -8,7 +8,6 @@ import common.init.Items;
import common.item.Item; import common.item.Item;
import common.item.ItemStack; import common.item.ItemStack;
import common.model.Transforms; import common.model.Transforms;
import common.properties.PropertyInteger;
import common.rng.Random; import common.rng.Random;
import common.tags.TagObject; import common.tags.TagObject;
import common.tileentity.TileEntity; import common.tileentity.TileEntity;
@ -21,8 +20,6 @@ import common.world.World;
public class BlockBanner extends BlockContainer implements Rotatable public class BlockBanner extends BlockContainer implements Rotatable
{ {
public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15);
public BlockBanner() public BlockBanner()
{ {
super(Material.WOOD); super(Material.WOOD);

View file

@ -4,12 +4,15 @@ import common.block.Block;
import common.item.Item; import common.item.Item;
import common.item.block.ItemBanner; import common.item.block.ItemBanner;
import common.properties.Property; import common.properties.Property;
import common.properties.PropertyInteger;
import common.util.BlockPos; import common.util.BlockPos;
import common.world.State; import common.world.State;
import common.world.World; import common.world.World;
public class BlockBannerStanding extends BlockBanner public class BlockBannerStanding extends BlockBanner
{ {
public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15);
public BlockBannerStanding() public BlockBannerStanding()
{ {
this.setDefaultState(this.getBaseState().withProperty(ROTATION, Integer.valueOf(0))); this.setDefaultState(this.getBaseState().withProperty(ROTATION, Integer.valueOf(0)));

View file

@ -223,7 +223,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
public static void writeState(TagObject tag, String name, State state) { public static void writeState(TagObject tag, String name, State state) {
if(state != null) if(state != null)
tag.setString(name, state.getId()); tag.setString(name, BlockRegistry.getName(state));
} }
public static void writeState(TagObject tag, State state) { public static void writeState(TagObject tag, State state) {
@ -231,7 +231,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
} }
public static State readState(TagObject tag, String name, State def) { public static State readState(TagObject tag, String name, State def) {
return tag.hasString(name) ? State.getState(tag.getString(name), def) : def; return tag.hasString(name) ? BlockRegistry.byName(tag.getString(name), def) : def;
} }
public static State readState(TagObject tag, State def) { public static State readState(TagObject tag, State def) {
@ -523,7 +523,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
public final Dimension addMetalOres(MetalType ... metals) { public final Dimension addMetalOres(MetalType ... metals) {
for(MetalType metal : metals) { for(MetalType metal : metals) {
int count = METAL_COUNTS[metal.rarity]; int count = METAL_COUNTS[metal.rarity];
this.ores.add(new Ore(BlockRegistry.getRegisteredBlock(metal.name + "_ore").getState(), this.ores.add(new Ore(BlockRegistry.byName(metal.name + "_ore").getState(),
count < 0 ? 0 : count, count < 0 ? (-count) : 0, METAL_SIZES[metal.rarity], METAL_OFFSETS[metal.rarity], METAL_HEIGHTS[metal.rarity], false)); count < 0 ? 0 : count, count < 0 ? (-count) : 0, METAL_SIZES[metal.rarity], METAL_OFFSETS[metal.rarity], METAL_HEIGHTS[metal.rarity], false));
} }
return this; return this;
@ -939,7 +939,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
String[] list = tag.getStringArray("Layers"); String[] list = tag.getStringArray("Layers");
this.layers = new State[list.length]; this.layers = new State[list.length];
for(int z = 0; z < this.layers.length; z++) { for(int z = 0; z < this.layers.length; z++) {
this.layers[z] = State.getState(list[z], Blocks.air.getState()); this.layers[z] = BlockRegistry.byName(list[z], Blocks.air.getState());
} }
} }
else { else {
@ -1177,7 +1177,7 @@ public abstract class Dimension extends Nameable implements Comparable<Dimension
if(this.layers != null) { if(this.layers != null) {
String[] list = new String[this.layers.length]; String[] list = new String[this.layers.length];
for(int z = 0; z < this.layers.length; z++) { for(int z = 0; z < this.layers.length; z++) {
list[z] = this.layers[z].getId(); list[z] = BlockRegistry.getName(this.layers[z]);
} }
tag.setStringArray("Layers", list); tag.setStringArray("Layers", list);
} }

View file

@ -1040,7 +1040,7 @@ public abstract class Entity
if (block.getRenderType() != -1) if (block.getRenderType() != -1)
{ {
this.worldObj.spawnParticle(ParticleType.BLOCK_CRACK, this.posX + ((double)this.rand.floatv() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.floatv() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D, BlockRegistry.getStateId(iblockstate)); this.worldObj.spawnParticle(ParticleType.BLOCK_CRACK, this.posX + ((double)this.rand.floatv() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.floatv() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D, BlockRegistry.getId(iblockstate));
} }
} }
@ -2615,7 +2615,7 @@ public abstract class Entity
String id = EntityRegistry.getEntityString(this); String id = EntityRegistry.getEntityString(this);
if(!EntityRegistry.SPAWN_EGGS.containsKey(id)) if(!EntityRegistry.SPAWN_EGGS.containsKey(id))
return null; return null;
return ItemRegistry.getRegisteredItem(id.toLowerCase() + "_spawner"); return ItemRegistry.byName(id.toLowerCase() + "_spawner");
} }
public Position getPos() { public Position getPos() {

View file

@ -358,7 +358,7 @@ public class EntityRabbit extends EntityAnimal {
this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, this.posX + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width,
this.posY + 0.5D + (double)(this.rand.floatv() * this.height), this.posY + 0.5D + (double)(this.rand.floatv() * this.height),
this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, 0.0D, 0.0D, 0.0D, this.posZ + (double)(this.rand.floatv() * this.width * 2.0F) - (double)this.width, 0.0D, 0.0D, 0.0D,
BlockRegistry.getStateId(this.worldObj.getState(this.getPosition()))); BlockRegistry.getId(this.worldObj.getState(this.getPosition())));
} }
else { else {
super.handleStatusUpdate(id); super.handleStatusUpdate(id);

View file

@ -122,7 +122,7 @@ public class EntitySheep extends EntityAnimal
{ {
if (!this.getSheared()) if (!this.getSheared())
{ {
this.entityDropItem(new ItemStack(ItemRegistry.getRegisteredItem(this.getFleeceColor().getName() + "_wool")), 0.0F); this.entityDropItem(new ItemStack(ItemRegistry.byName(this.getFleeceColor().getName() + "_wool")), 0.0F);
} }
// int i = this.rand.roll(2) + this.rand.zrange(1 + lootingModifier); // int i = this.rand.roll(2) + this.rand.zrange(1 + lootingModifier);
@ -191,7 +191,7 @@ public class EntitySheep extends EntityAnimal
for (int j = 0; j < i; ++j) for (int j = 0; j < i; ++j)
{ {
EntityItem entityitem = this.entityDropItem(new ItemStack(ItemRegistry.getRegisteredItem(this.getFleeceColor().getName() + "_wool")), 1.0F); EntityItem entityitem = this.entityDropItem(new ItemStack(ItemRegistry.byName(this.getFleeceColor().getName() + "_wool")), 1.0F);
entityitem.motionY += (double)(this.rand.floatv() * 0.05F); entityitem.motionY += (double)(this.rand.floatv() * 0.05F);
entityitem.motionX += (double)((this.rand.floatv() - this.rand.floatv()) * 0.1F); entityitem.motionX += (double)((this.rand.floatv() - this.rand.floatv()) * 0.1F);
entityitem.motionZ += (double)((this.rand.floatv() - this.rand.floatv()) * 0.1F); entityitem.motionZ += (double)((this.rand.floatv() - this.rand.floatv()) * 0.1F);

View file

@ -36,10 +36,10 @@ public class EntityFalling extends Entity implements IObjectData
super(worldIn); super(worldIn);
} }
public EntityFalling(World worldIn, double x, double y, double z, State fallingBlockState) public EntityFalling(World worldIn, double x, double y, double z, State state)
{ {
super(worldIn); super(worldIn);
this.fallTile = fallingBlockState; this.fallTile = state == null ? Blocks.sand.getState() : state;
this.preventSpawning = true; this.preventSpawning = true;
this.setSize(0.98F, 0.98F); this.setSize(0.98F, 0.98F);
this.setPosition(x, y, z); this.setPosition(x, y, z);
@ -53,7 +53,7 @@ public class EntityFalling extends Entity implements IObjectData
public EntityFalling(World worldIn, double x, double y, double z, int data) public EntityFalling(World worldIn, double x, double y, double z, int data)
{ {
this(worldIn, x, y, z, BlockRegistry.getStateById(data & 65535)); this(worldIn, x, y, z, BlockRegistry.byId(data & 65535));
} }
/** /**
@ -203,7 +203,7 @@ public class EntityFalling extends Entity implements IObjectData
*/ */
protected void writeEntity(TagObject tagCompound) protected void writeEntity(TagObject tagCompound)
{ {
tagCompound.setString("Block", (this.fallTile != null ? this.fallTile : Blocks.air.getState()).getId()); tagCompound.setString("Block", BlockRegistry.getName((this.fallTile != null ? this.fallTile : Blocks.air.getState())));
tagCompound.setByte("Time", (byte)this.fallTime); tagCompound.setByte("Time", (byte)this.fallTime);
tagCompound.setBool("DropItem", this.shouldDropItem); tagCompound.setBool("DropItem", this.shouldDropItem);
tagCompound.setBool("HurtEntities", this.hurtEntities); tagCompound.setBool("HurtEntities", this.hurtEntities);
@ -218,7 +218,7 @@ public class EntityFalling extends Entity implements IObjectData
{ {
if (tagCompund.hasString("Block")) if (tagCompund.hasString("Block"))
{ {
this.fallTile = State.getState(tagCompund.getString("Block"), Blocks.sand.getState()); this.fallTile = BlockRegistry.byName(tagCompund.getString("Block"), Blocks.sand.getState());
} }
else else
{ {
@ -276,7 +276,7 @@ public class EntityFalling extends Entity implements IObjectData
} }
public int getPacketData() { public int getPacketData() {
return BlockRegistry.getStateId(this.fallTile); return BlockRegistry.getId(this.fallTile);
} }
// public boolean hasSpawnVelocity() { // public boolean hasSpawnVelocity() {

View file

@ -68,7 +68,7 @@ public class EntityItem extends Entity
// for(int z = 0; z < 8; z++) { // for(int z = 0; z < 8; z++) {
((AWorldServer)this.worldObj).spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((AWorldServer)this.worldObj).spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ,
8, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, 0.1f, 8, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, 0.1f,
ItemRegistry.getIdFromItem(this.getEntityItem().getItem())); ItemRegistry.getId(this.getEntityItem().getItem()));
// } // }
this.worldObj.playAuxSFX(1023, this.getPosition(), 0); this.worldObj.playAuxSFX(1023, this.getPosition(), 0);
this.setDead(); this.setDead();
@ -462,7 +462,7 @@ public class EntityItem extends Entity
return this.getCustomNameTag(); return this.getCustomNameTag();
String comp = super.getTypeName(); String comp = super.getTypeName();
comp += " (" + this.getEntityItem().size + " * " + comp += " (" + this.getEntityItem().size + " * " +
ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ")"; ItemRegistry.getName(this.getEntityItem().getItem()) + ")";
return comp; return comp;
} }

View file

@ -75,6 +75,6 @@ public class EntityMetalhead extends EntityNPC {
protected ItemStack pickLoot(int slot) { protected ItemStack pickLoot(int slot) {
MetalType metal = this.rand.pick(MetalType.values()); MetalType metal = this.rand.pick(MetalType.values());
return new ItemStack(ItemRegistry.getRegisteredItem(this.rand.chance(5) ? metal.name + "_block" : (metal.name + (metal.isPowder ? "_powder" : "_ingot")))); return new ItemStack(ItemRegistry.byName(this.rand.chance(5) ? metal.name + "_block" : (metal.name + (metal.isPowder ? "_powder" : "_ingot"))));
} }
} }

View file

@ -4612,7 +4612,7 @@ public abstract class EntityNPC extends EntityLiving
public Item getItem() { public Item getItem() {
for(int z = 0; z < this.species.chars.length; z++) { for(int z = 0; z < this.species.chars.length; z++) {
if(this.species.chars[z].spawner && this.species.chars[z].skin.equals(this.getChar())) { if(this.species.chars[z].spawner && this.species.chars[z].skin.equals(this.getChar())) {
return ItemRegistry.getRegisteredItem(this.species.chars[z].skin + "_spawner"); return ItemRegistry.byName(this.species.chars[z].skin + "_spawner");
} }
} }
return super.getItem(); return super.getItem();

View file

@ -11,6 +11,7 @@ import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving; import common.entity.types.EntityLiving;
import common.entity.types.IObjectData; import common.entity.types.IObjectData;
import common.entity.types.IProjectile; import common.entity.types.IProjectile;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.init.Items; import common.init.Items;
import common.init.SoundEvent; import common.init.SoundEvent;
@ -473,7 +474,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
tagCompound.setShort("zTile", (short)this.zTile); tagCompound.setShort("zTile", (short)this.zTile);
tagCompound.setShort("life", (short)this.ticksInGround); tagCompound.setShort("life", (short)this.ticksInGround);
if(this.inTile != null) { if(this.inTile != null) {
tagCompound.setString("inTile", this.inTile.getId()); tagCompound.setString("inTile", BlockRegistry.getName(this.inTile));
} }
tagCompound.setByte("shake", (byte)this.arrowShake); tagCompound.setByte("shake", (byte)this.arrowShake);
tagCompound.setBool("inGround", this.inGround); tagCompound.setBool("inGround", this.inGround);
@ -493,7 +494,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
if (tagCompund.hasString("inTile")) if (tagCompund.hasString("inTile"))
{ {
this.inTile = State.getState(tagCompund.getString("inTile"), null); this.inTile = BlockRegistry.byName(tagCompund.getString("inTile"), null);
} }
else else
{ {

View file

@ -49,7 +49,7 @@ public class EntityDynamite extends EntityThrowable implements IObjectData
for (int k = 0; k < 8; ++k) for (int k = 0; k < 8; ++k)
{ {
this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getIdFromItem(ItemRegistry.getRegisteredItem("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize)))); this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getId(ItemRegistry.byName("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize))));
} }
if (!this.worldObj.client) if (!this.worldObj.client)

View file

@ -60,7 +60,7 @@ public class EntityEgg extends EntityThrowable
for (int k = 0; k < 8; ++k) for (int k = 0; k < 8; ++k)
{ {
this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getIdFromItem(Items.egg)); this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getId(Items.egg));
} }
if (!this.worldObj.client) if (!this.worldObj.client)

View file

@ -523,7 +523,7 @@ public class EntityHook extends Entity implements IObjectData
tagCompound.setShort("yTile", (short)this.yTile); tagCompound.setShort("yTile", (short)this.yTile);
tagCompound.setShort("zTile", (short)this.zTile); tagCompound.setShort("zTile", (short)this.zTile);
if(this.inTile != null) { if(this.inTile != null) {
String id = BlockRegistry.getNameFromBlock(this.inTile); String id = BlockRegistry.getName(this.inTile);
tagCompound.setString("inTile", id == null ? "" : id.toString()); tagCompound.setString("inTile", id == null ? "" : id.toString());
} }
tagCompound.setByte("shake", (byte)this.shake); tagCompound.setByte("shake", (byte)this.shake);
@ -541,7 +541,7 @@ public class EntityHook extends Entity implements IObjectData
if (tagCompund.hasString("inTile")) if (tagCompund.hasString("inTile"))
{ {
this.inTile = BlockRegistry.getRegisteredBlock(tagCompund.getString("inTile")); this.inTile = BlockRegistry.byName(tagCompund.getString("inTile"));
} }
else else
{ {

View file

@ -259,7 +259,7 @@ public abstract class EntityProjectile extends Entity
tagCompound.setShort("yTile", (short)this.yTile); tagCompound.setShort("yTile", (short)this.yTile);
tagCompound.setShort("zTile", (short)this.zTile); tagCompound.setShort("zTile", (short)this.zTile);
if(this.inTile != null) { if(this.inTile != null) {
String id = BlockRegistry.getNameFromBlock(this.inTile); String id = BlockRegistry.getName(this.inTile);
tagCompound.setString("inTile", id == null ? "" : id.toString()); tagCompound.setString("inTile", id == null ? "" : id.toString());
} }
tagCompound.setBool("inGround", this.inGround); tagCompound.setBool("inGround", this.inGround);
@ -280,7 +280,7 @@ public abstract class EntityProjectile extends Entity
if (tagCompund.hasString("inTile")) if (tagCompund.hasString("inTile"))
{ {
this.inTile = BlockRegistry.getRegisteredBlock(tagCompund.getString("inTile")); this.inTile = BlockRegistry.byName(tagCompund.getString("inTile"));
} }
else else
{ {

View file

@ -224,7 +224,7 @@ public abstract class EntityLiving extends Entity
} }
int i = (int)(150.0D * d0); int i = (int)(150.0D * d0);
((AWorldServer)this.worldObj).spawnParticle(ParticleType.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, BlockRegistry.getStateId(iblockstate)); ((AWorldServer)this.worldObj).spawnParticle(ParticleType.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, BlockRegistry.getId(iblockstate));
} }
} }
@ -1043,7 +1043,7 @@ public abstract class EntityLiving extends Entity
vec31 = vec31.rotatePitch(-this.rotPitch * (float)Math.PI / 180.0F); vec31 = vec31.rotatePitch(-this.rotPitch * (float)Math.PI / 180.0F);
vec31 = vec31.rotateYaw(-this.rotYaw * (float)Math.PI / 180.0F); vec31 = vec31.rotateYaw(-this.rotYaw * (float)Math.PI / 180.0F);
vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, ItemRegistry.getIdFromItem(stack.getItem())); this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, ItemRegistry.getId(stack.getItem()));
} }
} }

View file

@ -309,7 +309,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile
tagCompound.setShort("yTile", (short)this.yTile); tagCompound.setShort("yTile", (short)this.yTile);
tagCompound.setShort("zTile", (short)this.zTile); tagCompound.setShort("zTile", (short)this.zTile);
if(this.inTile != null) { if(this.inTile != null) {
String id = BlockRegistry.getNameFromBlock(this.inTile); String id = BlockRegistry.getName(this.inTile);
tagCompound.setString("inTile", id == null ? "" : id.toString()); tagCompound.setString("inTile", id == null ? "" : id.toString());
} }
tagCompound.setByte("shake", (byte)this.throwableShake); tagCompound.setByte("shake", (byte)this.throwableShake);
@ -334,7 +334,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile
if (tagCompund.hasString("inTile")) if (tagCompund.hasString("inTile"))
{ {
this.inTile = BlockRegistry.getRegisteredBlock(tagCompund.getString("inTile")); this.inTile = BlockRegistry.byName(tagCompund.getString("inTile"));
} }
else else
{ {

View file

@ -1,5 +1,12 @@
package common.init; package common.init;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import common.block.*; import common.block.*;
import common.block.artificial.BlockBed; import common.block.artificial.BlockBed;
import common.block.artificial.BlockBookshelf; import common.block.artificial.BlockBookshelf;
@ -128,48 +135,83 @@ import common.block.tile.BlockBannerHanging;
import common.block.tile.BlockBannerStanding; import common.block.tile.BlockBannerStanding;
import common.block.tile.BlockStandingSign; import common.block.tile.BlockStandingSign;
import common.block.tile.BlockWallSign; import common.block.tile.BlockWallSign;
import common.collect.BiMap;
import common.collect.HashBiMap;
import common.collect.Lists;
import common.collect.Maps;
import common.color.DyeColor; import common.color.DyeColor;
import common.item.CheatTab; import common.item.CheatTab;
import common.log.Log; import common.log.Log;
import common.model.TextureAnimation; import common.model.TextureAnimation;
import common.util.Mapping; import common.properties.Property;
import common.util.Util; import common.util.Util;
import common.world.State; import common.world.State;
public abstract class BlockRegistry { public abstract class BlockRegistry {
public static final Mapping<Block> REGISTRY = new Mapping("air"); private static final Map<String, Block> BLOCK_MAP = HashBiMap.<String, Block>create();
private static final List<Block> BLOCKS = Lists.newArrayList();
private static final Map<Block, String> BLOCK_NAMES = ((BiMap)BLOCK_MAP).inverse();
private static final Map<String, State> STATE_MAP = Maps.newHashMap();
private static final List<State> STATES = Lists.newArrayList();
private static final Map<State, String> STATE_NAMES = Maps.newHashMap();
private static final IdentityHashMap<State, Integer> STATE_IDS = new IdentityHashMap(512);
private static int nextBlockId = 0; private static Block air;
public static int getIdFromBlock(Block block) { private static void register(String name, Block block) {
return REGISTRY.getId(block); if(BLOCK_MAP.containsKey(name))
throw new IllegalArgumentException("Block " + name + " ist bereits registriert");
BLOCKS.add(block);
BLOCK_MAP.put(name, block);
} }
public static Block getBlockById(int id) { public static Set<String> getKeys() {
return REGISTRY.byId(id); return Collections.<String>unmodifiableSet(BLOCK_MAP.keySet());
} }
public static String getNameFromBlock(Block block) { public static Block byName(String name) {
return REGISTRY.getName(block); Block block = BLOCK_MAP.get(name);
return block == null ? air : block;
} }
public static Block getRegisteredBlock(String name) { public static Block byNameExact(String name) {
return REGISTRY.byName(name); return BLOCK_MAP.get(name);
} }
public static int getStateId(State state) { public static String getName(Block block) {
Block block = state.getBlock(); return BLOCK_NAMES.get(block);
return getIdFromBlock(block) + (block.getMetaFromState(state) << 12);
} }
public static State getStateById(int id) { public static Iterable<Block> blocks() {
int i = id & 4095; return BLOCKS;
int j = id >> 12 & 15;
return getBlockById(i).getStateFromMeta(j);
} }
private static void registerBlock(String name, Block block) { public static State byName(String name, State def) {
REGISTRY.register(nextBlockId++, name, block); if(name == null)
return def;
State state = STATE_MAP.get(name);
if(state != null)
return state;
int idx = name.indexOf(",");
Block block = BlockRegistry.byNameExact(idx >= 0 ? name.substring(0, idx) : name);
return block != null ? block.getState() : def;
}
public static String getName(State state) {
return STATE_NAMES.get(state);
}
public static int getId(State state) {
Integer id = STATE_IDS.get(state);
return id == null ? -1 : id.intValue();
}
public static State byId(int id) {
return id >= 0 && id < STATES.size() ? STATES.get(id) : null;
}
public static Iterable<State> states() {
return STATES;
} }
private static void registerFluid(String name, String display, boolean infinite, LiquidType type, boolean opaque, int light, int rate, private static void registerFluid(String name, String display, boolean infinite, LiquidType type, boolean opaque, int light, int rate,
@ -180,58 +222,58 @@ public abstract class BlockRegistry {
BlockStaticLiquid st = (BlockStaticLiquid)(new BlockStaticLiquid(type.material, opaque, rate, still, dy)).setHardness(100.0F) BlockStaticLiquid st = (BlockStaticLiquid)(new BlockStaticLiquid(type.material, opaque, rate, still, dy)).setHardness(100.0F)
.setLightOpacity(opaque ? 0 : 3).setLightLevel((float)light / 15.0f).setDisplay(display) .setLightOpacity(opaque ? 0 : 3).setLightLevel((float)light / 15.0f).setDisplay(display)
.setRadiation(radiation); .setRadiation(radiation);
registerBlock("flowing_" + name, dy); register("flowing_" + name, dy);
registerBlock(name, st); register(name, st);
} }
static void register() { static void register() {
registerBlock("air", (new BlockAir()).setDisplay("Luft")); register("air", air = (new BlockAir()).setDisplay("Luft"));
Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Stein"); Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Stein");
registerBlock("stone", stone); register("stone", stone);
registerBlock("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setStepSound(SoundType.STONE) register("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setStepSound(SoundType.STONE)
.setDisplay("Grundgestein").setTab(CheatTab.NATURE).setMiningLevel(6)); .setDisplay("Grundgestein").setTab(CheatTab.NATURE).setMiningLevel(6));
registerBlock("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.NATURE)); register("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.NATURE));
registerBlock("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.NATURE)); register("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.NATURE));
registerBlock("hellrock", (new BlockHellRock()).setHardness(0.4F).setStepSound(SoundType.STONE).setDisplay("Höllenstein")); register("hellrock", (new BlockHellRock()).setHardness(0.4F).setStepSound(SoundType.STONE).setDisplay("Höllenstein"));
registerBlock("cell_rock", (new Block(Material.LOOSE)).setHardness(1.0F).setResistance(3.0F) register("cell_rock", (new Block(Material.LOOSE)).setHardness(1.0F).setResistance(3.0F)
.setStepSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.NATURE)); .setStepSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.NATURE));
registerBlock("moon_rock", (new Block(Material.SOLID)).setHardness(2.5F).setResistance(10.0F) register("moon_rock", (new Block(Material.SOLID)).setHardness(2.5F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Mondgestein").setTab(CheatTab.NATURE)); .setStepSound(SoundType.STONE).setDisplay("Mondgestein").setTab(CheatTab.NATURE));
Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bruchstein").setTab(CheatTab.NATURE); .setDisplay("Bruchstein").setTab(CheatTab.NATURE);
registerBlock("cobblestone", cobblestone); register("cobblestone", cobblestone);
Block mossyCobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) Block mossyCobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bemooster Bruchstein").setTab(CheatTab.NATURE); .setDisplay("Bemooster Bruchstein").setTab(CheatTab.NATURE);
registerBlock("mossy_cobblestone", mossyCobblestone); register("mossy_cobblestone", mossyCobblestone);
Block sandstone = (new BlockSandStone("normal")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein"); Block sandstone = (new BlockSandStone("normal")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein");
registerBlock("sandstone", sandstone); register("sandstone", sandstone);
registerBlock("smooth_sandstone", (new BlockSandStone("smooth")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein")); register("smooth_sandstone", (new BlockSandStone("smooth")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein"));
registerBlock("carved_sandstone", (new BlockSandStone("carved")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein")); register("carved_sandstone", (new BlockSandStone("carved")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein"));
registerBlock("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(SoundType.STONE) register("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(SoundType.STONE)
.setDisplay("Obsidian").setMiningLevel(3)); .setDisplay("Obsidian").setMiningLevel(3));
registerBlock("clay", (new BlockClay()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable()); register("clay", (new BlockClay()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable());
registerBlock("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(SoundType.STONE).setDisplay("Gebrannter Ton")); register("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(SoundType.STONE).setDisplay("Gebrannter Ton"));
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F) register(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F)
.setStepSound(SoundType.STONE).setDisplay(color.getSubject(null) + " gefärbter Ton")); .setStepSound(SoundType.STONE).setDisplay(color.getSubject(null) + " gefärbter Ton"));
} }
registerBlock("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) register("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE).setFlammable(5, 5)); .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)); register("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)); register("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()); register("gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable());
registerBlock("ash", (new Block(Material.LOOSE)).setHardness(0.2F).setStepSound(SoundType.SAND).setDisplay("Asche") register("ash", (new Block(Material.LOOSE)).setHardness(0.2F).setStepSound(SoundType.SAND).setDisplay("Asche")
.setTab(CheatTab.NATURE).setShovelHarvestable()); .setTab(CheatTab.NATURE).setShovelHarvestable());
registerBlock("snow_layer", (new BlockSnow()).setHardness(0.1F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setLightOpacity(0) register("snow_layer", (new BlockSnow()).setHardness(0.1F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setLightOpacity(0)
.setShovelHarvestable()); .setShovelHarvestable());
registerBlock("snow", (new BlockSnowBlock()).setHardness(0.2F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setShovelHarvestable()); register("snow", (new BlockSnowBlock()).setHardness(0.2F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setShovelHarvestable());
registerBlock("ice", (new BlockIce()).setHardness(0.5F).setLightOpacity(3).setStepSound(SoundType.GLASS).setDisplay("Eis").setMiningLevel(0)); register("ice", (new BlockIce()).setHardness(0.5F).setLightOpacity(3).setStepSound(SoundType.GLASS).setDisplay("Eis").setMiningLevel(0));
registerBlock("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setStepSound(SoundType.GLASS).setDisplay("Packeis").setMiningLevel(0)); register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setStepSound(SoundType.GLASS).setDisplay("Packeis").setMiningLevel(0));
registerBlock("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Seelensand").setShovelHarvestable()); register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Seelensand").setShovelHarvestable());
registerBlock("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F) register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F)
.setDisplay("Glowstone")); .setDisplay("Glowstone"));
registerBlock("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarzstein")); register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarzstein"));
registerBlock("blackened_cobble", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) register("blackened_cobble", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Schwarzbruchstein").setTab(CheatTab.NATURE)); .setDisplay("Schwarzbruchstein").setTab(CheatTab.NATURE));
@ -248,183 +290,183 @@ public abstract class BlockRegistry {
registerFluid("springwater", "Klares Wasser", true, LiquidType.COLD, false, 0, 5, 0.0f, 1, 1); registerFluid("springwater", "Klares Wasser", true, LiquidType.COLD, false, 0, 5, 0.0f, 1, 1);
registerBlock("coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE).setDisplay("Steinkohle")); register("coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE).setDisplay("Steinkohle"));
registerBlock("lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) register("lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE)
.setDisplay("Lapislazulierz").setMiningLevel(1)); .setDisplay("Lapislazulierz").setMiningLevel(1));
registerBlock("emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) register("emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE)
.setDisplay("Smaragderz").setMiningLevel(2)); .setDisplay("Smaragderz").setMiningLevel(2));
registerBlock("quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) register("quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE)
.setDisplay("Quarzerz")); .setDisplay("Quarzerz"));
registerBlock("black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) register("black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE)
.setDisplay("Schwarzes Quarzerz")); .setDisplay("Schwarzes Quarzerz"));
registerBlock("redstone_ore", (new BlockRedstoneOre(false)).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) register("redstone_ore", (new BlockRedstoneOre(false)).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE)
.setDisplay("Redstone-Erz").setTab(CheatTab.GEMS).setMiningLevel(2)); .setDisplay("Redstone-Erz").setTab(CheatTab.GEMS).setMiningLevel(2));
registerBlock("lit_redstone_ore", (new BlockRedstoneOre(true)).setLightLevel(0.625F).setHardness(3.0F).setResistance(5.0F) register("lit_redstone_ore", (new BlockRedstoneOre(true)).setLightLevel(0.625F).setHardness(3.0F).setResistance(5.0F)
.setStepSound(SoundType.STONE).setDisplay("Redstone-Erz").setMiningLevel(2)); .setStepSound(SoundType.STONE).setDisplay("Redstone-Erz").setMiningLevel(2));
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1); // String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
registerBlock(metal.name + "_ore", (new BlockMetalOre(metal)).setHardness(3.0F).setResistance(5.0F) register(metal.name + "_ore", (new BlockMetalOre(metal)).setHardness(3.0F).setResistance(5.0F)
.setDisplay(metal.display + "erz").setMiningLevel(1)); .setDisplay(metal.display + "erz").setMiningLevel(1));
} }
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); // String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
registerBlock(ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) register(ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE)
.setDisplay(ore.display + "erz").setMiningLevel(ore.material.getHarvestLevel() - 1)); .setDisplay(ore.display + "erz").setMiningLevel(ore.material.getHarvestLevel() - 1));
} }
registerBlock("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); register("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("grass", (new BlockGrass()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable()); register("grass", (new BlockGrass()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable());
registerBlock("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); register("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setShovelHarvestable().setTab(CheatTab.NATURE));
registerBlock("podzol", (new BlockPodzol()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Podsol").setShovelHarvestable()); register("podzol", (new BlockPodzol()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Podsol").setShovelHarvestable());
registerBlock("mycelium", (new BlockMycelium()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable()); register("mycelium", (new BlockMycelium()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable());
registerBlock("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE) register("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE)
.setDisplay("Tian").setTab(CheatTab.NATURE)); .setDisplay("Tian").setTab(CheatTab.NATURE));
registerBlock("tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE) register("tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE)
.setDisplay("Tianerde").setTab(CheatTab.NATURE)); .setDisplay("Tianerde").setTab(CheatTab.NATURE));
registerBlock("moon_cheese", (new BlockTreasure(Material.SOFT)).setHardness(1.5F).setResistance(5.0F) register("moon_cheese", (new BlockTreasure(Material.SOFT)).setHardness(1.5F).setResistance(5.0F)
.setStepSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.NATURE)); .setStepSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.NATURE));
registerBlock("slime_block", (new BlockSlime()).setDisplay("Schleimblock").setStepSound(SoundType.SLIME)); register("slime_block", (new BlockSlime()).setDisplay("Schleimblock").setStepSound(SoundType.SLIME));
registerBlock("blackened_dirt", (new BlockBlackenedDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setShovelHarvestable()); register("blackened_dirt", (new BlockBlackenedDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setShovelHarvestable());
registerBlock("blackened_soil", (new BlockBlackenedSoil()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwarzgrund").setShovelHarvestable()); register("blackened_soil", (new BlockBlackenedSoil()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwarzgrund").setShovelHarvestable());
for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) { for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) {
registerBlock(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsEfficiency(0)); register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsEfficiency(0));
} }
registerBlock("deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Toter Busch")); register("deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Toter Busch"));
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
registerBlock(type.getName(), (new BlockFlower(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay())); register(type.getName(), (new BlockFlower(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay()));
} }
for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) { for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) {
registerBlock(type.getName(), new BlockDoublePlant(type).setDisplay(type.getDisplay())); register(type.getName(), new BlockDoublePlant(type).setDisplay(type.getDisplay()));
} }
Block cactus = (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus"); Block cactus = (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus");
registerBlock("cactus", cactus); register("cactus", cactus);
registerBlock("reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr")); register("reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr"));
registerBlock("vine", (new BlockVine()).setHardness(0.2F).setStepSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0)); register("vine", (new BlockVine()).setHardness(0.2F).setStepSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0));
registerBlock("waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt")); register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt"));
registerBlock("cocoa", (new BlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay("Kakao")); register("cocoa", (new BlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay("Kakao"));
Block brownMushroom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.125F) Block brownMushroom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.125F)
.setDisplay("Pilz"); .setDisplay("Pilz");
registerBlock("brown_mushroom", brownMushroom); register("brown_mushroom", brownMushroom);
registerBlock("brown_mushroom_block", (new BlockHugeMushroom(Material.WOOD, brownMushroom)).setHardness(0.2F) register("brown_mushroom_block", (new BlockHugeMushroom(Material.WOOD, brownMushroom)).setHardness(0.2F)
.setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); .setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS));
Block redMushrooom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Pilz"); Block redMushrooom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Pilz");
registerBlock("red_mushroom", redMushrooom); register("red_mushroom", redMushrooom);
registerBlock("red_mushroom_block", (new BlockHugeMushroom(Material.WOOD, redMushrooom)).setHardness(0.2F) register("red_mushroom_block", (new BlockHugeMushroom(Material.WOOD, redMushrooom)).setHardness(0.2F)
.setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); .setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS));
registerBlock("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.5F) register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.5F)
.setDisplay("Tianpilz")); .setDisplay("Tianpilz"));
Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbis"); Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbis");
registerBlock("pumpkin", pumpkin); register("pumpkin", pumpkin);
registerBlock("pumpkin_stem", (new BlockStem(pumpkin, "Kürbiskerne")).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbisstamm")); register("pumpkin_stem", (new BlockStem(pumpkin, "Kürbiskerne")).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbisstamm"));
Block melon = (new BlockMelon()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Melone"); Block melon = (new BlockMelon()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Melone");
registerBlock("melon_block", melon); register("melon_block", melon);
registerBlock("melon_stem", (new BlockStem(melon, "Melonenkerne")).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Melonenstamm")); register("melon_stem", (new BlockStem(melon, "Melonenkerne")).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Melonenstamm"));
registerBlock("dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub")); register("dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub"));
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {
registerBlock(wood.getName() + "_log", (new BlockLog()).setDisplay(wood.getDisplay() + "holz")); register(wood.getName() + "_log", (new BlockLog()).setDisplay(wood.getDisplay() + "holz"));
for(LeavesType type : LeavesType.values()) { for(LeavesType type : LeavesType.values()) {
registerBlock(wood.getName() + "_leaves_" + type.getName(), (new BlockLeaves(wood, type)).setDisplay(wood.getDisplay() + "laub (" + type.getDisplayName() + ")")); register(wood.getName() + "_leaves_" + type.getName(), (new BlockLeaves(wood, type)).setDisplay(wood.getDisplay() + "laub (" + type.getDisplayName() + ")"));
} }
registerBlock(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setStepSound(SoundType.GRASS) register(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setStepSound(SoundType.GRASS)
.setDisplay(wood.getDisplay() + "setzling")); .setDisplay(wood.getDisplay() + "setzling"));
} }
registerBlock("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer der Seelen")); register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer der Seelen"));
registerBlock("black_fire", (new BlockTintedFire(0x202020)).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Dunkles Feuer")); register("black_fire", (new BlockTintedFire(0x202020)).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Dunkles Feuer"));
registerBlock("web", (new BlockWeb()).setLightOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz")); register("web", (new BlockWeb()).setLightOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz"));
registerBlock("fire", (new BlockFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer")); register("fire", (new BlockFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer"));
registerBlock("lapis_block", (new Block(Material.SOLID)).setHardness(3.0F).setResistance(5.0F) register("lapis_block", (new Block(Material.SOLID)).setHardness(3.0F).setResistance(5.0F)
.setStepSound(SoundType.STONE).setDisplay("Lapislazuliblock").setTab(CheatTab.GEMS).setMiningLevel(1)); .setStepSound(SoundType.STONE).setDisplay("Lapislazuliblock").setTab(CheatTab.GEMS).setMiningLevel(1));
registerBlock("emerald_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) register("emerald_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Smaragdblock").setTab(CheatTab.GEMS).setMiningLevel(2)); .setStepSound(SoundType.STONE).setDisplay("Smaragdblock").setTab(CheatTab.GEMS).setMiningLevel(2));
registerBlock("redstone_block", (new BlockCompressedPowered(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) register("redstone_block", (new BlockCompressedPowered(Material.SOLID)).setHardness(5.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Redstone-Block").setTab(CheatTab.TECHNOLOGY)); .setStepSound(SoundType.STONE).setDisplay("Redstone-Block").setTab(CheatTab.TECHNOLOGY));
registerBlock("glass", (new BlockGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glas")); register("glass", (new BlockGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glas"));
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getSubject(null) + " gefärbtes Glas")); register(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getSubject(null) + " gefärbtes Glas"));
} }
registerBlock("glass_pane", (new BlockPane(Material.TRANSLUCENT, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe")); register("glass_pane", (new BlockPane(Material.TRANSLUCENT, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe"));
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getSubject(null) + " gefärbte Glasscheibe")); register(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getSubject(null) + " gefärbte Glasscheibe"));
} }
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle")
.setShearsEfficiency(1)); .setShearsEfficiency(1));
} }
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
registerBlock(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setLightOpacity(0)); register(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setLightOpacity(0));
} }
for(DyeColor color : BlockBed.COLORS) { for(DyeColor color : BlockBed.COLORS) {
registerBlock(color.getName() + "_bed", (new BlockBed(color)).setStepSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett")); register(color.getName() + "_bed", (new BlockBed(color)).setStepSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett"));
} }
registerBlock("ladder", (new BlockLadder()).setHardness(0.4F).setStepSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable()); register("ladder", (new BlockLadder()).setHardness(0.4F).setStepSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable());
registerBlock("torch", (new BlockTorch()).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(SoundType.WOOD).setDisplay("Fackel")); register("torch", (new BlockTorch()).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(SoundType.WOOD).setDisplay("Fackel"));
registerBlock("lamp", (new Block(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F) register("lamp", (new Block(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F)
.setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY)); .setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY));
registerBlock("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(SoundType.WOOD).setDisplay("Bücherregal")); register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(SoundType.WOOD).setDisplay("Bücherregal"));
registerBlock("cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen")); register("cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen"));
registerBlock("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(SoundType.STONE) register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(SoundType.STONE)
.setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION)); .setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION));
registerBlock("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf")); register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf"));
registerBlock("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay())); register("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay()));
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
registerBlock("flowerpot_" + type.getName(), (new BlockFlowerPot(BlockFlower.getByType(type))).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + type.getDisplay())); register("flowerpot_" + type.getName(), (new BlockFlowerPot(BlockFlower.getByType(type))).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + type.getDisplay()));
} }
registerBlock("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm") register("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm")
.setTab(CheatTab.DECORATION)); .setTab(CheatTab.DECORATION));
registerBlock("skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION)); register("skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION));
registerBlock("lit_pumpkin", (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setLightLevel(1.0F).setDisplay("Kürbislaterne")); register("lit_pumpkin", (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setLightLevel(1.0F).setDisplay("Kürbislaterne"));
registerBlock("hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(SoundType.GRASS).setDisplay("Strohballen") register("hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(SoundType.GRASS).setDisplay("Strohballen")
.setTab(CheatTab.DECORATION)); .setTab(CheatTab.DECORATION));
registerBlock("sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild")); register("sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
registerBlock("wall_sign", (new BlockWallSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild")); register("wall_sign", (new BlockWallSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
registerBlock("banner", (new BlockBannerStanding()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner")); register("banner", (new BlockBannerStanding()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
registerBlock("wall_banner", (new BlockBannerHanging()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner")); register("wall_banner", (new BlockBannerHanging()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
registerBlock("portal", (new BlockPortal()).setHardness(0.0F).setStepSound(SoundType.GLASS).setLightLevel(0.75F).setDisplay("Portal")); register("portal", (new BlockPortal()).setHardness(0.0F).setStepSound(SoundType.GLASS).setLightLevel(0.75F).setDisplay("Portal"));
registerBlock("floor_portal", (new BlockFloorPortal(Material.PORTAL)).setHardness(0.0F).setDisplay("Portal")); register("floor_portal", (new BlockFloorPortal(Material.PORTAL)).setHardness(0.0F).setDisplay("Portal"));
registerBlock("portal_frame", (new BlockPortalFrame()).setStepSound(SoundType.GLASS).setLightLevel(0.125F).setHardness(5.0F) register("portal_frame", (new BlockPortalFrame()).setStepSound(SoundType.GLASS).setLightLevel(0.125F).setHardness(5.0F)
.setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY)); .setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY));
registerBlock("farmland", (new BlockFarmland()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ackerboden") register("farmland", (new BlockFarmland()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ackerboden")
.setShovelHarvestable().setTab(CheatTab.PLANTS)); .setShovelHarvestable().setTab(CheatTab.PLANTS));
registerBlock("wheat", (new BlockCrops()).setDisplay("Getreide")); register("wheat", (new BlockCrops()).setDisplay("Getreide"));
registerBlock("carrot", (new BlockCarrot()).setDisplay("Karotten")); register("carrot", (new BlockCarrot()).setDisplay("Karotten"));
registerBlock("potato", (new BlockPotato()).setDisplay("Kartoffeln")); register("potato", (new BlockPotato()).setDisplay("Kartoffeln"));
registerBlock("soul_wart", (new BlockWart()).setDisplay("Seelenwarze")); register("soul_wart", (new BlockWart()).setDisplay("Seelenwarze"));
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1); // String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1);
registerBlock(metal.name + "_block", (new BlockMetalBlock(metal)).setHardness(5.0F).setResistance(10.0F) register(metal.name + "_block", (new BlockMetalBlock(metal)).setHardness(5.0F).setResistance(10.0F)
.setDisplay(metal.display + "block").setMiningLevel(1)); .setDisplay(metal.display + "block").setMiningLevel(1));
} }
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); // String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1);
registerBlock(ore.name + "_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE) register(ore.name + "_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay(ore.display + "block").setTab(CheatTab.GEMS) .setDisplay(ore.display + "block").setTab(CheatTab.GEMS)
.setMiningLevel(ore.material.getHarvestLevel() - 1)); .setMiningLevel(ore.material.getHarvestLevel() - 1));
} }
@ -434,198 +476,220 @@ public abstract class BlockRegistry {
registerBlock("stone_slab", (new BlockSlab(Material.SOLID, "stone_slab_side", "double_stone_top", "double_stone_top")) register("stone_slab", (new BlockSlab(Material.SOLID, "stone_slab_side", "double_stone_top", "double_stone_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinstufe"));
registerBlock("stone_stairs", (new BlockStairs(stone.getState())).setDisplay("Steintreppe")); register("stone_stairs", (new BlockStairs(stone.getState())).setDisplay("Steintreppe"));
registerBlock("cobblestone_slab", (new BlockSlab(Material.SOLID, "cobblestone")) register("cobblestone_slab", (new BlockSlab(Material.SOLID, "cobblestone"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Bruchsteinstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Bruchsteinstufe"));
registerBlock("cobblestone_stairs", (new BlockStairs(cobblestone.getState())).setDisplay("Bruchsteintreppe")); register("cobblestone_stairs", (new BlockStairs(cobblestone.getState())).setDisplay("Bruchsteintreppe"));
registerBlock("cobblestone_wall", (new BlockWall(cobblestone, "cobblestone")).setDisplay("Bruchsteinmauer")); register("cobblestone_wall", (new BlockWall(cobblestone, "cobblestone")).setDisplay("Bruchsteinmauer"));
registerBlock("mossy_cobblestone_wall", (new BlockWall(mossyCobblestone, "mossy_cobblestone")).setDisplay("Bemooste Bruchsteinmauer")); register("mossy_cobblestone_wall", (new BlockWall(mossyCobblestone, "mossy_cobblestone")).setDisplay("Bemooste Bruchsteinmauer"));
registerBlock("sandstone_slab", (new BlockSlab(Material.SOLID, "sandstone_normal", "sandstone_bottom", "sandstone_all")) register("sandstone_slab", (new BlockSlab(Material.SOLID, "sandstone_normal", "sandstone_bottom", "sandstone_all"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Sandsteinstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Sandsteinstufe"));
registerBlock("sandstone_stairs", (new BlockStairs(sandstone.getState(), register("sandstone_stairs", (new BlockStairs(sandstone.getState(),
"sandstone_bottom", "sandstone_all")) // fix type "sandstone_bottom", "sandstone_all")) // fix type
.setDisplay("Sandsteintreppe")); .setDisplay("Sandsteintreppe"));
Block quartz = (new BlockQuartz(false, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzblock"); Block quartz = (new BlockQuartz(false, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzblock");
registerBlock("quartz_block", quartz); register("quartz_block", quartz);
registerBlock("quartz_ornaments", (new BlockQuartz(false, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Quarzblock")); register("quartz_ornaments", (new BlockQuartz(false, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Quarzblock"));
registerBlock("quartz_pillar", (new BlockQuartzPillar(false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzsäule")); register("quartz_pillar", (new BlockQuartzPillar(false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzsäule"));
registerBlock("quartz_slab", (new BlockSlab(Material.SOLID, "quartz_block_side", "quartz_block_bottom", "quartz_top")) register("quartz_slab", (new BlockSlab(Material.SOLID, "quartz_block_side", "quartz_block_bottom", "quartz_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Quarzstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Quarzstufe"));
registerBlock("quartz_stairs", (new BlockStairs(quartz.getState(), register("quartz_stairs", (new BlockStairs(quartz.getState(),
"quartz_block_bottom", "quartz_top")) "quartz_block_bottom", "quartz_top"))
.setDisplay("Quarztreppe")); .setDisplay("Quarztreppe"));
registerBlock("iron_bars", (new BlockPane(Material.SOLID, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE) register("iron_bars", (new BlockPane(Material.SOLID, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Eisengitter")); .setDisplay("Eisengitter"));
registerBlock("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisentür")); register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisentür"));
registerBlock("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisenfalltür")); register("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisenfalltür"));
Block brick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) Block brick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Ziegelsteine").setTab(CheatTab.BLOCKS); .setDisplay("Ziegelsteine").setTab(CheatTab.BLOCKS);
registerBlock("brick_block", brick); register("brick_block", brick);
registerBlock("brick_slab", (new BlockSlab(Material.SOLID, "brick_block")) register("brick_slab", (new BlockSlab(Material.SOLID, "brick_block"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Ziegelstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Ziegelstufe"));
registerBlock("brick_stairs", (new BlockStairs(brick.getState())).setDisplay("Ziegeltreppe")); register("brick_stairs", (new BlockStairs(brick.getState())).setDisplay("Ziegeltreppe"));
Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Steinziegel").setTab(CheatTab.BLOCKS); .setDisplay("Steinziegel").setTab(CheatTab.BLOCKS);
registerBlock("stonebrick", stonebrick); register("stonebrick", stonebrick);
registerBlock("mossy_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) register("mossy_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Bemooste Steinziegel").setTab(CheatTab.BLOCKS)); .setDisplay("Bemooste Steinziegel").setTab(CheatTab.BLOCKS));
registerBlock("cracked_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) register("cracked_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Rissige Steinziegel").setTab(CheatTab.BLOCKS)); .setDisplay("Rissige Steinziegel").setTab(CheatTab.BLOCKS));
registerBlock("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) register("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Gemeißelte Steinziegel").setTab(CheatTab.BLOCKS)); .setDisplay("Gemeißelte Steinziegel").setTab(CheatTab.BLOCKS));
registerBlock("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick")) register("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinziegelstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinziegelstufe"));
registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState())) register("stonebrick_stairs", (new BlockStairs(stonebrick.getState()))
.setDisplay("Steinziegeltreppe")); .setDisplay("Steinziegeltreppe"));
Block bloodBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) Block bloodBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Blutrote Ziegel").setTab(CheatTab.BLOCKS); .setDisplay("Blutrote Ziegel").setTab(CheatTab.BLOCKS);
registerBlock("blood_brick", bloodBrick); register("blood_brick", bloodBrick);
registerBlock("blood_brick_slab", (new BlockSlab(Material.SOLID, "blood_brick")) register("blood_brick_slab", (new BlockSlab(Material.SOLID, "blood_brick"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Blutrote Ziegelstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Blutrote Ziegelstufe"));
registerBlock("blood_brick_fence", (new BlockFence(Material.SOLID, "blood_brick")).setHardness(2.0F).setResistance(10.0F) register("blood_brick_fence", (new BlockFence(Material.SOLID, "blood_brick")).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Blutroter Ziegelzaun")); .setStepSound(SoundType.STONE).setDisplay("Blutroter Ziegelzaun"));
registerBlock("blood_brick_stairs", (new BlockStairs(bloodBrick.getState())).setDisplay("Blutrote Ziegeltreppe")); register("blood_brick_stairs", (new BlockStairs(bloodBrick.getState())).setDisplay("Blutrote Ziegeltreppe"));
Block blackBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) Block blackBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Schwarze Ziegel").setTab(CheatTab.BLOCKS); .setDisplay("Schwarze Ziegel").setTab(CheatTab.BLOCKS);
registerBlock("black_brick", blackBrick); register("black_brick", blackBrick);
registerBlock("black_brick_slab", (new BlockSlab(Material.SOLID, "black_brick")) register("black_brick_slab", (new BlockSlab(Material.SOLID, "black_brick"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Ziegelstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Ziegelstufe"));
registerBlock("black_brick_stairs", (new BlockStairs(blackBrick.getState())).setDisplay("Schwarze Ziegeltreppe")); register("black_brick_stairs", (new BlockStairs(blackBrick.getState())).setDisplay("Schwarze Ziegeltreppe"));
registerBlock("black_brick_fence", (new BlockFence(Material.SOLID, "black_brick")).setHardness(2.0F).setResistance(10.0F) register("black_brick_fence", (new BlockFence(Material.SOLID, "black_brick")).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun")); .setStepSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun"));
Block bquartz = (new BlockQuartz(true, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer Quarzblock"); Block bquartz = (new BlockQuartz(true, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer Quarzblock");
registerBlock("black_quartz_block", bquartz); register("black_quartz_block", bquartz);
registerBlock("black_quartz_ornaments", (new BlockQuartz(true, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer gemeißelter Quarzblock")); register("black_quartz_ornaments", (new BlockQuartz(true, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer gemeißelter Quarzblock"));
registerBlock("black_quartz_pillar", (new BlockQuartzPillar(true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarze Quarzsäule")); register("black_quartz_pillar", (new BlockQuartzPillar(true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarze Quarzsäule"));
registerBlock("black_quartz_slab", (new BlockSlab(Material.SOLID, "black_quartz_block_side", "black_quartz_block_bottom", "black_quartz_top")) register("black_quartz_slab", (new BlockSlab(Material.SOLID, "black_quartz_block_side", "black_quartz_block_bottom", "black_quartz_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Quarzstufe")); .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Quarzstufe"));
registerBlock("black_quartz_stairs", (new BlockStairs(bquartz.getState(), register("black_quartz_stairs", (new BlockStairs(bquartz.getState(),
"black_quartz_block_bottom", "black_quartz_top")) "black_quartz_block_bottom", "black_quartz_top"))
.setDisplay("Schwarze Quarztreppe")); .setDisplay("Schwarze Quarztreppe"));
for(DecoType deco : DecoType.values()) { for(DecoType deco : DecoType.values()) {
registerBlock(deco.name, (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F) register(deco.name, (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay(deco.display).setTab(CheatTab.BLOCKS)); .setStepSound(SoundType.STONE).setDisplay(deco.display).setTab(CheatTab.BLOCKS));
} }
registerBlock("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD).setDisplay("Holzfalltür").setFlammable(5, 20)); register("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD).setDisplay("Holzfalltür").setFlammable(5, 20));
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {
Block planks = (new Block(Material.WOOD)).setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD) Block planks = (new Block(Material.WOOD)).setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD)
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20); .setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20);
registerBlock(wood.getName() + "_planks", planks); register(wood.getName() + "_planks", planks);
registerBlock(wood.getName() + "_stairs", (new BlockStairs(planks.getState())) register(wood.getName() + "_stairs", (new BlockStairs(planks.getState()))
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20)); .setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
registerBlock(wood.getName() + "_slab", (new BlockSlab(Material.WOOD, wood.getName() + "_planks")) register(wood.getName() + "_slab", (new BlockSlab(Material.WOOD, wood.getName() + "_planks"))
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20)); .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")) register(wood.getName() + "_fence", (new BlockFence(Material.WOOD, wood.getName() + "_planks"))
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20)); .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) register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F).setResistance(5.0F)
.setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20)); .setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20));
registerBlock(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD) register(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD)
.setDisplay(wood.getDisplay() + "holztür").setFlammable(5, 20)); .setDisplay(wood.getDisplay() + "holztür").setFlammable(5, 20));
} }
registerBlock("core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) register("core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Chunk-Lade-Kern")); .setDisplay("Chunk-Lade-Kern"));
registerBlock("mob_spawner", (new BlockMobSpawner()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Mob-Spawner")); register("mob_spawner", (new BlockMobSpawner()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Mob-Spawner"));
registerBlock("workbench", (new BlockWorkbench(3)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank")); register("workbench", (new BlockWorkbench(3)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank"));
registerBlock("furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Ofen") register("furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Ofen")
.setTab(CheatTab.TECHNOLOGY)); .setTab(CheatTab.TECHNOLOGY));
registerBlock("lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F) register("lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F)
.setDisplay("Ofen (Gefeuert)").setTab(CheatTab.TECHNOLOGY)); .setDisplay("Ofen (Gefeuert)").setTab(CheatTab.TECHNOLOGY));
for(int z = 0; z < BlockAnvil.ANVILS.length; z++) { for(int z = 0; z < BlockAnvil.ANVILS.length; z++) {
registerBlock("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss")); register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss"));
} }
registerBlock("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch")); register("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch"));
registerBlock("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand")); register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand"));
registerBlock("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel")); register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel"));
registerBlock("beacon", (new BlockBeacon()).setDisplay("Leuchtfeuer").setLightLevel(1.0F)); register("beacon", (new BlockBeacon()).setDisplay("Leuchtfeuer").setLightLevel(1.0F));
registerBlock("noteblock", (new BlockNote()).setHardness(0.8F).setDisplay("Notenblock")); register("noteblock", (new BlockNote()).setHardness(0.8F).setDisplay("Notenblock"));
registerBlock("jukebox", (new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Plattenspieler")); register("jukebox", (new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Plattenspieler"));
registerBlock("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Konstruktionstisch")); register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Konstruktionstisch"));
registerBlock("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Fertigungseinheit")); register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Fertigungseinheit"));
registerBlock("chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Truhe")); register("chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Truhe"));
registerBlock("trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Redstonetruhe")); register("trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Redstonetruhe"));
registerBlock("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE) register("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE)
.setDisplay("Warptruhe").setLightLevel(0.5F)); .setDisplay("Warptruhe").setLightLevel(0.5F));
for(int z = 0; z < BlockTNT.TNTS.length; z++) { for(int z = 0; z < BlockTNT.TNTS.length; z++) {
registerBlock("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z))); register("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z)));
} }
registerBlock("nuke", (new BlockNuke()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("T-17")); register("nuke", (new BlockNuke()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("T-17"));
registerBlock("piston", (new BlockPistonBase(false)).setDisplay("Kolben")); register("piston", (new BlockPistonBase(false)).setDisplay("Kolben"));
registerBlock("sticky_piston", (new BlockPistonBase(true)).setDisplay("Klebriger Kolben")); register("sticky_piston", (new BlockPistonBase(true)).setDisplay("Klebriger Kolben"));
registerBlock("piston_head", (new BlockPistonHead()).setDisplay("Kolben")); register("piston_head", (new BlockPistonHead()).setDisplay("Kolben"));
registerBlock("piston_extension", new BlockPistonMoving().setDisplay("Kolben")); register("piston_extension", new BlockPistonMoving().setDisplay("Kolben"));
registerBlock("dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Werfer")); register("dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Werfer"));
registerBlock("dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Spender")); register("dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Spender"));
registerBlock("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Trichter")); register("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Trichter"));
registerBlock("tian_reactor", (new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Tianreaktor")); register("tian_reactor", (new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Tianreaktor"));
registerBlock("rail", (new BlockRail()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Schiene").setMiningLevel(0)); register("rail", (new BlockRail()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Schiene").setMiningLevel(0));
registerBlock("golden_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Antriebsschiene").setMiningLevel(0)); register("golden_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Antriebsschiene").setMiningLevel(0));
registerBlock("detector_rail", (new BlockRailDetector()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Sensorschiene").setMiningLevel(0)); register("detector_rail", (new BlockRailDetector()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Sensorschiene").setMiningLevel(0));
registerBlock("activator_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Aktivierungsschiene").setMiningLevel(0)); register("activator_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Aktivierungsschiene").setMiningLevel(0));
registerBlock("lever", (new BlockLever()).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Hebel")); register("lever", (new BlockLever()).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Hebel"));
registerBlock("stone_pressure_plate", (new BlockPressurePlate(Material.SOLID, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F) register("stone_pressure_plate", (new BlockPressurePlate(Material.SOLID, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F)
.setStepSound(SoundType.STONE).setDisplay("Steindruckplatte")); .setStepSound(SoundType.STONE).setDisplay("Steindruckplatte"));
registerBlock("wooden_pressure_plate", (new BlockPressurePlate(Material.WOOD, BlockPressurePlate.Sensitivity.EVERYTHING)) register("wooden_pressure_plate", (new BlockPressurePlate(Material.WOOD, BlockPressurePlate.Sensitivity.EVERYTHING))
.setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Holzdruckplatte")); .setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Holzdruckplatte"));
registerBlock("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F) register("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F)
.setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (niedrige Gewichte)")); .setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (niedrige Gewichte)"));
registerBlock("heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 150)).setHardness(0.5F) register("heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 150)).setHardness(0.5F)
.setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (hohe Gewichte)")); .setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (hohe Gewichte)"));
registerBlock("stone_button", (new BlockButton(false, 20, "stone")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf")); register("stone_button", (new BlockButton(false, 20, "stone")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf"));
registerBlock("wooden_button", (new BlockButton(true, 30, "oak_planks")).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Knopf")); register("wooden_button", (new BlockButton(true, 30, "oak_planks")).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Knopf"));
registerBlock("red_button", (new BlockButton(true, 10, "red_button")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf")); register("red_button", (new BlockButton(true, 10, "red_button")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf"));
registerBlock("redstone", (new BlockRedstoneWire()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Redstone-Staub")); register("redstone", (new BlockRedstoneWire()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Redstone-Staub"));
registerBlock("unlit_redstone_torch", (new BlockRedstoneTorch(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Fackel")); register("unlit_redstone_torch", (new BlockRedstoneTorch(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Fackel"));
registerBlock("redstone_torch", (new BlockRedstoneTorch(true)).setHardness(0.0F).setLightLevel(0.5F).setStepSound(SoundType.WOOD) register("redstone_torch", (new BlockRedstoneTorch(true)).setHardness(0.0F).setLightLevel(0.5F).setStepSound(SoundType.WOOD)
.setDisplay("Redstone-Fackel").setTab(CheatTab.TECHNOLOGY)); .setDisplay("Redstone-Fackel").setTab(CheatTab.TECHNOLOGY));
registerBlock("repeater", (new BlockRedstoneRepeater(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Verstärker")); register("repeater", (new BlockRedstoneRepeater(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Verstärker"));
registerBlock("powered_repeater", (new BlockRedstoneRepeater(true)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Verstärker")); register("powered_repeater", (new BlockRedstoneRepeater(true)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Verstärker"));
registerBlock("comparator", (new BlockRedstoneComparator(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Komparator")); register("comparator", (new BlockRedstoneComparator(false)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Redstone-Komparator"));
registerBlock("powered_comparator", (new BlockRedstoneComparator(true)).setHardness(0.0F).setLightLevel(0.625F) register("powered_comparator", (new BlockRedstoneComparator(true)).setHardness(0.0F).setLightLevel(0.625F)
.setStepSound(SoundType.WOOD).setDisplay("Redstone-Komparator")); .setStepSound(SoundType.WOOD).setDisplay("Redstone-Komparator"));
registerBlock("redstone_lamp", (new BlockRedstoneLight(false)).setHardness(0.3F).setStepSound(SoundType.GLASS) register("redstone_lamp", (new BlockRedstoneLight(false)).setHardness(0.3F).setStepSound(SoundType.GLASS)
.setDisplay("Redstone-Lampe").setTab(CheatTab.TECHNOLOGY)); .setDisplay("Redstone-Lampe").setTab(CheatTab.TECHNOLOGY));
registerBlock("lit_redstone_lamp", (new BlockRedstoneLight(true)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Redstone-Lampe")); register("lit_redstone_lamp", (new BlockRedstoneLight(true)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Redstone-Lampe"));
registerBlock("daylight_detector", new BlockDaylightDetector(false).setDisplay("Tageslichtsensor")); register("daylight_detector", new BlockDaylightDetector(false).setDisplay("Tageslichtsensor"));
registerBlock("daylight_detector_inverted", new BlockDaylightDetector(true).setDisplay("Tageslichtsensor")); register("daylight_detector_inverted", new BlockDaylightDetector(true).setDisplay("Tageslichtsensor"));
registerBlock("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken")); register("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken"));
registerBlock("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0)); register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0));
REGISTRY.finish(); Map<Class, String> map = Maps.newLinkedHashMap();
for(Block block : BLOCKS) {
for(Block block : REGISTRY) {
for(State state : block.getValidStates()) { for(State state : block.getValidStates()) {
state.buildSaved(); STATE_NAMES.put(state, state.buildSaved());
} }
for(int n = 0; n < 16; n++) {
State state = block.getStateFromMeta(n);
String id = STATE_NAMES.get(state);
if(!STATE_MAP.containsKey(id)) {
STATE_MAP.put(id, state);
STATE_IDS.put(state, STATES.size());
STATES.add(state);
}
}
StringBuilder sb = new StringBuilder("\n\n\tpublic Property[] getSavedProperties() {\n\t\treturn new Property[] {");
boolean put = false;
for(Property prop : block.getState().getSavedProperties()) {
if(put)
sb.append(", ");
sb.append(prop.getName().toUpperCase());
put = true;
}
if(put)
map.put(block.getClass(), sb.append("};\n\t}").toString());
}
for(Entry<Class, String> entry : map.entrySet()) {
System.out.printf("%s.java\n%s\n", entry.getKey().getSimpleName(), entry.getValue());
} }
Log.SYSTEM.debug("%d Blöcke registriert", nextBlockId); Log.SYSTEM.debug("%d Blöcke registriert", BLOCK_MAP.size());
Log.SYSTEM.debug("%d Blockzustände registriert", STATE_MAP.size());
} }
} }

View file

@ -580,14 +580,15 @@ public abstract class Blocks {
public static final BlockOre zinc_ore = get("zinc_ore"); public static final BlockOre zinc_ore = get("zinc_ore");
private static <T extends Block> T get(String id) { private static <T extends Block> T get(String id) {
if(!BlockRegistry.REGISTRY.has(id)) T block = (T)BlockRegistry.byNameExact(id);
if(block == null)
throw new RuntimeException("Block " + id + " existiert nicht"); throw new RuntimeException("Block " + id + " existiert nicht");
return (T)BlockRegistry.REGISTRY.byName(id); return block;
} }
static { static {
if(Util.DEVMODE) { if(Util.DEVMODE) {
Set<Block> blocks = Sets.newHashSet(BlockRegistry.REGISTRY); Set<Block> blocks = Sets.newHashSet(BlockRegistry.blocks());
for(Field field : Blocks.class.getDeclaredFields()) { for(Field field : Blocks.class.getDeclaredFields()) {
if(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Block.class.isAssignableFrom(field.getType())) if(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Block.class.isAssignableFrom(field.getType()))
try { try {
@ -599,10 +600,10 @@ public abstract class Blocks {
} }
if(!blocks.isEmpty()) { if(!blocks.isEmpty()) {
List<Block> list = Lists.newArrayList(blocks); List<Block> list = Lists.newArrayList(blocks);
Collections.sort(list, Comparator.comparing(block -> BlockRegistry.getNameFromBlock(block))); Collections.sort(list, Comparator.comparing(block -> BlockRegistry.getName(block)));
System.err.printf("\n*** -------------------------------------------------------------- ***\n\n"); System.err.printf("\n*** -------------------------------------------------------------- ***\n\n");
for(Block block : list) { for(Block block : list) {
String name = BlockRegistry.getNameFromBlock(block); String name = BlockRegistry.getName(block);
System.err.printf("\tpublic static final %s %s = get(\"%s\");\n", block.getClass().getSimpleName(), name, name); System.err.printf("\tpublic static final %s %s = get(\"%s\");\n", block.getClass().getSimpleName(), name, name);
} }
System.err.printf("\n^^^ " + Blocks.class.getCanonicalName() + ": Blockliste ist unvollständig, Bitte neuen Quellcode einfügen ^^^\n"); System.err.printf("\n^^^ " + Blocks.class.getCanonicalName() + ": Blockliste ist unvollständig, Bitte neuen Quellcode einfügen ^^^\n");

View file

@ -50,77 +50,77 @@ public abstract class CraftingRegistry
static void register() static void register()
{ {
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
Item item = ItemRegistry.getRegisteredItem(ore.item); Item item = ItemRegistry.byName(ore.item);
ore.material.addRepairItem(item); ore.material.addRepairItem(item);
if(ore.material.hasTools()) { if(ore.material.hasTools()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item);
} }
if(ore.material.hasExtras()) { if(ore.material.hasExtras()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_shears")), " #", "# ", '#', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_shears")), " #", "# ", '#', item);
} }
if(ore.material.hasWeapons()) { if(ore.material.hasWeapons()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_sword")), WEAPONS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_sword")), WEAPONS[0], '#', Items.stick, 'X', item);
} }
if(ore.material.hasArmor()) { if(ore.material.hasArmor()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_helmet")), ARMOR[0], 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_helmet")), ARMOR[0], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_chestplate")), ARMOR[1], 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_chestplate")), ARMOR[1], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_leggings")), ARMOR[2], 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_leggings")), ARMOR[2], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(ore.name + "_boots")), ARMOR[3], 'X', item); add(new ItemStack(ItemRegistry.byName(ore.name + "_boots")), ARMOR[3], 'X', item);
} }
Item block = ItemRegistry.getRegisteredItem(ore.name + "_block"); Item block = ItemRegistry.byName(ore.name + "_block");
add(new ItemStack(block), "###", "###", "###", '#', item); add(new ItemStack(block), "###", "###", "###", '#', item);
add(new ItemStack(item, 9), "#", '#', block); add(new ItemStack(item, 9), "#", '#', block);
} }
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
Item item = ItemRegistry.getRegisteredItem(metal.isPowder ? (metal.name + "_powder") : (metal.name + "_ingot")); Item item = ItemRegistry.byName(metal.isPowder ? (metal.name + "_powder") : (metal.name + "_ingot"));
if(metal.material != null) if(metal.material != null)
metal.material.addRepairItem(item); metal.material.addRepairItem(item);
if(metal.material != null && metal.material.hasTools()) { if(metal.material != null && metal.material.hasTools()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item);
} }
if(metal.material != null && metal.material.hasExtras()) { if(metal.material != null && metal.material.hasExtras()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_shears")), " #", "# ", '#', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_shears")), " #", "# ", '#', item);
} }
if(metal.material != null && metal.material.hasWeapons()) { if(metal.material != null && metal.material.hasWeapons()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_sword")), WEAPONS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_sword")), WEAPONS[0], '#', Items.stick, 'X', item);
} }
if(metal.material != null && metal.material.hasArmor()) { if(metal.material != null && metal.material.hasArmor()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_helmet")), ARMOR[0], 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_helmet")), ARMOR[0], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_chestplate")), ARMOR[1], 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_chestplate")), ARMOR[1], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_leggings")), ARMOR[2], 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_leggings")), ARMOR[2], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(metal.name + "_boots")), ARMOR[3], 'X', item); add(new ItemStack(ItemRegistry.byName(metal.name + "_boots")), ARMOR[3], 'X', item);
} }
Item block = ItemRegistry.getRegisteredItem(metal.name + "_block"); Item block = ItemRegistry.byName(metal.name + "_block");
add(new ItemStack(block), "###", "###", "###", '#', item); add(new ItemStack(block), "###", "###", "###", '#', item);
add(new ItemStack(item, 9), "#", '#', block); add(new ItemStack(item, 9), "#", '#', block);
} }
for(ToolType tool : ToolType.values()) { for(ToolType tool : ToolType.values()) {
for(String itm : tool.items) { for(String itm : tool.items) {
Item item = ItemRegistry.getRegisteredItem(itm); Item item = ItemRegistry.byName(itm);
tool.material.addRepairItem(item); tool.material.addRepairItem(item);
if(tool.material.hasTools()) { if(tool.material.hasTools()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_pickaxe")), TOOLS[0], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_shovel")), TOOLS[1], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_axe")), TOOLS[2], '#', Items.stick, 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_hoe")), TOOLS[3], '#', Items.stick, 'X', item);
} }
if(tool.material.hasExtras()) { if(tool.material.hasExtras()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_shears")), " #", "# ", '#', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_shears")), " #", "# ", '#', item);
} }
if(tool.material.hasWeapons()) { if(tool.material.hasWeapons()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_sword")), WEAPONS[0], '#', Items.stick, 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_sword")), WEAPONS[0], '#', Items.stick, 'X', item);
} }
if(tool.material.hasArmor()) { if(tool.material.hasArmor()) {
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_helmet")), ARMOR[0], 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_helmet")), ARMOR[0], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_chestplate")), ARMOR[1], 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_chestplate")), ARMOR[1], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_leggings")), ARMOR[2], 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_leggings")), ARMOR[2], 'X', item);
add(new ItemStack(ItemRegistry.getRegisteredItem(tool.name + "_boots")), ARMOR[3], 'X', item); add(new ItemStack(ItemRegistry.byName(tool.name + "_boots")), ARMOR[3], 'X', item);
} }
} }
} }
@ -227,14 +227,14 @@ public abstract class CraftingRegistry
addShapeless(new ItemStack(Items.book, 1), Items.paper, Items.paper, Items.paper, Items.leather); addShapeless(new ItemStack(Items.book, 1), Items.paper, Items.paper, Items.paper, Items.leather);
addShapeless(new ItemStack(Items.writable_book, 1), Items.book, Items.ink_sack, Items.feather); addShapeless(new ItemStack(Items.writable_book, 1), Items.book, Items.ink_sack, Items.feather);
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {
Item planks = ItemRegistry.getRegisteredItem(wood.getName() + "_planks"); Item planks = ItemRegistry.byName(wood.getName() + "_planks");
add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_fence"), 3), "W#W", "W#W", '#', Items.stick, 'W', planks); add(new ItemStack(ItemRegistry.byName(wood.getName() + "_fence"), 3), "W#W", "W#W", '#', Items.stick, 'W', planks);
add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_fence_gate"), 1), "#W#", "#W#", '#', Items.stick, 'W', planks); add(new ItemStack(ItemRegistry.byName(wood.getName() + "_fence_gate"), 1), "#W#", "#W#", '#', Items.stick, 'W', planks);
add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_door"), 3), "##", "##", "##", '#', planks); add(new ItemStack(ItemRegistry.byName(wood.getName() + "_door"), 3), "##", "##", "##", '#', planks);
addBasic(new ItemStack(planks, 4), "#", '#', ItemRegistry.getRegisteredItem(wood.getName() + "_log")); addBasic(new ItemStack(planks, 4), "#", '#', ItemRegistry.byName(wood.getName() + "_log"));
Item slab = ItemRegistry.getRegisteredItem(wood.getName() + "_slab"); Item slab = ItemRegistry.byName(wood.getName() + "_slab");
add(new ItemStack(slab, 6), "###", '#', planks); add(new ItemStack(slab, 6), "###", '#', planks);
add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_stairs"), 4), "# ", "## ", "###", '#', planks); add(new ItemStack(ItemRegistry.byName(wood.getName() + "_stairs"), 4), "# ", "## ", "###", '#', planks);
add(new ItemStack(Items.daylight_detector), "GGG", "QQQ", "WWW", 'G', Items.glass, 'Q', Items.quartz, 'W', slab); add(new ItemStack(Items.daylight_detector), "GGG", "QQQ", "WWW", 'G', Items.glass, 'Q', Items.quartz, 'W', slab);
add(new ItemStack(Items.chest), "###", "# #", "###", '#', planks); add(new ItemStack(Items.chest), "###", "# #", "###", '#', planks);
@ -255,7 +255,7 @@ public abstract class CraftingRegistry
add(new ItemStack(Items.wooden_pressure_plate, 1), "##", '#', planks); add(new ItemStack(Items.wooden_pressure_plate, 1), "##", '#', planks);
add(new ItemStack(Items.piston, 1), "TTT", "#X#", "#R#", '#', Items.cobblestone, 'X', Items.iron_ingot, 'R', Items.redstone, 'T', planks); add(new ItemStack(Items.piston, 1), "TTT", "#X#", "#R#", '#', Items.cobblestone, 'X', Items.iron_ingot, 'R', Items.redstone, 'T', planks);
for(DyeColor color : BlockBed.COLORS) { for(DyeColor color : BlockBed.COLORS) {
add(new ItemStack(ItemRegistry.getRegisteredItem(color.getName() + "_bed"), 1), "###", "XXX", '#', BlockWool.getByColor(color).getItem(), 'X', planks); add(new ItemStack(ItemRegistry.byName(color.getName() + "_bed"), 1), "###", "XXX", '#', BlockWool.getByColor(color).getItem(), 'X', planks);
} }
} }

View file

@ -1,11 +1,20 @@
package common.init; package common.init;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import common.attributes.UsageSlot; import common.attributes.UsageSlot;
import common.block.Block; import common.block.Block;
import common.block.liquid.BlockDynamicLiquid; import common.block.liquid.BlockDynamicLiquid;
import common.block.liquid.BlockLiquid; import common.block.liquid.BlockLiquid;
import common.block.liquid.BlockStaticLiquid; import common.block.liquid.BlockStaticLiquid;
import common.block.natural.BlockOre; import common.block.natural.BlockOre;
import common.collect.BiMap;
import common.collect.HashBiMap;
import common.collect.Lists;
import common.color.DyeColor; import common.color.DyeColor;
import common.color.TextColor; import common.color.TextColor;
import common.entity.item.EntityCart; import common.entity.item.EntityCart;
@ -80,239 +89,257 @@ import common.log.Log;
import common.potion.Potion; import common.potion.Potion;
import common.potion.PotionHelper; import common.potion.PotionHelper;
import common.util.Pair; import common.util.Pair;
import common.util.Mapping;
import common.util.Util; import common.util.Util;
import common.world.Weather; import common.world.Weather;
public abstract class ItemRegistry { public abstract class ItemRegistry {
public static final Mapping<Item> REGISTRY = new Mapping(); private static final Map<String, Item> ITEM_MAP = HashBiMap.<String, Item>create();
private static final List<Item> ITEMS = Lists.newArrayList();
private static final Map<Item, String> ITEM_NAMES = ((BiMap)ITEM_MAP).inverse();
private static final IdentityHashMap<Item, Integer> ITEM_IDS = new IdentityHashMap(512);
private static int nextItemId = 4096; private static void register(String name, Item item) {
public static int getIdFromItem(Item item) {
return item == null ? 0 : REGISTRY.getId(item);
}
public static Item getItemById(int id) {
return REGISTRY.byId(id);
}
public static String getNameFromItem(Item item) {
return REGISTRY.getName(item);
}
public static Item getRegisteredItem(String name) {
return REGISTRY.byName(name);
}
private static void registerItem(String name, Item item) {
if(item.getBlock() != null) if(item.getBlock() != null)
throw new IllegalArgumentException("Item " + name + " darf keinen Block besitzen"); throw new IllegalArgumentException("Gegenstand " + name + " darf keinen Block besitzen");
REGISTRY.register(nextItemId++, name, item); if(ITEM_MAP.containsKey(name))
throw new IllegalArgumentException("Gegenstand " + name + " ist bereits mit ID " + ITEM_IDS.get(ITEM_MAP.get(name)) + " registriert");
ITEMS.add(item);
ITEM_MAP.put(name, item);
ITEM_IDS.put(item, ITEMS.size());
}
public static Set<String> getKeys() {
return Collections.<String>unmodifiableSet(ITEM_MAP.keySet());
}
public static Item byName(String name) {
return ITEM_MAP.get(name);
}
public static String getName(Item item) {
return ITEM_NAMES.get(item);
}
public static Item byId(int id) {
return id > 0 && id <= ITEMS.size() ? ITEMS.get(id - 1) : null;
}
public static int getId(Item item) {
if(item == null)
return 0;
Integer id = ITEM_IDS.get(item);
return id == null ? -1 : id.intValue();
}
public static Iterable<Item> items() {
return ITEMS;
} }
private static void registerTools(ToolMaterial material, String name, String prefix) { private static void registerTools(ToolMaterial material, String name, String prefix) {
if(material.hasTools()) { if(material.hasTools()) {
registerItem(name + "_shovel", (new ItemShovel(material)).setDisplay(prefix + "schaufel")); register(name + "_shovel", (new ItemShovel(material)).setDisplay(prefix + "schaufel"));
registerItem(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke")); register(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke"));
registerItem(name + "_axe", (new ItemAxe(material)).setDisplay(prefix + "axt")); register(name + "_axe", (new ItemAxe(material)).setDisplay(prefix + "axt"));
registerItem(name + "_hoe", (new ItemHoe(material)).setDisplay(prefix + "hacke")); register(name + "_hoe", (new ItemHoe(material)).setDisplay(prefix + "hacke"));
} }
if(material.hasExtras()) { if(material.hasExtras()) {
registerItem(name + "_shears", (new ItemShears(material)).setDisplay(prefix + "schere")); register(name + "_shears", (new ItemShears(material)).setDisplay(prefix + "schere"));
registerItem(name + "_horse_armor", (new ItemHorseArmor(material, name)).setDisplay(prefix + "pferderüstung")); register(name + "_horse_armor", (new ItemHorseArmor(material, name)).setDisplay(prefix + "pferderüstung"));
} }
if(material.hasWeapons()) { if(material.hasWeapons()) {
registerItem(name + "_sword", (new ItemSword(material)).setDisplay(prefix + "schwert")); register(name + "_sword", (new ItemSword(material)).setDisplay(prefix + "schwert"));
} }
if(material.hasArmor()) { if(material.hasArmor()) {
registerItem(name + "_helmet", (new ItemArmor(material, name, UsageSlot.HEAD)).setDisplay(prefix == null ? "Kappe" : prefix + "helm")); register(name + "_helmet", (new ItemArmor(material, name, UsageSlot.HEAD)).setDisplay(prefix == null ? "Kappe" : prefix + "helm"));
registerItem(name + "_chestplate", (new ItemArmor(material, name, UsageSlot.BODY)).setDisplay(prefix == null ? "Jacke" : prefix + "brustpanzer")); register(name + "_chestplate", (new ItemArmor(material, name, UsageSlot.BODY)).setDisplay(prefix == null ? "Jacke" : prefix + "brustpanzer"));
registerItem(name + "_leggings", (new ItemArmor(material, name, UsageSlot.LEGS)).setDisplay(prefix == null ? "Hose" : prefix + "beinschutz")); register(name + "_leggings", (new ItemArmor(material, name, UsageSlot.LEGS)).setDisplay(prefix == null ? "Hose" : prefix + "beinschutz"));
registerItem(name + "_boots", (new ItemArmor(material, name, UsageSlot.FEET)).setDisplay(prefix == null ? "Stiefel" : prefix + "stiefel")); register(name + "_boots", (new ItemArmor(material, name, UsageSlot.FEET)).setDisplay(prefix == null ? "Stiefel" : prefix + "stiefel"));
} }
} }
static void register() { static void register() {
for(Block block : BlockRegistry.REGISTRY) { for(Block block : BlockRegistry.blocks()) {
Item item = block.registerItem(); Item item = block.registerItem();
if(item != null) if(item != null) {
REGISTRY.register(BlockRegistry.getIdFromBlock(block), BlockRegistry.getNameFromBlock(block), item); ITEMS.add(item);
ITEM_MAP.put(BlockRegistry.getName(block), item);
ITEM_IDS.put(item, ITEMS.size());
}
} }
Item bucket = (new ItemBucket(null, false)).setDisplay("Eimer"); Item bucket = (new ItemBucket(null, false)).setDisplay("Eimer");
registerItem("bucket", bucket); register("bucket", bucket);
for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) { for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) {
registerItem(BlockRegistry.getNameFromBlock(liquid.first()) + register(BlockRegistry.getName(liquid.first()) +
"_bucket", new ItemBucket(liquid.second(), false).setDisplay("Eimer") "_bucket", new ItemBucket(liquid.second(), false).setDisplay("Eimer")
.setContainerItem(bucket)); .setContainerItem(bucket));
} }
registerItem("recursive_bucket", (new ItemBucket(null, true)).setDisplay("Unendlicher Eimer")); register("recursive_bucket", (new ItemBucket(null, true)).setDisplay("Unendlicher Eimer"));
for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) { for(Pair<BlockStaticLiquid, BlockDynamicLiquid> liquid : BlockLiquid.LIQUIDS) {
registerItem("recursive_" + BlockRegistry.getNameFromBlock(liquid.first()) + register("recursive_" + BlockRegistry.getName(liquid.first()) +
"_bucket", new ItemBucket(liquid.second(), true).setDisplay("Flutender Eimer")); "_bucket", new ItemBucket(liquid.second(), true).setDisplay("Flutender Eimer"));
} }
registerItem("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket)); register("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket));
registerItem("boat", (new ItemBoat()).setDisplay("Boot")); register("boat", (new ItemBoat()).setDisplay("Boot"));
registerItem("minecart", (new ItemMinecart(EntityCart.EnumMinecartType.RIDEABLE)).setDisplay("Lore")); register("minecart", (new ItemMinecart(EntityCart.EnumMinecartType.RIDEABLE)).setDisplay("Lore"));
registerItem("chest_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.CHEST)).setDisplay("Güterlore")); register("chest_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.CHEST)).setDisplay("Güterlore"));
registerItem("hopper_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.HOPPER)).setDisplay("Trichterlore")); register("hopper_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.HOPPER)).setDisplay("Trichterlore"));
registerItem("tnt_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.TNT)).setDisplay("TNT-Lore") register("tnt_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.TNT)).setDisplay("TNT-Lore")
.setColor(TextColor.RED)); .setColor(TextColor.RED));
for(EntityInfo egg : EntityRegistry.SPAWN_EGGS.values()) { for(EntityInfo egg : EntityRegistry.SPAWN_EGGS.values()) {
registerItem(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id())) register(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id()))
.setDisplay("Spawner").setMaxAmount(128)); .setDisplay("Spawner").setMaxAmount(128));
} }
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) { for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
for(CharacterInfo charinfo : species.chars) { for(CharacterInfo charinfo : species.chars) {
if(charinfo.spawner) if(charinfo.spawner)
registerItem(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner") register(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner")
.setMaxAmount(128)); .setMaxAmount(128));
} }
} }
registerItem("wand", (new ItemEditWand()).setDisplay("Bearbeitungswerkzeug")); register("wand", (new ItemEditWand()).setDisplay("Bearbeitungswerkzeug"));
registerItem("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug")); register("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug"));
registerItem("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter")); register("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter"));
registerItem("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.TOOLS)); register("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.TOOLS));
registerItem("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxAmount(128)); register("key", (new ItemKey()).setDisplay("Schlüssel").setTab(CheatTab.TOOLS).setMaxAmount(128));
for(Pair<Integer, TextColor> sides : ItemDie.DIE_SIDES) { for(Pair<Integer, TextColor> sides : ItemDie.DIE_SIDES) {
registerItem("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("Würfel").setMaxAmount(128)); register("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("Würfel").setMaxAmount(128));
} }
registerItem("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet")); register("chick_magnet", (new ItemMagnet(true)).setDisplay("Kükenmagnet"));
registerItem("magnet", (new ItemMagnet(false)).setDisplay("Magnet")); register("magnet", (new ItemMagnet(false)).setDisplay("Magnet"));
registerItem("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS)); register("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS));
for(Weather weather : Weather.values()) { for(Weather weather : Weather.values()) {
registerItem("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setDisplay("Wetterkristall").setTab(CheatTab.TOOLS)); register("weather_token_" + weather.getName(), new ItemWeatherToken(weather).setDisplay("Wetterkristall").setTab(CheatTab.TOOLS));
} }
registerItem("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug")); register("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug"));
registerItem("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele")); register("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele"));
registerItem("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug")); register("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug"));
registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(128)); register("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(128));
registerItem("bow", (new ItemBow()).setDisplay("Bogen")); register("bow", (new ItemBow()).setDisplay("Bogen"));
registerItem("boltgun", (new ItemBoltgun()).setDisplay("Bolter")); register("boltgun", (new ItemBoltgun()).setDisplay("Bolter"));
registerItem("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition")); register("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition"));
registerItem("arrow", (new ItemArrow()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxAmount(128)); register("arrow", (new ItemArrow()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxAmount(128));
Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS); Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS);
registerItem("coal", coal); register("coal", coal);
registerItem("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS)); register("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS));
registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC)); register("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
registerItem("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe")); register("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(512)); register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(512));
registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("bread", (new ItemFood(5, false)).setDisplay("Brot")); register("bread", (new ItemFood(5, false)).setDisplay("Brot"));
registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch")); register("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch"));
registerItem("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch")); register("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch"));
registerItem("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F) register("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
.setDisplay("Goldener Apfel")); .setDisplay("Goldener Apfel"));
registerItem("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F) register("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F)
.setDisplay("Geladener Apfel")); .setDisplay("Geladener Apfel"));
registerItem("saddle", (new ItemSaddle()).setDisplay("Sattel")); register("saddle", (new ItemSaddle()).setDisplay("Sattel"));
registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128)); register("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128));
registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS)); register("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS));
registerItem("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS)); register("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS));
registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC)); register("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC));
registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128)); register("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128));
registerItem("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS)); register("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS));
registerItem("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer").setTab(CheatTab.TOOLS)); register("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer").setTab(CheatTab.TOOLS));
registerItem("fishing_rod", (new ItemFishingRod()).setDisplay("Angel")); register("fishing_rod", (new ItemFishingRod()).setDisplay("Angel"));
registerItem("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect) register("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect)
.setTab(CheatTab.MATERIALS).setMaxAmount(256)); .setTab(CheatTab.MATERIALS).setMaxAmount(256));
for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) { for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) {
registerItem(type.getName(), (new ItemFishFood(false, type)).setDisplay(type.getDisplay())); register(type.getName(), (new ItemFishFood(false, type)).setDisplay(type.getDisplay()));
if(type.canCook()) if(type.canCook())
registerItem("cooked_" + type.getName(), (new ItemFishFood(true, type)).setDisplay(type.getDisplay())); register("cooked_" + type.getName(), (new ItemFishFood(true, type)).setDisplay(type.getDisplay()));
} }
Item lapis = null; Item lapis = null;
for(DyeColor color : DyeColor.values()) { for(DyeColor color : DyeColor.values()) {
Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(512); Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(512);
if(color == DyeColor.BLUE) if(color == DyeColor.BLUE)
lapis = dye; lapis = dye;
registerItem(color.getDye(), dye); register(color.getDye(), dye);
} }
registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512)); register("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512));
registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(128)); register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(128));
registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone")); register("melon", (new ItemFood(2, false)).setDisplay("Melone"));
registerItem("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch")); register("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch"));
registerItem("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak")); register("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak"));
registerItem("chicken", (new ItemFood(2, true)).setDisplay("Rohes Hühnchen")); register("chicken", (new ItemFood(2, true)).setDisplay("Rohes Hühnchen"));
registerItem("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen")); register("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
registerItem("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch")); register("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
registerItem("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.TOOLS)); register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.TOOLS));
registerItem("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); register("tear", (new ItemTiny()).setDisplay("Träne").setPotionEffect(PotionHelper.tearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256)); register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256));
for(int data : ItemPotion.getValidDataValues()) { for(int data : ItemPotion.getValidDataValues()) {
ItemPotion potion = new ItemPotion(data); ItemPotion potion = new ItemPotion(data);
registerItem(ItemPotion.getPotionName(potion), potion.setDisplay("Trank")); register(ItemPotion.getPotionName(potion), potion.setDisplay("Trank"));
} }
registerItem("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche")); register("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
registerItem("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge") register("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge")
.setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(128)); .setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(128));
registerItem("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge") register("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge")
.setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(128)); .setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(128));
registerItem("blazing_powder", (new Item()).setDisplay("Glühender Staub").setPotionEffect(PotionHelper.blazingPowderEffect) register("blazing_powder", (new Item()).setDisplay("Glühender Staub").setPotionEffect(PotionHelper.blazingPowderEffect)
.setTab(CheatTab.MATERIALS).setMaxAmount(256)); .setTab(CheatTab.MATERIALS).setMaxAmount(256));
registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128)); register("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128));
registerItem("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel")); register("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel"));
registerItem("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect) register("speckled_melon", (new Item()).setDisplay("Glitzernde Melone").setPotionEffect(PotionHelper.speckledMelonEffect)
.setTab(CheatTab.MISC)); .setTab(CheatTab.MISC));
registerItem("experience_bottle", (new ItemExpBottle()).setDisplay("Erfahrungsfläschchen")); register("experience_bottle", (new ItemExpBottle()).setDisplay("Erfahrungsfläschchen"));
registerItem("fire_charge", (new ItemFireball()).setDisplay("Feuerkugel")); register("fire_charge", (new ItemFireball()).setDisplay("Feuerkugel"));
registerItem("writable_book", (new Item()).setDisplay("Buch und Feder").setTab(CheatTab.TOOLS)); register("writable_book", (new Item()).setDisplay("Buch und Feder").setTab(CheatTab.TOOLS));
registerItem("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC)); register("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC));
Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS); Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS);
registerItem("emerald", emerald); register("emerald", emerald);
registerItem("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(128)); register("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxAmount(128));
registerItem("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(128)); register("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxAmount(128));
registerItem("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte") register("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte")
.setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.MISC)); .setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.MISC));
registerItem("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute")); register("carrot_on_a_stick", (new ItemCarrotOnAStick()).setDisplay("Karottenrute"));
registerItem("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA)); register("charge_crystal", (new ItemEffect()).setDisplay("Energiekristall").setTab(CheatTab.MISC).setColor(TextColor.DMAGENTA));
registerItem("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.MISC)); register("pumpkin_pie", (new ItemFood(8, false)).setDisplay("Kürbiskuchen").setTab(CheatTab.MISC));
registerItem("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete")); register("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete"));
registerItem("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS)); register("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS));
registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC)); register("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC));
registerItem("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS)); register("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS));
registerItem("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS)); register("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS));
Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS); Item quartz = (new Item()).setDisplay("Quarz").setTab(CheatTab.METALS);
registerItem("quartz", quartz); register("quartz", quartz);
Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS); Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS);
registerItem("black_quartz", bquartz); register("black_quartz", bquartz);
registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(128)); register("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(128));
registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild")); register("name_tag", (new ItemNameTag()).setDisplay("Namensschild"));
for(int z = 0; z < ItemDynamite.DYNAMITE.length; z++) { for(int z = 0; z < ItemDynamite.DYNAMITE.length; z++) {
registerItem("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(TextColor.RED)); register("dynamite" + (z == 0 ? "" : ("_" + z)), (new ItemDynamite(z)).setDisplay("Dynamit" + Util.getTierSuffix(z)).setColor(TextColor.RED));
} }
registerItem("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.MATERIALS)); register("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.MATERIALS));
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
Item itm = (new Item()).setDisplay(ore.itemDisplay).setTab(CheatTab.METALS); Item itm = (new Item()).setDisplay(ore.itemDisplay).setTab(CheatTab.METALS);
registerItem(ore.item, itm); register(ore.item, itm);
((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setDropItem(new ItemStack(itm, ore.dropQuantity), ((BlockOre)BlockRegistry.byName(ore.name + "_ore")).setDropItem(new ItemStack(itm, ore.dropQuantity),
ore.bonusChance, ore.experience); ore.bonusChance, ore.experience);
registerTools(ore.material, ore.name, ore.display); registerTools(ore.material, ore.name, ore.display);
} }
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
if(metal.isPowder) { if(metal.isPowder) {
Item itm = (new ItemMetal(metal)).setDisplay(metal.display + "pulver").setTab(CheatTab.METALS); Item itm = (new ItemMetal(metal)).setDisplay(metal.display + "pulver").setTab(CheatTab.METALS);
registerItem(metal.name + "_powder", itm); register(metal.name + "_powder", itm);
((BlockOre)BlockRegistry.getRegisteredBlock(metal.name + "_ore")).setDropItem(new ItemStack(itm), 0, 2); ((BlockOre)BlockRegistry.byName(metal.name + "_ore")).setDropItem(new ItemStack(itm), 0, 2);
} }
else { else {
Item itm = (new ItemMetal(metal)).setDisplay(metal.display + "barren").setTab(CheatTab.METALS); Item itm = (new ItemMetal(metal)).setDisplay(metal.display + "barren").setTab(CheatTab.METALS);
registerItem(metal.name + "_ingot", itm); register(metal.name + "_ingot", itm);
((BlockOre)BlockRegistry.getRegisteredBlock(metal.name + "_ore")).setSmeltItem(new ItemStack(itm)); ((BlockOre)BlockRegistry.byName(metal.name + "_ore")).setSmeltItem(new ItemStack(itm));
} }
if(metal.material != null) if(metal.material != null)
registerTools(metal.material, metal.name, metal.display); registerTools(metal.material, metal.name, metal.display);
@ -321,29 +348,27 @@ public abstract class ItemRegistry {
registerTools(tool.material, tool.name, tool.display); registerTools(tool.material, tool.name, tool.display);
} }
registerItem("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee")); register("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee"));
registerItem("record_cat", (new ItemRecord()).setDisplay("Protokoll #2 - Versuchskatzen")); register("record_cat", (new ItemRecord()).setDisplay("Protokoll #2 - Versuchskatzen"));
registerItem("record_blocks", (new ItemRecord()).setDisplay("Protokoll #3 - Blöcke und mehr Experimente")); register("record_blocks", (new ItemRecord()).setDisplay("Protokoll #3 - Blöcke und mehr Experimente"));
registerItem("record_chirp", (new ItemRecord()).setDisplay("Protokoll #4 - Experimente mit Vögeln: Eine gute Idee?")); register("record_chirp", (new ItemRecord()).setDisplay("Protokoll #4 - Experimente mit Vögeln: Eine gute Idee?"));
registerItem("record_far", (new ItemRecord()).setDisplay("Protokoll #5 - Haben wir es mit dem Design übertrieben?")); register("record_far", (new ItemRecord()).setDisplay("Protokoll #5 - Haben wir es mit dem Design übertrieben?"));
registerItem("record_mall", (new ItemRecord()).setDisplay("Protokoll #6 - Wocheneinkauf und mehr Kaffee")); register("record_mall", (new ItemRecord()).setDisplay("Protokoll #6 - Wocheneinkauf und mehr Kaffee"));
registerItem("record_mellohi", (new ItemRecord()).setDisplay("Protokoll #7 - Explosion: Hoffe auf Versicherungsersatz")); register("record_mellohi", (new ItemRecord()).setDisplay("Protokoll #7 - Explosion: Hoffe auf Versicherungsersatz"));
registerItem("record_stal", (new ItemRecord()).setDisplay("Protokoll #8 - Fortschritt stagniert")); register("record_stal", (new ItemRecord()).setDisplay("Protokoll #8 - Fortschritt stagniert"));
registerItem("record_strad", (new ItemRecord()).setDisplay("Protokoll #9 - Neue Strategie")); register("record_strad", (new ItemRecord()).setDisplay("Protokoll #9 - Neue Strategie"));
registerItem("record_ward", (new ItemRecord()).setDisplay("Protokoll #10 - Neue Lösung: Seelenwarzen??")); register("record_ward", (new ItemRecord()).setDisplay("Protokoll #10 - Neue Lösung: Seelenwarzen??"));
registerItem("record_11", (new ItemRecord()).setDisplay("Protokoll #11 - Wir waren erfolgreich")); register("record_11", (new ItemRecord()).setDisplay("Protokoll #11 - Wir waren erfolgreich"));
registerItem("record_wait", (new ItemRecord()).setDisplay("Protokoll #12 - Warte auf Bezahlung")); register("record_wait", (new ItemRecord()).setDisplay("Protokoll #12 - Warte auf Bezahlung"));
registerItem("record_delay", (new ItemRecord()).setDisplay("Protokoll #13 - Verzögerung der Umsetzung")); register("record_delay", (new ItemRecord()).setDisplay("Protokoll #13 - Verzögerung der Umsetzung"));
registerItem("record_extend", (new ItemRecord()).setDisplay("Protokoll #14 - Explosive Erweiterung unseres Labors")); register("record_extend", (new ItemRecord()).setDisplay("Protokoll #14 - Explosive Erweiterung unseres Labors"));
((BlockOre)BlockRegistry.getRegisteredBlock("coal_ore")).setDropItem(new ItemStack(coal), 0); ((BlockOre)BlockRegistry.byName("coal_ore")).setDropItem(new ItemStack(coal), 0);
((BlockOre)BlockRegistry.getRegisteredBlock("emerald_ore")).setDropItem(new ItemStack(emerald), 3); ((BlockOre)BlockRegistry.byName("emerald_ore")).setDropItem(new ItemStack(emerald), 3);
((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(lapis, 4), 4, 2); ((BlockOre)BlockRegistry.byName("lapis_ore")).setDropItem(new ItemStack(lapis, 4), 4, 2);
((BlockOre)BlockRegistry.getRegisteredBlock("quartz_ore")).setDropItem(new ItemStack(quartz), 2); ((BlockOre)BlockRegistry.byName("quartz_ore")).setDropItem(new ItemStack(quartz), 2);
((BlockOre)BlockRegistry.getRegisteredBlock("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3); ((BlockOre)BlockRegistry.byName("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3);
REGISTRY.finish(); Log.SYSTEM.debug("%d Gegenstände registriert", ITEM_MAP.size());
Log.SYSTEM.debug("%d Gegenstände registriert", nextItemId - 4096);
} }
} }

View file

@ -959,14 +959,15 @@ public abstract class Items {
public static final ItemFishFood pufferfish = get("pufferfish"); public static final ItemFishFood pufferfish = get("pufferfish");
private static <T extends Item> T get(String id) { private static <T extends Item> T get(String id) {
if(!ItemRegistry.REGISTRY.has(id)) T item = (T)ItemRegistry.byName(id);
if(item == null)
throw new RuntimeException("Gegenstand " + id + " existiert nicht"); throw new RuntimeException("Gegenstand " + id + " existiert nicht");
return (T)ItemRegistry.REGISTRY.byName(id); return item;
} }
static { static {
if(Util.DEVMODE) { if(Util.DEVMODE) {
Set<Item> items = Sets.newHashSet(ItemRegistry.REGISTRY); Set<Item> items = Sets.newHashSet(ItemRegistry.items());
for(Field field : Items.class.getDeclaredFields()) { for(Field field : Items.class.getDeclaredFields()) {
if(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Item.class.isAssignableFrom(field.getType())) if(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && Item.class.isAssignableFrom(field.getType()))
try { try {
@ -983,10 +984,10 @@ public abstract class Items {
} }
if(!items.isEmpty()) { if(!items.isEmpty()) {
List<Item> list = Lists.newArrayList(items); List<Item> list = Lists.newArrayList(items);
Collections.sort(list, Comparator.comparing(item -> ItemRegistry.getNameFromItem(item))); Collections.sort(list, Comparator.comparing(item -> ItemRegistry.getName(item)));
System.err.printf("\n*** -------------------------------------------------------------- ***\n\n"); System.err.printf("\n*** -------------------------------------------------------------- ***\n\n");
for(Item item : list) { for(Item item : list) {
String name = ItemRegistry.getNameFromItem(item); String name = ItemRegistry.getName(item);
System.err.printf("\tpublic static final %s %s = get(\"%s\");\n", item.getClass().getSimpleName(), name, name); System.err.printf("\tpublic static final %s %s = get(\"%s\");\n", item.getClass().getSimpleName(), name, name);
} }
System.err.printf("\n^^^ " + Items.class.getCanonicalName() + ": Gegenstandsliste ist unvollständig, Bitte neuen Quellcode einfügen ^^^\n"); System.err.printf("\n^^^ " + Items.class.getCanonicalName() + ": Gegenstandsliste ist unvollständig, Bitte neuen Quellcode einfügen ^^^\n");

View file

@ -39,7 +39,7 @@ public abstract class SmeltingRegistry
{ {
if (fish.canCook()) if (fish.canCook())
{ {
add(ItemRegistry.getRegisteredItem(fish.getName()), new ItemStack(ItemRegistry.getRegisteredItem("cooked_" + fish.getName())), 0.35F); add(ItemRegistry.byName(fish.getName()), new ItemStack(ItemRegistry.byName("cooked_" + fish.getName())), 0.35F);
} }
} }
@ -50,15 +50,15 @@ public abstract class SmeltingRegistry
add(Items.redstone_ore, new ItemStack(Items.redstone), 0.7F); add(Items.redstone_ore, new ItemStack(Items.redstone), 0.7F);
for(OreType ore : OreType.values()) { for(OreType ore : OreType.values()) {
Item item = ItemRegistry.getRegisteredItem(ore.item); Item item = ItemRegistry.byName(ore.item);
add(ItemRegistry.getRegisteredItem(ore.name + "_ore"), new ItemStack(item), ((float)ore.experience) / 3.0F); add(ItemRegistry.byName(ore.name + "_ore"), new ItemStack(item), ((float)ore.experience) / 3.0F);
} }
for(MetalType metal : MetalType.values()) { for(MetalType metal : MetalType.values()) {
Item item = ItemRegistry.getRegisteredItem(metal.isPowder ? (metal.name + "_powder") : (metal.name + "_ingot")); Item item = ItemRegistry.byName(metal.isPowder ? (metal.name + "_powder") : (metal.name + "_ingot"));
add(ItemRegistry.getRegisteredItem(metal.name + "_ore"), new ItemStack(item), 0.7F); add(ItemRegistry.byName(metal.name + "_ore"), new ItemStack(item), 0.7F);
} }
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {
add(ItemRegistry.getRegisteredItem(wood.getName() + "_log"), new ItemStack(Items.charcoal), 0.15F); add(ItemRegistry.byName(wood.getName() + "_log"), new ItemStack(Items.charcoal), 0.15F);
} }
} }

View file

@ -121,7 +121,7 @@ public enum CheatTab {
protected abstract Item getIconItem(); protected abstract Item getIconItem();
public void filter(List<ItemStack> list) { public void filter(List<ItemStack> list) {
for(Item item : ItemRegistry.REGISTRY) { for(Item item : ItemRegistry.items()) {
if(item != null && item.getTab() == this) { if(item != null && item.getTab() == this) {
item.getSubItems(item, this, list); item.getSubItems(item, this, list);
} }

View file

@ -25,8 +25,7 @@ import common.util.HitPosition;
import common.util.Vec3; import common.util.Vec3;
import common.world.World; import common.world.World;
public class Item public class Item {
{
private int maxAmount = 64; private int maxAmount = 64;
private int maxDamage = 0; private int maxDamage = 0;
private Item containerItem; private Item containerItem;
@ -35,74 +34,66 @@ public class Item
private CheatTab tab; private CheatTab tab;
private TextColor color = null; private TextColor color = null;
public final Item setMaxAmount(int max) public final Item setUnstackable() {
{ this.maxAmount = 1;
this.maxDamage = 0;
return this;
}
public final Item setMaxAmount(int max) {
this.maxAmount = max; this.maxAmount = max;
this.maxDamage = 0; this.maxDamage = 0;
return this; return this;
} }
public final Item setMaxDamage(int max) public final Item setMaxDamage(int max) {
{
this.maxAmount = 1; this.maxAmount = 1;
this.maxDamage = max; this.maxDamage = max;
return this; return this;
} }
public Item setDisplay(String name) public Item setDisplay(String name) {
{
this.display = name; this.display = name;
return this; return this;
} }
public final Item setContainerItem(Item containerItem) public final Item setContainerItem(Item containerItem) {
{
this.containerItem = containerItem; this.containerItem = containerItem;
return this; return this;
} }
public final Item setPotionEffect(String potionEffect) public final Item setPotionEffect(String potionEffect) {
{
this.potionEffect = potionEffect; this.potionEffect = potionEffect;
return this; return this;
} }
public final Item setTab(CheatTab tab) public final Item setTab(CheatTab tab) {
{
this.tab = tab; this.tab = tab;
return this; return this;
} }
public Item setColor(TextColor color) public Item setColor(TextColor color) {
{
this.color = color; this.color = color;
return this; return this;
} }
public final int getItemStackLimit() {
public final int getItemStackLimit()
{
return this.maxAmount; return this.maxAmount;
} }
public final int getMaxDamage() public final int getMaxDamage() {
{
return this.maxDamage; return this.maxDamage;
} }
public final boolean isDamageable() public final boolean isDamageable() {
{
return this.maxDamage > 0; return this.maxDamage > 0;
} }
public Block getBlock() {
public Block getBlock()
{
return null; return null;
} }
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
{
return false; return false;
} }
@ -110,111 +101,89 @@ public class Item
return false; return false;
} }
public float getStrVsBlock(ItemStack stack, Block state) public float getStrVsBlock(ItemStack stack, Block state) {
{
return 1.0F; return 1.0F;
} }
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
{
return itemStackIn; return itemStackIn;
} }
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) {
{
return stack; return stack;
} }
public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) {
{
return false; return false;
} }
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn) public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn) {
{
return false; return false;
} }
public boolean canHarvestBlock(Block blockIn) public boolean canHarvestBlock(Block blockIn) {
{
return false; return false;
} }
public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target) public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target) {
{
return false; return false;
} }
public String getDisplay(ItemStack stack) public String getDisplay(ItemStack stack) {
{
return this.display; return this.display;
} }
public Item getContainerItem() public Item getContainerItem() {
{
return this.containerItem; return this.containerItem;
} }
public boolean hasContainerItem() public boolean hasContainerItem() {
{
return this.containerItem != null; return this.containerItem != null;
} }
public int getColorFromItemStack(ItemStack stack, int renderPass) public int getColorFromItemStack(ItemStack stack, int renderPass) {
{
return 16777215; return 16777215;
} }
public ItemAction getItemUseAction(ItemStack stack) public ItemAction getItemUseAction(ItemStack stack) {
{
return ItemAction.NONE; return ItemAction.NONE;
} }
public ItemAction getItemPosition(ItemStack stack) public ItemAction getItemPosition(ItemStack stack) {
{
return ItemAction.NONE; return ItemAction.NONE;
} }
public int getMaxItemUseDuration(ItemStack stack) public int getMaxItemUseDuration(ItemStack stack) {
{
return 0; return 0;
} }
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) {
{
} }
public String getPotionEffect(ItemStack stack) public String getPotionEffect(ItemStack stack) {
{
return this.potionEffect; return this.potionEffect;
} }
public boolean isPotionIngredient(ItemStack stack) public boolean isPotionIngredient(ItemStack stack) {
{
return this.getPotionEffect(stack) != null; return this.getPotionEffect(stack) != null;
} }
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip) {
{
} }
public boolean hasEffect(ItemStack stack) public boolean hasEffect(ItemStack stack) {
{
return stack.isItemEnchanted(); return stack.isItemEnchanted();
} }
public TextColor getColor(ItemStack stack) public TextColor getColor(ItemStack stack) {
{
return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE); return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE);
} }
public boolean isItemTool(ItemStack stack) public boolean isItemTool(ItemStack stack) {
{
return this.getItemStackLimit() == 1 && this.isDamageable(); return this.getItemStackLimit() == 1 && this.isDamageable();
} }
protected HitPosition getMovingObjectPositionFromPlayer(World worldIn, EntityNPC playerIn, boolean useLiquids) protected HitPosition getMovingObjectPositionFromPlayer(World worldIn, EntityNPC playerIn, boolean useLiquids) {
{
float f = playerIn.rotPitch; float f = playerIn.rotPitch;
float f1 = playerIn.rotYaw; float f1 = playerIn.rotYaw;
double d0 = playerIn.posX; double d0 = playerIn.posX;
@ -232,23 +201,19 @@ public class Item
return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
} }
public int getItemEnchantability() public int getItemEnchantability() {
{
return 0; return 0;
} }
public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems) public void getSubItems(Item itemIn, CheatTab tab, List<ItemStack> subItems) {
{
subItems.add(new ItemStack(itemIn)); subItems.add(new ItemStack(itemIn));
} }
public CheatTab getTab() public CheatTab getTab() {
{
return this.tab; return this.tab;
} }
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
{
return false; return false;
} }
@ -256,8 +221,7 @@ public class Item
return 0; return 0;
} }
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot) public void getModifiers(Map<Attribute, Float> map, UsageSlot slot) {
{
} }
public boolean isFragile() { public boolean isFragile() {

View file

@ -70,7 +70,7 @@ public final class ItemStack
public static ItemStack getStack(String name, ItemStack def) { public static ItemStack getStack(String name, ItemStack def) {
if(name == null) if(name == null)
return def; return def;
Item item = ItemRegistry.REGISTRY.byNameExact(name); Item item = ItemRegistry.byName(name);
return item == null ? def : new ItemStack(item); return item == null ? def : new ItemStack(item);
} }
@ -143,7 +143,7 @@ public final class ItemStack
public TagObject writeTags(TagObject tag) public TagObject writeTags(TagObject tag)
{ {
if(this.item != null) if(this.item != null)
tag.setString("id", ItemRegistry.getNameFromItem(this.item)); tag.setString("id", ItemRegistry.getName(this.item));
if(this.size != 1) if(this.size != 1)
tag.setInt("size", this.size); tag.setInt("size", this.size);
if(this.tag != null) if(this.tag != null)
@ -153,7 +153,7 @@ public final class ItemStack
private void readTags(TagObject tag) private void readTags(TagObject tag)
{ {
this.item = tag.hasString("id") ? ItemRegistry.getRegisteredItem(tag.getString("id")) : null; this.item = tag.hasString("id") ? ItemRegistry.byName(tag.getString("id")) : null;
this.size = tag.hasInt("size") ? tag.getInt("size") : 1; this.size = tag.hasInt("size") ? tag.getInt("size") : 1;
this.tag = tag.hasObject("tag") ? tag.getObject("tag") : null; this.tag = tag.hasObject("tag") ? tag.getObject("tag") : null;
} }
@ -601,7 +601,7 @@ public final class ItemStack
if(this.getRepairCost() > 0) if(this.getRepairCost() > 0)
list.add("Reparaturkosten: " + this.getRepairCost() + " Mana"); list.add("Reparaturkosten: " + this.getRepairCost() + " Mana");
list.add(TextColor.GRAY + ItemRegistry.getNameFromItem(this.item)); list.add(TextColor.GRAY + ItemRegistry.getName(this.item));
if (this.hasTagCompound()) if (this.hasTagCompound())
{ {

View file

@ -212,8 +212,8 @@ public class ItemBlock extends Item
public Model getModel(ModelProvider provider, String name) { public Model getModel(ModelProvider provider, String name) {
return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture : return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture :
this.block.getModel(provider, this.block.getModel(provider,
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getState()).getPrimary() /* "blocks/" + name */) : BlockRegistry.getName(this.block).toString(), this.block.getState()).getPrimary() /* "blocks/" + name */) :
provider.getModel(this.block.getModel(provider, provider.getModel(this.block.getModel(provider,
BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getState()), this.getTransform()); BlockRegistry.getName(this.block).toString(), this.block.getState()), this.getTransform());
} }
} }

View file

@ -104,7 +104,7 @@ public class ItemDye extends Item
} }
State iblockstate = worldIn.getState(pos); State iblockstate = worldIn.getState(pos);
if(iblockstate.getBlock() instanceof BlockBed) { if(iblockstate.getBlock() instanceof BlockBed) {
Block bedBlock = BlockRegistry.getRegisteredBlock(this.color.getName() + "_bed"); Block bedBlock = BlockRegistry.byName(this.color.getName() + "_bed");
if(bedBlock != Blocks.air) { if(bedBlock != Blocks.air) {
if (iblockstate.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT) if (iblockstate.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT)
{ {

View file

@ -117,7 +117,7 @@ public class PacketBuffer {
this.writeShort(-1); this.writeShort(-1);
return; return;
} }
this.writeShort(ItemRegistry.getIdFromItem(stack.getItem())); this.writeShort(ItemRegistry.getId(stack.getItem()));
this.writeVarInt(stack.size); this.writeVarInt(stack.size);
this.writeTag(stack.getTagCompound()); this.writeTag(stack.getTagCompound());
} }
@ -127,7 +127,7 @@ public class PacketBuffer {
if(id < 0) if(id < 0)
return null; return null;
int amt = this.readVarInt(); int amt = this.readVarInt();
ItemStack stack = new ItemStack(ItemRegistry.getItemById(id), amt); ItemStack stack = new ItemStack(ItemRegistry.byId(id), amt);
stack.setTagCompound(this.readTag()); stack.setTagCompound(this.readTag());
return stack; return stack;
} }

View file

@ -8,6 +8,7 @@ import common.network.IClientPlayer;
import common.network.Packet; import common.network.Packet;
import common.network.PacketBuffer; import common.network.PacketBuffer;
import common.util.BlockPos; import common.util.BlockPos;
import common.world.State;
public class SPacketBlockAction implements Packet<IClientPlayer> public class SPacketBlockAction implements Packet<IClientPlayer>
{ {
@ -36,7 +37,8 @@ public class SPacketBlockAction implements Packet<IClientPlayer>
this.blockPosition = buf.readBlockPos(); this.blockPosition = buf.readBlockPos();
this.instrument = buf.readUnsignedByte(); this.instrument = buf.readUnsignedByte();
this.pitch = buf.readUnsignedByte(); this.pitch = buf.readUnsignedByte();
this.block = BlockRegistry.getBlockById(buf.readVarInt() & 4095); State state = BlockRegistry.byId(buf.readVarInt());
this.block = state == null ? null : state.getBlock();
} }
/** /**
@ -47,7 +49,7 @@ public class SPacketBlockAction implements Packet<IClientPlayer>
buf.writeBlockPos(this.blockPosition); buf.writeBlockPos(this.blockPosition);
buf.writeByte(this.instrument); buf.writeByte(this.instrument);
buf.writeByte(this.pitch); buf.writeByte(this.pitch);
buf.writeVarInt(BlockRegistry.getIdFromBlock(this.block) & 4095); buf.writeVarInt(BlockRegistry.getId(this.block.getState()));
} }
/** /**
@ -63,17 +65,11 @@ public class SPacketBlockAction implements Packet<IClientPlayer>
return this.blockPosition; return this.blockPosition;
} }
/**
* instrument data for noteblocks
*/
public int getData1() public int getData1()
{ {
return this.instrument; return this.instrument;
} }
/**
* pitch data for noteblocks
*/
public int getData2() public int getData2()
{ {
return this.pitch; return this.pitch;

View file

@ -2,6 +2,7 @@ package common.packet;
import java.io.IOException; import java.io.IOException;
import common.init.BlockRegistry;
import common.network.IClientPlayer; import common.network.IClientPlayer;
import common.network.Packet; import common.network.Packet;
import common.network.PacketBuffer; import common.network.PacketBuffer;
@ -30,7 +31,7 @@ public class SPacketBlockChange implements Packet<IClientPlayer>
public void readPacketData(PacketBuffer buf) throws IOException public void readPacketData(PacketBuffer buf) throws IOException
{ {
this.blockPosition = buf.readBlockPos(); this.blockPosition = buf.readBlockPos();
this.blockState = (State)State.ID_MAP.getByValue(buf.readVarInt()); this.blockState = BlockRegistry.byId(buf.readVarInt());
} }
/** /**
@ -39,7 +40,7 @@ public class SPacketBlockChange implements Packet<IClientPlayer>
public void writePacketData(PacketBuffer buf) throws IOException public void writePacketData(PacketBuffer buf) throws IOException
{ {
buf.writeBlockPos(this.blockPosition); buf.writeBlockPos(this.blockPosition);
buf.writeVarInt(State.ID_MAP.get(this.blockState)); buf.writeVarInt(BlockRegistry.getId(this.blockState));
} }
/** /**

View file

@ -2,6 +2,7 @@ package common.packet;
import java.io.IOException; import java.io.IOException;
import common.init.BlockRegistry;
import common.network.IClientPlayer; import common.network.IClientPlayer;
import common.network.Packet; import common.network.Packet;
import common.network.PacketBuffer; import common.network.PacketBuffer;
@ -38,7 +39,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
for (int i = 0; i < this.changedBlocks.length; ++i) for (int i = 0; i < this.changedBlocks.length; ++i)
{ {
this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readLong(), (State)State.ID_MAP.getByValue(buf.readVarInt())); this.changedBlocks[i] = new SPacketMultiBlockChange.BlockUpdateData(buf.readLong(), BlockRegistry.byId(buf.readVarInt()));
} }
} }
@ -54,7 +55,7 @@ public class SPacketMultiBlockChange implements Packet<IClientPlayer>
for (SPacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks) for (SPacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks)
{ {
buf.writeLong(s22packetmultiblockchange$blockupdatedata.getRawPos()); buf.writeLong(s22packetmultiblockchange$blockupdatedata.getRawPos());
buf.writeVarInt(State.ID_MAP.get(s22packetmultiblockchange$blockupdatedata.getBlockState())); buf.writeVarInt(BlockRegistry.getId(s22packetmultiblockchange$blockupdatedata.getBlockState()));
} }
} }

View file

@ -42,7 +42,7 @@ public class SPacketSpawnPlayer implements Packet<IClientPlayer>
this.yaw = (byte)((int)(player.rotYaw * 256.0F / 360.0F)); this.yaw = (byte)((int)(player.rotYaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(player.rotPitch * 256.0F / 360.0F)); this.pitch = (byte)((int)(player.rotPitch * 256.0F / 360.0F));
ItemStack itemstack = player.inventory.getCurrentItem(); ItemStack itemstack = player.inventory.getCurrentItem();
this.currentItem = itemstack == null ? 0 : ItemRegistry.getIdFromItem(itemstack.getItem()); this.currentItem = itemstack == null ? 0 : ItemRegistry.getId(itemstack.getItem());
this.watcher = player.getDataWatcher(); this.watcher = player.getDataWatcher();
this.texture = player.getSkin(); this.texture = player.getSkin();
} }

View file

@ -24,7 +24,7 @@ public abstract class TileEntity
protected World worldObj; protected World worldObj;
protected BlockPos pos = BlockPos.ORIGIN; protected BlockPos pos = BlockPos.ORIGIN;
protected boolean tileEntityInvalid; protected boolean tileEntityInvalid;
private int blockMetadata = -1; private State blockState = null;
/** the Block type that this TileEntity is contained within */ /** the Block type that this TileEntity is contained within */
protected Block blockType; protected Block blockType;
@ -108,15 +108,11 @@ public abstract class TileEntity
return tileentity; return tileentity;
} }
public int getBlockMetadata() public State getBlockState()
{ {
if (this.blockMetadata == -1) if(this.blockState == null)
{ this.blockState = this.worldObj.getState(this.pos);
State iblockstate = this.worldObj.getState(this.pos); return this.blockState;
this.blockMetadata = iblockstate.getBlock().getMetaFromState(iblockstate);
}
return this.blockMetadata;
} }
/** /**
@ -127,8 +123,7 @@ public abstract class TileEntity
{ {
if (this.worldObj != null) if (this.worldObj != null)
{ {
State iblockstate = this.worldObj.getState(this.pos); this.blockState = this.worldObj.getState(this.pos);
this.blockMetadata = iblockstate.getBlock().getMetaFromState(iblockstate);
if(!this.worldObj.client) if(!this.worldObj.client)
((AWorldServer)this.worldObj).markChunkDirty(this.pos); ((AWorldServer)this.worldObj).markChunkDirty(this.pos);
@ -212,7 +207,7 @@ public abstract class TileEntity
public void updateContainingBlockInfo() public void updateContainingBlockInfo()
{ {
this.blockType = null; this.blockType = null;
this.blockMetadata = -1; this.blockState = null;
} }
public void setPos(BlockPos posIn) public void setPos(BlockPos posIn)

View file

@ -22,6 +22,7 @@ import common.util.BoundingBox;
import common.util.ExtMath; import common.util.ExtMath;
import common.util.Facing; import common.util.Facing;
import common.vars.Vars; import common.vars.Vars;
import common.world.State;
import common.world.World; import common.world.World;
public class TileEntityHopper extends TileEntityLockable implements IHopper, ITickable public class TileEntityHopper extends TileEntityLockable implements IHopper, ITickable
@ -240,8 +241,11 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi
{ {
if (this.worldObj != null && !this.worldObj.client) if (this.worldObj != null && !this.worldObj.client)
{ {
if (!this.isOnTransferCooldown() && BlockHopper.isEnabled(this.getBlockMetadata())) if (!this.isOnTransferCooldown())
{ {
State state = this.getBlockState();
if(!(state.getBlock() instanceof BlockHopper) || !state.getValue(BlockHopper.ENABLED))
return false;
boolean flag = false; boolean flag = false;
if (!this.isEmpty()) if (!this.isEmpty())
@ -306,7 +310,8 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi
} }
else else
{ {
Facing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite(); State state = this.getBlockState();
Facing enumfacing = state.getBlock() instanceof BlockHopper ? state.getValue(BlockHopper.FACING).getOpposite() : Facing.DOWN;
if (isInventoryFull(iinventory, enumfacing)) if (isInventoryFull(iinventory, enumfacing))
{ {
@ -618,7 +623,8 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi
*/ */
private IInventory getInventoryForHopperTransfer() private IInventory getInventoryForHopperTransfer()
{ {
Facing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()); State state = this.getBlockState();
Facing enumfacing = state.getBlock() instanceof BlockHopper ? state.getValue(BlockHopper.FACING) : Facing.DOWN;
return getInventoryAtPosition(this.getWorld(), (double)(this.pos.getX() + enumfacing.getFrontOffsetX()), (double)(this.pos.getY() + enumfacing.getFrontOffsetY()), (double)(this.pos.getZ() + enumfacing.getFrontOffsetZ())); return getInventoryAtPosition(this.getWorld(), (double)(this.pos.getX() + enumfacing.getFrontOffsetX()), (double)(this.pos.getY() + enumfacing.getFrontOffsetY()), (double)(this.pos.getZ() + enumfacing.getFrontOffsetZ()));
} }

View file

@ -4,6 +4,7 @@ import java.util.List;
import common.collect.Lists; import common.collect.Lists;
import common.entity.Entity; import common.entity.Entity;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.tags.TagObject; import common.tags.TagObject;
import common.util.BoundingBox; import common.util.BoundingBox;
@ -41,9 +42,9 @@ public class TileEntityPiston extends TileEntity implements ITickable
return this.pistonState; return this.pistonState;
} }
public int getBlockMetadata() public State getBlockState()
{ {
return 0; return Blocks.piston_extension.getState();
} }
/** /**
@ -200,7 +201,7 @@ public class TileEntityPiston extends TileEntity implements ITickable
public void readTags(TagObject compound) public void readTags(TagObject compound)
{ {
super.readTags(compound); super.readTags(compound);
this.pistonState = State.getState(compound.getString("block"), Blocks.air.getState()); this.pistonState = BlockRegistry.byName(compound.getString("block"), Blocks.air.getState());
this.pistonFacing = Facing.getFront(compound.getInt("facing")); this.pistonFacing = Facing.getFront(compound.getInt("facing"));
this.lastProgress = this.progress = compound.getFloat("progress"); this.lastProgress = this.progress = compound.getFloat("progress");
this.extending = compound.getBool("extending"); this.extending = compound.getBool("extending");
@ -209,7 +210,7 @@ public class TileEntityPiston extends TileEntity implements ITickable
public void writeTags(TagObject compound) public void writeTags(TagObject compound)
{ {
super.writeTags(compound); super.writeTags(compound);
compound.setString("block", this.pistonState.getId()); compound.setString("block", BlockRegistry.getName(this.pistonState));
compound.setInt("facing", this.pistonFacing.getIndex()); compound.setInt("facing", this.pistonFacing.getIndex());
compound.setFloat("progress", this.lastProgress); compound.setFloat("progress", this.lastProgress);
compound.setBool("extending", this.extending); compound.setBool("extending", this.extending);

View file

@ -1,34 +0,0 @@
package common.util;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import common.collect.Iterators;
import common.collect.Lists;
public class IdMap<T> implements Iterable<T> {
private final IdentityHashMap<T, Integer> mapping = new IdentityHashMap(512);
private final List<T> list = Lists.<T>newArrayList();
public void put(T key, int value) {
this.mapping.put(key, value);
while(this.list.size() <= value) {
this.list.add(null);
}
this.list.set(value, key);
}
public int get(T key) {
Integer i = this.mapping.get(key);
return i == null ? -1 : i.intValue();
}
public final T getByValue(int value) {
return value >= 0 && value < this.list.size() ? this.list.get(value) : null;
}
public Iterator<T> iterator() {
return Iterators.filter(this.list.iterator(), Predicates.notNull());
}
}

View file

@ -1,90 +0,0 @@
package common.util;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import common.collect.BiMap;
import common.collect.HashBiMap;
public class Mapping<V> implements Iterable<V> {
private final Map<String, V> mapping = HashBiMap.<String, V>create();
private final IdMap<V> idMap = new IdMap<V>();
private final Map<V, String> nameMap;
private final String defaultKey;
private V defaultValue;
private boolean registered;
public Mapping(String def) {
this.nameMap = ((BiMap)this.mapping).inverse();
this.defaultKey = def;
}
public Mapping() {
this(null);
}
public void register(int id, String key, V value) {
if(this.registered)
throw new IllegalStateException("Es können keine neuen Werte registriert werden");
if(key == null)
throw new NullPointerException("Schlüssel ist null");
if(value == null)
throw new NullPointerException("Wert ist null");
if(this.mapping.containsKey(key))
throw new IllegalArgumentException(
"Schlüssel " + key + " ist bereits mit ID " + this.idMap.get(this.mapping.get(key)) + " registriert");
if(this.idMap.getByValue(id) != null)
throw new IllegalArgumentException("ID " + id + " ist bereits mit Name " + this.nameMap.get(this.idMap.getByValue(id)) + " registriert");
this.idMap.put(value, id);
this.mapping.put(key, value);
if(key.equals(this.defaultKey))
this.defaultValue = value;
}
public void finish() {
if(this.defaultKey != null && this.defaultValue == null)
throw new NullPointerException("Wert zu Standard-Schlüssel " + this.defaultKey + " ist nicht vorhanden");
this.registered = true;
}
public Set<String> getKeys() {
return Collections.<String>unmodifiableSet(this.mapping.keySet());
}
public V byName(String name) {
V v = this.mapping.get(name);
return v == null ? this.defaultValue : v;
}
public V byNameExact(String name) {
return this.mapping.get(name);
}
public String getName(V value) {
return this.nameMap.get(value);
}
public V byId(int id) {
V v = this.idMap.getByValue(id);
return v == null ? this.defaultValue : v;
}
public V byIdExact(int id) {
return this.idMap.getByValue(id);
}
public int getId(V value) {
return this.idMap.get(value);
}
public boolean has(String key) {
return this.mapping.containsKey(key);
}
public Iterator<V> iterator() {
return this.idMap.iterator();
}
}

View file

@ -3,6 +3,7 @@ package common.world;
import java.util.Arrays; import java.util.Arrays;
import common.block.Block; import common.block.Block;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.util.NibbleArray; import common.util.NibbleArray;
@ -21,14 +22,14 @@ public class BlockArray {
if(sky) if(sky)
this.skylight = new NibbleArray(); this.skylight = new NibbleArray();
if(filler != null && filler.getBlock() != Blocks.air) { if(filler != null && filler.getBlock() != Blocks.air) {
Arrays.fill(this.data, (char)State.ID_MAP.get(filler)); Arrays.fill(this.data, (char)BlockRegistry.getId(filler));
this.blocks = this.data.length; this.blocks = this.data.length;
this.ticked = filler.getBlock().getTickRandomly() ? this.data.length : 0; this.ticked = filler.getBlock().getTickRandomly() ? this.data.length : 0;
} }
} }
public State get(int x, int y, int z) { public State get(int x, int y, int z) {
State iblockstate = State.ID_MAP.getByValue(this.data[y << 8 | z << 4 | x]); State iblockstate = BlockRegistry.byId(this.data[y << 8 | z << 4 | x]);
return iblockstate != null ? iblockstate : Blocks.air.getState(); return iblockstate != null ? iblockstate : Blocks.air.getState();
} }
@ -46,7 +47,7 @@ public class BlockArray {
if(block.getTickRandomly()) if(block.getTickRandomly())
++this.ticked; ++this.ticked;
} }
this.data[y << 8 | z << 4 | x] = (char)State.ID_MAP.get(state); this.data[y << 8 | z << 4 | x] = (char)BlockRegistry.getId(state);
} }
public Block getBlock(int x, int y, int z) { public Block getBlock(int x, int y, int z) {

View file

@ -19,7 +19,6 @@ import common.collect.StandardTable;
import common.collect.Table; import common.collect.Table;
import common.init.BlockRegistry; import common.init.BlockRegistry;
import common.properties.Property; import common.properties.Property;
import common.util.IdMap;
public class State { public class State {
private static final Function<Entry<Property, Comparable>, String> MAP_ENTRY_TO_STRING = private static final Function<Entry<Property, Comparable>, String> MAP_ENTRY_TO_STRING =
@ -34,14 +33,11 @@ public class State {
} }
} }
}; };
private static final Map<String, State> NAME_MAP = Maps.newLinkedHashMap();
public static final IdMap<State> ID_MAP = new IdMap();
private final Block block; private final Block block;
private final ImmutableMap<Property, Comparable> properties; private final ImmutableMap<Property, Comparable> properties;
private ImmutableTable<Property, Comparable, State> map; private ImmutableTable<Property, Comparable, State> map;
private ImmutableSet<Property> saved; private ImmutableSet<Property> saved;
private String id;
private static Set<Property> getSavedProperties(Block block) { private static Set<Property> getSavedProperties(Block block) {
Set<Property> stored = Sets.newHashSet(); Set<Property> stored = Sets.newHashSet();
@ -70,7 +66,7 @@ public class State {
} }
private static String filterProperties(State state, Set<Property> stored) { private static String filterProperties(State state, Set<Property> stored) {
StringBuilder sb = new StringBuilder(BlockRegistry.getNameFromBlock(state.getBlock())); StringBuilder sb = new StringBuilder(BlockRegistry.getName(state.getBlock()));
for(Entry<Property, Comparable> entry : state.getProperties().entrySet()) { for(Entry<Property, Comparable> entry : state.getProperties().entrySet()) {
if(stored.contains(entry.getKey())) if(stored.contains(entry.getKey()))
sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue())); sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue()));
@ -78,17 +74,6 @@ public class State {
return sb.toString(); return sb.toString();
} }
public static State getState(String name, State def) {
if(name == null)
return def;
State state = NAME_MAP.get(name);
if(state != null)
return state;
int idx = name.indexOf(",");
Block block = BlockRegistry.REGISTRY.byNameExact(idx >= 0 ? name.substring(0, idx) : name);
return block != null ? block.getState() : def;
}
public State(Block block, ImmutableMap<Property, Comparable> properties) { public State(Block block, ImmutableMap<Property, Comparable> properties) {
this.block = block; this.block = block;
this.properties = properties; this.properties = properties;
@ -116,10 +101,6 @@ public class State {
return this.saved; return this.saved;
} }
public String getId() {
return this.id;
}
public <T extends Comparable<T>> T getValue(Property<T> property) { public <T extends Comparable<T>> T getValue(Property<T> property) {
if(!this.properties.containsKey(property)) { if(!this.properties.containsKey(property)) {
throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block); throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block);
@ -135,7 +116,7 @@ public class State {
} }
else if(!property.getStates().contains(value)) { else if(!property.getStates().contains(value)) {
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block "
+ BlockRegistry.getNameFromBlock(this.block) + ", it is not an allowed value"); + BlockRegistry.getName(this.block) + ", it is not an allowed value");
} }
else { else {
return (State)(this.properties.get(property) == value ? this : (State)this.map.get(property, value)); return (State)(this.properties.get(property) == value ? this : (State)this.map.get(property, value));
@ -160,7 +141,7 @@ public class State {
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(BlockRegistry.getNameFromBlock(this.getBlock())); sb.append(BlockRegistry.getName(this.getBlock()));
if(!this.getProperties().isEmpty()) { if(!this.getProperties().isEmpty()) {
sb.append("["); sb.append("[");
Iterable<String> iter = Iterables.transform(this.getProperties().entrySet(), MAP_ENTRY_TO_STRING); Iterable<String> iter = Iterables.transform(this.getProperties().entrySet(), MAP_ENTRY_TO_STRING);
@ -194,11 +175,10 @@ public class State {
this.map = ImmutableTable.<Property, Comparable, State>copyOf(table); this.map = ImmutableTable.<Property, Comparable, State>copyOf(table);
} }
public void buildSaved() { public String buildSaved() {
if(this.saved != null) if(this.saved != null)
throw new IllegalStateException(); throw new IllegalStateException();
ID_MAP.put(this, BlockRegistry.getIdFromBlock(this.block) << 4 | this.block.getMetaFromState(this));
this.saved = ImmutableSet.copyOf(getSavedProperties(this.block)); this.saved = ImmutableSet.copyOf(getSavedProperties(this.block));
NAME_MAP.put(this.id = filterProperties(this, this.saved), this); return filterProperties(this, this.saved);
} }
} }

View file

@ -248,7 +248,7 @@ public abstract class World implements IWorldAccess {
return false; return false;
} }
else { else {
this.playAuxSFX(2001, pos, BlockRegistry.getStateId(iblockstate)); this.playAuxSFX(2001, pos, BlockRegistry.getId(iblockstate));
if(dropBlock) { if(dropBlock) {
block.dropBlockAsItem(this, pos, iblockstate, 0); block.dropBlockAsItem(this, pos, iblockstate, 0);

View file

@ -42,11 +42,11 @@ public abstract class ReorderRegistry {
public static void register() { public static void register() {
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {
PLACE_LAST.add(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling")); PLACE_LAST.add(BlockRegistry.byName(wood.getName() + "_sapling"));
} }
// PLACE_LAST.add(Blocks.bed); // PLACE_LAST.add(Blocks.bed);
for(DyeColor color : BlockBed.COLORS) { for(DyeColor color : BlockBed.COLORS) {
PLACE_LAST.add(BlockRegistry.getRegisteredBlock(color.getName() + "_bed")); PLACE_LAST.add(BlockRegistry.byName(color.getName() + "_bed"));
} }
PLACE_LAST.add(Blocks.golden_rail); PLACE_LAST.add(Blocks.golden_rail);
PLACE_LAST.add(Blocks.detector_rail); PLACE_LAST.add(Blocks.detector_rail);
@ -141,7 +141,7 @@ public abstract class ReorderRegistry {
static { static {
for(WoodType wood : WoodType.values()) { for(WoodType wood : WoodType.values()) {
addAttach(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"), Facing.DOWN); addAttach(BlockRegistry.byName(wood.getName() + "_sapling"), Facing.DOWN);
} }
addAttach(Blocks.tallgrass, Facing.DOWN); addAttach(Blocks.tallgrass, Facing.DOWN);
addAttach(Blocks.deadbush, Facing.DOWN); addAttach(Blocks.deadbush, Facing.DOWN);

View file

@ -15,7 +15,7 @@ public abstract class RotationRegistry {
public static void register() { public static void register() {
List<RotationValue> values = Lists.newArrayList(); List<RotationValue> values = Lists.newArrayList();
for(Block block : common.init.BlockRegistry.REGISTRY) { for(Block block : common.init.BlockRegistry.blocks()) {
for(Property<?> prop : block.getPropertyMap()) { for(Property<?> prop : block.getPropertyMap()) {
for(Comparable v : prop.getStates()) { for(Comparable v : prop.getStates()) {
if(!(v instanceof DirectionVec vec)) if(!(v instanceof DirectionVec vec))

View file

@ -25,11 +25,11 @@ public class CommandBlock extends Command {
public Collection<String> complete(CommandEnvironment env, String last) { public Collection<String> complete(CommandEnvironment env, String last) {
int idx = last.indexOf(','); int idx = last.indexOf(',');
if(idx >= 0) { if(idx >= 0) {
Block block = BlockRegistry.REGISTRY.byNameExact(last.substring(0, idx)); Block block = BlockRegistry.byNameExact(last.substring(0, idx));
if(block != null) if(block != null)
return Lists.newArrayList(Iterables.transform(block.getValidStates(), state -> state.getId())); return Lists.newArrayList(Iterables.transform(block.getValidStates(), state -> BlockRegistry.getName(state)));
} }
return BlockRegistry.REGISTRY.getKeys(); return BlockRegistry.getKeys();
} }
}); });
this.addBlockPos("position", true); this.addBlockPos("position", true);
@ -40,7 +40,7 @@ public class CommandBlock extends Command {
} }
public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, TagObject tag) { public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, TagObject tag) {
State state = State.getState(block, null); State state = BlockRegistry.byName(block, null);
if(state == null) if(state == null)
throw new RunException("Block '%s' existiert nicht", block); throw new RunException("Block '%s' existiert nicht", block);
boolean success = world.setState(position, state); boolean success = world.setState(position, state);

View file

@ -20,7 +20,7 @@ public class CommandItem extends Command {
this.addString("item", false, new StringCompleter() { this.addString("item", false, new StringCompleter() {
public Collection<String> complete(CommandEnvironment env, String last) { public Collection<String> complete(CommandEnvironment env, String last) {
return ItemRegistry.REGISTRY.getKeys(); return ItemRegistry.getKeys();
} }
}); });
this.setParamsOptional(); this.setParamsOptional();

View file

@ -1207,7 +1207,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer
State iblockstate = this.entity.worldObj.getState(pos); State iblockstate = this.entity.worldObj.getState(pos);
TileEntity tileentity = this.entity.worldObj.getTileEntity(pos); TileEntity tileentity = this.entity.worldObj.getTileEntity(pos);
this.entity.worldObj.playAuxSFX(this.entity, 2001, pos, BlockRegistry.getStateId(iblockstate)); this.entity.worldObj.playAuxSFX(this.entity, 2001, pos, BlockRegistry.getId(iblockstate));
boolean flag1 = this.removeBlock(pos); boolean flag1 = this.removeBlock(pos);
// if (this.creative) // if (this.creative)

View file

@ -5,6 +5,7 @@ import java.util.Set;
import common.biome.Biome; import common.biome.Biome;
import common.block.Block; import common.block.Block;
import common.entity.Entity; import common.entity.Entity;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.log.Log; import common.log.Log;
import common.rng.Random; import common.rng.Random;
@ -24,13 +25,13 @@ public class ChunkServer extends Chunk {
super(world, x, z); super(world, x, z);
} }
public ChunkServer(World world, short[] data, int height, boolean base, boolean ceil, Random rand, Biome[] biomes, int x, int z) { public ChunkServer(World world, char[] data, int height, boolean base, boolean ceil, Random rand, Biome[] biomes, int x, int z) {
this(world, x, z); this(world, x, z);
boolean sky = !world.dimension.hasNoLight(); boolean sky = !world.dimension.hasNoLight();
for(int bx = 0; bx < 16; ++bx) { for(int bx = 0; bx < 16; ++bx) {
for(int bz = 0; bz < 16; ++bz) { for(int bz = 0; bz < 16; ++bz) {
for(int by = 0; by < height; ++by) { for(int by = 0; by < height; ++by) {
State state = State.ID_MAP.getByValue(data[bx << 4 | bz | by << 8]); State state = BlockRegistry.byId(data[bx << 4 | bz | by << 8]);
if(state != null && state.getBlock() != Blocks.air) { if(state != null && state.getBlock() != Blocks.air) {
int y = by >> 4; int y = by >> 4;
BlockArray arr = this.getArray(y); BlockArray arr = this.getArray(y);

View file

@ -109,6 +109,7 @@ import common.entity.animal.EntitySquid;
import common.entity.animal.EntityWolf; import common.entity.animal.EntityWolf;
import common.entity.item.EntityBoat; import common.entity.item.EntityBoat;
import common.entity.item.EntityMinecart; import common.entity.item.EntityMinecart;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.init.EntityRegistry; import common.init.EntityRegistry;
import common.init.TileRegistry; import common.init.TileRegistry;
@ -327,7 +328,7 @@ public abstract class Converter {
} }
private static void mapBlock(State state, int id, int data) { private static void mapBlock(State state, int id, int data) {
BLOCK_MAP[(id << 4) | data] = (char)State.ID_MAP.get(state); BLOCK_MAP[(id << 4) | data] = (char)BlockRegistry.getId(state);
} }
private static void mapBlock(State state, int id, int ... values) { private static void mapBlock(State state, int id, int ... values) {

View file

@ -44,24 +44,12 @@ public class Region {
removed.add(id); removed.add(id);
} }
Map<String, Character> mapping = Maps.newHashMap(); Map<String, Character> mapping = Maps.newHashMap();
Map<String, List<Character>> current = Maps.newHashMap();
Set<Character> taken = Sets.newHashSet(); Set<Character> taken = Sets.newHashSet();
List<String> missing = Lists.newArrayList(); List<String> missing = Lists.newArrayList();
for(int z = 0; z < 4096; z++) { for(State state : BlockRegistry.states()) {
Block block = BlockRegistry.getBlockById(z); if(state.getBlock() == Blocks.air)
if(block != Blocks.air) {
for(int n = 0; n < 16; n++) {
State state = block.getStateFromMeta(n);
String id = state.getId();
List<Character> ids = current.get(id);
char mid = (char)State.ID_MAP.get(state);
if(ids == null) {
current.put(id, Lists.newArrayList(mid));
}
else {
ids.add(mid);
continue; continue;
} String id = BlockRegistry.getName(state);
if(tag.hasChar(id)) { if(tag.hasChar(id)) {
char bid = tag.getChar(id); char bid = tag.getChar(id);
if(bid == 0) { if(bid == 0) {
@ -77,8 +65,6 @@ public class Region {
missing.add(id); missing.add(id);
} }
} }
}
}
char bid = 1; char bid = 1;
for(String id : missing) { for(String id : missing) {
while(taken.contains(bid)) { while(taken.contains(bid)) {
@ -91,11 +77,9 @@ public class Region {
} }
for(Entry<String, Character> entry : mapping.entrySet()) { for(Entry<String, Character> entry : mapping.entrySet()) {
bid = entry.getValue(); bid = entry.getValue();
List<Character> ids = current.get(entry.getKey()); char ids = (char)BlockRegistry.getId(BlockRegistry.byName(entry.getKey(), null));
DECODE_MAP[bid] = ids.get(0); DECODE_MAP[bid] = ids;
for(char id : ids) { ENCODE_MAP[ids] = bid;
ENCODE_MAP[id] = bid;
}
} }
for(String id : removed) { for(String id : removed) {
tag.remove(id); tag.remove(id);
@ -559,7 +543,7 @@ public class Region {
int invalid = 0; int invalid = 0;
for(int n = 0; n < ticks.size(); ++n) { for(int n = 0; n < ticks.size(); ++n) {
TagObject tick = ticks.get(n); TagObject tick = ticks.get(n);
Block block = BlockRegistry.getRegisteredBlock(tick.getString("i")); Block block = BlockRegistry.byName(tick.getString("i"));
if(block != Blocks.air) { // FIX if(block != Blocks.air) { // FIX
world.scheduleBlockUpdate(new BlockPos(tick.getInt("x"), tick.getInt("y"), tick.getInt("z")), block, world.scheduleBlockUpdate(new BlockPos(tick.getInt("x"), tick.getInt("y"), tick.getInt("z")), block,
@ -671,7 +655,7 @@ public class Region {
if(tic.getBlock() == Blocks.air) if(tic.getBlock() == Blocks.air)
continue; continue;
TagObject tick = new TagObject(); TagObject tick = new TagObject();
String res = BlockRegistry.getNameFromBlock(tic.getBlock()); String res = BlockRegistry.getName(tic.getBlock());
tick.setString("i", res == null ? "" : res); tick.setString("i", res == null ? "" : res);
tick.setInt("x", tic.position.getX()); tick.setInt("x", tic.position.getX());
tick.setInt("y", tic.position.getY()); tick.setInt("y", tic.position.getY());

View file

@ -1,27 +1,28 @@
package server.worldgen; package server.worldgen;
import common.init.BlockRegistry;
import common.init.Blocks; import common.init.Blocks;
import common.world.State; import common.world.State;
public class ChunkPrimer { public class ChunkPrimer {
public final int height; public final int height;
private final short[] data; private final char[] data;
public ChunkPrimer(int height) { public ChunkPrimer(int height) {
this.data = new short[Math.max(height, 256) * 256]; this.data = new char[Math.max(height, 256) * 256];
this.height = height; this.height = height;
} }
public short[] getData() { public char[] getData() {
return this.data; return this.data;
} }
public State get(int x, int y, int z) { public State get(int x, int y, int z) {
State state = State.ID_MAP.getByValue(this.data[x << 4 | z | y << 8]); State state = BlockRegistry.byId(this.data[x << 4 | z | y << 8]);
return state != null ? state : Blocks.air.getState(); return state != null ? state : Blocks.air.getState();
} }
public void set(int x, int y, int z, State state) { public void set(int x, int y, int z, State state) {
this.data[x << 4 | z | y << 8] = (short)State.ID_MAP.get(state); this.data[x << 4 | z | y << 8] = (char)BlockRegistry.getId(state);
} }
} }

View file

@ -404,19 +404,19 @@ public class StructureVillage
protected void writeTags(TagObject tagCompound) protected void writeTags(TagObject tagCompound)
{ {
super.writeTags(tagCompound); super.writeTags(tagCompound);
tagCompound.setString("CA", BlockRegistry.getNameFromBlock(this.cropTypeA)); tagCompound.setString("CA", BlockRegistry.getName(this.cropTypeA));
tagCompound.setString("CB", BlockRegistry.getNameFromBlock(this.cropTypeB)); tagCompound.setString("CB", BlockRegistry.getName(this.cropTypeB));
tagCompound.setString("CC", BlockRegistry.getNameFromBlock(this.cropTypeC)); tagCompound.setString("CC", BlockRegistry.getName(this.cropTypeC));
tagCompound.setString("CD", BlockRegistry.getNameFromBlock(this.cropTypeD)); tagCompound.setString("CD", BlockRegistry.getName(this.cropTypeD));
} }
protected void readTags(TagObject tagCompound) protected void readTags(TagObject tagCompound)
{ {
super.readTags(tagCompound); super.readTags(tagCompound);
this.cropTypeA = BlockRegistry.getRegisteredBlock(tagCompound.getString("CA")) instanceof BlockCrops crops ? crops : Blocks.wheat; this.cropTypeA = BlockRegistry.byName(tagCompound.getString("CA")) instanceof BlockCrops crops ? crops : Blocks.wheat;
this.cropTypeB = BlockRegistry.getRegisteredBlock(tagCompound.getString("CB")) instanceof BlockCrops crops ? crops : Blocks.wheat; this.cropTypeB = BlockRegistry.byName(tagCompound.getString("CB")) instanceof BlockCrops crops ? crops : Blocks.wheat;
this.cropTypeC = BlockRegistry.getRegisteredBlock(tagCompound.getString("CC")) instanceof BlockCrops crops ? crops : Blocks.wheat; this.cropTypeC = BlockRegistry.byName(tagCompound.getString("CC")) instanceof BlockCrops crops ? crops : Blocks.wheat;
this.cropTypeD = BlockRegistry.getRegisteredBlock(tagCompound.getString("CD")) instanceof BlockCrops crops ? crops : Blocks.wheat; this.cropTypeD = BlockRegistry.byName(tagCompound.getString("CD")) instanceof BlockCrops crops ? crops : Blocks.wheat;
} }
private BlockCrops func_151559_a(Random rand) private BlockCrops func_151559_a(Random rand)
@ -513,15 +513,15 @@ public class StructureVillage
protected void writeTags(TagObject tagCompound) protected void writeTags(TagObject tagCompound)
{ {
super.writeTags(tagCompound); super.writeTags(tagCompound);
tagCompound.setString("CA", BlockRegistry.getNameFromBlock(this.cropTypeA)); tagCompound.setString("CA", BlockRegistry.getName(this.cropTypeA));
tagCompound.setString("CB", BlockRegistry.getNameFromBlock(this.cropTypeB)); tagCompound.setString("CB", BlockRegistry.getName(this.cropTypeB));
} }
protected void readTags(TagObject tagCompound) protected void readTags(TagObject tagCompound)
{ {
super.readTags(tagCompound); super.readTags(tagCompound);
this.cropTypeA = BlockRegistry.getRegisteredBlock(tagCompound.getString("CA")) instanceof BlockCrops crops ? crops : Blocks.wheat; this.cropTypeA = BlockRegistry.byName(tagCompound.getString("CA")) instanceof BlockCrops crops ? crops : Blocks.wheat;
this.cropTypeB = BlockRegistry.getRegisteredBlock(tagCompound.getString("CB")) instanceof BlockCrops crops ? crops : Blocks.wheat; this.cropTypeB = BlockRegistry.byName(tagCompound.getString("CB")) instanceof BlockCrops crops ? crops : Blocks.wheat;
} }
private BlockCrops func_151560_a(Random rand) private BlockCrops func_151560_a(Random rand)