diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 5ea46871..d6fa8bd0 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -161,7 +161,7 @@ import common.packet.HPacketHandshake; import common.packet.CPacketAction.Action; import common.potion.Potion; import common.potion.PotionEffect; -import common.properties.IProperty; +import common.properties.Property; import common.sound.EventType; import common.sound.PositionedSound; import common.util.BlockPos; @@ -1497,8 +1497,6 @@ public class Client implements IThreadListener { return; } - int meta = 0; - boolean flag1 = false; Item item = null; if (this.pointed.type == HitPosition.ObjectType.BLOCK) @@ -1519,8 +1517,7 @@ public class Client implements IThreadListener { } Block block1 = item instanceof ItemBlock && !block.isPickStrict() ? item.getBlock() : block; - meta = block1.getDamageValue(this.world, blockpos); - flag1 = item.getHasSubtypes(); + // meta = block1.getDamageValue(this.world, blockpos); TODO: data } else { @@ -1535,9 +1532,9 @@ public class Client implements IThreadListener { InventoryPlayer inventoryplayer = this.player.inventory; - inventoryplayer.setCurrentItem(item, meta, flag1); + inventoryplayer.setCurrentItem(item); if(this.itemCheat) { - this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item, 1, meta), inventoryplayer.currentItem, this.ctrl())); + this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item), inventoryplayer.currentItem, this.ctrl())); } } } @@ -1932,7 +1929,7 @@ public class Client implements IThreadListener { "Schaue auf: " + BlockRegistry.getNameFromBlock(block.getBlock()) + "\n" + String.format("Position: %d %d %d", pos.getX(), pos.getY(), pos.getZ()) ); - for(Entry entry : block.getProperties().entrySet()) { + for(Entry entry : block.getProperties().entrySet()) { str.append("\n" + entry.getKey().getName() + ": " + entry.getValue().toString()); } @@ -1957,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() : "RĂ¼stung: n/a, Pfeile: n/a") + "\n" + (held != null ? - "Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size + " (" + held.getMetadata() + ")" : "Gegens.: n/a") + "\n" + + "Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size : "Gegens.: n/a") + "\n" + "Eigens.: " + (entity.dead ? "D" : "") + (entity.noClip ? "N" : "") + (entity.onGround ? "G" : "") + (entity.canBeCollidedWith() ? "C" : "") + (entity.canBePushed() ? "P" : "") + (entity.isBurning() ? "B" : "") + (entity.isPlayer() ? "S" : "") diff --git a/client/src/main/java/client/init/RenderRegistry.java b/client/src/main/java/client/init/RenderRegistry.java index 254989d7..e69fc53d 100644 --- a/client/src/main/java/client/init/RenderRegistry.java +++ b/client/src/main/java/client/init/RenderRegistry.java @@ -150,7 +150,7 @@ public abstract class RenderRegistry { map.put(EntityBoat.class, new RenderBoat(mgr)); map.put(EntityHook.class, new RenderFish(mgr)); map.put(EntityHorse.class, new RenderHorse(mgr, new ModelHorse())); - map.put(EntityDynamite.class, new RenderDynamite(mgr, Items.dynamite, ritem)); + map.put(EntityDynamite.class, new RenderDynamite(mgr, ritem)); map.put(EntityNuke.class, new RenderBlockEntity(mgr, Blocks.nuke.getState())); map.put(EntityMouse.class, new RenderMouse(mgr, new ModelMouse())); map.put(EntityDie.class, new RenderDie(mgr)); diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index 5981cfc5..e7914270 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -517,7 +517,7 @@ public class ClientPlayer implements IClientPlayer } else { - player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i), 1, 0); + player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i)); } player.setPositionAndRotation(x, y, z, yaw, pitch); diff --git a/client/src/main/java/client/renderer/ItemModelMesher.java b/client/src/main/java/client/renderer/ItemModelMesher.java index 619016bb..b8402af6 100755 --- a/client/src/main/java/client/renderer/ItemModelMesher.java +++ b/client/src/main/java/client/renderer/ItemModelMesher.java @@ -32,19 +32,13 @@ public class ItemModelMesher public TextureAtlasSprite getParticleIcon(Item item) { - return this.getParticleIcon(item, 0); - } - - public TextureAtlasSprite getParticleIcon(Item item, int meta) - { - return this.getItemModel(new ItemStack(item, 1, meta)).getBaseTexture(); + return this.getItemModel(new ItemStack(item)).getBaseTexture(); } public IBakedModel getItemModel(ItemStack stack) { Item item = stack.getItem(); - IBakedModel ibakedmodel = this.simpleShapesCache.get(Integer.valueOf(this.getIndex(item, - stack.isItemStackDamageable() ? 0 : stack.getMetadata()))); + IBakedModel ibakedmodel = this.simpleShapesCache.get(this.getIndex(item)); if (ibakedmodel == null) { @@ -64,9 +58,9 @@ public class ItemModelMesher return ibakedmodel; } - private int getIndex(Item item, int meta) + private int getIndex(Item item) { - return ItemRegistry.getIdFromItem(item) << 16 | meta; + return ItemRegistry.getIdFromItem(item); } // public void register(Item item, int meta, ResourceLocation location) @@ -122,9 +116,9 @@ public class ItemModelMesher continue; item.getRenderItems(item, stacks); for(ItemStack stack : stacks) { - this.simpleShapesCache.put(this.getIndex(item, stack.getMetadata()), + this.simpleShapesCache.put(this.getIndex(item), this.modelManager.getModel("item/" + - ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory")); + ItemRegistry.getNameFromItem(item).toString() + '#' + "inventory")); } stacks.clear(); } diff --git a/client/src/main/java/client/renderer/blockmodel/ModelBakery.java b/client/src/main/java/client/renderer/blockmodel/ModelBakery.java index 3bd370d4..2e581db0 100755 --- a/client/src/main/java/client/renderer/blockmodel/ModelBakery.java +++ b/client/src/main/java/client/renderer/blockmodel/ModelBakery.java @@ -144,8 +144,8 @@ public abstract class ModelBakery // { item.getRenderItems(item, stacks); for(ItemStack stack : stacks) { - String resourcelocation = "item/" + ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory"; - models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString(), stack.getMetadata())); + String resourcelocation = "item/" + ItemRegistry.getNameFromItem(item).toString() + '#' + "inventory"; + models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString())); itemLocations.add(resourcelocation); } stacks.clear(); diff --git a/client/src/main/java/client/renderer/blockmodel/ModelManager.java b/client/src/main/java/client/renderer/blockmodel/ModelManager.java index 55a9399f..f5bddec7 100755 --- a/client/src/main/java/client/renderer/blockmodel/ModelManager.java +++ b/client/src/main/java/client/renderer/blockmodel/ModelManager.java @@ -13,7 +13,7 @@ import common.collect.Maps; import common.init.BlockRegistry; import common.init.Blocks; import common.init.FluidRegistry; -import common.properties.IProperty; +import common.properties.Property; import common.util.IRegistry; import common.world.State; @@ -36,7 +36,7 @@ public class ModelManager // Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block)); } else { - IProperty[] ignored = block.getIgnoredProperties(); + Property[] ignored = block.getIgnoredProperties(); if(ignored != null) this.mappers.put(block, new MultiStateMap.Builder().ignore(ignored).build()); } diff --git a/client/src/main/java/client/renderer/blockmodel/MultiStateMap.java b/client/src/main/java/client/renderer/blockmodel/MultiStateMap.java index 496e619c..75c9acac 100755 --- a/client/src/main/java/client/renderer/blockmodel/MultiStateMap.java +++ b/client/src/main/java/client/renderer/blockmodel/MultiStateMap.java @@ -7,16 +7,16 @@ import java.util.Map; import common.collect.Lists; import common.collect.Maps; import common.init.BlockRegistry; -import common.properties.IProperty; +import common.properties.Property; import common.world.State; public class MultiStateMap extends StateMap { - private final IProperty name; + private final Property name; private final String suffix; - private final List < IProperty> ignored; + private final List < Property> ignored; - private MultiStateMap(IProperty name, String suffix, List < IProperty> ignored) + private MultiStateMap(Property name, String suffix, List < Property> ignored) { this.name = name; this.suffix = suffix; @@ -25,7 +25,7 @@ public class MultiStateMap extends StateMap protected String getResourceLocation(State state) { - Map map = Maps.newLinkedHashMap(state.getProperties()); + Map map = Maps.newLinkedHashMap(state.getProperties()); String s; if (this.name == null) @@ -34,7 +34,7 @@ public class MultiStateMap extends StateMap } else { - s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); + s = ((Property)this.name).getName((Comparable)map.remove(this.name)); } if (this.suffix != null) @@ -42,7 +42,7 @@ public class MultiStateMap extends StateMap s = s + this.suffix; } - for (IProperty iproperty : this.ignored) + for (Property iproperty : this.ignored) { map.remove(iproperty); } @@ -52,11 +52,11 @@ public class MultiStateMap extends StateMap public static class Builder { - private IProperty name; + private Property name; private String suffix; - private final List < IProperty> ignored = Lists. < IProperty> newArrayList(); + private final List < Property> ignored = Lists. < Property> newArrayList(); - public MultiStateMap.Builder withName(IProperty builderPropertyIn) + public MultiStateMap.Builder withName(Property builderPropertyIn) { this.name = builderPropertyIn; return this; @@ -68,7 +68,7 @@ public class MultiStateMap extends StateMap return this; } - public MultiStateMap.Builder ignore(IProperty... p_178442_1_) + public MultiStateMap.Builder ignore(Property... p_178442_1_) { Collections.addAll(this.ignored, p_178442_1_); return this; diff --git a/client/src/main/java/client/renderer/blockmodel/StateMap.java b/client/src/main/java/client/renderer/blockmodel/StateMap.java index d85f8a1d..155c9b8b 100755 --- a/client/src/main/java/client/renderer/blockmodel/StateMap.java +++ b/client/src/main/java/client/renderer/blockmodel/StateMap.java @@ -5,25 +5,25 @@ import java.util.Map.Entry; import common.block.Block; import common.collect.Maps; -import common.properties.IProperty; +import common.properties.Property; import common.world.State; public abstract class StateMap { protected Map mapStateModelLocations = Maps.newLinkedHashMap(); - public String getPropertyString(Map p_178131_1_) + public String getPropertyString(Map p_178131_1_) { StringBuilder stringbuilder = new StringBuilder(); - for (Entry entry : p_178131_1_.entrySet()) + for (Entry entry : p_178131_1_.entrySet()) { if (stringbuilder.length() != 0) { stringbuilder.append(","); } - IProperty iproperty = (IProperty)entry.getKey(); + Property iproperty = (Property)entry.getKey(); Comparable comparable = (Comparable)entry.getValue(); stringbuilder.append(iproperty.getName()); stringbuilder.append("="); diff --git a/client/src/main/java/client/renderer/entity/RenderDynamite.java b/client/src/main/java/client/renderer/entity/RenderDynamite.java index 376e2aeb..f23f318f 100755 --- a/client/src/main/java/client/renderer/entity/RenderDynamite.java +++ b/client/src/main/java/client/renderer/entity/RenderDynamite.java @@ -1,16 +1,16 @@ package client.renderer.entity; import common.entity.projectile.EntityDynamite; -import common.item.Item; +import common.init.ItemRegistry; import common.item.ItemStack; public class RenderDynamite extends RenderItemEntity { - public RenderDynamite(RenderManager renderManagerIn, Item itemIn, RenderItem renderItemIn) { - super(renderManagerIn, itemIn, renderItemIn); + public RenderDynamite(RenderManager renderManagerIn, RenderItem renderItemIn) { + super(renderManagerIn, null, renderItemIn); } public ItemStack getStack(EntityDynamite entityIn) { - return new ItemStack(this.item, 1, entityIn.explosionSize); + return new ItemStack(ItemRegistry.getRegisteredItem("dynamite" + (entityIn.explosionSize <= 0 || entityIn.explosionSize >= 8 ? "" : "_" + entityIn.explosionSize))); } } diff --git a/client/src/main/java/client/renderer/entity/RenderItem.java b/client/src/main/java/client/renderer/entity/RenderItem.java index a2a790f7..5d10f719 100755 --- a/client/src/main/java/client/renderer/entity/RenderItem.java +++ b/client/src/main/java/client/renderer/entity/RenderItem.java @@ -230,7 +230,7 @@ public class RenderItem if (item == Items.fishing_rod && entityplayer.fishEntity != null) { - modelresourcelocation = "item/fishing_rod#1" + '#' + "inventory"; + modelresourcelocation = "item/fishing_rod_cast" + '#' + "inventory"; } else if (item == Items.bow && entityplayer.getItemInUse() != null) { @@ -238,15 +238,15 @@ public class RenderItem if (i >= 18) { - modelresourcelocation = "item/bow#3" + '#' + "inventory"; + modelresourcelocation = "item/bow_pulling_3" + '#' + "inventory"; } else if (i > 13) { - modelresourcelocation = "item/bow#2" + '#' + "inventory"; + modelresourcelocation = "item/bow_pulling_2" + '#' + "inventory"; } else if (i > 0) { - modelresourcelocation = "item/bow#1" + '#' + "inventory"; + modelresourcelocation = "item/bow_pulling_1" + '#' + "inventory"; } } diff --git a/client/src/main/java/client/renderer/entity/RenderItemEntity.java b/client/src/main/java/client/renderer/entity/RenderItemEntity.java index 41da3446..2e660e43 100755 --- a/client/src/main/java/client/renderer/entity/RenderItemEntity.java +++ b/client/src/main/java/client/renderer/entity/RenderItemEntity.java @@ -39,7 +39,7 @@ public class RenderItemEntity extends Render public ItemStack getStack(T entityIn) { - return new ItemStack(this.item, 1, 0); + return new ItemStack(this.item); } protected String getEntityTexture(Entity entity) diff --git a/client/src/main/java/client/renderer/entity/RenderPotion.java b/client/src/main/java/client/renderer/entity/RenderPotion.java index 42567832..0fb4fa68 100755 --- a/client/src/main/java/client/renderer/entity/RenderPotion.java +++ b/client/src/main/java/client/renderer/entity/RenderPotion.java @@ -2,6 +2,7 @@ package client.renderer.entity; import common.entity.projectile.EntityPotion; import common.init.Items; +import common.item.ItemPotion; import common.item.ItemStack; public class RenderPotion extends RenderItemEntity @@ -13,6 +14,6 @@ public class RenderPotion extends RenderItemEntity public ItemStack getStack(EntityPotion entityIn) { - return new ItemStack(this.item, 1, entityIn.getPotionDamage()); + return new ItemStack(ItemPotion.getPotionItem(entityIn.getPotionDamage())); } } diff --git a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java index 616fd3b1..5a8d0ded 100755 --- a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java +++ b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java @@ -6,9 +6,9 @@ import client.Client; import client.renderer.BlockRenderer; import client.renderer.GlState; import client.renderer.texture.TextureMap; -import common.block.tech.BlockTNT; +import common.block.Block; import common.entity.item.EntityTnt; -import common.init.Blocks; +import common.init.BlockRegistry; import common.util.ExtMath; @@ -17,12 +17,8 @@ public class RenderTntPrimed extends Render public RenderTntPrimed(RenderManager renderManagerIn) { super(renderManagerIn); -// this.shadowSize = 0.5F; } - /** - * Renders the desired {@code T} type Entity. - */ public void doRender(EntityTnt entity, double x, double y, double z, float partialTicks) { BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher(); @@ -42,7 +38,8 @@ public class RenderTntPrimed extends Render float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(entity); GL11.glTranslatef(-0.5F, -0.5F, 0.5F); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), entity.getBrightness(partialTicks)); + Block tnt = BlockRegistry.getRegisteredBlock("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize)); + blockrendererdispatcher.renderBlockBrightness(tnt.getState(), entity.getBrightness(partialTicks)); GL11.glTranslatef(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) @@ -54,7 +51,7 @@ public class RenderTntPrimed extends Render GlState.color(1.0F, 1.0F, 1.0F, f2); GlState.doPolygonOffset(-3.0F, -3.0F); GlState.enablePolygonOffset(); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), 1.0F); + blockrendererdispatcher.renderBlockBrightness(tnt.getState(), 1.0F); GlState.doPolygonOffset(0.0F, 0.0F); GlState.disablePolygonOffset(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -67,9 +64,6 @@ public class RenderTntPrimed extends Render super.doRender(entity, x, y, z, partialTicks); } - /** - * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. - */ protected String getEntityTexture(EntityTnt entity) { return TextureMap.locationBlocksTexture; diff --git a/client/src/main/java/client/renderer/particle/EntityBreakingFX.java b/client/src/main/java/client/renderer/particle/EntityBreakingFX.java index fb192367..7e408b49 100755 --- a/client/src/main/java/client/renderer/particle/EntityBreakingFX.java +++ b/client/src/main/java/client/renderer/particle/EntityBreakingFX.java @@ -10,14 +10,9 @@ import common.world.World; public class EntityBreakingFX extends EntityFX { - protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_) + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_) { - this(worldIn, posXIn, posYIn, posZIn, p_i1195_8_, 0); - } - - protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_, int p_i1197_15_) - { - this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_, p_i1197_15_); + this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_); this.motionX *= 0.10000000149011612D; this.motionY *= 0.10000000149011612D; this.motionZ *= 0.10000000149011612D; @@ -26,10 +21,10 @@ public class EntityBreakingFX extends EntityFX this.motionZ += zSpeedIn; } - protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_) + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_) { super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D); - this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_)); + this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_)); this.particleRed = this.particleGreen = this.particleBlue = 1.0F; this.particleGravity = 1.0F; // Blocks.snow.particleGravity; this.particleScale /= 2.0F; @@ -75,8 +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_) { - int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0; - return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0]), i); + return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0])); } } diff --git a/client/src/main/java/client/renderer/particle/EntityFirework.java b/client/src/main/java/client/renderer/particle/EntityFirework.java index 476388fd..a92e7479 100755 --- a/client/src/main/java/client/renderer/particle/EntityFirework.java +++ b/client/src/main/java/client/renderer/particle/EntityFirework.java @@ -277,7 +277,7 @@ public class EntityFirework if (aint.length == 0) { - aint = new int[] {ItemDye.dyeColors[0]}; + aint = new int[] {ItemDye.FIREWORK_COLORS[0]}; } if (l == 1) diff --git a/client/src/main/java/client/util/PlayerController.java b/client/src/main/java/client/util/PlayerController.java index e18d64fe..13103a48 100755 --- a/client/src/main/java/client/util/PlayerController.java +++ b/client/src/main/java/client/util/PlayerController.java @@ -189,8 +189,7 @@ public class PlayerController { if(this.stack != null && stack != null) { flag = stack.getItem() == this.stack.getItem() - && ItemStack.areItemStackTagsEqual(stack, this.stack) - && (stack.isItemStackDamageable() || stack.getMetadata() == this.stack.getMetadata()); + && ItemStack.areItemStackTagsEqual(stack, this.stack); } return pos.equals(this.position) && flag; diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index dbfdf905..2ba83a93 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -20,6 +20,7 @@ import common.init.ItemRegistry; import common.init.Items; import common.init.SoundEvent; import common.item.ItemDye; +import common.item.ItemPotion; import common.log.Log; import common.model.ParticleType; import common.rng.Random; @@ -653,7 +654,7 @@ public class WorldClient extends AWorldClient 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), data}); + 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)}); } ParticleType enumparticletypes = ParticleType.WATER_SPLASH; @@ -661,13 +662,14 @@ public class WorldClient extends AWorldClient float f1 = 1.0F; float f2 = 1.0F; if((data & 16383) != 0) { - int j1 = Items.potion.getColorFromDamage(data); + ItemPotion potion = ItemPotion.getPotionItem(data); + int j1 = potion.getColorFromDamage(); f = (float)(j1 >> 16 & 255) / 255.0F; f1 = (float)(j1 >> 8 & 255) / 255.0F; f2 = (float)(j1 >> 0 & 255) / 255.0F; enumparticletypes = ParticleType.SPELL; - if (Items.potion.isEffectInstant(data)) + if (potion.isEffectInstant()) { enumparticletypes = ParticleType.SPELL_INSTANT; } diff --git a/client/src/main/resources/textures/blocks/black_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/black_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/black_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/black_clay.png diff --git a/client/src/main/resources/textures/blocks/blue_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/blue_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/blue_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/blue_clay.png diff --git a/client/src/main/resources/textures/blocks/brown_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/brown_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/brown_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/brown_clay.png diff --git a/client/src/main/resources/textures/blocks/stonebrick_chiseled.png b/client/src/main/resources/textures/blocks/carved_stonebrick.png similarity index 100% rename from client/src/main/resources/textures/blocks/stonebrick_chiseled.png rename to client/src/main/resources/textures/blocks/carved_stonebrick.png diff --git a/client/src/main/resources/textures/blocks/stonebrick_cracked.png b/client/src/main/resources/textures/blocks/cracked_stonebrick.png similarity index 100% rename from client/src/main/resources/textures/blocks/stonebrick_cracked.png rename to client/src/main/resources/textures/blocks/cracked_stonebrick.png diff --git a/client/src/main/resources/textures/blocks/cyan_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/cyan_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/cyan_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/cyan_clay.png diff --git a/client/src/main/resources/textures/blocks/oxeye_daisy.png b/client/src/main/resources/textures/blocks/daisy.png similarity index 100% rename from client/src/main/resources/textures/blocks/oxeye_daisy.png rename to client/src/main/resources/textures/blocks/daisy.png diff --git a/client/src/main/resources/textures/blocks/gray_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/gray_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/gray_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/gray_clay.png diff --git a/client/src/main/resources/textures/blocks/green_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/green_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/green_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/green_clay.png diff --git a/client/src/main/resources/textures/blocks/double_fern_bottom.png b/client/src/main/resources/textures/blocks/large_fern_bottom.png similarity index 100% rename from client/src/main/resources/textures/blocks/double_fern_bottom.png rename to client/src/main/resources/textures/blocks/large_fern_bottom.png diff --git a/client/src/main/resources/textures/blocks/double_fern_top.png b/client/src/main/resources/textures/blocks/large_fern_top.png similarity index 100% rename from client/src/main/resources/textures/blocks/double_fern_top.png rename to client/src/main/resources/textures/blocks/large_fern_top.png diff --git a/client/src/main/resources/textures/blocks/double_grass_bottom.png b/client/src/main/resources/textures/blocks/large_tallgrass_bottom.png similarity index 100% rename from client/src/main/resources/textures/blocks/double_grass_bottom.png rename to client/src/main/resources/textures/blocks/large_tallgrass_bottom.png diff --git a/client/src/main/resources/textures/blocks/double_grass_top.png b/client/src/main/resources/textures/blocks/large_tallgrass_top.png similarity index 100% rename from client/src/main/resources/textures/blocks/double_grass_top.png rename to client/src/main/resources/textures/blocks/large_tallgrass_top.png diff --git a/client/src/main/resources/textures/blocks/light_blue_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/light_blue_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/light_blue_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/light_blue_clay.png diff --git a/client/src/main/resources/textures/blocks/lime_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/lime_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/lime_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/lime_clay.png diff --git a/client/src/main/resources/textures/blocks/magenta_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/magenta_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/magenta_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/magenta_clay.png diff --git a/client/src/main/resources/textures/blocks/stonebrick_mossy.png b/client/src/main/resources/textures/blocks/mossy_stonebrick.png similarity index 100% rename from client/src/main/resources/textures/blocks/stonebrick_mossy.png rename to client/src/main/resources/textures/blocks/mossy_stonebrick.png diff --git a/client/src/main/resources/textures/blocks/orange_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/orange_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/orange_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/orange_clay.png diff --git a/client/src/main/resources/textures/blocks/pink_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/pink_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/pink_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/pink_clay.png diff --git a/client/src/main/resources/textures/blocks/purple_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/purple_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/purple_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/purple_clay.png diff --git a/client/src/main/resources/textures/blocks/red_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/red_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/red_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/red_clay.png diff --git a/client/src/main/resources/textures/blocks/double_rose_bottom.png b/client/src/main/resources/textures/blocks/rose_bush_bottom.png similarity index 100% rename from client/src/main/resources/textures/blocks/double_rose_bottom.png rename to client/src/main/resources/textures/blocks/rose_bush_bottom.png diff --git a/client/src/main/resources/textures/blocks/double_rose_top.png b/client/src/main/resources/textures/blocks/rose_bush_top.png similarity index 100% rename from client/src/main/resources/textures/blocks/double_rose_top.png rename to client/src/main/resources/textures/blocks/rose_bush_top.png diff --git a/client/src/main/resources/textures/blocks/silver_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/silver_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/silver_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/silver_clay.png diff --git a/client/src/main/resources/textures/blocks/stonebrick_default.png b/client/src/main/resources/textures/blocks/stonebrick.png similarity index 100% rename from client/src/main/resources/textures/blocks/stonebrick_default.png rename to client/src/main/resources/textures/blocks/stonebrick.png diff --git a/client/src/main/resources/textures/blocks/tall_grass.png b/client/src/main/resources/textures/blocks/tallgrass.png similarity index 100% rename from client/src/main/resources/textures/blocks/tall_grass.png rename to client/src/main/resources/textures/blocks/tallgrass.png diff --git a/client/src/main/resources/textures/blocks/white_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/white_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/white_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/white_clay.png diff --git a/client/src/main/resources/textures/blocks/yellow_stained_hardened_clay.png b/client/src/main/resources/textures/blocks/yellow_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/yellow_stained_hardened_clay.png rename to client/src/main/resources/textures/blocks/yellow_clay.png diff --git a/client/src/main/resources/textures/items/charged_apple.png b/client/src/main/resources/textures/items/charged_apple.png new file mode 100755 index 00000000..8dc6dfed Binary files /dev/null and b/client/src/main/resources/textures/items/charged_apple.png differ diff --git a/client/src/main/resources/textures/items/flower_pot.png b/client/src/main/resources/textures/items/flowerpot.png similarity index 100% rename from client/src/main/resources/textures/items/flower_pot.png rename to client/src/main/resources/textures/items/flowerpot.png diff --git a/common/src/main/java/common/ai/EntityAIEatGrass.java b/common/src/main/java/common/ai/EntityAIEatGrass.java index 47e76e47..f1dfb8c2 100755 --- a/common/src/main/java/common/ai/EntityAIEatGrass.java +++ b/common/src/main/java/common/ai/EntityAIEatGrass.java @@ -1,6 +1,5 @@ package common.ai; -import common.block.foliage.BlockTallGrass; import common.entity.animal.EntitySheep; import common.init.BlockRegistry; import common.init.Blocks; @@ -35,7 +34,7 @@ public class EntityAIEatGrass extends EntityAIBase { BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); State state = this.entityWorld.getState(blockpos); - return (state.getBlock() == Blocks.tallgrass && state.getValue(BlockTallGrass.TYPE) == BlockTallGrass.EnumType.GRASS) || + return state.getBlock() == Blocks.tallgrass || this.entityWorld.getState(blockpos.down()).getBlock() == Blocks.grass; } } @@ -86,7 +85,7 @@ public class EntityAIEatGrass extends EntityAIBase BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); State state = this.entityWorld.getState(blockpos); - if (state.getBlock() == Blocks.tallgrass && state.getValue(BlockTallGrass.TYPE) == BlockTallGrass.EnumType.GRASS) + if (state.getBlock() == Blocks.tallgrass) { if (Vars.mobGrief) { diff --git a/common/src/main/java/common/ai/EntityAIShareItems.java b/common/src/main/java/common/ai/EntityAIShareItems.java index a43c7927..ad9cc717 100755 --- a/common/src/main/java/common/ai/EntityAIShareItems.java +++ b/common/src/main/java/common/ai/EntityAIShareItems.java @@ -64,14 +64,14 @@ public class EntityAIShareItems extends EntityAIWatchClosest2 { int l = itemstack.size / 2; itemstack.size -= l; - itemstack1 = new ItemStack(item, l, itemstack.getMetadata()); + itemstack1 = new ItemStack(item, l); } else if (item == Items.wheats && itemstack.size > 5) { int j = itemstack.size / 2 / 3 * 3; int k = j / 3; itemstack.size -= j; - itemstack1 = new ItemStack(Items.bread, k, 0); + itemstack1 = new ItemStack(Items.bread, k); } if (itemstack.size <= 0) diff --git a/common/src/main/java/common/ai/EntityAITakePlace.java b/common/src/main/java/common/ai/EntityAITakePlace.java index 77413613..a5b138d4 100755 --- a/common/src/main/java/common/ai/EntityAITakePlace.java +++ b/common/src/main/java/common/ai/EntityAITakePlace.java @@ -3,10 +3,11 @@ package common.ai; import java.util.Map; import common.block.Block; +import common.block.foliage.BlockFlower; import common.collect.Maps; import common.entity.npc.EntityNPC; import common.init.Blocks; -import common.init.ItemRegistry; +import common.item.Item; import common.item.ItemStack; import common.rng.Random; import common.util.BlockPos; @@ -17,45 +18,12 @@ import common.world.World; public class EntityAITakePlace extends EntityAIBase { - private static class StackKey { - public String item; - public int meta; - - public StackKey(String str) { - String[] tok = str.split(":", 2); - this.item = tok[0]; - this.meta = tok.length > 1 ? Integer.parseInt(tok[1]) : -1; - } - - public StackKey(ItemStack stack) { - this.item = ItemRegistry.getNameFromItem(stack.getItem()).toString(); - this.meta = stack.getItem().getMaxDamage() <= 0 ? stack.getMetadata() : -1; - } - -// public boolean isSame(ItemStack stack) { -// return this.item.equals(ItemRegistry.getNameFromItem(stack.getItem()).toString()) && -// (stack.getItem().getMaxDamage() > 0 || stack.getMetadata() == this.meta); -// } - - public boolean equals(Object other) { - return other instanceof StackKey && ((StackKey)other).item.equals(this.item) && ((StackKey)other).meta == this.meta; - } - - public int hashCode() { - return this.item.hashCode() ^ (this.meta << 8); - } - - public String toString() { - return this.item + (this.meta == -1 ? "" : (":" + this.meta)); - } - } - private static final Map STEALABLE = Maps.newHashMap(); - private static final Map PLACEABLE = Maps.newHashMap(); + private static final Map PLACEABLE = Maps.newHashMap(); private static void addPlaceable(State state, ItemStack stack) { STEALABLE.put(state, stack); - PLACEABLE.put(new StackKey(stack), state); + PLACEABLE.put(stack.getItem(), state); } private static void addPlaceable(Block block) { @@ -63,7 +31,9 @@ public class EntityAITakePlace extends EntityAIBase } static { - addPlaceable(Blocks.flower); + for(BlockFlower block : BlockFlower.FLOWERS) { + addPlaceable(block); + } addPlaceable(Blocks.brown_mushroom); addPlaceable(Blocks.red_mushroom); addPlaceable(Blocks.blue_mushroom); @@ -85,7 +55,7 @@ public class EntityAITakePlace extends EntityAIBase this.place = false; return this.entity.getRNG().chance(20); } - else if(this.entity.getRNG().chance(200) && PLACEABLE.containsKey(new StackKey(this.entity.getHeldItem()))) { + else if(this.entity.getRNG().chance(200) && PLACEABLE.containsKey(this.entity.getHeldItem().getItem())) { this.place = this.entity.getRNG().rarity(10); return true; } @@ -102,11 +72,11 @@ public class EntityAITakePlace extends EntityAIBase BlockPos blockpos = new BlockPos(i, j, k); if(this.place) { ItemStack stack = this.entity.getHeldItem(); - if(stack == null || !PLACEABLE.containsKey(new StackKey(this.entity.getHeldItem()))) + if(stack == null || !PLACEABLE.containsKey(this.entity.getHeldItem().getItem())) return; Block replace = world.getState(blockpos).getBlock(); Block below = world.getState(blockpos.down()).getBlock(); - State state = PLACEABLE.get(new StackKey(this.entity.getHeldItem())); + State state = PLACEABLE.get(this.entity.getHeldItem().getItem()); if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace == Blocks.air && below != Blocks.air && below.isFullCube()) { diff --git a/common/src/main/java/common/ai/EntityAITempt.java b/common/src/main/java/common/ai/EntityAITempt.java index a7008c7c..ed17ee6a 100755 --- a/common/src/main/java/common/ai/EntityAITempt.java +++ b/common/src/main/java/common/ai/EntityAITempt.java @@ -1,5 +1,7 @@ package common.ai; +import java.util.function.Predicate; + import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.item.Item; @@ -38,7 +40,7 @@ public class EntityAITempt extends EntityAIBase /** True if this EntityAITempt task is running */ private boolean isRunning; - private Item temptItem; + private Predicate temptItem; private double range; private double distance; @@ -48,11 +50,19 @@ public class EntityAITempt extends EntityAIBase private boolean scaredByPlayerMovement; private boolean avoidWater; - public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Item temptItemIn, boolean scaredByPlayerMovementIn) { + public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, final Item temptItemIn, boolean scaredByPlayerMovementIn) { + this(temptedEntityIn, speedIn, new Predicate() { + public boolean test(ItemStack stack) { + return stack.getItem() == temptItemIn; + } + }, 2.5, 10.0, scaredByPlayerMovementIn); + } + + public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Predicate temptItemIn, boolean scaredByPlayerMovementIn) { this(temptedEntityIn, speedIn, temptItemIn, 2.5, 10.0, scaredByPlayerMovementIn); } - public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Item temptItemIn, double distance, double range, boolean scaredByPlayerMovementIn) + public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Predicate temptItemIn, double distance, double range, boolean scaredByPlayerMovementIn) { this.temptedEntity = temptedEntityIn; this.speed = speedIn; @@ -91,7 +101,7 @@ public class EntityAITempt extends EntityAIBase if(this.temptItem == null) return this.temptedEntity.getDistanceSqToEntity(this.temptingPlayer) >= this.distance; ItemStack itemstack = this.temptingPlayer.getCurrentEquippedItem(); - return itemstack == null ? false : itemstack.getItem() == this.temptItem; + return itemstack == null ? false : this.temptItem.test(itemstack); } } } diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index e7d2cc63..3086a8d1 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -32,7 +32,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -156,7 +156,7 @@ public class Block { } } - private final ImmutableList properties; + private final ImmutableList properties; private final ImmutableList states; protected final Material material; @@ -212,14 +212,14 @@ public class Block { return (T[])((Object[])((Object[])Array.newInstance(clazz, size))); } - private static Map createMap(Iterable keys, Iterable values) { - return populateMap(keys, values, Maps.newLinkedHashMap()); + private static Map createMap(Iterable keys, Iterable values) { + return populateMap(keys, values, Maps.newLinkedHashMap()); } - private static Map populateMap(Iterable keys, Iterable values, Map map) { + private static Map populateMap(Iterable keys, Iterable values, Map map) { Iterator iterator = values.iterator(); - for(IProperty prop : keys) { + for(Property prop : keys) { map.put(prop, iterator.next()); } @@ -231,28 +231,28 @@ public class Block { } } - private static List> getAllowedValues(List properties) { + private static List> getAllowedValues(List properties) { List> list = Lists.>newArrayList(); for(int z = 0; z < properties.size(); z++) { - list.add((properties.get(z)).getAllowedValues()); + list.add((properties.get(z)).getStates()); } return list; } - private static ImmutableList getPropertyList(IProperty[] properties) { - Arrays.sort(properties, new Comparator() { - public int compare(IProperty p1, IProperty p2) { + private static ImmutableList getPropertyList(Property[] properties) { + Arrays.sort(properties, new Comparator() { + public int compare(Property p1, Property p2) { return p1.getName().compareTo(p2.getName()); } }); return ImmutableList.copyOf(properties); } - private static ImmutableList getStateList(List properties, Block block) { - Map, State> map = Maps., State>newLinkedHashMap(); + private static ImmutableList getStateList(List properties, Block block) { + Map, State> map = Maps., State>newLinkedHashMap(); List list = Lists.newArrayList(); for(List allowed : cartesianProduct(getAllowedValues(properties))) { - Map props = createMap(properties, allowed); + Map props = createMap(properties, allowed); State state = new State(block, ImmutableMap.copyOf(props)); map.put(props, state); list.add(state); @@ -388,7 +388,7 @@ public class Block { return this.states.get(0); } - public Collection getPropertyMap() { + public Collection getPropertyMap() { return this.properties; } @@ -592,7 +592,7 @@ public class Block { Item item = this.getItemDropped(state, worldIn.rand, fortune); if(item != null) { - spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); + spawnAsEntity(worldIn, pos, new ItemStack(item)); } } } @@ -621,10 +621,6 @@ public class Block { } } - public int damageDropped(State state) { - return 0; - } - public float getExplosionResistance(Entity exploder) { return this.blockResistance / 5.0F; } @@ -852,14 +848,9 @@ public class Block { } public ItemStack createStackedBlock(State state) { - int i = 0; Item item = ItemRegistry.getItemFromBlock(this); - - if(item != null && item.getHasSubtypes()) { - i = this.getMetaFromState(state); - } - - return new ItemStack(item, 1, i); + // TODO: data + return new ItemStack(item); } public int quantityDroppedWithBonus(int fortune, Random random) { @@ -901,14 +892,6 @@ public class Block { return ItemRegistry.getItemFromBlock(this); } - public int getDamageValue(World worldIn, BlockPos pos) { - return this.damageDropped(worldIn.getState(pos)); - } - - public void getSubBlocks(Item itemIn, CheatTab tab, List list) { - list.add(new ItemStack(itemIn, 1, 0)); - } - public CheatTab getTab() { return this.tab; } @@ -951,8 +934,8 @@ public class Block { return state; } - protected IProperty[] getProperties() { - return new IProperty[0]; + protected Property[] getProperties() { + return new Property[0]; } protected final void setDefaultState(State state) { @@ -991,7 +974,7 @@ public class Block { return provider.getModel(name).add().all(); } - public IProperty[] getIgnoredProperties() { + public Property[] getIgnoredProperties() { return null; } diff --git a/common/src/main/java/common/block/BlockColored.java b/common/src/main/java/common/block/BlockColored.java deleted file mode 100755 index 6ff3755b..00000000 --- a/common/src/main/java/common/block/BlockColored.java +++ /dev/null @@ -1,49 +0,0 @@ -package common.block; - -import java.util.List; - -import common.color.DyeColor; -import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; -import common.model.Model; -import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyEnum; -import common.world.State; - -public class BlockColored extends Block { - public static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); - - public BlockColored(Material material) { - super(material); - this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE)); - this.setTab(CheatTab.BLOCKS); - } - - public int damageDropped(State state) { - return state.getValue(COLOR).getMetadata(); - } - - public void getSubBlocks(Item item, CheatTab tab, List list) { - for(DyeColor color : DyeColor.values()) { - list.add(new ItemStack(item, 1, color.getMetadata())); - } - } - - public State getStateFromMeta(int meta) { - return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta)); - } - - public int getMetaFromState(State state) { - return state.getValue(COLOR).getMetadata(); - } - - protected IProperty[] getProperties() { - return new IProperty[] {COLOR}; - } - - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(state.getValue(COLOR).getName() + "_" + name).add().all(); - } -} diff --git a/common/src/main/java/common/block/BlockDirectional.java b/common/src/main/java/common/block/BlockDirectional.java deleted file mode 100755 index 0cb7a7a0..00000000 --- a/common/src/main/java/common/block/BlockDirectional.java +++ /dev/null @@ -1,12 +0,0 @@ -package common.block; - -import common.properties.PropertyDirection; -import common.util.Facing; - -public abstract class BlockDirectional extends Block { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); - - public BlockDirectional(Material material) { - super(material); - } -} diff --git a/common/src/main/java/common/block/Directional.java b/common/src/main/java/common/block/Directional.java new file mode 100644 index 00000000..c4361340 --- /dev/null +++ b/common/src/main/java/common/block/Directional.java @@ -0,0 +1,8 @@ +package common.block; + +import common.properties.PropertyEnum; +import common.util.Facing; + +public interface Directional { + public static final PropertyEnum FACING = PropertyEnum.create("facing", Facing.class, Facing.values()); +} diff --git a/common/src/main/java/common/block/DirectionalDown.java b/common/src/main/java/common/block/DirectionalDown.java new file mode 100644 index 00000000..8dbba560 --- /dev/null +++ b/common/src/main/java/common/block/DirectionalDown.java @@ -0,0 +1,8 @@ +package common.block; + +import common.properties.PropertyEnum; +import common.util.Facing; + +public interface DirectionalDown { + public static final PropertyEnum FACING = PropertyEnum.create("facing", Facing.class, Facing.DOWN, Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST); +} diff --git a/common/src/main/java/common/block/DirectionalUp.java b/common/src/main/java/common/block/DirectionalUp.java new file mode 100644 index 00000000..c3f8dc37 --- /dev/null +++ b/common/src/main/java/common/block/DirectionalUp.java @@ -0,0 +1,8 @@ +package common.block; + +import common.properties.PropertyEnum; +import common.util.Facing; + +public interface DirectionalUp { + public static final PropertyEnum FACING = PropertyEnum.create("facing", Facing.class, Facing.UP, Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST); +} diff --git a/common/src/main/java/common/block/Rotatable.java b/common/src/main/java/common/block/Rotatable.java new file mode 100755 index 00000000..4bf6bfa5 --- /dev/null +++ b/common/src/main/java/common/block/Rotatable.java @@ -0,0 +1,8 @@ +package common.block; + +import common.properties.PropertyEnum; +import common.util.Facing; + +public interface Rotatable { + public static final PropertyEnum FACING = PropertyEnum.create("facing", Facing.class, Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST); +} diff --git a/common/src/main/java/common/block/artificial/BlockBed.java b/common/src/main/java/common/block/artificial/BlockBed.java index 371619d0..22a5317b 100755 --- a/common/src/main/java/common/block/artificial/BlockBed.java +++ b/common/src/main/java/common/block/artificial/BlockBed.java @@ -1,7 +1,7 @@ package common.block.artificial; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.Material; import common.color.DyeColor; import common.color.TextColor; @@ -12,7 +12,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -23,7 +23,7 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockBed extends BlockDirectional { +public class BlockBed extends Block implements Rotatable { public static enum EnumPartType implements Identifyable { HEAD("head"), FOOT("foot"); @@ -188,8 +188,8 @@ public class BlockBed extends BlockDirectional { return ((Facing)state.getValue(FACING)).getHorizontalIndex() | (state.getValue(PART) == BlockBed.EnumPartType.HEAD ? 8 : 0); } - protected IProperty[] getProperties() { - return new IProperty[] {FACING, PART}; + protected Property[] getProperties() { + return new Property[] {FACING, PART}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/artificial/BlockCake.java b/common/src/main/java/common/block/artificial/BlockCake.java index 425c641a..9907df78 100755 --- a/common/src/main/java/common/block/artificial/BlockCake.java +++ b/common/src/main/java/common/block/artificial/BlockCake.java @@ -8,7 +8,7 @@ import common.item.Item; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -228,9 +228,9 @@ public class BlockCake extends Block return ((Integer)state.getValue(BITES)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {BITES}; + return new Property[] {BITES}; } public int getComparatorInputOverride(World worldIn, BlockPos pos) diff --git a/common/src/main/java/common/block/artificial/BlockCarpet.java b/common/src/main/java/common/block/artificial/BlockCarpet.java index 6deb687b..a3764475 100755 --- a/common/src/main/java/common/block/artificial/BlockCarpet.java +++ b/common/src/main/java/common/block/artificial/BlockCarpet.java @@ -1,18 +1,12 @@ package common.block.artificial; -import java.util.List; - import common.block.Block; import common.block.Material; import common.color.DyeColor; import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.properties.IProperty; -import common.properties.PropertyEnum; import common.util.BlockPos; import common.util.Facing; import common.world.IWorldAccess; @@ -21,25 +15,27 @@ import common.world.World; public class BlockCarpet extends Block { - public static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); - - public BlockCarpet() - { - super(Material.FLEECE); - this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE)); - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); -// this.setTickRandomly(true); - this.setTab(CheatTab.DECORATION); - this.setBlockBoundsFromMeta(0); + public static final BlockCarpet[] CARPETS = new BlockCarpet[DyeColor.values().length]; + + private final DyeColor color; + + public static BlockCarpet getByColor(DyeColor color) { + return CARPETS[color.getMetadata()]; } -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); -// } + public BlockCarpet(DyeColor color) + { + super(Material.FLEECE); + this.color = color; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); + this.setTab(CheatTab.DECORATION); + this.setBlockBoundsFromMeta(); + CARPETS[color.ordinal()] = this; + } + + public DyeColor getColor() { + return this.color; + } /** * Used to determine ambient occlusion and culling when rebuilding chunks for render @@ -59,15 +55,15 @@ public class BlockCarpet extends Block */ public void setBlockBoundsForItemRender() { - this.setBlockBoundsFromMeta(0); + this.setBlockBoundsFromMeta(); } public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { - this.setBlockBoundsFromMeta(0); + this.setBlockBoundsFromMeta(); } - protected void setBlockBoundsFromMeta(int meta) + private void setBlockBoundsFromMeta() { int i = 0; float f = (float)(1 * (1 + i)) / 16.0F; @@ -111,52 +107,11 @@ public class BlockCarpet extends Block return side == Facing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side); } - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((DyeColor)state.getValue(COLOR)).getMetadata(); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (int i = 0; i < 16; ++i) - { - list.add(new ItemStack(itemIn, 1, i)); - } - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((DyeColor)state.getValue(COLOR)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {COLOR}; - } - public Transforms getTransform() { return Transforms.LAYER; } public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(state.getValue(COLOR).getName() + "_wool").add(0, 0, 0, 16, 1, 16).nswe().uv(0, 15, 16, 16).d().u().noCull(); + return provider.getModel(this.color.getName() + "_wool").add(0, 0, 0, 16, 1, 16).nswe().uv(0, 15, 16, 16).d().u().noCull(); } } diff --git a/common/src/main/java/common/block/artificial/BlockDoor.java b/common/src/main/java/common/block/artificial/BlockDoor.java index eb445ea5..08ad3d34 100755 --- a/common/src/main/java/common/block/artificial/BlockDoor.java +++ b/common/src/main/java/common/block/artificial/BlockDoor.java @@ -3,6 +3,7 @@ package common.block.artificial; import java.util.List; import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.collect.Lists; import common.entity.npc.EntityNPC; @@ -13,9 +14,8 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -29,9 +29,8 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockDoor extends Block +public class BlockDoor extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyEnum HINGE = PropertyEnum.create("hinge", BlockDoor.EnumHingePosition.class); public static final PropertyBool POWERED = PropertyBool.create("powered"); @@ -446,9 +445,9 @@ public class BlockDoor extends Block return (combinedMeta & 16) != 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {HALF, FACING, OPEN, HINGE, POWERED}; + return new Property[] {HALF, FACING, OPEN, HINGE, POWERED}; } private static ModelRotation getRotation(Facing rot, int offset) { @@ -500,8 +499,8 @@ public class BlockDoor extends Block } } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {POWERED}; + public Property[] getIgnoredProperties() { + return new Property[] {POWERED}; } public static enum EnumDoorHalf implements Identifyable diff --git a/common/src/main/java/common/block/artificial/BlockFence.java b/common/src/main/java/common/block/artificial/BlockFence.java index dfd3cad4..cc7b7fb1 100755 --- a/common/src/main/java/common/block/artificial/BlockFence.java +++ b/common/src/main/java/common/block/artificial/BlockFence.java @@ -13,7 +13,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.util.BlockPos; import common.util.BoundingBox; @@ -196,9 +196,9 @@ public class BlockFence extends Block return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {NORTH, EAST, WEST, SOUTH}; + return new Property[] {NORTH, EAST, WEST, SOUTH}; } public Transforms getTransform() { diff --git a/common/src/main/java/common/block/artificial/BlockFenceGate.java b/common/src/main/java/common/block/artificial/BlockFenceGate.java index 887479fc..f86f67a9 100755 --- a/common/src/main/java/common/block/artificial/BlockFenceGate.java +++ b/common/src/main/java/common/block/artificial/BlockFenceGate.java @@ -1,7 +1,7 @@ package common.block.artificial; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.Material; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -12,7 +12,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.util.BlockPos; import common.util.BoundingBox; @@ -22,7 +22,7 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockFenceGate extends BlockDirectional +public class BlockFenceGate extends Block implements Rotatable { public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyBool POWERED = PropertyBool.create("powered"); @@ -200,9 +200,9 @@ public class BlockFenceGate extends BlockDirectional return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, OPEN, POWERED, IN_WALL}; + return new Property[] {FACING, OPEN, POWERED, IN_WALL}; } public Transforms getTransform() { @@ -406,7 +406,7 @@ public class BlockFenceGate extends BlockDirectional .rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite())); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {POWERED}; + public Property[] getIgnoredProperties() { + return new Property[] {POWERED}; } } diff --git a/common/src/main/java/common/block/artificial/BlockFlowerPot.java b/common/src/main/java/common/block/artificial/BlockFlowerPot.java index 7c3436b5..5276b3b9 100755 --- a/common/src/main/java/common/block/artificial/BlockFlowerPot.java +++ b/common/src/main/java/common/block/artificial/BlockFlowerPot.java @@ -1,9 +1,13 @@ package common.block.artificial; +import java.util.List; + import common.block.Block; import common.block.Material; import common.block.foliage.BlockFlower; +import common.collect.Lists; import common.entity.npc.EntityNPC; +import common.init.BlockRegistry; import common.init.Blocks; import common.init.ItemRegistry; import common.init.Items; @@ -13,8 +17,6 @@ import common.item.ItemStack; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -22,7 +24,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockFlowerPot extends Block // Container +public class BlockFlowerPot extends Block { private static final Model flower_pot_cactus = ModelProvider.getModelProvider().getModel("flower_pot") .add(5, 0, 5, 6, 6, 11) @@ -99,23 +101,18 @@ public class BlockFlowerPot extends Block // Container .u("dirt").uv(6, 6, 10, 10).noCull() ; - public static final PropertyInteger CONTENTS = PropertyInteger.create("contents", 0, 1 + BlockFlower.EnumFlowerType.values().length); + public static final List POTS = Lists.newArrayList(); + + private final Block content; - public BlockFlowerPot() + public BlockFlowerPot(Block content) { super(Material.SMALL); - this.setDefaultState(this.getBaseState().withProperty(CONTENTS, 0)); // .withProperty(LEGACY_DATA, Integer.valueOf(0))); + this.content = content; this.setBlockBoundsForItemRender(); + POTS.add(this); } -// /** -// * Gets the localized name of this block. Used for the statistics page. -// */ -// public String getLocalizedName() -// { -// return "Blumentopf"; -// } - /** * Sets the block's bounds for rendering it as an item */ @@ -134,43 +131,18 @@ public class BlockFlowerPot extends Block // Container return false; } -// /** -// * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render -// */ -// public int getRenderType() -// { -// return 3; -// } - public boolean isFullCube() { return false; } -// public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) -// { -// TileEntity tileentity = worldIn.getTileEntity(pos); -// -// if (tileentity instanceof TileEntityFlowerPot) -// { -// Item item = ((TileEntityFlowerPot)tileentity).getFlowerPotItem(); -// -// if (item instanceof ItemBlock) -// { -// return BlockRegistry.getBlockFromItem(item).colorMultiplier(worldIn, pos, renderPass); -// } -// } -// -// return 16777215; -// } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { ItemStack itemstack = playerIn.inventory.getCurrentItem(); if (itemstack != null && itemstack.getItem() instanceof ItemBlock) { - if (state.getValue(CONTENTS) > 0) + if (this.content != null) { return false; } @@ -178,14 +150,13 @@ public class BlockFlowerPot extends Block // Container { Block block = itemstack.getItem().getBlock(); - if (block != Blocks.flower && block != Blocks.cactus) + if (!(block instanceof BlockFlower) && block != Blocks.cactus) { return false; } else { - worldIn.setState(pos, state.withProperty(CONTENTS, block == Blocks.cactus ? 1 : (2 + (itemstack.getMetadata() >= - BlockFlower.EnumFlowerType.values().length ? 0 : itemstack.getMetadata()))), 2); + worldIn.setState(pos, BlockRegistry.getRegisteredBlock("flowerpot_" + BlockRegistry.getNameFromBlock(this.content)).getState(), 2); // tileentityflowerpot.setFlowerPotData(itemstack.getItem(), itemstack.getMetadata()); // tileentityflowerpot.markDirty(); // worldIn.markBlockForUpdate(pos); @@ -208,18 +179,7 @@ public class BlockFlowerPot extends Block // Container public Item getItem(World worldIn, BlockPos pos) { - State state = worldIn.getState(pos); - return state.getBlock() == this ? (state.getValue(CONTENTS) == 1 ? ItemRegistry.getItemFromBlock(Blocks.cactus) : - (state.getValue(CONTENTS) >= 2 ? ItemRegistry.getItemFromBlock(Blocks.flower) : Items.flower_pot)) : Items.flower_pot; - } - - /** - * Gets the meta to use for the Pick Block ItemStack result - */ - public int getDamageValue(World worldIn, BlockPos pos) - { - State state = worldIn.getState(pos); - return state.getBlock() == this && state.getValue(CONTENTS) >= 2 ? state.getValue(CONTENTS) - 2 : 0; + return worldIn.getState(pos).getBlock() == this && this.content != null ? ItemRegistry.getItemFromBlock(this.content) : Items.flowerpot; } public boolean isPickStrict() @@ -246,117 +206,31 @@ public class BlockFlowerPot extends Block // Container public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) { - int type = state.getValue(CONTENTS); - if(type > 0) - spawnAsEntity(worldIn, pos, new ItemStack(type == 1 ? Blocks.cactus : Blocks.flower, 1, type == 1 ? 0 : (type - 2))); + if(this.content != null) + spawnAsEntity(worldIn, pos, new ItemStack(this.content)); super.onBlockRemoved(worldIn, pos, state); } -// public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityNPC player) -// { -// super.onBlockHarvested(worldIn, pos, state, player); -// -// if (player.capabilities.isCreativeMode) -// { -// TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); -// -// if (tileentityflowerpot != null) -// { -// tileentityflowerpot.setFlowerPotData((Item)null, 0); -// } -// } -// } - /** * Get the Item that this Block should drop when harvested. */ public Item getItemDropped(State state, Random rand, int fortune) { - return Items.flower_pot; + return Items.flowerpot; } - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(CONTENTS, Math.min(meta, BlockFlower.EnumFlowerType.values().length + 1)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return state.getValue(CONTENTS); - } - -// private TileEntityFlowerPot getTileEntity(World worldIn, BlockPos pos) -// { -// TileEntity tileentity = worldIn.getTileEntity(pos); -// return tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)tileentity : null; -// } -// -// /** -// * Returns a new instance of a block's tile entity class. Called on placing the block. -// */ -// public TileEntity createNewTileEntity(World worldIn, int meta) -// { -// return new TileEntityFlowerPot(null, 0); -// } - - protected IProperty[] getProperties() - { - return new IProperty[] {CONTENTS}; - } - -// /** -// * Get the actual Block state of this Block at the given position. This applies properties not visible in the -// * metadata, such as fence connections. -// */ -// public IBlockState getActualState(IBlockState state, IWorldAccess worldIn, BlockPos pos) -// { -// int type = 0; -// TileEntity tileentity = worldIn.getTileEntity(pos); -// -// if (tileentity instanceof TileEntityFlowerPot) -// { -// TileEntityFlowerPot tileentityflowerpot = (TileEntityFlowerPot)tileentity; -// Item item = tileentityflowerpot.getFlowerPotItem(); -// -// if (item instanceof ItemBlock) -// { -// int i = tileentityflowerpot.getFlowerPotData(); -// Block block = BlockRegistry.getBlockFromItem(item); -// if (block == Blocks.flower) -// { -// -// } -// else if (block == Blocks.cactus) -// { -// type = 1; -// } -// } -// } -// -// return state.withProperty(CONTENTS, type); -// } - public BlockLayer getBlockLayer() { return BlockLayer.CUTOUT; } public Model getModel(ModelProvider provider, String name, State state) { - switch(state.getValue(CONTENTS)) { - case 0: + if(this.content == null) return flower_pot; - case 1: + else if(this.content == Blocks.cactus) return flower_pot_cactus; -// case FERN: -// return flower_pot_fern; - default: - String plant = BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.BASE, state.getValue(CONTENTS) - 2).getName().toLowerCase(); + else { + String plant = BlockRegistry.getNameFromBlock(this.content); return provider.getModel("flower_pot") .add(5, 0, 5, 6, 6, 11) .d().uv(5, 5, 6, 11) diff --git a/common/src/main/java/common/block/artificial/BlockHay.java b/common/src/main/java/common/block/artificial/BlockHay.java index eefc04f3..c9de3f01 100755 --- a/common/src/main/java/common/block/artificial/BlockHay.java +++ b/common/src/main/java/common/block/artificial/BlockHay.java @@ -6,7 +6,7 @@ import common.entity.types.EntityLiving; import common.init.ItemRegistry; import common.item.CheatTab; import common.item.ItemStack; -import common.properties.IProperty; +import common.properties.Property; import common.util.BlockPos; import common.util.Facing; import common.world.State; @@ -61,14 +61,14 @@ public class BlockHay extends BlockRotatedPillar return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AXIS}; + return new Property[] {AXIS}; } public ItemStack createStackedBlock(State state) { - return new ItemStack(ItemRegistry.getItemFromBlock(this), 1, 0); + return new ItemStack(ItemRegistry.getItemFromBlock(this)); } /** diff --git a/common/src/main/java/common/block/artificial/BlockLadder.java b/common/src/main/java/common/block/artificial/BlockLadder.java index 20c8ac2f..d2b49b1f 100755 --- a/common/src/main/java/common/block/artificial/BlockLadder.java +++ b/common/src/main/java/common/block/artificial/BlockLadder.java @@ -1,7 +1,7 @@ package common.block.artificial; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.Material; import common.entity.types.EntityLiving; import common.item.CheatTab; @@ -9,8 +9,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -18,10 +17,8 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockLadder extends Block +public class BlockLadder extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); - public BlockLadder() { super(Material.SMALL); @@ -161,9 +158,9 @@ public class BlockLadder extends Block return ((Facing)state.getValue(FACING)).getIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { @@ -171,6 +168,6 @@ public class BlockLadder extends Block .add(0, 0, 15.2f, 16, 16, 15.2f).noShade() .n().uv(0, 0, 16, 16).noCull() .s().uv(0, 0, 16, 16).noCull() - .rotate(ModelRotation.getNorthRot(state.getValue(BlockDirectional.FACING))); + .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } } diff --git a/common/src/main/java/common/block/artificial/BlockPane.java b/common/src/main/java/common/block/artificial/BlockPane.java index 2125ba39..857376d6 100755 --- a/common/src/main/java/common/block/artificial/BlockPane.java +++ b/common/src/main/java/common/block/artificial/BlockPane.java @@ -12,7 +12,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -180,7 +180,7 @@ public class BlockPane extends Block public final boolean canPaneConnectToBlock(Block blockIn) { - return blockIn.isFullBlock() || blockIn == this || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.stained_glass_pane || blockIn instanceof BlockPane; + return blockIn.isFullBlock() || blockIn == this || blockIn == Blocks.glass || blockIn instanceof BlockStainedGlass || blockIn instanceof BlockStainedGlassPane || blockIn instanceof BlockPane; } public boolean canSilkHarvest() @@ -201,9 +201,9 @@ public class BlockPane extends Block return 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {NORTH, EAST, WEST, SOUTH}; + return new Property[] {NORTH, EAST, WEST, SOUTH}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/artificial/BlockPortal.java b/common/src/main/java/common/block/artificial/BlockPortal.java index a140f4b1..36e1b045 100755 --- a/common/src/main/java/common/block/artificial/BlockPortal.java +++ b/common/src/main/java/common/block/artificial/BlockPortal.java @@ -12,7 +12,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.properties.PropertyInteger; import common.rng.Random; @@ -277,9 +277,9 @@ public class BlockPortal extends Block return (state.getValue(AXIS) == Axis.Z ? 8 : 0) | state.getValue(DIM); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AXIS, DIM}; + return new Property[] {AXIS, DIM}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/artificial/BlockPortalFrame.java b/common/src/main/java/common/block/artificial/BlockPortalFrame.java index 0c5a300f..b33a0722 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -3,6 +3,7 @@ package common.block.artificial; import java.util.List; import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; @@ -15,9 +16,8 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -26,9 +26,8 @@ import common.util.Facing; import common.world.State; import common.world.World; -public class BlockPortalFrame extends Block +public class BlockPortalFrame extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyBool ORB = PropertyBool.create("orb"); public BlockPortalFrame() @@ -133,9 +132,9 @@ public class BlockPortalFrame extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, ORB}; + return new Property[] {FACING, ORB}; } public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state) diff --git a/common/src/main/java/common/block/artificial/BlockQuartz.java b/common/src/main/java/common/block/artificial/BlockQuartz.java index 5e78fc2d..85201d24 100755 --- a/common/src/main/java/common/block/artificial/BlockQuartz.java +++ b/common/src/main/java/common/block/artificial/BlockQuartz.java @@ -1,195 +1,36 @@ package common.block.artificial; -import java.util.List; - import common.block.Block; import common.block.Material; -import common.entity.types.EntityLiving; -import common.init.ItemRegistry; import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.model.ModelRotation; -import common.properties.IProperty; -import common.properties.PropertyEnum; -import common.util.BlockPos; -import common.util.Facing; -import common.util.Identifyable; import common.world.State; -import common.world.World; -public class BlockQuartz extends Block -{ - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockQuartz.EnumType.class); +public class BlockQuartz extends Block { + private final boolean dark; + private final boolean ornaments; - private final String prefix; - - public BlockQuartz(String prefix) - { - super(Material.SOLID); - this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockQuartz.EnumType.DEFAULT)); - this.setTab(CheatTab.BLOCKS); - this.prefix = prefix; - } + public BlockQuartz(boolean dark, boolean ornaments) { + super(Material.SOLID); + this.dark = dark; + this.ornaments = ornaments; + this.setTab(CheatTab.BLOCKS); + } - /** - * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the - * IBlockstate - */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) - { - if (meta == BlockQuartz.EnumType.LINES_Y.getMetadata()) - { - switch (facing.getAxis()) - { - case Z: - return this.getState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_Z); + public boolean isDark() { + return this.dark; + } - case X: - return this.getState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_X); + public boolean hasOrnaments() { + return this.ornaments; + } - case Y: - default: - return this.getState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_Y); - } - } - else - { - return meta == BlockQuartz.EnumType.CHISELED.getMetadata() ? this.getState().withProperty(VARIANT, BlockQuartz.EnumType.CHISELED) : this.getState().withProperty(VARIANT, BlockQuartz.EnumType.DEFAULT); - } - } - - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(VARIANT); - return blockquartz$enumtype != BlockQuartz.EnumType.LINES_X && blockquartz$enumtype != BlockQuartz.EnumType.LINES_Z ? blockquartz$enumtype.getMetadata() : BlockQuartz.EnumType.LINES_Y.getMetadata(); - } - - public ItemStack createStackedBlock(State state) - { - BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(VARIANT); - return blockquartz$enumtype != BlockQuartz.EnumType.LINES_X && blockquartz$enumtype != BlockQuartz.EnumType.LINES_Z ? super.createStackedBlock(state) : new ItemStack(ItemRegistry.getItemFromBlock(this), 1, BlockQuartz.EnumType.LINES_Y.getMetadata()); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - list.add(new ItemStack(itemIn, 1, BlockQuartz.EnumType.DEFAULT.getMetadata())); - list.add(new ItemStack(itemIn, 1, BlockQuartz.EnumType.CHISELED.getMetadata())); - list.add(new ItemStack(itemIn, 1, BlockQuartz.EnumType.LINES_Y.getMetadata())); - } - -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return MapColor.quartzColor; -// } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(VARIANT, BlockQuartz.EnumType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockQuartz.EnumType)state.getValue(VARIANT)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {VARIANT}; - } - - public Model getModel(ModelProvider provider, String name, State state) { - switch(state.getValue(VARIANT)) { - case DEFAULT: - default: - return provider.getModel(this.prefix + "quartz_block_side").add().nswe().d(this.prefix + "quartz_block_bottom").u(this.prefix + "quartz_top"); - case CHISELED: - return provider.getModel(this.prefix + "quartz_block_chiseled").add().nswe().du(this.prefix + "quartz_block_chiseled_top"); - case LINES_X: - return provider.getModel(this.prefix + "quartz_block_lines").add().nswe().du(this.prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y90); - case LINES_Y: - return provider.getModel(this.prefix + "quartz_block_lines").add().nswe().du(this.prefix + "quartz_block_lines_top"); - case LINES_Z: - return provider.getModel(this.prefix + "quartz_block_lines").add().nswe().du(this.prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y0); - } - } - - public static enum EnumType implements Identifyable - { - DEFAULT(0, "default", "default", null), - CHISELED(1, "chiseled", "chiseled", null), - LINES_Y(2, "lines_y", "lines", Facing.Axis.Y), - LINES_X(3, "lines_x", "lines", Facing.Axis.X), - LINES_Z(4, "lines_z", "lines", Facing.Axis.Z); - - private static final BlockQuartz.EnumType[] META_LOOKUP = new BlockQuartz.EnumType[values().length]; - private final int meta; - private final String name; - private final String unlocalizedName; - private final Facing.Axis axis; - - private EnumType(int meta, String name, String unlocalizedName, Facing.Axis axis) - { - this.meta = meta; - this.name = name; - this.unlocalizedName = unlocalizedName; - this.axis = axis; - } - - public int getMetadata() - { - return this.meta; - } - - public String toString() - { - return this.name; - // return this.unlocalizedName; - } - - public static BlockQuartz.EnumType byMetadata(int meta) - { - if (meta < 0 || meta >= META_LOOKUP.length) - { - meta = 0; - } - - return META_LOOKUP[meta]; - } - - public String getName() - { - return this.name; - } - - public Facing.Axis getAxis() - { - return this.axis; - } - - static { - for (BlockQuartz.EnumType blockquartz$enumtype : values()) - { - META_LOOKUP[blockquartz$enumtype.getMetadata()] = blockquartz$enumtype; - } - } - } + public Model getModel(ModelProvider provider, String name, State state) { + String prefix = this.dark ? "black_" : ""; + if(this.ornaments) + return provider.getModel(prefix + "quartz_block_chiseled").add().nswe().du(prefix + "quartz_block_chiseled_top"); + else + return provider.getModel(prefix + "quartz_block_side").add().nswe().d(prefix + "quartz_block_bottom").u(prefix + "quartz_top"); + } } diff --git a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java new file mode 100644 index 00000000..ca6c6724 --- /dev/null +++ b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java @@ -0,0 +1,87 @@ +package common.block.artificial; + +import common.block.BlockRotatedPillar; +import common.block.Material; +import common.entity.types.EntityLiving; +import common.item.CheatTab; +import common.model.Model; +import common.model.ModelProvider; +import common.model.ModelRotation; +import common.properties.Property; +import common.util.BlockPos; +import common.util.Facing; +import common.world.State; +import common.world.World; + +public class BlockQuartzPillar extends BlockRotatedPillar +{ + private final boolean dark; + + public BlockQuartzPillar(boolean dark) + { + super(Material.SOLID); + this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y)); + this.setTab(CheatTab.BLOCKS); + this.dark = dark; + } + + public boolean isDark() { + return this.dark; + } + + public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) + { + return this.getState().withProperty(AXIS, facing.getAxis()); + } + + public State getStateFromMeta(int meta) + { + State state = this.getState(); + switch (meta & 3) + { + default: + state = state.withProperty(AXIS, Facing.Axis.Y); + break; + case 1: + state = state.withProperty(AXIS, Facing.Axis.X); + break; + case 2: + state = state.withProperty(AXIS, Facing.Axis.Z); + break; + } + return state; + } + + public int getMetaFromState(State state) + { + int meta = 0; + switch (state.getValue(AXIS)) + { + case X: + meta = 1; + break; + case Z: + meta = 2; + break; + } + return meta; + } + + protected Property[] getProperties() + { + return new Property[] {AXIS}; + } + + public Model getModel(ModelProvider provider, String name, State state) { + String prefix = this.dark ? "black_" : ""; + switch(state.getValue(AXIS)) { + case X: + return provider.getModel(prefix + "quartz_block_lines").add().nswe().du(prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y90); + case Y: + default: + return provider.getModel(prefix + "quartz_block_lines").add().nswe().du(prefix + "quartz_block_lines_top"); + case Z: + return provider.getModel(prefix + "quartz_block_lines").add().nswe().du(prefix + "quartz_block_lines_top").rotate(ModelRotation.X90_Y0); + } + } +} diff --git a/common/src/main/java/common/block/artificial/BlockSkull.java b/common/src/main/java/common/block/artificial/BlockSkull.java index f5f0c268..1b68aedf 100755 --- a/common/src/main/java/common/block/artificial/BlockSkull.java +++ b/common/src/main/java/common/block/artificial/BlockSkull.java @@ -1,6 +1,7 @@ package common.block.artificial; -import common.block.BlockDirectional; +import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.Entity; import common.entity.types.EntityLiving; @@ -9,14 +10,14 @@ import common.item.Item; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; import common.world.State; import common.world.World; -public class BlockSkull extends BlockDirectional { +public class BlockSkull extends Block implements Rotatable { public BlockSkull() { super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); @@ -39,8 +40,8 @@ public class BlockSkull extends BlockDirectional { return state.getValue(FACING).getHorizontalIndex(); } - protected IProperty[] getProperties() { - return new IProperty[] {FACING}; + protected Property[] getProperties() { + return new Property[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/artificial/BlockSlab.java b/common/src/main/java/common/block/artificial/BlockSlab.java index 223745c7..3ae3d0db 100755 --- a/common/src/main/java/common/block/artificial/BlockSlab.java +++ b/common/src/main/java/common/block/artificial/BlockSlab.java @@ -3,6 +3,7 @@ package common.block.artificial; import java.util.List; import common.block.Block; +import common.block.Directional; import common.block.Material; import common.collect.Lists; import common.entity.Entity; @@ -12,9 +13,8 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -23,9 +23,8 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockSlab extends Block +public class BlockSlab extends Block implements Directional { - public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool DOUBLE = PropertyBool.create("double"); public static final PropertyBool SEAMLESS = PropertyBool.create("seamless"); public static final List SLABS = Lists.newArrayList(); @@ -72,9 +71,9 @@ public class BlockSlab extends Block return dir == Facing.DOWN ? 0 : (dir == Facing.UP ? 1 : (dir.getHorizontalIndex() + 2)); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, DOUBLE, SEAMLESS}; + return new Property[] {FACING, DOUBLE, SEAMLESS}; } public boolean canSilkHarvest() @@ -96,7 +95,7 @@ public class BlockSlab extends Block if (item != null) { - spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); + spawnAsEntity(worldIn, pos, new ItemStack(item)); } } } diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlass.java b/common/src/main/java/common/block/artificial/BlockStainedGlass.java index 8ca8637c..84121a8b 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlass.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlass.java @@ -1,52 +1,34 @@ package common.block.artificial; -import java.util.List; - import common.color.DyeColor; -import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyEnum; import common.world.State; public class BlockStainedGlass extends BlockGlass { - public static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); + public static final BlockStainedGlass[] GLASS = new BlockStainedGlass[DyeColor.values().length]; + + private final DyeColor color; + + public static BlockStainedGlass getByColor(DyeColor color) { + return GLASS[color.getMetadata()]; + } - public BlockStainedGlass() { - this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE)); + public BlockStainedGlass(DyeColor color) { + this.color = color; + GLASS[color.ordinal()] = this; } - - public int damageDropped(State state) { - return state.getValue(COLOR).getMetadata(); - } - - public void getSubBlocks(Item item, CheatTab tab, List list) { - for(DyeColor color : DyeColor.values()) { - list.add(new ItemStack(item, 1, color.getMetadata())); - } + + public DyeColor getColor() { + return this.color; } public BlockLayer getBlockLayer() { return BlockLayer.TRANSLUCENT; } - public State getStateFromMeta(int meta) { - return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta)); - } - - public int getMetaFromState(State state) { - return state.getValue(COLOR).getMetadata(); - } - - protected IProperty[] getProperties() { - return new IProperty[] {COLOR}; - } - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(state.getValue(COLOR).getName() + "_glass").add().all(); + return provider.getModel(this.color.getName() + "_glass").add().all(); } } diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java index 9c295817..2b103321 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java @@ -1,103 +1,50 @@ package common.block.artificial; -import java.util.List; - import common.block.Material; import common.color.DyeColor; import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.BlockLayer; -import common.properties.IProperty; -import common.properties.PropertyEnum; +import common.properties.Property; import common.world.State; public class BlockStainedGlassPane extends BlockPane { - public static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); + public static final BlockStainedGlassPane[] PANES = new BlockStainedGlassPane[DyeColor.values().length]; + + private final DyeColor color; + + public static BlockStainedGlassPane getByColor(DyeColor color) { + return PANES[color.getMetadata()]; + } - public BlockStainedGlassPane() + public BlockStainedGlassPane(DyeColor color) { super(Material.TRANSLUCENT, false); - this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(COLOR, DyeColor.WHITE)); + this.color = color; + this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); this.setTab(CheatTab.BLOCKS); + PANES[color.ordinal()] = this; } - - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((DyeColor)state.getValue(COLOR)).getMetadata(); + + public DyeColor getColor() { + return this.color; } - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (int i = 0; i < DyeColor.values().length; ++i) - { - list.add(new ItemStack(itemIn, 1, i)); - } - } - -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); -// } - public BlockLayer getBlockLayer() { return BlockLayer.TRANSLUCENT; } - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) + protected Property[] getProperties() { - return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta)); + return new Property[] {NORTH, EAST, WEST, SOUTH}; } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((DyeColor)state.getValue(COLOR)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {NORTH, EAST, WEST, SOUTH, COLOR}; - } - -// public void onBlockAdded(IWorldServer worldIn, BlockPos pos, State state) -// { -// if (!worldIn.client) -// { -// BlockBeacon.updateColorAsync(worldIn, pos); -// } -// } -// -// public void onBlockRemoved(IWorldServer worldIn, BlockPos pos, State state) -// { -// if (!worldIn.client) -// { -// BlockBeacon.updateColorAsync(worldIn, pos); -// } -// } protected String getPaneBase(State state) { - return state.getValue(COLOR).getName() + "_glass"; + return this.color.getName() + "_glass"; } protected String getPaneEdge(State state) { - return state.getValue(COLOR).getName() + "_glass_pane"; + return this.color.getName() + "_glass_pane"; } } diff --git a/common/src/main/java/common/block/artificial/BlockStairs.java b/common/src/main/java/common/block/artificial/BlockStairs.java index 337f7153..a8cd4e11 100755 --- a/common/src/main/java/common/block/artificial/BlockStairs.java +++ b/common/src/main/java/common/block/artificial/BlockStairs.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.List; import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; @@ -15,8 +16,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -33,9 +33,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockStairs extends Block +public class BlockStairs extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyEnum HALF = PropertyEnum.create("half", BlockStairs.EnumHalf.class); public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockStairs.EnumShape.class); private static final int[][] field_150150_a = new int[][] {{4, 5}, {5, 7}, {6, 7}, {4, 6}, {0, 1}, {1, 3}, {2, 3}, {0, 2}}; @@ -805,9 +804,9 @@ public class BlockStairs extends Block return state; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, HALF, SHAPE}; + return new Property[] {FACING, HALF, SHAPE}; } public Transforms getTransform() { diff --git a/common/src/main/java/common/block/artificial/BlockStoneBrick.java b/common/src/main/java/common/block/artificial/BlockStoneBrick.java deleted file mode 100755 index f0a7508f..00000000 --- a/common/src/main/java/common/block/artificial/BlockStoneBrick.java +++ /dev/null @@ -1,140 +0,0 @@ -package common.block.artificial; - -import java.util.List; - -import common.block.Block; -import common.block.Material; -import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; -import common.model.Model; -import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyEnum; -import common.util.Identifyable; -import common.world.State; - -public class BlockStoneBrick extends Block -{ - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockStoneBrick.EnumType.class); - public static final int DEFAULT_META = BlockStoneBrick.EnumType.DEFAULT.getMetadata(); - public static final int MOSSY_META = BlockStoneBrick.EnumType.MOSSY.getMetadata(); - public static final int CRACKED_META = BlockStoneBrick.EnumType.CRACKED.getMetadata(); - public static final int CHISELED_META = BlockStoneBrick.EnumType.CHISELED.getMetadata(); - - public BlockStoneBrick() - { - super(Material.SOLID); - this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockStoneBrick.EnumType.DEFAULT)); - this.setTab(CheatTab.BLOCKS); - } - - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((BlockStoneBrick.EnumType)state.getValue(VARIANT)).getMetadata(); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (BlockStoneBrick.EnumType blockstonebrick$enumtype : BlockStoneBrick.EnumType.values()) - { - list.add(new ItemStack(itemIn, 1, blockstonebrick$enumtype.getMetadata())); - } - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(VARIANT, BlockStoneBrick.EnumType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockStoneBrick.EnumType)state.getValue(VARIANT)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {VARIANT}; - } - - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel("stonebrick_" + state.getValue(VARIANT).getTexture()).add().all(); - } - - public static enum EnumType implements Identifyable - { - DEFAULT("default", 0, "stonebrick", "Steinziegel"), - MOSSY("mossy", 1, "mossy_stonebrick", "Bemooste Steinziegel"), - CRACKED("cracked", 2, "cracked_stonebrick", "Rissige Steinziegel"), - CHISELED("chiseled", 3, "chiseled_stonebrick", "GemeiĂŸelte Steinziegel"); - - private static final BlockStoneBrick.EnumType[] META_LOOKUP = new BlockStoneBrick.EnumType[values().length]; - private final int meta; - private final String texture; - private final String name; - private final String display; - - private EnumType(String texture, int meta, String name, String display) - { - this.texture = texture; - this.meta = meta; - this.name = name; - this.display = display; - } - - public int getMetadata() - { - return this.meta; - } - - public String toString() - { - return this.name; - } - - public static BlockStoneBrick.EnumType byMetadata(int meta) - { - if (meta < 0 || meta >= META_LOOKUP.length) - { - meta = 0; - } - - return META_LOOKUP[meta]; - } - - public String getName() - { - return this.name; - } - - public String getTexture() - { - return this.texture; - } - - public String getDisplay() - { - return this.display; - } - - static { - for (BlockStoneBrick.EnumType blockstonebrick$enumtype : values()) - { - META_LOOKUP[blockstonebrick$enumtype.getMetadata()] = blockstonebrick$enumtype; - } - } - } -} diff --git a/common/src/main/java/common/block/artificial/BlockTrapDoor.java b/common/src/main/java/common/block/artificial/BlockTrapDoor.java index 3f970d69..ba94d827 100755 --- a/common/src/main/java/common/block/artificial/BlockTrapDoor.java +++ b/common/src/main/java/common/block/artificial/BlockTrapDoor.java @@ -1,6 +1,7 @@ package common.block.artificial; import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -11,9 +12,8 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.util.BlockPos; import common.util.BoundingBox; @@ -26,9 +26,8 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockTrapDoor extends Block +public class BlockTrapDoor extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); @@ -250,7 +249,7 @@ public class BlockTrapDoor extends Block private static boolean isValidSupportBlock(Block blockIn) { - return blockIn.getMaterial().isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + return blockIn.getMaterial().isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn instanceof BlockStainedGlass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; } public BlockLayer getBlockLayer() @@ -287,9 +286,9 @@ public class BlockTrapDoor extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, OPEN, HALF}; + return new Property[] {FACING, OPEN, HALF}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/artificial/BlockWall.java b/common/src/main/java/common/block/artificial/BlockWall.java index 703eed41..40432a4a 100755 --- a/common/src/main/java/common/block/artificial/BlockWall.java +++ b/common/src/main/java/common/block/artificial/BlockWall.java @@ -4,20 +4,17 @@ import java.util.List; import common.block.Block; import common.block.Material; +import common.collect.Lists; import common.init.Blocks; import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyEnum; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; -import common.util.Identifyable; import common.world.IBlockAccess; import common.world.IWorldAccess; import common.world.State; @@ -30,25 +27,25 @@ public class BlockWall extends Block public static final PropertyBool EAST = PropertyBool.create("east"); public static final PropertyBool SOUTH = PropertyBool.create("south"); public static final PropertyBool WEST = PropertyBool.create("west"); - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockWall.EnumType.class); + public static final List WALLS = Lists.newArrayList(); + + private final String texture; - public BlockWall(Block modelBlock) + public BlockWall(Block modelBlock, String texture) { super(modelBlock.getMaterial()); - this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(VARIANT, BlockWall.EnumType.NORMAL)); + this.texture = texture; + this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); this.setHardness(modelBlock.getRawHardness()); this.setResistance(modelBlock.getRawResistance() / 3.0F); this.setStepSound(modelBlock.sound); this.setTab(CheatTab.BLOCKS); + WALLS.add(this); + } + + public String getTexture() { + return this.texture; } - -// /** -// * Gets the localized name of this block. Used for the statistics page. -// */ -// public String getLocalizedName() -// { -// return "Bruchsteinmauer"; -// } public boolean isFullCube() { @@ -129,47 +126,11 @@ public class BlockWall extends Block return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true); } - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (BlockWall.EnumType blockwall$enumtype : BlockWall.EnumType.values()) - { - list.add(new ItemStack(itemIn, 1, blockwall$enumtype.getMetadata())); - } - } - - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((BlockWall.EnumType)state.getValue(VARIANT)).getMetadata(); - } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) { return side == Facing.DOWN ? super.shouldSideBeRendered(worldIn, pos, side) : true; } - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(VARIANT, BlockWall.EnumType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockWall.EnumType)state.getValue(VARIANT)).getMetadata(); - } - /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. @@ -179,13 +140,17 @@ public class BlockWall extends Block return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); } - protected IProperty[] getProperties() + public int getMetaFromState(State state) { + return 0; + } + + protected Property[] getProperties() { - return new IProperty[] {UP, NORTH, EAST, WEST, SOUTH, VARIANT}; + return new Property[] {UP, NORTH, EAST, WEST, SOUTH}; } public Model getModel(ModelProvider provider, String name, State state) { - String wall = state.getValue(VARIANT).getName(); + String wall = this.texture; boolean n = state.getValue(NORTH); boolean s = state.getValue(SOUTH); boolean w = state.getValue(WEST); @@ -328,59 +293,4 @@ public class BlockWall extends Block .e().uv(5, 3, 11, 16) .rotate(!w ? ModelRotation.X0_Y0 : (!e ? ModelRotation.X0_Y180 : (!s ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90))); } - - public static enum EnumType implements Identifyable - { - NORMAL(0, "cobblestone", "Bruchsteinmauer"), - MOSSY(1, "mossy_cobblestone", "Bemooste Bruchsteinmauer"); - - private static final BlockWall.EnumType[] META_LOOKUP = new BlockWall.EnumType[values().length]; - private final int meta; - private final String name; - private String display; - - private EnumType(int meta, String name, String display) - { - this.meta = meta; - this.name = name; - this.display = display; - } - - public int getMetadata() - { - return this.meta; - } - - public String toString() - { - return this.name; - } - - public static BlockWall.EnumType byMetadata(int meta) - { - if (meta < 0 || meta >= META_LOOKUP.length) - { - meta = 0; - } - - return META_LOOKUP[meta]; - } - - public String getName() - { - return this.name; - } - - public String getDisplay() - { - return this.display; - } - - static { - for (BlockWall.EnumType blockwall$enumtype : values()) - { - META_LOOKUP[blockwall$enumtype.getMetadata()] = blockwall$enumtype; - } - } - } } diff --git a/common/src/main/java/common/block/artificial/BlockWool.java b/common/src/main/java/common/block/artificial/BlockWool.java new file mode 100755 index 00000000..10bad55f --- /dev/null +++ b/common/src/main/java/common/block/artificial/BlockWool.java @@ -0,0 +1,34 @@ +package common.block.artificial; + +import common.block.Block; +import common.block.Material; +import common.color.DyeColor; +import common.item.CheatTab; +import common.model.Model; +import common.model.ModelProvider; +import common.world.State; + +public class BlockWool extends Block { + public static final BlockWool[] WOOLS = new BlockWool[DyeColor.values().length]; + + private final DyeColor color; + + public static BlockWool getByColor(DyeColor color) { + return WOOLS[color.getMetadata()]; + } + + public BlockWool(DyeColor color) { + super(Material.BURNABLE); + this.color = color; + this.setTab(CheatTab.BLOCKS); + WOOLS[color.ordinal()] = this; + } + + public DyeColor getColor() { + return this.color; + } + + public Model getModel(ModelProvider provider, String name, State state) { + return provider.getModel(this.color.getName() + "_wool").add().all(); + } +} diff --git a/common/src/main/java/common/block/foliage/BlockBaseFlower.java b/common/src/main/java/common/block/foliage/BlockBaseFlower.java deleted file mode 100755 index 413ec6eb..00000000 --- a/common/src/main/java/common/block/foliage/BlockBaseFlower.java +++ /dev/null @@ -1,9 +0,0 @@ -package common.block.foliage; - -public class BlockBaseFlower extends BlockFlower -{ - public BlockFlower.EnumFlowerColor getBlockType() - { - return BlockFlower.EnumFlowerColor.BASE; - } -} diff --git a/common/src/main/java/common/block/foliage/BlockCactus.java b/common/src/main/java/common/block/foliage/BlockCactus.java index 204599a5..7a496474 100755 --- a/common/src/main/java/common/block/foliage/BlockCactus.java +++ b/common/src/main/java/common/block/foliage/BlockCactus.java @@ -9,7 +9,7 @@ import common.item.CheatTab; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -161,16 +161,16 @@ public class BlockCactus extends Block return ((Integer)state.getValue(AGE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AGE}; + return new Property[] {AGE}; } public Model getModel(ModelProvider provider, String name, State state) { return cactus; } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {AGE}; + public Property[] getIgnoredProperties() { + return new Property[] {AGE}; } } diff --git a/common/src/main/java/common/block/foliage/BlockCocoa.java b/common/src/main/java/common/block/foliage/BlockCocoa.java index 3f8e27c9..d3296a1e 100755 --- a/common/src/main/java/common/block/foliage/BlockCocoa.java +++ b/common/src/main/java/common/block/foliage/BlockCocoa.java @@ -1,7 +1,7 @@ package common.block.foliage; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.Material; import common.color.DyeColor; import common.entity.types.EntityLiving; @@ -13,7 +13,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -25,7 +25,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockCocoa extends BlockDirectional implements IGrowable +public class BlockCocoa extends Block implements Rotatable, IGrowable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 2); @@ -169,21 +169,13 @@ public class BlockCocoa extends BlockDirectional implements IGrowable for (int k = 0; k < j; ++k) { - spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, DyeColor.BROWN.getDyeDamage())); + spawnAsEntity(worldIn, pos, new ItemStack(Items.cocoa)); } } public Item getItem(World worldIn, BlockPos pos) { - return Items.dye; - } - - /** - * Gets the meta to use for the Pick Block ItemStack result - */ - public int getDamageValue(World worldIn, BlockPos pos) - { - return DyeColor.BROWN.getDyeDamage(); + return Items.cocoa; } /** @@ -228,9 +220,9 @@ public class BlockCocoa extends BlockDirectional implements IGrowable return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, AGE}; + return new Property[] {FACING, AGE}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockCrops.java b/common/src/main/java/common/block/foliage/BlockCrops.java index db1806e4..55749f46 100755 --- a/common/src/main/java/common/block/foliage/BlockCrops.java +++ b/common/src/main/java/common/block/foliage/BlockCrops.java @@ -9,7 +9,7 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -163,7 +163,7 @@ public class BlockCrops extends BlockBush implements IGrowable { if (worldIn.rand.zrange(15) <= i) { - spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); + spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed())); } } } @@ -217,9 +217,9 @@ public class BlockCrops extends BlockBush implements IGrowable return ((Integer)state.getValue(AGE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AGE}; + return new Property[] {AGE}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockDeadBush.java b/common/src/main/java/common/block/foliage/BlockDeadBush.java index 9e24f13c..8d1ca4c0 100755 --- a/common/src/main/java/common/block/foliage/BlockDeadBush.java +++ b/common/src/main/java/common/block/foliage/BlockDeadBush.java @@ -2,6 +2,7 @@ package common.block.foliage; import common.block.Block; import common.block.Material; +import common.block.natural.BlockColoredClay; import common.entity.npc.EntityNPC; import common.init.Blocks; import common.init.Items; @@ -38,7 +39,7 @@ public class BlockDeadBush extends BlockBush */ protected boolean canPlaceBlockOn(Block ground) { - return ground == Blocks.sand || ground == Blocks.hardened_clay || ground == Blocks.stained_hardened_clay || ground == Blocks.dirt; + return ground == Blocks.sand || ground == Blocks.hardened_clay || ground instanceof BlockColoredClay || ground == Blocks.dirt; } /** @@ -62,7 +63,7 @@ public class BlockDeadBush extends BlockBush if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { // player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush)); } else { diff --git a/common/src/main/java/common/block/foliage/BlockDoublePlant.java b/common/src/main/java/common/block/foliage/BlockDoublePlant.java index 34ef4246..feed960a 100755 --- a/common/src/main/java/common/block/foliage/BlockDoublePlant.java +++ b/common/src/main/java/common/block/foliage/BlockDoublePlant.java @@ -3,9 +3,10 @@ package common.block.foliage; import java.util.List; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.Material; import common.block.SoundType; +import common.collect.Lists; import common.color.Colorizer; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -18,7 +19,7 @@ import common.item.ItemShears; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; @@ -32,20 +33,29 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockDoublePlant extends BlockBush implements IGrowable +public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable { - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); - public static final PropertyEnum FACING = BlockDirectional.FACING; + public static final BlockDoublePlant[] PLANTS = new BlockDoublePlant[EnumPlantType.values().length]; - public BlockDoublePlant() + private final EnumPlantType type; + + public static BlockDoublePlant getByType(EnumPlantType type) { + return PLANTS[type.ordinal()]; + } + + public BlockDoublePlant(EnumPlantType type) { super(Material.BUSH); - this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockDoublePlant.EnumPlantType.SUNFLOWER).withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, Facing.NORTH)); + this.type = type; + this.setDefaultState(this.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, Facing.NORTH)); this.setHardness(0.0F); this.setStepSound(SoundType.GRASS); -// this.setDisplay("doublePlant"); -// this.setTickRandomly(); + PLANTS[type.ordinal()] = this; + } + + public EnumPlantType getType() { + return this.type; } public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) @@ -59,8 +69,8 @@ public class BlockDoublePlant extends BlockBush implements IGrowable worldIn.setState(pos, Blocks.air.getState()); pos = pos.down(); if(!upper || worldIn.getState(pos).getBlock() == this) - worldIn.setState(pos, state.getValue(VARIANT) == EnumPlantType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : - Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); + worldIn.setState(pos, this.type == EnumPlantType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : + Blocks.dead_bush.getState()); return; } super.updateTick(worldIn, pos, state, rand); @@ -71,21 +81,6 @@ public class BlockDoublePlant extends BlockBush implements IGrowable this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public BlockDoublePlant.EnumPlantType getVariant(IWorldAccess worldIn, BlockPos pos) - { - State iblockstate = worldIn.getState(pos); - - if (iblockstate.getBlock() == this) - { - iblockstate = this.getActualState(iblockstate, worldIn, pos); - return (BlockDoublePlant.EnumPlantType)iblockstate.getValue(VARIANT); - } - else - { - return BlockDoublePlant.EnumPlantType.FERN; - } - } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { return super.canPlaceBlockAt(worldIn, pos) && worldIn.isAirBlock(pos.up()); @@ -104,8 +99,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } else { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)this.getActualState(iblockstate, worldIn, pos).getValue(VARIANT); - return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN || blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS; + return this.type == BlockDoublePlant.EnumPlantType.FERN || this.type == BlockDoublePlant.EnumPlantType.GRASS; } } @@ -160,29 +154,18 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } else { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT); - return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN ? null : (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat : null) : ItemRegistry.getItemFromBlock(this)); + return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat : null) : ItemRegistry.getItemFromBlock(this)); } } - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.UPPER && state.getValue(VARIANT) != BlockDoublePlant.EnumPlantType.GRASS ? ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT)).getMeta() : 0; - } - public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = this.getVariant(worldIn, pos); - return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(worldIn, pos); + return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(worldIn, pos); } - public void placeAt(World worldIn, BlockPos lowerPos, BlockDoublePlant.EnumPlantType variant, int flags) + public void placeAt(World worldIn, BlockPos lowerPos, int flags) { - worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT, variant), flags); + worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER), flags); worldIn.setState(lowerPos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags); } @@ -211,9 +194,8 @@ public class BlockDoublePlant extends BlockBush implements IGrowable // if (!player.creative) // { State iblockstate = worldIn.getState(pos.down()); - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)iblockstate.getValue(VARIANT); - if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS) + if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS) { worldIn.destroyBlock(pos.down(), true); } @@ -250,47 +232,23 @@ public class BlockDoublePlant extends BlockBush implements IGrowable private boolean onHarvest(World worldIn, BlockPos pos, State state, EntityNPC player) { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT); - - if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS) + if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS) { return false; } else { -// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + spawnAsEntity(worldIn, pos, new ItemStack(this.type == BlockDoublePlant.EnumPlantType.GRASS ? Blocks.tallgrass : Blocks.fern, 2)); return true; } } - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype : BlockDoublePlant.EnumPlantType.values()) - { - list.add(new ItemStack(itemIn, 1, blockdoubleplant$enumplanttype.getMeta())); - } - } - - /** - * Gets the meta to use for the Pick Block ItemStack result - */ - public int getDamageValue(World worldIn, BlockPos pos) - { - return this.getVariant(worldIn, pos).getMeta(); - } - /** * Whether this IGrowable can grow */ public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = this.getVariant(worldIn, pos); - return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN; + return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN; } public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) @@ -300,7 +258,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) { - spawnAsEntity(worldIn, pos, new ItemStack(this, 1, this.getVariant(worldIn, pos).getMeta())); + spawnAsEntity(worldIn, pos, new ItemStack(this)); } /** @@ -308,26 +266,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable */ public State getStateFromMeta(int meta) { - return (meta & 8) > 0 ? this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER) : this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT, BlockDoublePlant.EnumPlantType.byMetadata(meta & 7)); - } - - /** - * Get the actual Block state of this Block at the given position. This applies properties not visible in the - * metadata, such as fence connections. - */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) - { - if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) - { - State iblockstate = worldIn.getState(pos.down()); - - if (iblockstate.getBlock() == this) - { - state = state.withProperty(VARIANT, iblockstate.getValue(VARIANT)); - } - } - - return state; + return (meta & 8) > 0 ? this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER) : this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER); } /** @@ -335,21 +274,16 @@ public class BlockDoublePlant extends BlockBush implements IGrowable */ public int getMetaFromState(State state) { - return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 | ((Facing)state.getValue(FACING)).getHorizontalIndex() : ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT)).getMeta(); + return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 | ((Facing)state.getValue(FACING)).getHorizontalIndex() : 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {HALF, VARIANT, FACING}; + return new Property[] {HALF, FACING}; } - -// public EnumOffsetType getOffsetType() -// { -// return EnumOffsetType.XZ; -// } public Model getModel(ModelProvider provider, String name, State state) { - if(state.getValue(VARIANT) == EnumPlantType.SUNFLOWER && state.getValue(HALF) == EnumBlockHalf.UPPER) + if(this.type == EnumPlantType.SUNFLOWER && state.getValue(HALF) == EnumBlockHalf.UPPER) return provider.getModel("sunflower_front") .add(0.8f, 0f, 8f, 15.2f, 8f, 8f).noShade().rotate(8, 8, 8, Axis.Y, 45, true).ns("sunflower_top") .uv(0, 8, 16, 16).noCull() @@ -357,16 +291,16 @@ public class BlockDoublePlant extends BlockBush implements IGrowable .uv(0, 8, 16, 16).noCull() .add(9.6f, -1f, 1f, 9.6f, 15f, 15f).noShade().rotate(8, 8, 8, Axis.Z, 22.5f, true).w("sunflower_back") .uv(0, 0, 16, 16).noCull().e().uv(0, 0, 16, 16).noCull(); - else if(state.getValue(VARIANT) == EnumPlantType.FERN || state.getValue(VARIANT) == EnumPlantType.GRASS) - return provider.getModel(state.getValue(VARIANT).getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER + else if(this.type == EnumPlantType.FERN || this.type == EnumPlantType.GRASS) + return provider.getModel(this.type.getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER ? "top" : "bottom")).crossTint(); else - return provider.getModel(state.getValue(VARIANT).getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER + return provider.getModel(this.type.getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER ? "top" : "bottom")).cross(); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {FACING}; + public Property[] getIgnoredProperties() { + return new Property[] {FACING}; } public static enum EnumBlockHalf implements Identifyable @@ -389,9 +323,9 @@ public class BlockDoublePlant extends BlockBush implements IGrowable { SUNFLOWER(0, "sunflower", "Sonnenblume"), SYRINGA(1, "syringa", "Flieder"), - GRASS(2, "double_grass", "Hohes Gras"), - FERN(3, "double_fern", "GroĂŸer Farn"), - ROSE(4, "double_rose", "Rosenstrauch"), + GRASS(2, "large_tallgrass", "Hohes Gras"), + FERN(3, "large_fern", "GroĂŸer Farn"), + ROSE(4, "rose_bush", "Rosenstrauch"), PAEONIA(5, "paeonia", "Pfingstrose"); private static final BlockDoublePlant.EnumPlantType[] META_LOOKUP = new BlockDoublePlant.EnumPlantType[values().length]; diff --git a/common/src/main/java/common/block/foliage/BlockFarmland.java b/common/src/main/java/common/block/foliage/BlockFarmland.java index d4ccd0ec..1a442cca 100755 --- a/common/src/main/java/common/block/foliage/BlockFarmland.java +++ b/common/src/main/java/common/block/foliage/BlockFarmland.java @@ -2,15 +2,15 @@ package common.block.foliage; import common.block.Block; import common.block.Material; -import common.block.natural.BlockDirt; import common.entity.Entity; import common.entity.types.EntityLiving; import common.init.Blocks; import common.init.ItemRegistry; +import common.init.Items; import common.item.Item; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -149,12 +149,12 @@ public class BlockFarmland extends Block */ public Item getItemDropped(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); + return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); } public Item getItem(World worldIn, BlockPos pos) { - return ItemRegistry.getItemFromBlock(Blocks.dirt); + return Items.dirt; } /** @@ -173,9 +173,9 @@ public class BlockFarmland extends Block return ((Integer)state.getValue(MOISTURE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {MOISTURE}; + return new Property[] {MOISTURE}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockFlower.java b/common/src/main/java/common/block/foliage/BlockFlower.java index dabe90f2..f69ba5e2 100755 --- a/common/src/main/java/common/block/foliage/BlockFlower.java +++ b/common/src/main/java/common/block/foliage/BlockFlower.java @@ -12,7 +12,7 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -21,14 +21,24 @@ import common.vars.Vars; import common.world.State; import common.world.AWorldServer; -public abstract class BlockFlower extends BlockBush +public class BlockFlower extends BlockBush { - protected PropertyEnum type; + public static final BlockFlower[] FLOWERS = new BlockFlower[EnumFlowerType.values().length]; + + private final EnumFlowerType type; + + public static BlockFlower getByType(EnumFlowerType type) { + return FLOWERS[type.ordinal()]; + } - public BlockFlower() + public BlockFlower(EnumFlowerType type) { - this.setDefaultState(this.getBaseState().withProperty(this.getTypeProperty(), /* this.getBlockType() == BlockFlower.EnumFlowerColor.RED ? BlockFlower.EnumFlowerType.ROSE : */ BlockFlower.EnumFlowerType.DANDELION)); -// this.setTickRandomly(); + this.type = type; + FLOWERS[type.ordinal()] = this; + } + + public EnumFlowerType getType() { + return this.type; } public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) @@ -36,154 +46,40 @@ public abstract class BlockFlower extends BlockBush if(Vars.flowerDry && worldIn.getTemperatureC(pos) >= 50.0f) { worldIn.setState(pos, worldIn.rand.chance(3) ? Blocks.air.getState() : - Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); + Blocks.dead_bush.getState()); return; } super.updateTick(worldIn, pos, state, rand); } - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((BlockFlower.EnumFlowerType)state.getValue(this.getTypeProperty())).getMeta(); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (BlockFlower.EnumFlowerType blockflower$enumflowertype : BlockFlower.EnumFlowerType.getTypes(this.getBlockType())) - { - list.add(new ItemStack(itemIn, 1, blockflower$enumflowertype.getMeta())); - } - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(this.getTypeProperty(), BlockFlower.EnumFlowerType.getType(this.getBlockType(), meta)); - } - - /** - * Get the Type of this flower (Yellow/Red) - */ - public abstract BlockFlower.EnumFlowerColor getBlockType(); - - public IProperty getTypeProperty() - { - if (this.type == null) - { - this.type = PropertyEnum.create("type", BlockFlower.EnumFlowerType.class, new Predicate() - { - public boolean test(BlockFlower.EnumFlowerType p_apply_1_) - { - return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType(); - } - }); - } - - return this.type; - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockFlower.EnumFlowerType)state.getValue(this.getTypeProperty())).getMeta(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {this.getTypeProperty()}; - } - -// public EnumOffsetType getOffsetType() -// { -// return EnumOffsetType.XZ; -// } - - public static enum EnumFlowerColor - { - BASE; - - public BlockFlower getBlock() - { - return Blocks.flower; // this == BASE ? Blocks.flower : null; - } - } - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(state.getValue(this.type).getName()).cross(); + return provider.getModel(this.type.getName()).cross(); } public static enum EnumFlowerType implements Identifyable { - DANDELION(BlockFlower.EnumFlowerColor.BASE, 0, "dandelion", "Löwenzahn"), - ROSE(BlockFlower.EnumFlowerColor.BASE, 1, "rose", "Rose"), - POPPY(BlockFlower.EnumFlowerColor.BASE, 2, "poppy", "Mohn"), - BLUE_ORCHID(BlockFlower.EnumFlowerColor.BASE, 3, "blue_orchid", "Blaue Orchidee"), - ALLIUM(BlockFlower.EnumFlowerColor.BASE, 4, "allium", "Sternlauch"), - HOUSTONIA(BlockFlower.EnumFlowerColor.BASE, 5, "houstonia", "Porzellansternchen"), - RED_TULIP(BlockFlower.EnumFlowerColor.BASE, 6, "red_tulip", "Rote Tulpe"), - ORANGE_TULIP(BlockFlower.EnumFlowerColor.BASE, 7, "orange_tulip", "Orange Tulpe"), - WHITE_TULIP(BlockFlower.EnumFlowerColor.BASE, 8, "white_tulip", "WeiĂŸe Tulpe"), - PINK_TULIP(BlockFlower.EnumFlowerColor.BASE, 9, "pink_tulip", "Rosa Tulpe"), - OXEYE_DAISY(BlockFlower.EnumFlowerColor.BASE, 10, "oxeye_daisy", "Margerite"), - BLACK_LOTUS(BlockFlower.EnumFlowerColor.BASE, 11, "black_lotus", "Schwarzer Lotus"); + DANDELION("dandelion", "Löwenzahn"), + ROSE("rose", "Rose"), + POPPY("poppy", "Mohn"), + BLUE_ORCHID("blue_orchid", "Blaue Orchidee"), + ALLIUM("allium", "Sternlauch"), + HOUSTONIA("houstonia", "Porzellansternchen"), + RED_TULIP("red_tulip", "Rote Tulpe"), + ORANGE_TULIP("orange_tulip", "Orange Tulpe"), + WHITE_TULIP("white_tulip", "WeiĂŸe Tulpe"), + PINK_TULIP("pink_tulip", "Rosa Tulpe"), + OXEYE_DAISY("daisy", "Margerite"), + BLACK_LOTUS("black_lotus", "Schwarzer Lotus"); - private static final BlockFlower.EnumFlowerType[][] TYPES_FOR_BLOCK = new BlockFlower.EnumFlowerType[BlockFlower.EnumFlowerColor.values().length][]; - private final BlockFlower.EnumFlowerColor blockType; - private final int meta; private final String name; private final String display; -// private EnumFlowerType(BlockFlower.EnumFlowerColor blockType, int meta, String name) -// { -// this(blockType, meta, name, name); -// } - - private EnumFlowerType(BlockFlower.EnumFlowerColor blockType, int meta, String name, String display) + private EnumFlowerType(String name, String display) { - this.blockType = blockType; - this.meta = meta; this.name = name; this.display = display; } - public BlockFlower.EnumFlowerColor getBlockType() - { - return this.blockType; - } - - public int getMeta() - { - return this.meta; - } - - public static BlockFlower.EnumFlowerType getType(BlockFlower.EnumFlowerColor blockType, int meta) - { - BlockFlower.EnumFlowerType[] ablockflower$enumflowertype = TYPES_FOR_BLOCK[blockType.ordinal()]; - - if (meta < 0 || meta >= ablockflower$enumflowertype.length) - { - meta = 0; - } - - return ablockflower$enumflowertype[meta]; - } - - public static BlockFlower.EnumFlowerType[] getTypes(BlockFlower.EnumFlowerColor flowerColor) - { - return TYPES_FOR_BLOCK[flowerColor.ordinal()]; - } - public String toString() { return this.name; @@ -198,19 +94,5 @@ public abstract class BlockFlower extends BlockBush { return this.display; } - - static { - for (final BlockFlower.EnumFlowerColor blockflower$enumflowercolor : BlockFlower.EnumFlowerColor.values()) - { - Collection collection = Filter.filter(Lists.newArrayList(values()), new Predicate() - { - public boolean test(BlockFlower.EnumFlowerType p_apply_1_) - { - return p_apply_1_.getBlockType() == blockflower$enumflowercolor; - } - }); - TYPES_FOR_BLOCK[blockflower$enumflowercolor.ordinal()] = (BlockFlower.EnumFlowerType[])collection.toArray(new BlockFlower.EnumFlowerType[collection.size()]); - } - } } } diff --git a/common/src/main/java/common/block/foliage/BlockGrass.java b/common/src/main/java/common/block/foliage/BlockGrass.java index 97804357..dfe3d458 100755 --- a/common/src/main/java/common/block/foliage/BlockGrass.java +++ b/common/src/main/java/common/block/foliage/BlockGrass.java @@ -3,7 +3,6 @@ package common.block.foliage; import common.biome.IBiome; import common.block.Block; import common.block.Material; -import common.block.natural.BlockDirt; import common.color.Colorizer; import common.init.Blocks; import common.item.CheatTab; @@ -11,7 +10,7 @@ import common.item.Item; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -78,7 +77,7 @@ public class BlockGrass extends Block implements IGrowable Block block = worldIn.getState(blockpos.up()).getBlock(); State iblockstate = worldIn.getState(blockpos); - if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) + if (iblockstate.getBlock() == Blocks.dirt && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) { worldIn.setState(blockpos, Blocks.grass.getState()); } @@ -87,7 +86,7 @@ public class BlockGrass extends Block implements IGrowable } else { if(Vars.grassDry) - worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT) : + worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() : Blocks.dirt.getState()); } // } @@ -98,7 +97,7 @@ public class BlockGrass extends Block implements IGrowable */ public Item getItemDropped(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); + return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); } /** @@ -132,9 +131,9 @@ public class BlockGrass extends Block implements IGrowable return 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {SNOWY}; + return new Property[] {SNOWY}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockHugeMushroom.java b/common/src/main/java/common/block/foliage/BlockHugeMushroom.java index 873240b4..ef8281ec 100755 --- a/common/src/main/java/common/block/foliage/BlockHugeMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockHugeMushroom.java @@ -7,7 +7,7 @@ import common.init.ItemRegistry; import common.item.Item; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -19,6 +19,7 @@ import common.world.World; public class BlockHugeMushroom extends Block { public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockHugeMushroom.EnumType.class); + private final Block smallBlock; public BlockHugeMushroom(Material p_i46392_1_, Block p_i46392_3_) @@ -95,9 +96,9 @@ public class BlockHugeMushroom extends Block return ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)).getMetadata(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {VARIANT}; + return new Property[] {VARIANT}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockLeaves.java b/common/src/main/java/common/block/foliage/BlockLeaves.java index 1d081508..811f1a85 100755 --- a/common/src/main/java/common/block/foliage/BlockLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockLeaves.java @@ -8,6 +8,7 @@ import common.block.SoundType; import common.collect.Lists; import common.color.Colorizer; import common.entity.npc.EntityNPC; +import common.init.BlockRegistry; import common.init.Blocks; import common.init.ItemRegistry; import common.init.WoodType; @@ -18,9 +19,8 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -33,41 +33,37 @@ import common.world.AWorldServer; public class BlockLeaves extends BlockLeavesBase { - public static final PropertyEnum TYPE = PropertyEnum.create("type", LeavesType.class); public static final PropertyBool DECAY = PropertyBool.create("decay"); public static final List LEAVES = Lists.newArrayList(); + private static final BlockLeaves[] MAPPING = new BlockLeaves[WoodType.values().length * LeavesType.values().length]; private final WoodType type; + private final LeavesType subType; int[] surroundings; + + public static BlockLeaves getLeavesBlock(WoodType type, LeavesType subType) { + return MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()]; + } - public BlockLeaves(WoodType type) + public BlockLeaves(WoodType type, LeavesType subType) { super(Material.LEAVES); this.type = type; - this.setDefaultState(this.getBaseState().withProperty(TYPE, LeavesType.SPRING).withProperty(DECAY, Boolean.valueOf(true))); + this.subType = subType; + this.setDefaultState(this.getBaseState().withProperty(DECAY, Boolean.valueOf(true))); this.setTickRandomly(); this.setTab(CheatTab.PLANTS); this.setHardness(0.2F); this.setLightOpacity(1); this.setStepSound(SoundType.GRASS); LEAVES.add(this); + MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()] = this; } -// public int getBlockColor() -// { -// return ColorizerFoliage.getFoliageColor(0.5D, 1.0D); -// } - -// public int getRenderColor(IBlockState state) -// { -// return ColorizerFoliage.getFoliageColorBasic(); -// } -// -// public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) -// { -// return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos); -// } + public LeavesType getType() { + return this.subType; + } public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) { @@ -100,8 +96,8 @@ public class BlockLeaves extends BlockLeavesBase public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - if(Vars.seasonLeaves && state.getValue(TYPE) != worldIn.getLeavesGen(pos)) { - worldIn.setState(pos, state.withProperty(TYPE, worldIn.getLeavesGen(pos)), 2); + if(Vars.seasonLeaves && this.subType != worldIn.getLeavesGen(pos)) { + worldIn.setState(pos, getLeavesBlock(this.type, worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)), 2); } if(Vars.leafDry && worldIn.getTemperatureC(pos) >= 50.0f) { worldIn.setState(pos, worldIn.rand.chance(40) ? Blocks.air.getState() : Blocks.dry_leaves.getState()); @@ -270,7 +266,7 @@ public class BlockLeaves extends BlockLeavesBase if (worldIn.rand.chance(i)) { Item item = this.getItemDropped(state, worldIn.rand, fortune); - spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); + spawnAsEntity(worldIn, pos, new ItemStack(item)); } i = 200; @@ -286,40 +282,29 @@ public class BlockLeaves extends BlockLeavesBase } if(this.type.getItem() != null && worldIn.rand.chance(i)) // np - spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.getRegisteredItem(this.type.getItem()), 1, 0)); + spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.getRegisteredItem(this.type.getItem()))); } } public int getRenderColor(State state) { - return state.getBlock() != this || !state.getValue(TYPE).isTinted() ? 16777215 : + return state.getBlock() != this || !this.subType.isTinted() ? 16777215 : ((this.type.getTintType() == null ? Colorizer.BASIC : this.type.getTintType()).getColor()); } public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) { State state = worldIn.getState(pos); - return state.getBlock() != this || !state.getValue(TYPE).isTinted() ? 16777215 : (this.type.getTintType() + return state.getBlock() != this || !this.subType.isTinted() ? 16777215 : (this.type.getTintType() == null ? Colorizer.getFoliageColor(worldIn, pos) : this.type.getTintType().getColor()); } - public void getSubBlocks(Item itemIn, CheatTab tab, List list) { - for(int z = 0; z < LeavesType.values().length; z++) { - list.add(new ItemStack(itemIn, 1, z)); - } - } - - public ItemStack createStackedBlock(State state) { - return new ItemStack(ItemRegistry.getItemFromBlock(this), 1, ((LeavesType)state.getValue(TYPE)).getIndex()); - } - public State getStateFromMeta(int meta) { - return this.getState().withProperty(TYPE, LeavesType.getById(meta & 7)).withProperty(DECAY, Boolean.valueOf((meta & 8) == 0)); + return this.getState().withProperty(DECAY, Boolean.valueOf((meta & 8) == 0)); } public int getMetaFromState(State state) { int i = 0; - i = i | ((LeavesType)state.getValue(TYPE)).getIndex(); if(!((Boolean)state.getValue(DECAY)).booleanValue()) { i |= 8; @@ -328,22 +313,13 @@ public class BlockLeaves extends BlockLeavesBase return i; } -// public BlockPlanks.EnumType getWoodType() { -// return this.type; -// } - - protected IProperty[] getProperties() { - return new IProperty[] {TYPE, DECAY}; + protected Property[] getProperties() { + return new Property[] {DECAY}; } -// public int damageDropped(IBlockState state) { -// return ((LeavesType)state.getValue(TYPE)).getIndex(); -// } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { if(!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { -// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.getItemFromBlock(this), 1, ((LeavesType)state.getValue(TYPE)).getIndex())); + spawnAsEntity(worldIn, pos, new ItemStack(this)); } else { super.harvestBlock(worldIn, player, pos, state, te); @@ -351,16 +327,11 @@ public class BlockLeaves extends BlockLeavesBase } public Model getModel(ModelProvider provider, String name, State state) { - return state.getValue(TYPE).isTinted() ? provider.getModel(name + "_" + state.getValue(TYPE).getName()).add().all().tint() : - provider.getModel(name + "_" + state.getValue(TYPE).getName()).add().all(); + return this.subType.isTinted() ? provider.getModel(name).add().all().tint() : + provider.getModel(name).add().all(); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {DECAY}; - } - - public int getDamageValue(World worldIn, BlockPos pos) { - State state = worldIn.getState(pos); - return state.getBlock() == this ? state.getValue(TYPE).getIndex() : super.getDamageValue(worldIn, pos); + public Property[] getIgnoredProperties() { + return new Property[] {DECAY}; } } diff --git a/common/src/main/java/common/block/foliage/BlockLilyPad.java b/common/src/main/java/common/block/foliage/BlockLilyPad.java index 11024808..4187d83d 100755 --- a/common/src/main/java/common/block/foliage/BlockLilyPad.java +++ b/common/src/main/java/common/block/foliage/BlockLilyPad.java @@ -3,7 +3,7 @@ package common.block.foliage; import java.util.List; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.liquid.BlockLiquid; import common.block.liquid.BlockStaticLiquid; import common.entity.Entity; @@ -14,7 +14,7 @@ import common.item.CheatTab; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -22,14 +22,14 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockLilyPad extends BlockBush +public class BlockLilyPad extends BlockBush implements Rotatable { public BlockLilyPad() { float f = 0.5F; float f1 = 0.015625F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); - this.setDefaultState(this.getBaseState().withProperty(BlockDirectional.FACING, Facing.NORTH)); + this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); this.setTab(CheatTab.PLANTS); } @@ -87,22 +87,22 @@ public class BlockLilyPad extends BlockBush public State getStateFromMeta(int meta) { - return this.getState().withProperty(BlockDirectional.FACING, Facing.getHorizontal(meta)); + return this.getState().withProperty(FACING, Facing.getHorizontal(meta)); } public int getMetaFromState(State state) { - return ((Facing)state.getValue(BlockDirectional.FACING)).getHorizontalIndex(); + return ((Facing)state.getValue(FACING)).getHorizontalIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {BlockDirectional.FACING}; + return new Property[] {FACING}; } public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) { - return this.getState().withProperty(BlockDirectional.FACING, placer.getHorizontalFacing().getOpposite()); + return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } public Model getModel(ModelProvider provider, String name, State state) { @@ -110,6 +110,6 @@ public class BlockLilyPad extends BlockBush .add(0, 0.25f, 0, 16, 0.25f, 16) .d().uv(16, 16, 0, 0).tint().noCull() .u().uv(16, 0, 0, 16).tint().noCull() - .rotate(ModelRotation.getNorthRot(state.getValue(BlockDirectional.FACING))); + .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } } diff --git a/common/src/main/java/common/block/foliage/BlockLog.java b/common/src/main/java/common/block/foliage/BlockLog.java index 8c9fbab7..1cc80e82 100755 --- a/common/src/main/java/common/block/foliage/BlockLog.java +++ b/common/src/main/java/common/block/foliage/BlockLog.java @@ -8,7 +8,7 @@ import common.item.CheatTab; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.util.BlockPos; import common.util.Facing; @@ -82,19 +82,19 @@ public class BlockLog extends BlockRotatedPillar switch (meta & 3) { - case 0: + default: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y); break; - case 4: + case 1: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X); break; - case 8: + case 2: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z); break; - default: + case 3: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE); } @@ -109,7 +109,6 @@ public class BlockLog extends BlockRotatedPillar public int getMetaFromState(State state) { int i = 0; -// i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) { @@ -128,9 +127,9 @@ public class BlockLog extends BlockRotatedPillar return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {LOG_AXIS}; + return new Property[] {LOG_AXIS}; } public static enum EnumAxis implements Identifyable diff --git a/common/src/main/java/common/block/foliage/BlockMushroom.java b/common/src/main/java/common/block/foliage/BlockMushroom.java index 24a8fb45..a770839c 100755 --- a/common/src/main/java/common/block/foliage/BlockMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockMushroom.java @@ -2,7 +2,6 @@ package common.block.foliage; import common.biome.IBiome; import common.block.Block; -import common.block.natural.BlockDirt; import common.init.Blocks; import common.model.Model; import common.model.ModelProvider; @@ -79,7 +78,7 @@ public class BlockMushroom extends BlockBush implements IGrowable if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { State iblockstate = worldIn.getState(pos.down()); - return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); + return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.podzol ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); } else { diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index 65e5ce34..49b79fdb 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -2,14 +2,13 @@ package common.block.foliage; import common.block.Block; import common.block.Material; -import common.block.natural.BlockDirt; import common.init.Blocks; import common.item.CheatTab; import common.item.Item; import common.model.Model; import common.model.ModelProvider; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -48,7 +47,7 @@ public class BlockMycelium extends Block if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getState(pos.up()).getBlock().getLightOpacity() > 2) { if(Vars.mycelDecay) - worldIn.setState(pos, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + worldIn.setState(pos, Blocks.dirt.getState()); } else if(Vars.mycelSpread) { @@ -60,7 +59,7 @@ public class BlockMycelium extends Block State iblockstate = worldIn.getState(blockpos); Block block = worldIn.getState(blockpos.up()).getBlock(); - if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) + if (iblockstate.getBlock() == Blocks.dirt && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) { worldIn.setState(blockpos, this.getState()); } @@ -85,7 +84,7 @@ public class BlockMycelium extends Block */ public Item getItemDropped(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); + return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); } /** @@ -96,9 +95,9 @@ public class BlockMycelium extends Block return 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {SNOWY}; + return new Property[] {SNOWY}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockPumpkin.java b/common/src/main/java/common/block/foliage/BlockPumpkin.java index 9b70bad9..806e9346 100755 --- a/common/src/main/java/common/block/foliage/BlockPumpkin.java +++ b/common/src/main/java/common/block/foliage/BlockPumpkin.java @@ -1,19 +1,20 @@ package common.block.foliage; -import common.block.BlockDirectional; +import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.types.EntityLiving; import common.item.CheatTab; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.util.BlockPos; import common.util.Facing; import common.world.State; import common.world.World; -public class BlockPumpkin extends BlockDirectional { +public class BlockPumpkin extends Block implements Rotatable { public BlockPumpkin() { super(Material.SOFT); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); @@ -36,8 +37,8 @@ public class BlockPumpkin extends BlockDirectional { return state.getValue(FACING).getHorizontalIndex(); } - protected IProperty[] getProperties() { - return new IProperty[] {FACING}; + protected Property[] getProperties() { + return new Property[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockReed.java b/common/src/main/java/common/block/foliage/BlockReed.java index e581de92..d64b79cf 100755 --- a/common/src/main/java/common/block/foliage/BlockReed.java +++ b/common/src/main/java/common/block/foliage/BlockReed.java @@ -8,7 +8,7 @@ import common.item.Item; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -179,16 +179,16 @@ public class BlockReed extends Block return ((Integer)state.getValue(AGE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AGE}; + return new Property[] {AGE}; } public Model getModel(ModelProvider provider, String name, State state) { return provider.getModel("reeds").crossTint(); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {AGE}; + public Property[] getIgnoredProperties() { + return new Property[] {AGE}; } } diff --git a/common/src/main/java/common/block/foliage/BlockSapling.java b/common/src/main/java/common/block/foliage/BlockSapling.java index df3ca7d6..d359c91e 100755 --- a/common/src/main/java/common/block/foliage/BlockSapling.java +++ b/common/src/main/java/common/block/foliage/BlockSapling.java @@ -9,7 +9,7 @@ import common.init.WoodType; import common.item.CheatTab; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -49,7 +49,7 @@ public class BlockSapling extends BlockBush implements IGrowable if(Vars.saplingDry && worldIn.getTemperatureC(pos) >= 50.0f) { worldIn.setState(pos, worldIn.rand.chance(25) ? Blocks.air.getState() : - Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); + Blocks.dead_bush.getState()); return; } // if (!worldIn.client) @@ -132,9 +132,9 @@ public class BlockSapling extends BlockBush implements IGrowable return state.getValue(STAGE); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {STAGE}; + return new Property[] {STAGE}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockStem.java b/common/src/main/java/common/block/foliage/BlockStem.java index e647e19b..fce5dbae 100755 --- a/common/src/main/java/common/block/foliage/BlockStem.java +++ b/common/src/main/java/common/block/foliage/BlockStem.java @@ -1,8 +1,7 @@ package common.block.foliage; -import java.util.function.Predicate; - import common.block.Block; +import common.block.DirectionalUp; import common.init.Blocks; import common.init.Items; import common.item.CheatTab; @@ -11,8 +10,7 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -23,16 +21,10 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockStem extends BlockBush implements IGrowable +public class BlockStem extends BlockBush implements DirectionalUp, IGrowable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); - public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate() - { - public boolean test(Facing p_apply_1_) - { - return p_apply_1_ != Facing.DOWN; - } - }); + private final Block crop; public BlockStem(Block crop) @@ -234,9 +226,9 @@ public class BlockStem extends BlockBush implements IGrowable return ((Integer)state.getValue(AGE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AGE, FACING}; + return new Property[] {AGE, FACING}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockTallGrass.java b/common/src/main/java/common/block/foliage/BlockTallGrass.java index be708d50..3001eea4 100755 --- a/common/src/main/java/common/block/foliage/BlockTallGrass.java +++ b/common/src/main/java/common/block/foliage/BlockTallGrass.java @@ -3,6 +3,7 @@ package common.block.foliage; import java.util.List; import common.block.Material; +import common.collect.Lists; import common.color.Colorizer; import common.entity.npc.EntityNPC; import common.init.Blocks; @@ -13,7 +14,7 @@ import common.item.ItemShears; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; @@ -27,33 +28,38 @@ import common.world.AWorldServer; public class BlockTallGrass extends BlockBush implements IGrowable { - public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); + public static final BlockTallGrass[] BUSHES = new BlockTallGrass[EnumType.values().length]; + + private final EnumType type; + + public static BlockTallGrass getByType(EnumType type) { + return BUSHES[type.ordinal()]; + } - public BlockTallGrass() + public BlockTallGrass(EnumType type) { super(Material.BUSH); - this.setDefaultState(this.getBaseState().withProperty(TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); + this.type = type; float f = 0.4F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); -// this.setTickRandomly(); + BUSHES[type.ordinal()] = this; + } + + public EnumType getType() { + return this.type; } public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - if(Vars.tallgrassDry && worldIn.getTemperatureC(pos) >= 50.0f && state.getValue(TYPE) != EnumType.DEAD_BUSH) + if(Vars.tallgrassDry && worldIn.getTemperatureC(pos) >= 50.0f && this.type != EnumType.DEAD_BUSH) { - worldIn.setState(pos, state.getValue(TYPE) == EnumType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : - this.getState().withProperty(TYPE, EnumType.DEAD_BUSH)); + worldIn.setState(pos, this.type == EnumType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : + Blocks.dead_bush.getState()); return; } super.updateTick(worldIn, pos, state, rand); } -// public int getBlockColor() -// { -// return ColorizerFoliage.getGrassColor(0.5D, 1.0D); -// } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) { return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); @@ -75,8 +81,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable } else { - BlockTallGrass.EnumType blocktallgrass$enumtype = (BlockTallGrass.EnumType)state.getValue(TYPE); - return blocktallgrass$enumtype == BlockTallGrass.EnumType.DEAD_BUSH ? 16777215 : Colorizer.getGrassColor(0.5D, 1.0D); + return this.type == EnumType.DEAD_BUSH ? 16777215 : Colorizer.getGrassColor(0.5D, 1.0D); } } @@ -105,8 +110,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable { if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { -// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); + spawnAsEntity(worldIn, pos, new ItemStack(this)); } else { @@ -114,32 +118,12 @@ public class BlockTallGrass extends BlockBush implements IGrowable } } - /** - * Gets the meta to use for the Pick Block ItemStack result - */ - public int getDamageValue(World worldIn, BlockPos pos) - { - State iblockstate = worldIn.getState(pos); - return iblockstate.getBlock().getMetaFromState(iblockstate); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (int i = 0; i < 3; ++i) // FIX (dead)bush! - { - list.add(new ItemStack(itemIn, 1, i)); - } - } - /** * Whether this IGrowable can grow */ public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) { - return state.getValue(TYPE) != BlockTallGrass.EnumType.DEAD_BUSH; + return this.type != EnumType.DEAD_BUSH; } public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) @@ -149,66 +133,42 @@ public class BlockTallGrass extends BlockBush implements IGrowable public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.GRASS; + BlockDoublePlant block = Blocks.large_tallgrass; - if (state.getValue(TYPE) == BlockTallGrass.EnumType.FERN) + if (this.type == BlockTallGrass.EnumType.FERN) { - blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.FERN; + block = Blocks.large_fern; } - if (Blocks.double_plant.canPlaceBlockAt(worldIn, pos)) + if (block.canPlaceBlockAt(worldIn, pos)) { - Blocks.double_plant.placeAt(worldIn, pos, blockdoubleplant$enumplanttype, 2); + block.placeAt(worldIn, pos, 2); } } - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(TYPE, BlockTallGrass.EnumType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {TYPE}; - } - -// public EnumOffsetType getOffsetType() -// { -// return EnumOffsetType.XYZ; -// } - public Model getModel(ModelProvider provider, String name, State state) { - if(state.getValue(TYPE) != EnumType.DEAD_BUSH) - return provider.getModel(state.getValue(TYPE).getName()).crossTint(); + if(this.type != EnumType.DEAD_BUSH) + return provider.getModel(this.type.getName()).crossTint(); else return provider.getModel("deadbush").cross(); } public static enum EnumType implements Identifyable { - DEAD_BUSH(0, "dead_bush"), - GRASS(1, "tall_grass"), - FERN(2, "fern"); + DEAD_BUSH(0, "dead_bush", "Busch"), + GRASS(1, "tallgrass", "Gras"), + FERN(2, "fern", "Farn"); private static final BlockTallGrass.EnumType[] META_LOOKUP = new BlockTallGrass.EnumType[values().length]; private final int meta; private final String name; + private final String display; - private EnumType(int meta, String name) + private EnumType(int meta, String name, String display) { this.meta = meta; this.name = name; + this.display = display; } public int getMeta() @@ -236,6 +196,11 @@ public class BlockTallGrass extends BlockBush implements IGrowable return this.name; } + public String getDisplay() + { + return this.display; + } + static { for (BlockTallGrass.EnumType blocktallgrass$enumtype : values()) { diff --git a/common/src/main/java/common/block/foliage/BlockTianSoil.java b/common/src/main/java/common/block/foliage/BlockTianSoil.java index bf7aa447..dce3ab62 100755 --- a/common/src/main/java/common/block/foliage/BlockTianSoil.java +++ b/common/src/main/java/common/block/foliage/BlockTianSoil.java @@ -7,7 +7,7 @@ import common.item.CheatTab; import common.item.Item; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -41,9 +41,9 @@ public class BlockTianSoil extends Block return 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {SNOWY}; + return new Property[] {SNOWY}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockVine.java b/common/src/main/java/common/block/foliage/BlockVine.java index 5e0b4e73..84447d4e 100755 --- a/common/src/main/java/common/block/foliage/BlockVine.java +++ b/common/src/main/java/common/block/foliage/BlockVine.java @@ -14,7 +14,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.tileentity.TileEntity; @@ -425,7 +425,7 @@ public class BlockVine extends Block if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { // player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine)); } else { @@ -476,9 +476,9 @@ public class BlockVine extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {UP, NORTH, EAST, SOUTH, WEST}; + return new Property[] {UP, NORTH, EAST, SOUTH, WEST}; } public static PropertyBool getPropertyFor(Facing side) diff --git a/common/src/main/java/common/block/foliage/BlockWart.java b/common/src/main/java/common/block/foliage/BlockWart.java index 30771d89..d1649800 100755 --- a/common/src/main/java/common/block/foliage/BlockWart.java +++ b/common/src/main/java/common/block/foliage/BlockWart.java @@ -9,7 +9,7 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -123,9 +123,9 @@ public class BlockWart extends BlockBush return ((Integer)state.getValue(AGE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AGE}; + return new Property[] {AGE}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/liquid/BlockLiquid.java b/common/src/main/java/common/block/liquid/BlockLiquid.java index 4643b574..ad1b4a4b 100755 --- a/common/src/main/java/common/block/liquid/BlockLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockLiquid.java @@ -10,7 +10,7 @@ import common.init.SoundEvent; import common.item.Item; import common.model.BlockLayer; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -382,9 +382,9 @@ public abstract class BlockLiquid extends Block return ((Integer)state.getValue(LEVEL)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {LEVEL}; + return new Property[] {LEVEL}; } public boolean isXrayVisible() diff --git a/common/src/main/java/common/block/natural/BlockColoredClay.java b/common/src/main/java/common/block/natural/BlockColoredClay.java new file mode 100644 index 00000000..9f724109 --- /dev/null +++ b/common/src/main/java/common/block/natural/BlockColoredClay.java @@ -0,0 +1,34 @@ +package common.block.natural; + +import common.block.Block; +import common.block.Material; +import common.color.DyeColor; +import common.item.CheatTab; +import common.model.Model; +import common.model.ModelProvider; +import common.world.State; + +public class BlockColoredClay extends Block { + public static final BlockColoredClay[] CLAY = new BlockColoredClay[DyeColor.values().length]; + + private final DyeColor color; + + public static BlockColoredClay getByColor(DyeColor color) { + return CLAY[color.getMetadata()]; + } + + public BlockColoredClay(DyeColor color) { + super(Material.SOLID); + this.color = color; + this.setTab(CheatTab.NATURE); + CLAY[color.ordinal()] = this; + } + + public DyeColor getColor() { + return this.color; + } + + public Model getModel(ModelProvider provider, String name, State state) { + return provider.getModel(this.color.getName() + "_clay").add().all(); + } +} diff --git a/common/src/main/java/common/block/natural/BlockDirt.java b/common/src/main/java/common/block/natural/BlockDirt.java deleted file mode 100755 index f93a03c3..00000000 --- a/common/src/main/java/common/block/natural/BlockDirt.java +++ /dev/null @@ -1,186 +0,0 @@ -package common.block.natural; - -import java.util.List; - -import common.block.Block; -import common.block.Material; -import common.init.Blocks; -import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; -import common.model.Model; -import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyBool; -import common.properties.PropertyEnum; -import common.util.BlockPos; -import common.util.Identifyable; -import common.world.IWorldAccess; -import common.world.State; -import common.world.World; - -public class BlockDirt extends Block -{ - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDirt.DirtType.class); - public static final PropertyBool SNOWY = PropertyBool.create("snowy"); - - public BlockDirt() - { - super(Material.LOOSE); - this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockDirt.DirtType.DIRT).withProperty(SNOWY, Boolean.valueOf(false))); - this.setTab(CheatTab.NATURE); - } - -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return ((BlockDirt.DirtType)state.getValue(VARIANT)).getMapColor(); -// } - - /** - * Get the actual Block state of this Block at the given position. This applies properties not visible in the - * metadata, such as fence connections. - */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) - { - if (state.getValue(VARIANT) == BlockDirt.DirtType.PODZOL) - { - Block block = worldIn.getState(pos.up()).getBlock(); - state = state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); - } - - return state; - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - list.add(new ItemStack(this, 1, BlockDirt.DirtType.DIRT.getMetadata())); - list.add(new ItemStack(this, 1, BlockDirt.DirtType.COARSE_DIRT.getMetadata())); - list.add(new ItemStack(this, 1, BlockDirt.DirtType.PODZOL.getMetadata())); - } - - /** - * Gets the meta to use for the Pick Block ItemStack result - */ - public int getDamageValue(World worldIn, BlockPos pos) - { - State iblockstate = worldIn.getState(pos); - return iblockstate.getBlock() != this ? 0 : ((BlockDirt.DirtType)iblockstate.getValue(VARIANT)).getMetadata(); - } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(VARIANT, BlockDirt.DirtType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockDirt.DirtType)state.getValue(VARIANT)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {VARIANT, SNOWY}; - } - - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - BlockDirt.DirtType blockdirt$dirttype = (BlockDirt.DirtType)state.getValue(VARIANT); - - if (blockdirt$dirttype == BlockDirt.DirtType.PODZOL) - { - blockdirt$dirttype = BlockDirt.DirtType.DIRT; - } - - return blockdirt$dirttype.getMetadata(); - } - - public Model getModel(ModelProvider provider, String name, State state) { - switch(state.getValue(VARIANT)) { - case DIRT: - default: - return provider.getModel("dirt").add().all(); - case COARSE_DIRT: - return provider.getModel("coarse_dirt").add().all(); - case PODZOL: - return state.getValue(SNOWY) ? provider.getModel("grass_side_snowed").add().nswe().d("dirt").u("grass_top") : - provider.getModel("dirt_podzol_side").add().nswe().d("dirt").u("dirt_podzol_top"); - } - } - - public static enum DirtType implements Identifyable - { - DIRT(0, "dirt", "Erde"), - COARSE_DIRT(1, "coarse_dirt", "Grobe Erde"), - PODZOL(2, "podzol", "Podsol"); - - private static final BlockDirt.DirtType[] METADATA_LOOKUP = new BlockDirt.DirtType[values().length]; - private final int metadata; - private final String name; - private final String display; - -// private DirtType(int meta, String name) -// { -// this(meta, name, name); -// } - - private DirtType(int meta, String name, String display) - { - this.metadata = meta; - this.name = name; - this.display = display; - } - - public int getMetadata() - { - return this.metadata; - } - - public String getDisplay() - { - return this.display; - } - - public String toString() - { - return this.name; - } - - public static BlockDirt.DirtType byMetadata(int metadata) - { - if (metadata < 0 || metadata >= METADATA_LOOKUP.length) - { - metadata = 0; - } - - return METADATA_LOOKUP[metadata]; - } - - public String getName() - { - return this.name; - } - - static { - for (BlockDirt.DirtType blockdirt$dirttype : values()) - { - METADATA_LOOKUP[blockdirt$dirttype.getMetadata()] = blockdirt$dirttype; - } - } - } -} diff --git a/common/src/main/java/common/block/natural/BlockFire.java b/common/src/main/java/common/block/natural/BlockFire.java index 40002fa0..fd8ee8e2 100755 --- a/common/src/main/java/common/block/natural/BlockFire.java +++ b/common/src/main/java/common/block/natural/BlockFire.java @@ -12,7 +12,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyInteger; import common.rng.Random; @@ -452,9 +452,9 @@ public class BlockFire extends Block return ((Integer)state.getValue(AGE)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}; + return new Property[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}; } private static Model fire_nsu2_flip(String fire) { @@ -1139,8 +1139,8 @@ public class BlockFire extends Block state.getValue(NORTH), state.getValue(SOUTH), state.getValue(WEST), state.getValue(EAST)); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {AGE}; + public Property[] getIgnoredProperties() { + return new Property[] {AGE}; } public void getAnimatedTextures(Map map) { diff --git a/common/src/main/java/common/block/natural/BlockHardenedClay.java b/common/src/main/java/common/block/natural/BlockHardenedClay.java index 93e8b749..f51001d0 100755 --- a/common/src/main/java/common/block/natural/BlockHardenedClay.java +++ b/common/src/main/java/common/block/natural/BlockHardenedClay.java @@ -11,12 +11,4 @@ public class BlockHardenedClay extends Block super(Material.SOLID); this.setTab(CheatTab.NATURE); } - -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return null; -// } } diff --git a/common/src/main/java/common/block/natural/BlockHellRock.java b/common/src/main/java/common/block/natural/BlockHellRock.java index 63c6b728..6d58d9ba 100755 --- a/common/src/main/java/common/block/natural/BlockHellRock.java +++ b/common/src/main/java/common/block/natural/BlockHellRock.java @@ -12,14 +12,6 @@ public class BlockHellRock extends Block this.setTab(CheatTab.NATURE); } -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return MapColor.hellColor; -// } - public boolean canKeepFire() { return true; } diff --git a/common/src/main/java/common/block/natural/BlockOre.java b/common/src/main/java/common/block/natural/BlockOre.java index bcf4df17..83e830a5 100755 --- a/common/src/main/java/common/block/natural/BlockOre.java +++ b/common/src/main/java/common/block/natural/BlockOre.java @@ -125,16 +125,6 @@ public class BlockOre extends Block } } - public int getDamageValue(World worldIn, BlockPos pos) - { - return 0; - } - - public int damageDropped(State state) - { - return this.dropItem == null ? 0 : this.dropItem.getMetadata(); // this == Blocks.lapis_ore ? EnumDyeColor.BLUE.getDyeDamage() : 0; - } - public boolean isXrayVisible() { return true; diff --git a/common/src/main/java/common/block/natural/BlockPodzol.java b/common/src/main/java/common/block/natural/BlockPodzol.java new file mode 100644 index 00000000..f812ce73 --- /dev/null +++ b/common/src/main/java/common/block/natural/BlockPodzol.java @@ -0,0 +1,48 @@ +package common.block.natural; + +import common.block.Block; +import common.block.Material; +import common.init.Blocks; +import common.init.Items; +import common.item.CheatTab; +import common.item.Item; +import common.model.Model; +import common.model.ModelProvider; +import common.properties.Property; +import common.properties.PropertyBool; +import common.rng.Random; +import common.util.BlockPos; +import common.world.IWorldAccess; +import common.world.State; + +public class BlockPodzol extends Block { + public static final PropertyBool SNOWY = PropertyBool.create("snowy"); + + public BlockPodzol() { + super(Material.LOOSE); + this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false))); + this.setTab(CheatTab.NATURE); + } + + public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) { + Block block = worldIn.getState(pos.up()).getBlock(); + return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); + } + + public int getMetaFromState(State state) { + return 0; + } + + protected Property[] getProperties() { + return new Property[] {SNOWY}; + } + + public Item getItemDropped(State state, Random rand, int fortune) { + return Items.dirt; + } + + public Model getModel(ModelProvider provider, String name, State state) { + return state.getValue(SNOWY) ? provider.getModel("grass_side_snowed").add().nswe().d("dirt").u("grass_top") + : provider.getModel("dirt_podzol_side").add().nswe().d("dirt").u("dirt_podzol_top"); + } +} diff --git a/common/src/main/java/common/block/natural/BlockRock.java b/common/src/main/java/common/block/natural/BlockRock.java deleted file mode 100755 index 92b0352b..00000000 --- a/common/src/main/java/common/block/natural/BlockRock.java +++ /dev/null @@ -1,49 +0,0 @@ -package common.block.natural; - -import java.util.List; - -import common.block.Block; -import common.block.Material; -import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; -import common.model.Model; -import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyBool; -import common.world.State; - -public class BlockRock extends Block { - public static final PropertyBool SMOOTH = PropertyBool.create("smooth"); - - public BlockRock() { - super(Material.SOLID); - this.setDefaultState(this.getBaseState().withProperty(SMOOTH, false)); - this.setTab(CheatTab.NATURE); - } - - public int damageDropped(State state) { - return state.getValue(SMOOTH) ? 1 : 0; - } - - public void getSubBlocks(Item itemIn, CheatTab tab, List list) { - list.add(new ItemStack(itemIn, 1, 0)); - list.add(new ItemStack(itemIn, 1, 1)); - } - - public State getStateFromMeta(int meta) { - return this.getState().withProperty(SMOOTH, (meta & 1) != 0); - } - - public int getMetaFromState(State state) { - return state.getValue(SMOOTH) ? 1 : 0; - } - - protected IProperty[] getProperties() { - return new IProperty[] {SMOOTH}; - } - - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(state.getValue(SMOOTH) ? "smooth_rock" : "rock").add().all(); - } -} diff --git a/common/src/main/java/common/block/natural/BlockSand.java b/common/src/main/java/common/block/natural/BlockSand.java deleted file mode 100755 index ae5d6cb5..00000000 --- a/common/src/main/java/common/block/natural/BlockSand.java +++ /dev/null @@ -1,135 +0,0 @@ -package common.block.natural; - -import java.util.List; - -import common.block.BlockFalling; -import common.block.Material; -import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; -import common.model.Model; -import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyEnum; -import common.util.Identifyable; -import common.world.State; - -public class BlockSand extends BlockFalling -{ - public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockSand.EnumType.class); - - public BlockSand() - { - super(Material.LOOSE); - this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockSand.EnumType.SAND)); - this.setTab(CheatTab.NATURE); - } - - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((BlockSand.EnumType)state.getValue(VARIANT)).getMetadata(); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (BlockSand.EnumType blocksand$enumtype : BlockSand.EnumType.values()) - { - list.add(new ItemStack(itemIn, 1, blocksand$enumtype.getMetadata())); - } - } - -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return ((BlockSand.EnumType)state.getValue(VARIANT)).getMapColor(); -// } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(VARIANT, BlockSand.EnumType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockSand.EnumType)state.getValue(VARIANT)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {VARIANT}; - } - - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(state.getValue(VARIANT).getName()).add().all(); - } - - public static enum EnumType implements Identifyable - { - SAND(0, "sand", "Sand"), - RED_SAND(1, "red_sand", "Roter Sand"); - - private static final BlockSand.EnumType[] META_LOOKUP = new BlockSand.EnumType[values().length]; - private final int meta; - private final String name; - private final String display; - - private EnumType(int meta, String name, String display) - { - this.meta = meta; - this.name = name; - this.display = display; - } - - public int getMetadata() - { - return this.meta; - } - - public String toString() - { - return this.name; - } - - public static BlockSand.EnumType byMetadata(int meta) - { - if (meta < 0 || meta >= META_LOOKUP.length) - { - meta = 0; - } - - return META_LOOKUP[meta]; - } - - public String getName() - { - return this.name; - } - - public String getDisplay() - { - return this.display; - } - - static { - for (BlockSand.EnumType blocksand$enumtype : values()) - { - META_LOOKUP[blocksand$enumtype.getMetadata()] = blocksand$enumtype; - } - } - } -} diff --git a/common/src/main/java/common/block/natural/BlockSandStone.java b/common/src/main/java/common/block/natural/BlockSandStone.java index ca1bcac4..282f464f 100755 --- a/common/src/main/java/common/block/natural/BlockSandStone.java +++ b/common/src/main/java/common/block/natural/BlockSandStone.java @@ -1,144 +1,22 @@ package common.block.natural; -import java.util.List; - import common.block.Block; import common.block.Material; import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; -import common.properties.PropertyEnum; -import common.util.Identifyable; import common.world.State; -public class BlockSandStone extends Block -{ - public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockSandStone.EnumType.class); +public class BlockSandStone extends Block { + private final String texture; - public BlockSandStone() - { - super(Material.SOLID); - this.setDefaultState(this.getBaseState().withProperty(TYPE, BlockSandStone.EnumType.DEFAULT)); - this.setTab(CheatTab.NATURE); - } + public BlockSandStone(String texture) { + super(Material.SOLID); + this.texture = texture; + this.setTab(CheatTab.NATURE); + } - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((BlockSandStone.EnumType)state.getValue(TYPE)).getMetadata(); - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for (BlockSandStone.EnumType blocksandstone$enumtype : BlockSandStone.EnumType.values()) - { - list.add(new ItemStack(itemIn, 1, blocksandstone$enumtype.getMetadata())); - } - } - -// /** -// * Get the MapColor for this Block and the given BlockState -// */ -// public MapColor getMapColor(IBlockState state) -// { -// return MapColor.sandColor; -// } - - /** - * Convert the given metadata into a BlockState for this Block - */ - public State getStateFromMeta(int meta) - { - return this.getState().withProperty(TYPE, BlockSandStone.EnumType.byMetadata(meta)); - } - - /** - * Convert the BlockState into the correct metadata value - */ - public int getMetaFromState(State state) - { - return ((BlockSandStone.EnumType)state.getValue(TYPE)).getMetadata(); - } - - protected IProperty[] getProperties() - { - return new IProperty[] {TYPE}; - } - - public Model getModel(ModelProvider provider, String name, State state) { - switch(state.getValue(TYPE)) { - case DEFAULT: - default: - return provider.getModel("sandstone_normal").add().nswe().d("sandstone_bottom").u("sandstone_all"); - case CHISELED: - return provider.getModel("sandstone_carved").add().nswe().d("sandstone_bottom").u("sandstone_all"); - case SMOOTH: - return provider.getModel("sandstone_smooth").add().nswe().d("sandstone_bottom").u("sandstone_all"); - } - } - - public static enum EnumType implements Identifyable - { - DEFAULT(0, "sandstone", "Sandstein"), - CHISELED(1, "chiseled_sandstone", "GemeiĂŸelter Sandstein"), - SMOOTH(2, "smooth_sandstone", "Glatter Sandstein"); - - private static final BlockSandStone.EnumType[] META_LOOKUP = new BlockSandStone.EnumType[values().length]; - private final int metadata; - private final String name; - private final String display; - - private EnumType(int meta, String name, String display) - { - this.metadata = meta; - this.name = name; - this.display = display; - } - - public int getMetadata() - { - return this.metadata; - } - - public String toString() - { - return this.name; - } - - public static BlockSandStone.EnumType byMetadata(int meta) - { - if (meta < 0 || meta >= META_LOOKUP.length) - { - meta = 0; - } - - return META_LOOKUP[meta]; - } - - public String getName() - { - return this.name; - } - - public String getDisplay() - { - return this.display; - } - - static { - for (BlockSandStone.EnumType blocksandstone$enumtype : values()) - { - META_LOOKUP[blocksandstone$enumtype.getMetadata()] = blocksandstone$enumtype; - } - } - } + public Model getModel(ModelProvider provider, String name, State state) { + return provider.getModel("sandstone_" + this.texture).add().nswe().d("sandstone_bottom").u("sandstone_all"); + } } diff --git a/common/src/main/java/common/block/natural/BlockSnow.java b/common/src/main/java/common/block/natural/BlockSnow.java index 4a412400..f123225c 100755 --- a/common/src/main/java/common/block/natural/BlockSnow.java +++ b/common/src/main/java/common/block/natural/BlockSnow.java @@ -11,7 +11,7 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.tileentity.TileEntity; @@ -115,7 +115,7 @@ public class BlockSnow extends Block public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { - spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); + spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1)); worldIn.setBlockToAir(pos); // player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); } @@ -174,9 +174,9 @@ public class BlockSnow extends Block return ((Integer)state.getValue(LAYERS)).intValue() - 1; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {LAYERS}; + return new Property[] {LAYERS}; } public Transforms getTransform() { diff --git a/common/src/main/java/common/block/tech/BlockAnvil.java b/common/src/main/java/common/block/tech/BlockAnvil.java index 8a003522..e7d41f67 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -1,7 +1,6 @@ package common.block.tech; -import java.util.List; - +import common.block.Rotatable; import common.block.BlockFalling; import common.block.Material; import common.entity.item.EntityFalling; @@ -11,33 +10,41 @@ import common.inventory.Container; import common.inventory.ContainerRepair; import common.inventory.InventoryPlayer; import common.item.CheatTab; -import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.IProperty; -import common.properties.PropertyDirection; -import common.properties.PropertyInteger; +import common.properties.Property; import common.tileentity.IInteractionObject; import common.util.BlockPos; +import common.util.ExtMath; import common.util.Facing; import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockAnvil extends BlockFalling +public class BlockAnvil extends BlockFalling implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); - public static final PropertyInteger DAMAGE = PropertyInteger.create("damage", 0, 2); + public static final BlockAnvil[] ANVILS = new BlockAnvil[3]; + + private final int damage; + + public static BlockAnvil getByDamage(int damage) { + return ANVILS[ExtMath.clampi(damage, 0, ANVILS.length - 1)]; + } - public BlockAnvil() + public BlockAnvil(int damage) { super(Material.HEAVY); - this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(DAMAGE, Integer.valueOf(0))); + this.damage = damage; + this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); this.setLightOpacity(0); this.setTab(CheatTab.TECHNOLOGY); + ANVILS[damage] = this; + } + + public int getAnvilDamage() { + return this.damage; } public boolean isFullCube() @@ -53,6 +60,10 @@ public class BlockAnvil extends BlockFalling return false; } + public boolean isMagnetic() { + return true; + } + /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate @@ -60,7 +71,7 @@ public class BlockAnvil extends BlockFalling public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) { Facing enumfacing = placer.getHorizontalFacing().rotateY(); - return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, enumfacing).withProperty(DAMAGE, Integer.valueOf(meta >> 2)); + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, enumfacing); } public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) @@ -73,15 +84,6 @@ public class BlockAnvil extends BlockFalling return true; } - /** - * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It - * returns the metadata of the dropped item based on the old metadata of the block. - */ - public int damageDropped(State state) - { - return ((Integer)state.getValue(DAMAGE)).intValue(); - } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); @@ -96,16 +98,6 @@ public class BlockAnvil extends BlockFalling } } - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - list.add(new ItemStack(itemIn, 1, 0)); - list.add(new ItemStack(itemIn, 1, 1)); - list.add(new ItemStack(itemIn, 1, 2)); - } - protected void onStartFalling(EntityFalling fallingEntity) { fallingEntity.setHurtEntities(true); @@ -134,7 +126,7 @@ public class BlockAnvil extends BlockFalling */ public State getStateFromMeta(int meta) { - return this.getState().withProperty(FACING, Facing.getHorizontal(meta & 3)).withProperty(DAMAGE, Integer.valueOf((meta & 12) == 12 ? 0 : ((meta & 12) >> 2))); + return this.getState().withProperty(FACING, Facing.getHorizontal(meta & 3)); } /** @@ -144,13 +136,12 @@ public class BlockAnvil extends BlockFalling { int i = 0; i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); - i = i | ((Integer)state.getValue(DAMAGE)).intValue() << 2; return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, DAMAGE}; + return new Property[] {FACING}; } public Transforms getTransform() { @@ -165,7 +156,7 @@ public class BlockAnvil extends BlockFalling .ns().uv(4, 11, 12, 12).noCull().w().uv(4, 3, 5, 13).rot(90).noCull().e().uv(5, 3, 4, 13).rot(270).noCull() .add(6, 5, 4, 10, 10, 12).du().uv(10, 12, 6, 4).rot(180).noCull() .ns().uv(6, 6, 10, 11).noCull().w().uv(5, 4, 10, 12).rot(90).noCull().e().uv(10, 4, 5, 12).rot(270).noCull() - .add(3, 10, 0, 13, 16, 16).d().uv(3, 0, 13, 16).rot(180).noCull().u("anvil_top_" + state.getValue(DAMAGE)) + .add(3, 10, 0, 13, 16, 16).d().uv(3, 0, 13, 16).rot(180).noCull().u("anvil_top_" + this.damage) .uv(3, 0, 13, 16).rot(180).noCull() .ns().uv(3, 0, 13, 6).noCull().w().uv(10, 0, 16, 16).rot(90).noCull().e().uv(16, 0, 10, 16).rot(270).noCull() .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index bcde12f5..eb2280a3 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -16,7 +16,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.tileentity.TileEntity; @@ -529,9 +529,9 @@ public class BlockBrewingStand extends BlockContainer return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]}; + return new Property[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/tech/BlockButton.java b/common/src/main/java/common/block/tech/BlockButton.java index 956d0fe2..a170d068 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -3,6 +3,7 @@ package common.block.tech; import java.util.List; import common.block.Block; +import common.block.Directional; import common.block.Material; import common.collect.Lists; import common.entity.Entity; @@ -15,9 +16,8 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -27,9 +27,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockButton extends Block +public class BlockButton extends Block implements Directional { - public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool POWERED = PropertyBool.create("powered"); public static final List BUTTONS = Lists.newArrayList(); @@ -394,9 +393,9 @@ public class BlockButton extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, POWERED}; + return new Property[] {FACING, POWERED}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index 087c8652..4672cd56 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -7,8 +7,6 @@ import common.block.Material; import common.entity.Entity; import common.entity.item.EntityItem; import common.entity.npc.EntityNPC; -import common.init.Blocks; -import common.init.FluidRegistry; import common.init.Items; import common.item.Item; import common.item.ItemArmor; @@ -16,7 +14,7 @@ import common.item.ItemBanner; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.tileentity.TileEntityBanner; @@ -492,7 +490,7 @@ public class BlockCauldron extends Block int i = ((Integer)state.getValue(LEVEL)).intValue(); Item item = itemstack.getItem(); - if (item == Items.water_bucket && FluidRegistry.getStaticBlock(itemstack.getMetadata()) == Blocks.water) + if (item == Items.water_bucket) { if (i < 3) { @@ -513,7 +511,7 @@ public class BlockCauldron extends Block { // if (!playerIn.creative) // { - ItemStack itemstack2 = new ItemStack(Items.potion, 1, 0); + ItemStack itemstack2 = new ItemStack(Items.potion); if (!playerIn.inventory.addItemStackToInventory(itemstack2)) { @@ -659,9 +657,9 @@ public class BlockCauldron extends Block return ((Integer)state.getValue(LEVEL)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {LEVEL}; + return new Property[] {LEVEL}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index 75d977dc..03080280 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -2,6 +2,7 @@ package common.block.tech; import common.block.Block; import common.block.BlockContainer; +import common.block.Rotatable; import common.block.Material; import common.color.TextColor; import common.entity.Entity; @@ -17,8 +18,7 @@ import common.inventory.InventoryLargeChest; import common.item.CheatTab; import common.item.ItemStack; import common.packet.SPacketSoundEffect; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.tileentity.ILockableContainer; import common.tileentity.Passcode; import common.tileentity.TileEntity; @@ -33,11 +33,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockChest extends BlockContainer +public class BlockChest extends BlockContainer implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); - - /** 0 : Normal chest, 1 : Trapped chest */ public final int chestType; public BlockChest(int type) @@ -628,9 +625,9 @@ public class BlockChest extends BlockContainer return ((Facing)state.getValue(FACING)).getIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } public boolean isXrayVisible() diff --git a/common/src/main/java/common/block/tech/BlockDaylightDetector.java b/common/src/main/java/common/block/tech/BlockDaylightDetector.java index f35f5304..82ee1bcc 100755 --- a/common/src/main/java/common/block/tech/BlockDaylightDetector.java +++ b/common/src/main/java/common/block/tech/BlockDaylightDetector.java @@ -1,7 +1,5 @@ package common.block.tech; -import java.util.List; - import common.block.BlockContainer; import common.block.Material; import common.block.SoundType; @@ -10,11 +8,10 @@ import common.init.Blocks; import common.init.ItemRegistry; import common.item.CheatTab; import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.tileentity.TileEntity; @@ -175,20 +172,9 @@ public class BlockDaylightDetector extends BlockContainer return ((Integer)state.getValue(POWER)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {POWER}; - } - - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - if (!this.inverted) - { - super.getSubBlocks(itemIn, tab, list); - } + return new Property[] {POWER}; } public Transforms getTransform() { diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index 4421fbb8..0165aa94 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -2,6 +2,7 @@ package common.block.tech; import common.block.Block; import common.block.BlockContainer; +import common.block.Directional; import common.block.Material; import common.dispenser.BehaviorDefaultDispenseItem; import common.dispenser.IBehaviorDispenseItem; @@ -20,9 +21,8 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityDispenser; @@ -33,9 +33,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockDispenser extends BlockContainer +public class BlockDispenser extends BlockContainer implements Directional { - public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool TRIGGERED = PropertyBool.create("triggered"); public static final RegistryDefaulted dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem()); protected Random rand = new Random(); @@ -301,9 +300,9 @@ public class BlockDispenser extends BlockContainer return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, TRIGGERED}; + return new Property[] {FACING, TRIGGERED}; } public boolean isMagnetic() { @@ -319,7 +318,7 @@ public class BlockDispenser extends BlockContainer .s("furnace_side").we("furnace_side").rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {TRIGGERED}; + public Property[] getIgnoredProperties() { + return new Property[] {TRIGGERED}; } } diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index 4a3d9fae..e4eaf1e1 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -2,6 +2,7 @@ package common.block.tech; import common.block.Block; import common.block.BlockContainer; +import common.block.Rotatable; import common.block.Material; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -15,8 +16,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityFurnace; @@ -27,9 +27,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockFurnace extends BlockContainer +public class BlockFurnace extends BlockContainer implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); private final boolean isBurning; private static boolean keepInventory; @@ -271,9 +270,9 @@ public class BlockFurnace extends BlockContainer return ((Facing)state.getValue(FACING)).getIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/tech/BlockHopper.java b/common/src/main/java/common/block/tech/BlockHopper.java index 524a7996..fc9f09b8 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -1,10 +1,9 @@ package common.block.tech; import java.util.List; -import java.util.function.Predicate; - import common.block.Block; import common.block.BlockContainer; +import common.block.DirectionalDown; import common.block.Material; import common.entity.Entity; import common.entity.npc.EntityNPC; @@ -17,9 +16,8 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.tileentity.TileEntity; import common.tileentity.TileEntityHopper; import common.util.BlockPos; @@ -30,7 +28,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockHopper extends BlockContainer +public class BlockHopper extends BlockContainer implements DirectionalDown { private static final Model hopper_down = ModelProvider.getModelProvider().getModel("hopper_outside") .add(0, 10, 0, 16, 11, 16) @@ -84,13 +82,6 @@ public class BlockHopper extends BlockContainer .e().uv(6, 12, 10, 16).noCull() ; - public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate() - { - public boolean test(Facing p_apply_1_) - { - return p_apply_1_ != Facing.UP; - } - }); public static final PropertyBool ENABLED = PropertyBool.create("enabled"); public BlockHopper() @@ -302,9 +293,9 @@ public class BlockHopper extends BlockContainer return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, ENABLED}; + return new Property[] {FACING, ENABLED}; } public boolean isMagnetic() { @@ -365,7 +356,7 @@ public class BlockHopper extends BlockContainer .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {ENABLED}; + public Property[] getIgnoredProperties() { + return new Property[] {ENABLED}; } } diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index 6e5e2769..91e80f11 100755 --- a/common/src/main/java/common/block/tech/BlockLever.java +++ b/common/src/main/java/common/block/tech/BlockLever.java @@ -9,7 +9,7 @@ import common.item.CheatTab; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.util.BlockPos; @@ -270,9 +270,9 @@ public class BlockLever extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, POWERED}; + return new Property[] {FACING, POWERED}; } private static ModelRotation getRotation(EnumOrientation face) { diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index efdf9c30..d8b85231 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -1,7 +1,7 @@ package common.block.tech; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.ITileEntityProvider; import common.block.Material; import common.entity.npc.EntityNPC; @@ -9,7 +9,7 @@ import common.entity.types.EntityLiving; import common.inventory.Container; import common.inventory.InventoryHelper; import common.item.CheatTab; -import common.properties.IProperty; +import common.properties.Property; import common.tileentity.TileEntity; import common.tileentity.TileEntityDevice; import common.util.BlockPos; @@ -18,7 +18,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public abstract class BlockMachine extends BlockDirectional implements ITileEntityProvider { +public abstract class BlockMachine extends Block implements Rotatable, ITileEntityProvider { public BlockMachine() { super(Material.SOLID); this.hasTile = true; @@ -94,8 +94,8 @@ public abstract class BlockMachine extends BlockDirectional implements ITileEnti return ((Facing)state.getValue(FACING)).getHorizontalIndex(); } - protected IProperty[] getProperties() { - return new IProperty[] {FACING}; + protected Property[] getProperties() { + return new Property[] {FACING}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/tech/BlockPistonBase.java b/common/src/main/java/common/block/tech/BlockPistonBase.java index cc6a0615..64f7c830 100755 --- a/common/src/main/java/common/block/tech/BlockPistonBase.java +++ b/common/src/main/java/common/block/tech/BlockPistonBase.java @@ -3,6 +3,7 @@ package common.block.tech; import java.util.List; import common.block.Block; +import common.block.Directional; import common.block.ITileEntityProvider; import common.block.Material; import common.block.SoundType; @@ -16,9 +17,8 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.tileentity.TileEntity; import common.tileentity.TileEntityPiston; import common.util.BlockPos; @@ -31,7 +31,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockPistonBase extends Block +public class BlockPistonBase extends Block implements Directional { private static class BlockPistonStructureHelper { @@ -246,7 +246,6 @@ public class BlockPistonBase extends Block } } - public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool EXTENDED = PropertyBool.create("extended"); /** This piston is the sticky one? */ @@ -703,9 +702,9 @@ public class BlockPistonBase extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, EXTENDED}; + return new Property[] {FACING, EXTENDED}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/tech/BlockPistonHead.java b/common/src/main/java/common/block/tech/BlockPistonHead.java index 21aa5e21..0306e530 100755 --- a/common/src/main/java/common/block/tech/BlockPistonHead.java +++ b/common/src/main/java/common/block/tech/BlockPistonHead.java @@ -3,6 +3,7 @@ package common.block.tech; import java.util.List; import common.block.Block; +import common.block.Directional; import common.block.Material; import common.block.SoundType; import common.entity.Entity; @@ -12,9 +13,8 @@ import common.item.Item; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -26,9 +26,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockPistonHead extends Block +public class BlockPistonHead extends Block implements Directional { - public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockPistonHead.EnumPistonType.class); public static final PropertyBool SHORT = PropertyBool.create("short"); @@ -255,9 +254,9 @@ public class BlockPistonHead extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, TYPE, SHORT}; + return new Property[] {FACING, TYPE, SHORT}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/tech/BlockPistonMoving.java b/common/src/main/java/common/block/tech/BlockPistonMoving.java index 666061d9..3b7b4ccf 100755 --- a/common/src/main/java/common/block/tech/BlockPistonMoving.java +++ b/common/src/main/java/common/block/tech/BlockPistonMoving.java @@ -6,8 +6,7 @@ import common.block.Material; import common.entity.npc.EntityNPC; import common.init.Blocks; import common.item.Item; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; @@ -24,7 +23,7 @@ import common.world.AWorldServer; public class BlockPistonMoving extends BlockContainer { - public static final PropertyDirection FACING = BlockPistonHead.FACING; + public static final PropertyEnum FACING = BlockPistonHead.FACING; public static final PropertyEnum TYPE = BlockPistonHead.TYPE; public BlockPistonMoving() @@ -307,8 +306,8 @@ public class BlockPistonMoving extends BlockContainer return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, TYPE}; + return new Property[] {FACING, TYPE}; } } diff --git a/common/src/main/java/common/block/tech/BlockPressurePlate.java b/common/src/main/java/common/block/tech/BlockPressurePlate.java index b17b4b07..338cbbab 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlate.java @@ -5,7 +5,7 @@ import java.util.List; import common.block.Material; import common.entity.Entity; import common.entity.types.EntityLiving; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.util.BlockPos; import common.util.BoundingBox; @@ -83,9 +83,9 @@ public class BlockPressurePlate extends BlockBasePressurePlate return ((Boolean)state.getValue(POWERED)).booleanValue() ? 1 : 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {POWERED}; + return new Property[] {POWERED}; } public String getTexture() { diff --git a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java index eeac2ec3..375fd766 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java @@ -2,7 +2,7 @@ package common.block.tech; import common.block.Material; import common.entity.Entity; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.util.BlockPos; import common.util.ExtMath; @@ -70,9 +70,9 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate return ((Integer)state.getValue(POWER)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {POWER}; + return new Property[] {POWER}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/tech/BlockRail.java b/common/src/main/java/common/block/tech/BlockRail.java index de178aa1..bdfa0aae 100755 --- a/common/src/main/java/common/block/tech/BlockRail.java +++ b/common/src/main/java/common/block/tech/BlockRail.java @@ -1,7 +1,7 @@ package common.block.tech; import common.block.Block; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.util.BlockPos; import common.world.State; @@ -25,7 +25,7 @@ public class BlockRail extends BlockRailBase } } - public IProperty getShapeProperty() + public Property getShapeProperty() { return SHAPE; } @@ -46,8 +46,8 @@ public class BlockRail extends BlockRailBase return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {SHAPE}; + return new Property[] {SHAPE}; } } diff --git a/common/src/main/java/common/block/tech/BlockRailBase.java b/common/src/main/java/common/block/tech/BlockRailBase.java index df3e43c7..0cd20bd4 100755 --- a/common/src/main/java/common/block/tech/BlockRailBase.java +++ b/common/src/main/java/common/block/tech/BlockRailBase.java @@ -11,7 +11,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -227,7 +227,7 @@ public abstract class BlockRailBase extends Block } } - public abstract IProperty getShapeProperty(); + public abstract Property getShapeProperty(); public static enum EnumRailDirection implements Identifyable { diff --git a/common/src/main/java/common/block/tech/BlockRailDetector.java b/common/src/main/java/common/block/tech/BlockRailDetector.java index 330cc6ce..7a3a59d0 100755 --- a/common/src/main/java/common/block/tech/BlockRailDetector.java +++ b/common/src/main/java/common/block/tech/BlockRailDetector.java @@ -9,7 +9,7 @@ import common.inventory.Container; import common.inventory.IInventory; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.rng.Random; @@ -23,20 +23,13 @@ import common.world.AWorldServer; public class BlockRailDetector extends BlockRailBase { - public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class, new Predicate() - { - public boolean test(BlockRailBase.EnumRailDirection p_apply_1_) - { - return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST; - } - }); + public static final PropertyEnum SHAPE = PropertyEnum.create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST, EnumRailDirection.ASCENDING_EAST, EnumRailDirection.ASCENDING_WEST, EnumRailDirection.ASCENDING_NORTH, EnumRailDirection.ASCENDING_SOUTH); public static final PropertyBool POWERED = PropertyBool.create("powered"); public BlockRailDetector() { super(true); this.setDefaultState(this.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH)); -// this.setTickRandomly(true); } /** @@ -135,7 +128,7 @@ public class BlockRailDetector extends BlockRailBase this.updatePoweredState(worldIn, pos, state); } - public IProperty getShapeProperty() + public Property getShapeProperty() { return SHAPE; } @@ -207,9 +200,9 @@ public class BlockRailDetector extends BlockRailBase return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {SHAPE, POWERED}; + return new Property[] {SHAPE, POWERED}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/tech/BlockRailPowered.java b/common/src/main/java/common/block/tech/BlockRailPowered.java index 727800b7..72fa440d 100755 --- a/common/src/main/java/common/block/tech/BlockRailPowered.java +++ b/common/src/main/java/common/block/tech/BlockRailPowered.java @@ -1,11 +1,9 @@ package common.block.tech; -import java.util.function.Predicate; - import common.block.Block; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.util.BlockPos; @@ -14,13 +12,7 @@ import common.world.World; public class BlockRailPowered extends BlockRailBase { - public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class, new Predicate() - { - public boolean test(BlockRailBase.EnumRailDirection p_apply_1_) - { - return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST; - } - }); + public static final PropertyEnum SHAPE = PropertyEnum.create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST, EnumRailDirection.ASCENDING_EAST, EnumRailDirection.ASCENDING_WEST, EnumRailDirection.ASCENDING_NORTH, EnumRailDirection.ASCENDING_SOUTH); public static final PropertyBool POWERED = PropertyBool.create("powered"); public BlockRailPowered() @@ -166,7 +158,7 @@ public class BlockRailPowered extends BlockRailBase } } - public IProperty getShapeProperty() + public Property getShapeProperty() { return SHAPE; } @@ -195,9 +187,9 @@ public class BlockRailPowered extends BlockRailBase return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {SHAPE, POWERED}; + return new Property[] {SHAPE, POWERED}; } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/tech/BlockRedstoneComparator.java b/common/src/main/java/common/block/tech/BlockRedstoneComparator.java index 635d9f47..3507eddf 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneComparator.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneComparator.java @@ -11,7 +11,7 @@ import common.item.Item; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.rng.Random; @@ -301,9 +301,9 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, MODE, POWERED}; + return new Property[] {FACING, MODE, POWERED}; } /** diff --git a/common/src/main/java/common/block/tech/BlockRedstoneDiode.java b/common/src/main/java/common/block/tech/BlockRedstoneDiode.java index 5c61033d..a86e845c 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneDiode.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneDiode.java @@ -1,7 +1,7 @@ package common.block.tech; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.Material; import common.entity.types.EntityLiving; import common.init.Blocks; @@ -15,7 +15,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public abstract class BlockRedstoneDiode extends BlockDirectional +public abstract class BlockRedstoneDiode extends Block implements Rotatable { /** Tells whether the repeater is powered or not */ protected final boolean isRepeaterPowered; diff --git a/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java b/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java index 07499f25..b87d1a9d 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneRepeater.java @@ -9,7 +9,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyInteger; import common.rng.Random; @@ -153,9 +153,9 @@ public class BlockRedstoneRepeater extends BlockRedstoneDiode return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, DELAY, LOCKED}; + return new Property[] {FACING, DELAY, LOCKED}; } private static Model getModelOff(int delay) { diff --git a/common/src/main/java/common/block/tech/BlockRedstoneWire.java b/common/src/main/java/common/block/tech/BlockRedstoneWire.java index 514b546a..e29e5067 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneWire.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneWire.java @@ -16,7 +16,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyEnum; import common.properties.PropertyInteger; import common.rng.Random; @@ -817,9 +817,9 @@ public class BlockRedstoneWire extends Block return ((Integer)state.getValue(POWER)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {NORTH, EAST, SOUTH, WEST, POWER}; + return new Property[] {NORTH, EAST, SOUTH, WEST, POWER}; } public boolean isMagnetic() { @@ -1023,8 +1023,8 @@ public class BlockRedstoneWire extends Block return redstone_none; } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {POWER}; + public Property[] getIgnoredProperties() { + return new Property[] {POWER}; } static enum EnumAttachPosition implements Identifyable diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index 45c5fbf5..eb771420 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -1,7 +1,5 @@ package common.block.tech; -import java.util.List; - import common.block.Block; import common.block.Material; import common.entity.Entity; @@ -13,13 +11,12 @@ import common.init.Items; import common.init.SoundEvent; import common.item.CheatTab; import common.item.Item; -import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyInteger; import common.util.BlockPos; +import common.util.ExtMath; import common.util.Facing; import common.world.Explosion; import common.world.State; @@ -29,13 +26,25 @@ import common.world.AWorldServer; public class BlockTNT extends Block { public static final PropertyBool EXPLODE = PropertyBool.create("explode"); - public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 7); + public static final BlockTNT[] TNTS = new BlockTNT[8]; + + private final int power; + + public static BlockTNT getByPower(int power) { + return TNTS[ExtMath.clampi(power, 0, TNTS.length - 1)]; + } - public BlockTNT() + public BlockTNT(int power) { super(Material.EXPLOSIVE); + this.power = power; this.setDefaultState(this.getBaseState().withProperty(EXPLODE, Boolean.valueOf(false))); this.setTab(CheatTab.TECHNOLOGY); + TNTS[power] = this; + } + + public int getExplosionPower() { + return this.power; } public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) @@ -68,7 +77,7 @@ public class BlockTNT extends Block { if (!worldIn.client) { - EntityTnt entitytntprimed = new EntityTnt(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy(), prevState.getValue(POWER).intValue()); + EntityTnt entitytntprimed = new EntityTnt(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy(), this.power); entitytntprimed.fuse = worldIn.rand.zrange(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; worldIn.spawnEntityInWorld(entitytntprimed); } @@ -88,7 +97,7 @@ public class BlockTNT extends Block { if (((Boolean)state.getValue(EXPLODE)).booleanValue()) { - EntityTnt entitytntprimed = new EntityTnt(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter, state.getValue(POWER).intValue()); + EntityTnt entitytntprimed = new EntityTnt(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter, this.power); worldIn.spawnEntityInWorld(entitytntprimed); worldIn.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F); } @@ -138,13 +147,6 @@ public class BlockTNT extends Block } } } - - public void getSubBlocks(Item itemIn, CheatTab tab, List list) - { - for(int z = 0; z < 8; z++) { - list.add(new ItemStack(itemIn, 1, z)); - } - } /** * Return whether this block can drop from an explosion. @@ -159,7 +161,7 @@ public class BlockTNT extends Block */ public State getStateFromMeta(int meta) { - return this.getState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0)).withProperty(POWER, Integer.valueOf(((meta >> 1) & 7))); + return this.getState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0)); } /** @@ -167,17 +169,12 @@ public class BlockTNT extends Block */ public int getMetaFromState(State state) { - return (((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0) | (state.getValue(POWER).intValue() << 1); - } - - public int damageDropped(State state) - { - return ((Integer)state.getValue(POWER)).intValue(); + return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {EXPLODE, POWER}; + return new Property[] {EXPLODE}; } public boolean isXrayVisible() @@ -186,12 +183,12 @@ public class BlockTNT extends Block } public Model getModel(ModelProvider provider, String name, State state) { - String power = state.getValue(POWER) == 0 ? "" : ("_" + state.getValue(POWER)); + String power = this.power == 0 ? "" : ("_" + this.power); return provider.getModel("tnt_side" + power).add().nswe().d("tnt_bottom" + power).u("tnt_top" + power); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {EXPLODE}; + public Property[] getIgnoredProperties() { + return new Property[] {EXPLODE}; } public void onDestroyedByFire(World world, BlockPos pos, State state) { diff --git a/common/src/main/java/common/block/tech/BlockTorch.java b/common/src/main/java/common/block/tech/BlockTorch.java index 91d82e4b..a9d4150b 100755 --- a/common/src/main/java/common/block/tech/BlockTorch.java +++ b/common/src/main/java/common/block/tech/BlockTorch.java @@ -1,11 +1,10 @@ package common.block.tech; -import java.util.function.Predicate; - import common.block.Block; -import common.block.BlockDirectional; +import common.block.DirectionalUp; import common.block.Material; import common.block.artificial.BlockFence; +import common.block.artificial.BlockStainedGlass; import common.entity.types.EntityLiving; import common.init.Blocks; import common.item.CheatTab; @@ -14,8 +13,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -27,16 +25,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockTorch extends Block +public class BlockTorch extends Block implements DirectionalUp { - public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate() - { - public boolean test(Facing p_apply_1_) - { - return p_apply_1_ != Facing.DOWN; - } - }); - private static boolean isBlockNormalCube(World world, BlockPos pos, boolean def) { if(!World.isValid(pos) || (world.client && !world.isBlockLoaded(pos, false))) return def; @@ -79,13 +69,13 @@ public class BlockTorch extends Block else { Block block = worldIn.getState(pos).getBlock(); - return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; + return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block instanceof BlockStainedGlass; } } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - for (Facing enumfacing : FACING.getAllowedValues()) + for (Facing enumfacing : FACING.getStates()) { if (this.canPlaceAt(worldIn, pos, enumfacing)) { @@ -320,9 +310,9 @@ public class BlockTorch extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { @@ -348,6 +338,6 @@ public class BlockTorch extends Block .add(-8, 3.5f, 7, 8, 19.5f, 9).noShade().rotate(0, 3.5f, 8, Facing.Axis.Z, -22.5f, false) .n().uv(0, 0, 16, 16).noCull() .s().uv(0, 0, 16, 16).noCull() - .rotate(ModelRotation.getEastRot(state.getValue(BlockDirectional.FACING), false)); + .rotate(ModelRotation.getEastRot(state.getValue(FACING), false)); } } diff --git a/common/src/main/java/common/block/tech/BlockTripWire.java b/common/src/main/java/common/block/tech/BlockTripWire.java index 8ed734df..f3b0f707 100755 --- a/common/src/main/java/common/block/tech/BlockTripWire.java +++ b/common/src/main/java/common/block/tech/BlockTripWire.java @@ -14,7 +14,7 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -300,9 +300,9 @@ public class BlockTripWire extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH}; + return new Property[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH}; } private static Model getModelDetached(boolean n, boolean s, boolean w, boolean e, int sides) { @@ -693,7 +693,7 @@ public class BlockTripWire extends Block getModelDetached(n, s, w, e, sides))); } - public IProperty[] getIgnoredProperties() { - return new IProperty[] {DISARMED, POWERED}; + public Property[] getIgnoredProperties() { + return new Property[] {DISARMED, POWERED}; } } diff --git a/common/src/main/java/common/block/tech/BlockTripWireHook.java b/common/src/main/java/common/block/tech/BlockTripWireHook.java index 95cb387b..78214f4f 100755 --- a/common/src/main/java/common/block/tech/BlockTripWireHook.java +++ b/common/src/main/java/common/block/tech/BlockTripWireHook.java @@ -1,6 +1,7 @@ package common.block.tech; import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.types.EntityLiving; import common.init.Blocks; @@ -11,9 +12,8 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyBool; -import common.properties.PropertyDirection; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -23,9 +23,8 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockTripWireHook extends Block +public class BlockTripWireHook extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyBool POWERED = PropertyBool.create("powered"); public static final PropertyBool ATTACHED = PropertyBool.create("attached"); public static final PropertyBool SUSPENDED = PropertyBool.create("suspended"); @@ -370,9 +369,9 @@ public class BlockTripWireHook extends Block return i; } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING, POWERED, ATTACHED, SUSPENDED}; + return new Property[] {FACING, POWERED, ATTACHED, SUSPENDED}; } public boolean isMagnetic() { diff --git a/common/src/main/java/common/block/tech/BlockWarpChest.java b/common/src/main/java/common/block/tech/BlockWarpChest.java index e1cfa54b..06e75f30 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -1,6 +1,7 @@ package common.block.tech; import common.block.Block; +import common.block.Rotatable; import common.block.Material; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -14,8 +15,7 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -23,10 +23,8 @@ import common.world.AWorldClient; import common.world.State; import common.world.World; -public class BlockWarpChest extends Block +public class BlockWarpChest extends Block implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); - public BlockWarpChest() { super(Material.SOLID); @@ -157,9 +155,9 @@ public class BlockWarpChest extends Block return ((Facing)state.getValue(FACING)).getIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } public boolean isXrayVisible() diff --git a/common/src/main/java/common/block/tile/BlockBanner.java b/common/src/main/java/common/block/tile/BlockBanner.java index e34b8e8f..328c226c 100755 --- a/common/src/main/java/common/block/tile/BlockBanner.java +++ b/common/src/main/java/common/block/tile/BlockBanner.java @@ -1,13 +1,13 @@ package common.block.tile; import common.block.BlockContainer; +import common.block.Rotatable; import common.block.Material; import common.entity.npc.EntityNPC; import common.init.Items; import common.item.Item; import common.item.ItemStack; import common.model.Transforms; -import common.properties.PropertyDirection; import common.properties.PropertyInteger; import common.rng.Random; import common.tags.TagObject; @@ -15,14 +15,12 @@ import common.tileentity.TileEntity; import common.tileentity.TileEntityBanner; import common.util.BlockPos; import common.util.BoundingBox; -import common.util.Facing; import common.world.IBlockAccess; import common.world.State; import common.world.World; -public class BlockBanner extends BlockContainer +public class BlockBanner extends BlockContainer implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15); public BlockBanner() @@ -32,14 +30,6 @@ public class BlockBanner extends BlockContainer float f1 = 1.0F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); } - -// /** -// * Gets the localized name of this block. Used for the statistics page. -// */ -// public String getLocalizedName() -// { -// return "Banner"; -// } public boolean isPickStrict() { @@ -103,14 +93,6 @@ public class BlockBanner extends BlockContainer { return Items.banner; } - - public int getDamageValue(World worldIn, BlockPos pos) - { - TileEntity te = worldIn.getTileEntity(pos); - if(te instanceof TileEntityBanner) - return ((TileEntityBanner)te).getBaseColor(); - return super.getDamageValue(worldIn, pos); - } /** * Spawns this Block's drops into the World as EntityItems. @@ -121,7 +103,7 @@ public class BlockBanner extends BlockContainer if (tileentity instanceof TileEntityBanner) { - ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); + ItemStack itemstack = new ItemStack(Items.banner); TagObject tag = new TagObject(); tileentity.writeTags(tag); tag.remove("x"); @@ -147,7 +129,7 @@ public class BlockBanner extends BlockContainer if (te instanceof TileEntityBanner) { TileEntityBanner tileentitybanner = (TileEntityBanner)te; - ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor()); + ItemStack itemstack = new ItemStack(Items.banner); TagObject tag = new TagObject(); TileEntityBanner.setBaseColorAndPatterns(tag, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns()); itemstack.setTagInfo("BlockEntityTag", tag); diff --git a/common/src/main/java/common/block/tile/BlockBannerHanging.java b/common/src/main/java/common/block/tile/BlockBannerHanging.java index 1d54303d..4e380b7d 100644 --- a/common/src/main/java/common/block/tile/BlockBannerHanging.java +++ b/common/src/main/java/common/block/tile/BlockBannerHanging.java @@ -1,7 +1,7 @@ package common.block.tile; import common.block.Block; -import common.properties.IProperty; +import common.properties.Property; import common.util.BlockPos; import common.util.Facing; import common.world.IWorldAccess; @@ -75,8 +75,8 @@ public class BlockBannerHanging extends BlockBanner return ((Facing)state.getValue(FACING)).getIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } } \ No newline at end of file diff --git a/common/src/main/java/common/block/tile/BlockBannerStanding.java b/common/src/main/java/common/block/tile/BlockBannerStanding.java index 9a6e28c6..c19ea518 100644 --- a/common/src/main/java/common/block/tile/BlockBannerStanding.java +++ b/common/src/main/java/common/block/tile/BlockBannerStanding.java @@ -1,7 +1,7 @@ package common.block.tile; import common.block.Block; -import common.properties.IProperty; +import common.properties.Property; import common.util.BlockPos; import common.world.State; import common.world.World; @@ -34,8 +34,8 @@ public class BlockBannerStanding extends BlockBanner return ((Integer)state.getValue(ROTATION)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {ROTATION}; + return new Property[] {ROTATION}; } } \ No newline at end of file diff --git a/common/src/main/java/common/block/tile/BlockStandingSign.java b/common/src/main/java/common/block/tile/BlockStandingSign.java index f6a616a2..d80ee07e 100755 --- a/common/src/main/java/common/block/tile/BlockStandingSign.java +++ b/common/src/main/java/common/block/tile/BlockStandingSign.java @@ -1,7 +1,7 @@ package common.block.tile; import common.block.Block; -import common.properties.IProperty; +import common.properties.Property; import common.properties.PropertyInteger; import common.util.BlockPos; import common.world.State; @@ -46,8 +46,8 @@ public class BlockStandingSign extends BlockSign return ((Integer)state.getValue(ROTATION)).intValue(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {ROTATION}; + return new Property[] {ROTATION}; } } diff --git a/common/src/main/java/common/block/tile/BlockWallSign.java b/common/src/main/java/common/block/tile/BlockWallSign.java index b390bd6b..77dd5eb8 100755 --- a/common/src/main/java/common/block/tile/BlockWallSign.java +++ b/common/src/main/java/common/block/tile/BlockWallSign.java @@ -1,18 +1,16 @@ package common.block.tile; import common.block.Block; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.block.Rotatable; +import common.properties.Property; import common.util.BlockPos; import common.util.Facing; import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockWallSign extends BlockSign +public class BlockWallSign extends BlockSign implements Rotatable { - public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); - public BlockWallSign() { this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); @@ -87,8 +85,8 @@ public class BlockWallSign extends BlockSign return ((Facing)state.getValue(FACING)).getIndex(); } - protected IProperty[] getProperties() + protected Property[] getProperties() { - return new IProperty[] {FACING}; + return new Property[] {FACING}; } } diff --git a/common/src/main/java/common/color/DyeColor.java b/common/src/main/java/common/color/DyeColor.java index b197b360..b691635c 100755 --- a/common/src/main/java/common/color/DyeColor.java +++ b/common/src/main/java/common/color/DyeColor.java @@ -7,22 +7,22 @@ import common.util.Identifyable; public enum DyeColor implements Identifyable { - WHITE(0, 15, "white", "WeiĂŸ", "WeiĂŸes", "WeiĂŸer", "WeiĂŸe", "Knochenmehl", 16777215, TextColor.WHITE), - ORANGE(1, 14, "orange", "Orange", "Oranges", "Oranger", "Orange", "Oranger Farbstoff", 14188339, TextColor.ORANGE), - MAGENTA(2, 13, "magenta", "Magenta", "Magenta", "Magenta", "Magenta", "Magenta Farbstoff", 11685080, TextColor.NEON), - LIGHT_BLUE(3, 12, "light_blue", "Hellblau", "Hellblaues", "Hellblauer", "Hellblaue", "Hellblauer Farbstoff", 6724056, TextColor.BLUE), - YELLOW(4, 11, "yellow", "Gelb", "Gelbes", "Gelber", "Gelbe", "Gelber Farbstoff", 15066419, TextColor.YELLOW), - LIME(5, 10, "lime", "HellgrĂ¼n", "HellgrĂ¼nes", "HellgrĂ¼ner", "HellgrĂ¼ne", "HellgrĂ¼ner Farbstoff", 8375321, TextColor.GREEN), - PINK(6, 9, "pink", "Rosa", "Rosa", "Rosa", "Rosa", "Rosa Farbstoff", 15892389, TextColor.MAGENTA), - GRAY(7, 8, "gray", "Grau", "Graues", "Grauer", "Graue", "Grauer Farbstoff", 5000268, TextColor.GRAY), - SILVER(8, 7, "silver", "Hellgrau", "Hellgraues", "Hellgrauer", "Hellgraue", "Hellgrauer Farbstoff", 10066329, TextColor.LGRAY), - CYAN(9, 6, "cyan", "TĂ¼rkis", "TĂ¼rkises", "TĂ¼rkiser", "TĂ¼rkise", "TĂ¼rkiser Farbstoff", 5013401, TextColor.CYAN), - PURPLE(10, 5, "purple", "Violett", "Violettes", "Violetter", "Violette", "Violetter Farbstoff", 8339378, TextColor.DMAGENTA), - BLUE(11, 4, "blue", "Blau", "Blaues", "Blauer", "Blaue", "Lapislazuli", 3361970, TextColor.MIDNIGHT), - BROWN(12, 3, "brown", "Braun", "Braunes", "Brauner", "Braune", "Kakaobohnen", 6704179, TextColor.ORANGE), - GREEN(13, 2, "green", "GrĂ¼n", "GrĂ¼nes", "GrĂ¼ner", "GrĂ¼ne", "KaktusgrĂ¼n", 6717235, TextColor.DGREEN), - RED(14, 1, "red", "Rot", "Rotes", "Roter", "Rote", "Roter Farbstoff", 10040115, TextColor.DRED), - BLACK(15, 0, "black", "Schwarz", "Schwarzes", "Schwarzer", "Schwarze", "Tintenbeutel", 1644825, TextColor.BLACK); + WHITE(0, 15, "white", "WeiĂŸ", "WeiĂŸes", "WeiĂŸer", "WeiĂŸe", "bonemeal", "Knochenmehl", 16777215, TextColor.WHITE), + ORANGE(1, 14, "orange", "Orange", "Oranges", "Oranger", "Orange", null, "Oranger Farbstoff", 14188339, TextColor.ORANGE), + MAGENTA(2, 13, "magenta", "Magenta", "Magenta", "Magenta", "Magenta", null, "Magenta Farbstoff", 11685080, TextColor.NEON), + LIGHT_BLUE(3, 12, "light_blue", "Hellblau", "Hellblaues", "Hellblauer", "Hellblaue", null, "Hellblauer Farbstoff", 6724056, TextColor.BLUE), + YELLOW(4, 11, "yellow", "Gelb", "Gelbes", "Gelber", "Gelbe", null, "Gelber Farbstoff", 15066419, TextColor.YELLOW), + LIME(5, 10, "lime", "HellgrĂ¼n", "HellgrĂ¼nes", "HellgrĂ¼ner", "HellgrĂ¼ne", null, "HellgrĂ¼ner Farbstoff", 8375321, TextColor.GREEN), + PINK(6, 9, "pink", "Rosa", "Rosa", "Rosa", "Rosa", null, "Rosa Farbstoff", 15892389, TextColor.MAGENTA), + GRAY(7, 8, "gray", "Grau", "Graues", "Grauer", "Graue", null, "Grauer Farbstoff", 5000268, TextColor.GRAY), + SILVER(8, 7, "silver", "Hellgrau", "Hellgraues", "Hellgrauer", "Hellgraue", null, "Hellgrauer Farbstoff", 10066329, TextColor.LGRAY), + CYAN(9, 6, "cyan", "TĂ¼rkis", "TĂ¼rkises", "TĂ¼rkiser", "TĂ¼rkise", null, "TĂ¼rkiser Farbstoff", 5013401, TextColor.CYAN), + PURPLE(10, 5, "purple", "Violett", "Violettes", "Violetter", "Violette", null, "Violetter Farbstoff", 8339378, TextColor.DMAGENTA), + BLUE(11, 4, "blue", "Blau", "Blaues", "Blauer", "Blaue", "lapis_lazuli", "Lapislazuli", 3361970, TextColor.MIDNIGHT), + BROWN(12, 3, "brown", "Braun", "Braunes", "Brauner", "Braune", "cocoa", "Kakaobohnen", 6704179, TextColor.ORANGE), + GREEN(13, 2, "green", "GrĂ¼n", "GrĂ¼nes", "GrĂ¼ner", "GrĂ¼ne", "cactus_green", "KaktusgrĂ¼n", 6717235, TextColor.DGREEN), + RED(14, 1, "red", "Rot", "Rotes", "Roter", "Rote", null, "Roter Farbstoff", 10040115, TextColor.DRED), + BLACK(15, 0, "black", "Schwarz", "Schwarzes", "Schwarzer", "Schwarze", "ink_sack", "Tintenbeutel", 1644825, TextColor.BLACK); private static final Map LOOKUP = Maps.newHashMap(); private static final DyeColor[] META_LOOKUP = new DyeColor[values().length]; @@ -36,11 +36,12 @@ public enum DyeColor implements Identifyable private final String msubject; private final String fsubject; private final String dye; + private final String dyeName; private final int color; private final TextColor chatColor; private DyeColor(int meta, int dyeDamage, String name, String display, String subject, String msubject, - String fsubject, String dye, int colorIn, TextColor chatColor) + String fsubject, String dye, String dyeName, int colorIn, TextColor chatColor) { this.meta = meta; this.dyeDamage = dyeDamage; @@ -49,7 +50,8 @@ public enum DyeColor implements Identifyable this.subject = subject; this.msubject = msubject; this.fsubject = fsubject; - this.dye = dye; + this.dye = dye == null ? name + "_dye" : dye; + this.dyeName = dyeName; this.color = colorIn; this.chatColor = chatColor; } @@ -135,6 +137,11 @@ public enum DyeColor implements Identifyable return this.dye; } + public String getDyeName() + { + return this.dyeName; + } + static { for (DyeColor color : values()) { diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index 15a3e9d9..a8490216 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -1629,7 +1629,7 @@ public abstract class Entity public EntityItem dropItemWithOffset(Item itemIn, int size, float offsetY) { - return this.entityDropItem(new ItemStack(itemIn, size, 0), offsetY); + return this.entityDropItem(new ItemStack(itemIn, size), offsetY); } /** diff --git a/common/src/main/java/common/entity/animal/EntityCow.java b/common/src/main/java/common/entity/animal/EntityCow.java index 4e14119b..62641f85 100755 --- a/common/src/main/java/common/entity/animal/EntityCow.java +++ b/common/src/main/java/common/entity/animal/EntityCow.java @@ -130,7 +130,7 @@ public class EntityCow extends EntityAnimal } else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket))) { - player.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), false); + player.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket), false); } return true; diff --git a/common/src/main/java/common/entity/animal/EntityOcelot.java b/common/src/main/java/common/entity/animal/EntityOcelot.java index 67483aeb..cffd3289 100755 --- a/common/src/main/java/common/entity/animal/EntityOcelot.java +++ b/common/src/main/java/common/entity/animal/EntityOcelot.java @@ -23,6 +23,7 @@ import common.entity.types.EntityTameable; import common.init.Items; import common.init.SoundEvent; import common.item.Item; +import common.item.ItemFishFood; import common.item.ItemStack; import common.pathfinding.PathNavigateGround; import common.tags.TagObject; @@ -46,7 +47,7 @@ public class EntityOcelot extends EntityTameable ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); - this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.fish, true)); + this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, stack -> stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(), true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F)); this.tasks.addTask(6, new EntityAIOcelotSit(this, 0.8D)); this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.3F)); @@ -222,7 +223,7 @@ public class EntityOcelot extends EntityTameable this.aiSit.setSitting(!this.isSitting()); } } - else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D) + else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() instanceof ItemFishFood fish && !fish.isCooked() && player.getDistanceSqToEntity(this) < 9.0D) { // if (!player.creative) // { @@ -278,7 +279,7 @@ public class EntityOcelot extends EntityTameable */ public boolean isBreedingItem(ItemStack stack) { - return stack != null && stack.getItem() == Items.fish; + return stack != null && stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(); } /** diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index 4b34e121..0ee95740 100755 --- a/common/src/main/java/common/entity/animal/EntityRabbit.java +++ b/common/src/main/java/common/entity/animal/EntityRabbit.java @@ -16,7 +16,7 @@ import common.ai.EntityAIWatchClosest; import common.ai.EntityJumpHelper; import common.ai.EntityMoveHelper; import common.block.Block; -import common.block.foliage.BlockTallGrass; +import common.block.foliage.BlockFlower; import common.entity.DamageSource; import common.entity.Entity; import common.entity.npc.Alignment; @@ -25,7 +25,6 @@ import common.entity.types.EntityAnimal; import common.entity.types.EntityLiving; import common.init.BlockRegistry; import common.init.Blocks; -import common.init.ItemRegistry; import common.init.Items; import common.init.SoundEvent; import common.item.Item; @@ -64,9 +63,7 @@ public class EntityRabbit extends EntityAnimal { this.navigator.setHeightRequirement(2.5F); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityRabbit.AIPanic(this, 1.33D)); - this.tasks.addTask(2, new EntityAITempt(this, 1.0D, Items.carrot, false)); - this.tasks.addTask(2, new EntityAITempt(this, 1.0D, Items.golden_carrot, false)); - this.tasks.addTask(2, new EntityAITempt(this, 1.0D, ItemRegistry.getItemFromBlock(Blocks.flower), false)); + this.tasks.addTask(2, new EntityAITempt(this, 1.0D, stack -> stack.getItem() == Items.carrot || stack.getItem() == Items.golden_carrot || stack.getItem().getBlock() instanceof BlockFlower, false)); this.tasks.addTask(3, new EntityAIMate(this, 0.8D) { protected int getMatingCooldown() { return EntityRabbit.this.rand.excl(50, 200); @@ -268,7 +265,7 @@ public class EntityRabbit extends EntityAnimal { } private boolean isRabbitBreedingItem(Item itemIn) { - return itemIn == Items.carrot || itemIn == Items.golden_carrot || itemIn == ItemRegistry.getItemFromBlock(Blocks.flower); + return itemIn == Items.carrot || itemIn == Items.golden_carrot || itemIn.getBlock() instanceof BlockFlower; } public EntityRabbit createChild(EntityLiving ageable) { @@ -489,8 +486,8 @@ public class EntityRabbit extends EntityAnimal { if(Vars.rabidRabbits) return block != Blocks.bedrock; return block == Blocks.carrot || block == Blocks.potato || block == Blocks.wheat || block == Blocks.brown_mushroom || - block == Blocks.flower || block == Blocks.blue_mushroom || - (block == Blocks.tallgrass && state.getValue(BlockTallGrass.TYPE) == BlockTallGrass.EnumType.GRASS); + block instanceof BlockFlower || block == Blocks.blue_mushroom || + block == Blocks.tallgrass; } } diff --git a/common/src/main/java/common/entity/animal/EntitySheep.java b/common/src/main/java/common/entity/animal/EntitySheep.java index a2250da5..ca5e04f7 100755 --- a/common/src/main/java/common/entity/animal/EntitySheep.java +++ b/common/src/main/java/common/entity/animal/EntitySheep.java @@ -12,6 +12,7 @@ import common.ai.EntityAITempt; import common.ai.EntityAIWander; import common.ai.EntityAIWatchClosest; import common.biome.Biome; +import common.block.artificial.BlockWool; import common.collect.Maps; import common.color.DyeColor; import common.entity.item.EntityItem; @@ -26,6 +27,7 @@ import common.init.SoundEvent; import common.inventory.Container; import common.inventory.InventoryCrafting; import common.item.Item; +import common.item.ItemDye; import common.item.ItemShears; import common.item.ItemStack; import common.pathfinding.PathNavigateGround; @@ -75,8 +77,6 @@ public class EntitySheep extends EntityAnimal this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, null, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); - this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.dye, 1, 0)); - this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.dye, 1, 0)); } protected void updateAITasks() @@ -123,7 +123,7 @@ public class EntitySheep extends EntityAnimal { if (!this.getSheared()) { - this.entityDropItem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 0.0F); + this.entityDropItem(new ItemStack(ItemRegistry.getRegisteredItem(this.getFleeceColor().getName() + "_wool")), 0.0F); } // int i = this.rand.roll(2) + this.rand.zrange(1 + lootingModifier); @@ -143,7 +143,7 @@ public class EntitySheep extends EntityAnimal protected Item getDropItem() { - return ItemRegistry.getItemFromBlock(Blocks.wool); + return ItemRegistry.getItemFromBlock(BlockWool.getByColor(this.getFleeceColor())); } public void handleStatusUpdate(byte id) @@ -192,7 +192,7 @@ public class EntitySheep extends EntityAnimal for (int j = 0; j < i; ++j) { - EntityItem entityitem = this.entityDropItem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 1.0F); + EntityItem entityitem = this.entityDropItem(new ItemStack(ItemRegistry.getRegisteredItem(this.getFleeceColor().getName() + "_wool")), 1.0F); entityitem.motionY += (double)(this.rand.floatv() * 0.05F); entityitem.motionX += (double)((this.rand.floatv() - this.rand.floatv()) * 0.1F); entityitem.motionZ += (double)((this.rand.floatv() - this.rand.floatv()) * 0.1F); @@ -350,28 +350,25 @@ public class EntitySheep extends EntityAnimal return livingdata; } - /** - * Attempts to mix both parent sheep to come up with a mixed dye color. - */ private DyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother) { - int i = ((EntitySheep)father).getFleeceColor().getDyeDamage(); - int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage(); - this.inventoryCrafting.getStackInSlot(0).setItemDamage(i); - this.inventoryCrafting.getStackInSlot(1).setItemDamage(j); + DyeColor i = ((EntitySheep)father).getFleeceColor(); + DyeColor j = ((EntitySheep)mother).getFleeceColor(); + this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(ItemDye.getByColor(i))); + this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(ItemDye.getByColor(j))); ItemStack itemstack = CraftingRegistry.getMatching(this.inventoryCrafting, ((EntitySheep)father).worldObj); - int k; + DyeColor k; - if (itemstack != null && itemstack.getItem() == Items.dye) + if (itemstack != null && itemstack.getItem() instanceof ItemDye dye) { - k = itemstack.getMetadata(); + k = dye.getColor(); } else { k = this.worldObj.rand.chance() ? i : j; } - return DyeColor.byDyeDamage(k); + return k; } public float getEyeHeight() diff --git a/common/src/main/java/common/entity/animal/EntitySquid.java b/common/src/main/java/common/entity/animal/EntitySquid.java index 1650e154..20969ed6 100755 --- a/common/src/main/java/common/entity/animal/EntitySquid.java +++ b/common/src/main/java/common/entity/animal/EntitySquid.java @@ -119,7 +119,7 @@ public class EntitySquid extends EntityWaterMob for (int j = 0; j < i; ++j) { - this.entityDropItem(new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), 0.0F); + this.entityDropItem(new ItemStack(Items.ink_sack), 0.0F); } } diff --git a/common/src/main/java/common/entity/animal/EntityWolf.java b/common/src/main/java/common/entity/animal/EntityWolf.java index cf694c07..8aa922b4 100755 --- a/common/src/main/java/common/entity/animal/EntityWolf.java +++ b/common/src/main/java/common/entity/animal/EntityWolf.java @@ -26,6 +26,7 @@ import common.entity.types.EntityTameable; import common.init.Items; import common.init.SoundEvent; import common.item.Item; +import common.item.ItemDye; import common.item.ItemFood; import common.item.ItemStack; import common.model.ParticleType; @@ -380,9 +381,9 @@ public class EntityWolf extends EntityTameable return true; } } - else if (itemstack.getItem() == Items.dye) + else if (itemstack.getItem() instanceof ItemDye dye) { - DyeColor enumdyecolor = DyeColor.byDyeDamage(itemstack.getMetadata()); + DyeColor enumdyecolor = dye.getColor(); if (enumdyecolor != this.getCollarColor()) { diff --git a/common/src/main/java/common/entity/item/EntityFalling.java b/common/src/main/java/common/entity/item/EntityFalling.java index 75d3c6b0..8fe60389 100755 --- a/common/src/main/java/common/entity/item/EntityFalling.java +++ b/common/src/main/java/common/entity/item/EntityFalling.java @@ -140,7 +140,7 @@ public class EntityFalling extends Entity implements IObjectData } else if (this.shouldDropItem && Vars.objectDrop) { - this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F); + this.entityDropItem(new ItemStack(block), 0.0F); } } } @@ -149,7 +149,7 @@ public class EntityFalling extends Entity implements IObjectData { if (this.shouldDropItem && Vars.objectDrop) { - this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F); + this.entityDropItem(new ItemStack(block), 0.0F); } this.setDead(); @@ -169,7 +169,7 @@ public class EntityFalling extends Entity implements IObjectData if (i > 0) { List list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox())); - boolean flag = block == Blocks.anvil; + boolean flag = block instanceof BlockAnvil; DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock; if(this.worldObj.client || (flag ? Vars.damageAcme : Vars.damageSquish)) { @@ -181,16 +181,17 @@ public class EntityFalling extends Entity implements IObjectData if (flag && (this.worldObj.client || Vars.anvilFallDecay) && (double)this.rand.floatv() < 0.05000000074505806D + (double)i * 0.05D) { - int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue(); + BlockAnvil anvil = (BlockAnvil)block; + int j = anvil.getAnvilDamage(); ++j; - if (j > 2) + if (j >= BlockAnvil.ANVILS.length) { this.canSetAsBlock = true; } else { - this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j)); + this.fallTile = BlockAnvil.getByDamage(j).getState().withProperty(BlockAnvil.FACING, this.fallTile.getValue(BlockAnvil.FACING)); } } } diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index 00e1f5af..dc0fcadb 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -67,7 +67,7 @@ public class EntityItem extends Entity // for(int z = 0; z < 8; z++) { ((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, - ItemRegistry.getIdFromItem(this.getEntityItem().getItem()), this.getEntityItem().getMetadata()); + ItemRegistry.getIdFromItem(this.getEntityItem().getItem())); // } this.worldObj.playAuxSFX(1023, this.getPosition(), 0); this.setDead(); @@ -233,10 +233,6 @@ public class EntityItem extends Entity { return false; } - else if (itemstack1.getItem().getHasSubtypes() && itemstack1.getMetadata() != itemstack.getMetadata()) - { - return false; - } else if (itemstack1.size < itemstack.size) { return other.combineItems(this); @@ -465,7 +461,7 @@ public class EntityItem extends Entity return this.getCustomNameTag(); String comp = super.getTypeName(); comp += " (" + this.getEntityItem().size + " * " + - ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ":" + this.getEntityItem().getMetadata() + ")"; + ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ")"; return comp; } diff --git a/common/src/main/java/common/entity/npc/EntityHuman.java b/common/src/main/java/common/entity/npc/EntityHuman.java index 77a4d3df..64c03d4e 100755 --- a/common/src/main/java/common/entity/npc/EntityHuman.java +++ b/common/src/main/java/common/entity/npc/EntityHuman.java @@ -105,7 +105,7 @@ public class EntityHuman extends EntityNPC { } public boolean isBreedingItem(ItemStack stack) { - return stack.getItem() == Items.golden_apple && stack.getMetadata() == 0; + return stack.getItem() == Items.golden_apple; } protected void updateAITasks() { diff --git a/common/src/main/java/common/entity/npc/EntityMage.java b/common/src/main/java/common/entity/npc/EntityMage.java index 4811eb2e..fcfd1d0b 100755 --- a/common/src/main/java/common/entity/npc/EntityMage.java +++ b/common/src/main/java/common/entity/npc/EntityMage.java @@ -5,6 +5,7 @@ import java.util.List; import common.entity.effect.EntityLightning; import common.entity.types.EntityLiving; import common.init.Items; +import common.item.ItemPotion; import common.item.ItemStack; import common.potion.Potion; import common.potion.PotionEffect; @@ -37,9 +38,9 @@ public class EntityMage extends EntityNPC ItemStack itemstack = this.getHeldItem(); this.setItem(0, null); - if (itemstack != null && itemstack.getItem() == Items.potion) + if (itemstack != null && itemstack.getItem() instanceof ItemPotion potion) { - List list = Items.potion.getEffects(itemstack); + List list = potion.getEffects(); if (list != null) { @@ -84,14 +85,14 @@ public class EntityMage extends EntityNPC if (i > -1) { - this.setItem(0, new ItemStack(Items.potion, 1, i)); + this.setItem(0, new ItemStack(ItemPotion.getPotionItem(i))); this.attackTimer = this.getHeldItem().getMaxItemUseDuration(); this.drinking = true; this.setSpeedMod(0.165f); } else if(this.rand.chance(80)) { boolean far = this.getAttackTarget() != null && this.getAttackTarget().getDistanceSqToEntity(this) >= 256.0; - this.setItem(0, far || this.rand.chance() ? new ItemStack(Items.potion, 1, 16384) : null); + this.setItem(0, far || this.rand.chance() ? new ItemStack(Items.splash_potion) : null); } } } diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 74452db8..39fa2f46 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -1393,7 +1393,7 @@ public abstract class EntityNPC extends EntityLiving flag = itemsword.getDamageVsEntity() > itemsword1.getDamageVsEntity(); } else { - flag = stack.getMetadata() > old.getMetadata() || stack.hasTagCompound() && !old.hasTagCompound(); + flag = stack.getItemDamage() > old.getItemDamage() || stack.hasTagCompound() && !old.hasTagCompound(); } } else if(stack.getItem() instanceof ItemBow && old.getItem() instanceof ItemBow) { @@ -1420,7 +1420,7 @@ public abstract class EntityNPC extends EntityLiving flag = itemarmor.damageReduceAmount > itemarmor1.damageReduceAmount; } else { - flag = stack.getMetadata() > old.getMetadata() || stack.hasTagCompound() && !old.hasTagCompound(); + flag = stack.getItemDamage() > old.getItemDamage() || stack.hasTagCompound() && !old.hasTagCompound(); } } else { diff --git a/common/src/main/java/common/entity/projectile/EntityDie.java b/common/src/main/java/common/entity/projectile/EntityDie.java index bc655a67..dc484fbb 100755 --- a/common/src/main/java/common/entity/projectile/EntityDie.java +++ b/common/src/main/java/common/entity/projectile/EntityDie.java @@ -5,6 +5,7 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.entity.types.EntityThrowable; import common.entity.types.IObjectData; +import common.init.ItemRegistry; import common.init.Items; import common.init.SoundEvent; import common.item.ItemDie; @@ -116,17 +117,8 @@ public class EntityDie extends EntityThrowable implements IObjectData return this.getValue() != 0; } - public int getStackMeta() { - int meta = 1; - for(int z = 0; z < ItemDie.DIE_SIDES.length; z++) { - if(this.sides == ItemDie.DIE_SIDES[z]) - meta = z; - } - return meta; - } - public ItemStack getStack() { - return new ItemStack(Items.die, 1, this.getStackMeta()); + return new ItemStack(ItemDie.getBySides(this.sides)); } public boolean interactFirst(EntityNPC player) @@ -160,6 +152,6 @@ public class EntityDie extends EntityThrowable implements IObjectData { if(this.getValue() == 0) return null; - return ItemDie.DIE_COLORS[this.getStackMeta()] + "" + this.getValue(); + return ItemDie.getBySides(this.sides).getDieColor() + "" + this.getValue(); } } diff --git a/common/src/main/java/common/entity/projectile/EntityDynamite.java b/common/src/main/java/common/entity/projectile/EntityDynamite.java index e33b81e5..9024243e 100755 --- a/common/src/main/java/common/entity/projectile/EntityDynamite.java +++ b/common/src/main/java/common/entity/projectile/EntityDynamite.java @@ -50,7 +50,7 @@ public class EntityDynamite extends EntityThrowable implements IObjectData 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.dynamite), 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.getIdFromItem(ItemRegistry.getRegisteredItem("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize)))); } if (!this.worldObj.client) diff --git a/common/src/main/java/common/entity/projectile/EntityPotion.java b/common/src/main/java/common/entity/projectile/EntityPotion.java index bcee5498..f430b3d1 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -6,6 +6,7 @@ import common.entity.types.EntityLiving; import common.entity.types.EntityThrowable; import common.entity.types.IObjectData; import common.init.Items; +import common.item.ItemPotion; import common.item.ItemStack; import common.potion.Potion; import common.potion.PotionEffect; @@ -17,9 +18,6 @@ import common.world.World; public class EntityPotion extends EntityThrowable implements IObjectData { - /** - * The damage value of the thrown potion that this EntityPotion represents. - */ private ItemStack potionDamage; public EntityPotion(World worldIn) @@ -29,7 +27,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData public EntityPotion(World worldIn, EntityLiving throwerIn, int meta) { - this(worldIn, throwerIn, new ItemStack(Items.potion, 1, meta)); + this(worldIn, throwerIn, new ItemStack(ItemPotion.getPotionItem(meta))); } public EntityPotion(World worldIn, EntityLiving throwerIn, ItemStack potionDamageIn) @@ -40,7 +38,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData public EntityPotion(World worldIn, double x, double y, double z, int data) { - this(worldIn, x, y, z, new ItemStack(Items.potion, 1, data)); + this(worldIn, x, y, z, new ItemStack(ItemPotion.getPotionItem(data))); } public EntityPotion(World worldIn, double x, double y, double z, ItemStack potionDamageIn) @@ -72,12 +70,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData */ public void setPotionDamage(int potionId) { - if (this.potionDamage == null) - { - this.potionDamage = new ItemStack(Items.potion, 1, 0); - } - - this.potionDamage.setItemDamage(potionId); + this.potionDamage = new ItemStack(ItemPotion.getPotionItem(potionId)); } /** @@ -87,10 +80,10 @@ public class EntityPotion extends EntityThrowable implements IObjectData { if (this.potionDamage == null) { - this.potionDamage = new ItemStack(Items.potion, 1, 0); + this.potionDamage = new ItemStack(Items.potion); } - return this.potionDamage.getMetadata(); + return this.potionDamage.getItem() instanceof ItemPotion potion ? potion.getPotionData() : 0; } /** @@ -100,7 +93,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData { if (!this.worldObj.client) { - List list = Items.potion.getEffects(this.potionDamage); + List list = this.potionDamage != null && this.potionDamage.getItem() instanceof ItemPotion potion ? potion.getEffects() : null; BoundingBox axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D); List list1 = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb); @@ -171,7 +164,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData this.setPotionDamage(tagCompund.getInt("potionValue")); } - if (this.potionDamage == null) + if (this.potionDamage == null || !(this.potionDamage.getItem() instanceof ItemPotion)) { this.setDead(); } diff --git a/common/src/main/java/common/entity/projectile/FishConstants.java b/common/src/main/java/common/entity/projectile/FishConstants.java index 890d8c77..eb7dfee1 100644 --- a/common/src/main/java/common/entity/projectile/FishConstants.java +++ b/common/src/main/java/common/entity/projectile/FishConstants.java @@ -13,7 +13,7 @@ public abstract class FishConstants { new RngFishable(new ItemStack(Items.bone), 10), new RngFishable(new ItemStack(Items.potion), 10), new RngFishable(new ItemStack(Items.string), 5), (new RngFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F), new RngFishable(new ItemStack(Items.bowl), 10), new RngFishable(new ItemStack(Items.stick), 5), - new RngFishable(new ItemStack(Items.dye, 10, DyeColor.BLACK.getDyeDamage()), 1), + new RngFishable(new ItemStack(Items.ink_sack, 10), 1), new RngFishable(new ItemStack(Blocks.tripwire_hook), 10), new RngFishable(new ItemStack(Items.rotten_flesh), 10)); public static final WeightedList FISHING_TREASURE = new WeightedList( new RngFishable(new ItemStack(Blocks.waterlily), 1), new RngFishable(new ItemStack(Items.name_tag), 1), @@ -22,8 +22,8 @@ public abstract class FishConstants { (new RngFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(), (new RngFishable(new ItemStack(Items.book), 1)).setEnchantable()); public static final WeightedList FISH_TYPES = new WeightedList( - new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 60), - new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.SALMON.getMetadata()), 25), - new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.CLOWNFISH.getMetadata()), 2), - new RngFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.PUFFERFISH.getMetadata()), 13)); + new RngFishable(new ItemStack(Items.cod), 60), + new RngFishable(new ItemStack(Items.salmon), 25), + new RngFishable(new ItemStack(Items.clownfish), 2), + new RngFishable(new ItemStack(Items.pufferfish), 13)); } diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index 8ca2d012..46c5c85c 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -19,15 +19,15 @@ import common.block.artificial.BlockPane; import common.block.artificial.BlockPortal; import common.block.artificial.BlockPortalFrame; import common.block.artificial.BlockQuartz; +import common.block.artificial.BlockQuartzPillar; import common.block.artificial.BlockSkull; import common.block.artificial.BlockSlab; import common.block.artificial.BlockStainedGlass; import common.block.artificial.BlockStainedGlassPane; import common.block.artificial.BlockStairs; -import common.block.artificial.BlockStoneBrick; import common.block.artificial.BlockTrapDoor; import common.block.artificial.BlockWall; -import common.block.foliage.BlockBaseFlower; +import common.block.artificial.BlockWool; import common.block.foliage.BlockBlackenedSoil; import common.block.foliage.BlockBlueShroom; import common.block.foliage.BlockCactus; @@ -38,6 +38,7 @@ import common.block.foliage.BlockDeadBush; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockDryLeaves; import common.block.foliage.BlockFarmland; +import common.block.foliage.BlockFlower; import common.block.foliage.BlockGrass; import common.block.foliage.BlockHugeMushroom; import common.block.foliage.BlockLeaves; @@ -55,13 +56,14 @@ import common.block.foliage.BlockTallGrass; import common.block.foliage.BlockTianSoil; import common.block.foliage.BlockVine; import common.block.foliage.BlockWart; +import common.block.foliage.LeavesType; import common.block.liquid.BlockDynamicLiquid; import common.block.liquid.BlockStaticLiquid; import common.block.natural.BlockBedrock; import common.block.natural.BlockBlackenedDirt; import common.block.natural.BlockBlackenedStone; import common.block.natural.BlockClay; -import common.block.natural.BlockDirt; +import common.block.natural.BlockColoredClay; import common.block.natural.BlockFire; import common.block.natural.BlockGlowstone; import common.block.natural.BlockGravel; @@ -71,9 +73,8 @@ import common.block.natural.BlockIce; import common.block.natural.BlockObsidian; import common.block.natural.BlockOre; import common.block.natural.BlockPackedIce; +import common.block.natural.BlockPodzol; import common.block.natural.BlockRedstoneOre; -import common.block.natural.BlockRock; -import common.block.natural.BlockSand; import common.block.natural.BlockSandStone; import common.block.natural.BlockSlime; import common.block.natural.BlockSnow; @@ -130,6 +131,7 @@ import common.init.FluidRegistry.LiquidType; import common.item.CheatTab; import common.util.ObjectIntIdentityMap; import common.util.RegistryNamespacedDefaultedByKey; +import common.util.Util; import common.world.State; public abstract class BlockRegistry { @@ -235,7 +237,8 @@ public abstract class BlockRegistry { registerBlock("stone", stone); registerBlock("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setStepSound(SoundType.STONE) .setDisplay("Grundgestein").setTab(CheatTab.NATURE).setMiningLevel(6)); - registerBlock("rock", (new BlockRock()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen")); + registerBlock("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)); registerBlock("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) .setStepSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.NATURE)); @@ -244,19 +247,25 @@ public abstract class BlockRegistry { Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) .setDisplay("Bruchstein").setTab(CheatTab.NATURE); registerBlock("cobblestone", cobblestone); - registerBlock("mossy_cobblestone", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) - .setDisplay("Bemooster Bruchstein").setTab(CheatTab.NATURE)); - Block sandstone = (new BlockSandStone()).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein"); + Block mossyCobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setDisplay("Bemooster Bruchstein").setTab(CheatTab.NATURE); + registerBlock("mossy_cobblestone", mossyCobblestone); + Block sandstone = (new BlockSandStone("normal")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein"); registerBlock("sandstone", sandstone); + registerBlock("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")); registerBlock("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(SoundType.STONE) .setDisplay("Obsidian").setMiningLevel(3)); registerBlock("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")); - registerBlock("stained_hardened_clay", (new BlockColored(Material.SOLID)).setHardness(1.25F).setResistance(7.0F) - .setStepSound(SoundType.STONE).setDisplay("gefärbter Ton").setTab(CheatTab.NATURE)); + for(DyeColor color : DyeColor.values()) { + registerBlock(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F) + .setStepSound(SoundType.STONE).setDisplay(color.getSubject(null) + " gefärbter Ton")); + } registerBlock("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) .setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE)); - registerBlock("sand", (new BlockSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable()); + registerBlock("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); + registerBlock("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Roter Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); registerBlock("gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable()); registerBlock("ash", (new Block(Material.LOOSE)).setHardness(0.2F).setStepSound(SoundType.SAND).setDisplay("Asche") .setTab(CheatTab.NATURE).setShovelHarvestable()); @@ -315,8 +324,10 @@ public abstract class BlockRegistry { - registerBlock("dirt", (new BlockDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable()); + registerBlock("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()); + registerBlock("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()); registerBlock("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) .setDisplay("Tian").setTab(CheatTab.NATURE)); @@ -331,11 +342,18 @@ public abstract class BlockRegistry { - registerBlock("tallgrass", (new BlockTallGrass()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShearsEfficiency(0)); + for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) { + registerBlock(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")); - registerBlock("flower", (new BlockBaseFlower()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Blume")); - registerBlock("double_plant", new BlockDoublePlant().setDisplay("Pflanze")); - registerBlock("cactus", (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus")); + for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { + registerBlock(type.getName(), (new BlockFlower(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay())); + } + for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) { + registerBlock(type.getName(), new BlockDoublePlant(type).setDisplay(type.getDisplay())); + } + Block cactus = (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus"); + registerBlock("cactus", cactus); registerBlock("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)); registerBlock("waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt")); @@ -366,7 +384,9 @@ public abstract class BlockRegistry { registerBlock("dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub")); for(WoodType wood : WoodType.values()) { registerBlock(wood.getName() + "_log", (new BlockLog()).setDisplay(wood.getDisplay() + "holz")); - registerBlock(wood.getName() + "_leaves", (new BlockLeaves(wood)).setDisplay(wood.getDisplay() + "laub")); + for(LeavesType type : LeavesType.values()) { + registerBlock(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) .setDisplay(wood.getDisplay() + "setzling")); } @@ -386,15 +406,22 @@ public abstract class BlockRegistry { .setStepSound(SoundType.STONE).setDisplay("Redstone-Block").setTab(CheatTab.TECHNOLOGY)); registerBlock("glass", (new BlockGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glas")); - registerBlock("stained_glass", (new BlockStainedGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbtes Glas")); + 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")); + } registerBlock("glass_pane", (new BlockPane(Material.TRANSLUCENT, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe")); - registerBlock("stained_glass_pane", (new BlockStainedGlassPane()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbte Glasscheibe")); + 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")); + } - - registerBlock("wool", (new BlockColored(Material.BURNABLE)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay("Wolle") + for(DyeColor color : DyeColor.values()) { + registerBlock(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") .setShearsEfficiency(1)); - registerBlock("carpet", (new BlockCarpet()).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay("Teppich").setLightOpacity(0)); + } + 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)); + } for(DyeColor color : BlockBed.COLORS) { registerBlock(color.getName() + "_bed", (new BlockBed(color)).setStepSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett")); } @@ -407,7 +434,11 @@ public abstract class BlockRegistry { registerBlock("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) .setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION)); - registerBlock("flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf")); + registerBlock("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())); + 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())); + } registerBlock("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm") .setTab(CheatTab.DECORATION)); registerBlock("skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION)); @@ -459,19 +490,22 @@ public abstract class BlockRegistry { registerBlock("cobblestone_slab", (new BlockSlab(Material.SOLID, "cobblestone")) .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Bruchsteinstufe")); registerBlock("cobblestone_stairs", (new BlockStairs(cobblestone.getState())).setDisplay("Bruchsteintreppe")); - registerBlock("cobblestone_wall", (new BlockWall(cobblestone)).setDisplay("Bruchsteinmauer")); + registerBlock("cobblestone_wall", (new BlockWall(cobblestone, "cobblestone")).setDisplay("Bruchsteinmauer")); + registerBlock("mossy_cobblestone_wall", (new BlockWall(mossyCobblestone, "mossy_cobblestone")).setDisplay("Bemooste Bruchsteinmauer")); registerBlock("sandstone_slab", (new BlockSlab(Material.SOLID, "sandstone_normal", "sandstone_bottom", "sandstone_all")) .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Sandsteinstufe")); - registerBlock("sandstone_stairs", (new BlockStairs(sandstone.getState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT), + registerBlock("sandstone_stairs", (new BlockStairs(sandstone.getState(), "sandstone_bottom", "sandstone_all")) // fix type .setDisplay("Sandsteintreppe")); - Block quartz = (new BlockQuartz("")).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); + registerBlock("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")); registerBlock("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")); - registerBlock("quartz_stairs", (new BlockStairs(quartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT), + registerBlock("quartz_stairs", (new BlockStairs(quartz.getState(), "quartz_block_bottom", "quartz_top")) .setDisplay("Quarztreppe")); @@ -487,12 +521,18 @@ public abstract class BlockRegistry { .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Ziegelstufe")); registerBlock("brick_stairs", (new BlockStairs(brick.getState())).setDisplay("Ziegeltreppe")); - Block stonebrick = (new BlockStoneBrick()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) - .setDisplay("Steinziegel"); + Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setDisplay("Steinziegel").setTab(CheatTab.BLOCKS); registerBlock("stonebrick", stonebrick); - registerBlock("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick_default")) + registerBlock("mossy_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setDisplay("Bemooste Steinziegel").setTab(CheatTab.BLOCKS)); + registerBlock("cracked_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setDisplay("Rissige Steinziegel").setTab(CheatTab.BLOCKS)); + registerBlock("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setDisplay("GemeiĂŸelte Steinziegel").setTab(CheatTab.BLOCKS)); + registerBlock("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick")) .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinziegelstufe")); - registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT))) + registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState())) .setDisplay("Steinziegeltreppe")); @@ -515,11 +555,13 @@ public abstract class BlockRegistry { registerBlock("black_brick_fence", (new BlockFence(Material.SOLID, "black_brick")).setHardness(2.0F).setResistance(10.0F) .setStepSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun")); - Block bquartz = (new BlockQuartz("black_")).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); + registerBlock("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")); registerBlock("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")); - registerBlock("black_quartz_stairs", (new BlockStairs(bquartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT), + registerBlock("black_quartz_stairs", (new BlockStairs(bquartz.getState(), "black_quartz_block_bottom", "black_quartz_top")) .setDisplay("Schwarze Quarztreppe")); @@ -557,7 +599,9 @@ public abstract class BlockRegistry { .setTab(CheatTab.TECHNOLOGY)); registerBlock("lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F) .setDisplay("Ofen (Gefeuert)").setTab(CheatTab.TECHNOLOGY)); - registerBlock("anvil", (new BlockAnvil()).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay("Amboss")); + 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")); + } registerBlock("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")); registerBlock("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel")); @@ -572,7 +616,9 @@ public abstract class BlockRegistry { registerBlock("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE) .setDisplay("Warptruhe").setLightLevel(0.5F)); - registerBlock("tnt", (new BlockTNT()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT")); + 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))); + } registerBlock("nuke", (new BlockNuke()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("T-17")); registerBlock("piston", (new BlockPistonBase(false)).setDisplay("Kolben")); diff --git a/common/src/main/java/common/init/Blocks.java b/common/src/main/java/common/init/Blocks.java index 0b163e05..7d397980 100755 --- a/common/src/main/java/common/init/Blocks.java +++ b/common/src/main/java/common/init/Blocks.java @@ -20,10 +20,15 @@ import common.util.Util; public abstract class Blocks { + public static final BlockAir air = get("air"); public static final BlockDoor acacia_door = get("acacia_door"); public static final BlockFence acacia_fence = get("acacia_fence"); public static final BlockFenceGate acacia_fence_gate = get("acacia_fence_gate"); - public static final BlockLeaves acacia_leaves = get("acacia_leaves"); + public static final BlockLeaves acacia_leaves_autumn = get("acacia_leaves_autumn"); + public static final BlockLeaves acacia_leaves_snowy = get("acacia_leaves_snowy"); + public static final BlockLeaves acacia_leaves_spring = get("acacia_leaves_spring"); + public static final BlockLeaves acacia_leaves_summer = get("acacia_leaves_summer"); + public static final BlockLeaves acacia_leaves_winter = get("acacia_leaves_winter"); public static final BlockLog acacia_log = get("acacia_log"); public static final Block acacia_planks = get("acacia_planks"); public static final BlockSapling acacia_sapling = get("acacia_sapling"); @@ -31,12 +36,14 @@ public abstract class Blocks { public static final BlockStairs acacia_stairs = get("acacia_stairs"); public static final BlockStaticLiquid acid = get("acid"); public static final BlockRailPowered activator_rail = get("activator_rail"); - public static final BlockAir air = get("air"); + public static final BlockFlower allium = get("allium"); public static final Block aluminium_block = get("aluminium_block"); public static final BlockOre aluminium_ore = get("aluminium_ore"); public static final Block antimony_block = get("antimony_block"); public static final BlockOre antimony_ore = get("antimony_ore"); public static final BlockAnvil anvil = get("anvil"); + public static final BlockAnvil anvil_damaged_1 = get("anvil_damaged_1"); + public static final BlockAnvil anvil_damaged_2 = get("anvil_damaged_2"); public static final Block ardite_block = get("ardite_block"); public static final BlockOre ardite_ore = get("ardite_ore"); public static final Block arsenic_block = get("arsenic_block"); @@ -49,7 +56,11 @@ public abstract class Blocks { public static final BlockDoor birch_door = get("birch_door"); public static final BlockFence birch_fence = get("birch_fence"); public static final BlockFenceGate birch_fence_gate = get("birch_fence_gate"); - public static final BlockLeaves birch_leaves = get("birch_leaves"); + public static final BlockLeaves birch_leaves_autumn = get("birch_leaves_autumn"); + public static final BlockLeaves birch_leaves_snowy = get("birch_leaves_snowy"); + public static final BlockLeaves birch_leaves_spring = get("birch_leaves_spring"); + public static final BlockLeaves birch_leaves_summer = get("birch_leaves_summer"); + public static final BlockLeaves birch_leaves_winter = get("birch_leaves_winter"); public static final BlockLog birch_log = get("birch_log"); public static final Block birch_planks = get("birch_planks"); public static final BlockSapling birch_sapling = get("birch_sapling"); @@ -62,13 +73,21 @@ public abstract class Blocks { public static final BlockFence black_brick_fence = get("black_brick_fence"); public static final BlockSlab black_brick_slab = get("black_brick_slab"); public static final BlockStairs black_brick_stairs = get("black_brick_stairs"); + public static final BlockCarpet black_carpet = get("black_carpet"); + public static final BlockColoredClay black_clay = get("black_clay"); public static final BlockTintedFire black_fire = get("black_fire"); + public static final BlockStainedGlass black_glass = get("black_glass"); + public static final BlockStainedGlassPane black_glass_pane = get("black_glass_pane"); + public static final BlockFlower black_lotus = get("black_lotus"); public static final Block black_metal_block = get("black_metal_block"); public static final BlockOre black_metal_ore = get("black_metal_ore"); public static final BlockQuartz black_quartz_block = get("black_quartz_block"); public static final BlockOre black_quartz_ore = get("black_quartz_ore"); + public static final BlockQuartz black_quartz_ornaments = get("black_quartz_ornaments"); + public static final BlockQuartzPillar black_quartz_pillar = get("black_quartz_pillar"); public static final BlockSlab black_quartz_slab = get("black_quartz_slab"); public static final BlockStairs black_quartz_stairs = get("black_quartz_stairs"); + public static final BlockWool black_wool = get("black_wool"); public static final Block blackened_cobble = get("blackened_cobble"); public static final BlockBlackenedDirt blackened_dirt = get("blackened_dirt"); public static final BlockBlackenedSoil blackened_soil = get("blackened_soil"); @@ -76,7 +95,11 @@ public abstract class Blocks { public static final BlockDoor blackwood_door = get("blackwood_door"); public static final BlockFence blackwood_fence = get("blackwood_fence"); public static final BlockFenceGate blackwood_fence_gate = get("blackwood_fence_gate"); - public static final BlockLeaves blackwood_leaves = get("blackwood_leaves"); + public static final BlockLeaves blackwood_leaves_autumn = get("blackwood_leaves_autumn"); + public static final BlockLeaves blackwood_leaves_snowy = get("blackwood_leaves_snowy"); + public static final BlockLeaves blackwood_leaves_spring = get("blackwood_leaves_spring"); + public static final BlockLeaves blackwood_leaves_summer = get("blackwood_leaves_summer"); + public static final BlockLeaves blackwood_leaves_winter = get("blackwood_leaves_winter"); public static final BlockLog blackwood_log = get("blackwood_log"); public static final Block blackwood_planks = get("blackwood_planks"); public static final BlockSapling blackwood_sapling = get("blackwood_sapling"); @@ -87,26 +110,42 @@ public abstract class Blocks { public static final BlockFence blood_brick_fence = get("blood_brick_fence"); public static final BlockSlab blood_brick_slab = get("blood_brick_slab"); public static final BlockStairs blood_brick_stairs = get("blood_brick_stairs"); + public static final BlockCarpet blue_carpet = get("blue_carpet"); + public static final BlockColoredClay blue_clay = get("blue_clay"); + public static final BlockStainedGlass blue_glass = get("blue_glass"); + public static final BlockStainedGlassPane blue_glass_pane = get("blue_glass_pane"); public static final BlockBlueShroom blue_mushroom = get("blue_mushroom"); + public static final BlockFlower blue_orchid = get("blue_orchid"); + public static final BlockWool blue_wool = get("blue_wool"); public static final BlockBookshelf bookshelf = get("bookshelf"); public static final BlockBrewingStand brewing_stand = get("brewing_stand"); public static final Block brick_block = get("brick_block"); public static final BlockSlab brick_slab = get("brick_slab"); public static final BlockStairs brick_stairs = get("brick_stairs"); + public static final BlockCarpet brown_carpet = get("brown_carpet"); + public static final BlockColoredClay brown_clay = get("brown_clay"); + public static final BlockStainedGlass brown_glass = get("brown_glass"); + public static final BlockStainedGlassPane brown_glass_pane = get("brown_glass_pane"); public static final BlockMushroom brown_mushroom = get("brown_mushroom"); public static final BlockHugeMushroom brown_mushroom_block = get("brown_mushroom_block"); + public static final BlockWool brown_wool = get("brown_wool"); public static final BlockCactus cactus = get("cactus"); public static final BlockCake cake = get("cake"); public static final Block calcium_block = get("calcium_block"); public static final BlockOre calcium_ore = get("calcium_ore"); - public static final BlockCarpet carpet = get("carpet"); public static final BlockCarrot carrot = get("carrot"); + public static final BlockSandStone carved_sandstone = get("carved_sandstone"); + public static final Block carved_stonebrick = get("carved_stonebrick"); public static final BlockCauldron cauldron = get("cauldron"); public static final Block cell_rock = get("cell_rock"); public static final BlockDoor cherry_door = get("cherry_door"); public static final BlockFence cherry_fence = get("cherry_fence"); public static final BlockFenceGate cherry_fence_gate = get("cherry_fence_gate"); - public static final BlockLeaves cherry_leaves = get("cherry_leaves"); + public static final BlockLeaves cherry_leaves_autumn = get("cherry_leaves_autumn"); + public static final BlockLeaves cherry_leaves_snowy = get("cherry_leaves_snowy"); + public static final BlockLeaves cherry_leaves_spring = get("cherry_leaves_spring"); + public static final BlockLeaves cherry_leaves_summer = get("cherry_leaves_summer"); + public static final BlockLeaves cherry_leaves_winter = get("cherry_leaves_winter"); public static final BlockLog cherry_log = get("cherry_log"); public static final Block cherry_planks = get("cherry_planks"); public static final BlockSapling cherry_sapling = get("cherry_sapling"); @@ -120,6 +159,7 @@ public abstract class Blocks { public static final BlockClay clay = get("clay"); public static final Block coal_block = get("coal_block"); public static final BlockOre coal_ore = get("coal_ore"); + public static final Block coarse_dirt = get("coarse_dirt"); public static final Block cobalt_block = get("cobalt_block"); public static final BlockOre cobalt_ore = get("cobalt_ore"); public static final Block cobblestone = get("cobblestone"); @@ -132,10 +172,22 @@ public abstract class Blocks { public static final Block copper_block = get("copper_block"); public static final BlockOre copper_ore = get("copper_ore"); public static final BlockCore core = get("core"); + public static final Block cracked_stonebrick = get("cracked_stonebrick"); + public static final BlockCarpet cyan_carpet = get("cyan_carpet"); + public static final BlockColoredClay cyan_clay = get("cyan_clay"); + public static final BlockStainedGlass cyan_glass = get("cyan_glass"); + public static final BlockStainedGlassPane cyan_glass_pane = get("cyan_glass_pane"); + public static final BlockWool cyan_wool = get("cyan_wool"); + public static final BlockFlower daisy = get("daisy"); + public static final BlockFlower dandelion = get("dandelion"); public static final BlockDoor dark_oak_door = get("dark_oak_door"); public static final BlockFence dark_oak_fence = get("dark_oak_fence"); public static final BlockFenceGate dark_oak_fence_gate = get("dark_oak_fence_gate"); - public static final BlockLeaves dark_oak_leaves = get("dark_oak_leaves"); + public static final BlockLeaves dark_oak_leaves_autumn = get("dark_oak_leaves_autumn"); + public static final BlockLeaves dark_oak_leaves_snowy = get("dark_oak_leaves_snowy"); + public static final BlockLeaves dark_oak_leaves_spring = get("dark_oak_leaves_spring"); + public static final BlockLeaves dark_oak_leaves_summer = get("dark_oak_leaves_summer"); + public static final BlockLeaves dark_oak_leaves_winter = get("dark_oak_leaves_winter"); public static final BlockLog dark_oak_log = get("dark_oak_log"); public static final Block dark_oak_planks = get("dark_oak_planks"); public static final BlockSapling dark_oak_sapling = get("dark_oak_sapling"); @@ -143,13 +195,13 @@ public abstract class Blocks { public static final BlockStairs dark_oak_stairs = get("dark_oak_stairs"); public static final BlockDaylightDetector daylight_detector = get("daylight_detector"); public static final BlockDaylightDetector daylight_detector_inverted = get("daylight_detector_inverted"); + public static final BlockTallGrass dead_bush = get("dead_bush"); public static final BlockDeadBush deadbush = get("deadbush"); public static final BlockRailDetector detector_rail = get("detector_rail"); public static final Block diamond_block = get("diamond_block"); public static final BlockOre diamond_ore = get("diamond_ore"); - public static final BlockDirt dirt = get("dirt"); + public static final Block dirt = get("dirt"); public static final BlockDispenser dispenser = get("dispenser"); - public static final BlockDoublePlant double_plant = get("double_plant"); public static final BlockDragonEgg dragon_egg = get("dragon_egg"); public static final BlockDropper dropper = get("dropper"); public static final BlockDryLeaves dry_leaves = get("dry_leaves"); @@ -157,14 +209,27 @@ public abstract class Blocks { public static final BlockOre emerald_ore = get("emerald_ore"); public static final BlockEnchantmentTable enchanting_table = get("enchanting_table"); public static final BlockFarmland farmland = get("farmland"); + public static final BlockTallGrass fern = get("fern"); public static final BlockFire fire = get("fire"); public static final BlockFloorPortal floor_portal = get("floor_portal"); public static final Block floor_tiles = get("floor_tiles"); public static final Block floor_tiles_black = get("floor_tiles_black"); public static final Block floor_tiles_red = get("floor_tiles_red"); public static final Block floor_tiles_white = get("floor_tiles_white"); - public static final BlockBaseFlower flower = get("flower"); - public static final BlockFlowerPot flower_pot = get("flower_pot"); + public static final BlockFlowerPot flowerpot = get("flowerpot"); + public static final BlockFlowerPot flowerpot_allium = get("flowerpot_allium"); + public static final BlockFlowerPot flowerpot_black_lotus = get("flowerpot_black_lotus"); + public static final BlockFlowerPot flowerpot_blue_orchid = get("flowerpot_blue_orchid"); + public static final BlockFlowerPot flowerpot_cactus = get("flowerpot_cactus"); + public static final BlockFlowerPot flowerpot_daisy = get("flowerpot_daisy"); + public static final BlockFlowerPot flowerpot_dandelion = get("flowerpot_dandelion"); + public static final BlockFlowerPot flowerpot_houstonia = get("flowerpot_houstonia"); + public static final BlockFlowerPot flowerpot_orange_tulip = get("flowerpot_orange_tulip"); + public static final BlockFlowerPot flowerpot_pink_tulip = get("flowerpot_pink_tulip"); + public static final BlockFlowerPot flowerpot_poppy = get("flowerpot_poppy"); + public static final BlockFlowerPot flowerpot_red_tulip = get("flowerpot_red_tulip"); + public static final BlockFlowerPot flowerpot_rose = get("flowerpot_rose"); + public static final BlockFlowerPot flowerpot_white_tulip = get("flowerpot_white_tulip"); public static final BlockDynamicLiquid flowing_acid = get("flowing_acid"); public static final BlockDynamicLiquid flowing_blood = get("flowing_blood"); public static final BlockDynamicLiquid flowing_goo = get("flowing_goo"); @@ -174,6 +239,7 @@ public abstract class Blocks { public static final BlockDynamicLiquid flowing_mercury = get("flowing_mercury"); public static final BlockDynamicLiquid flowing_nukage = get("flowing_nukage"); public static final BlockDynamicLiquid flowing_slime = get("flowing_slime"); + public static final BlockDynamicLiquid flowing_springwater = get("flowing_springwater"); public static final BlockDynamicLiquid flowing_water = get("flowing_water"); public static final BlockFurnace furnace = get("furnace"); public static final BlockGlass glass = get("glass"); @@ -185,6 +251,16 @@ public abstract class Blocks { public static final BlockStaticLiquid goo = get("goo"); public static final BlockGrass grass = get("grass"); public static final BlockGravel gravel = get("gravel"); + public static final BlockCarpet gray_carpet = get("gray_carpet"); + public static final BlockColoredClay gray_clay = get("gray_clay"); + public static final BlockStainedGlass gray_glass = get("gray_glass"); + public static final BlockStainedGlassPane gray_glass_pane = get("gray_glass_pane"); + public static final BlockWool gray_wool = get("gray_wool"); + public static final BlockCarpet green_carpet = get("green_carpet"); + public static final BlockColoredClay green_clay = get("green_clay"); + public static final BlockStainedGlass green_glass = get("green_glass"); + public static final BlockStainedGlassPane green_glass_pane = get("green_glass_pane"); + public static final BlockWool green_wool = get("green_wool"); public static final Block gyriyn_block = get("gyriyn_block"); public static final BlockOre gyriyn_ore = get("gyriyn_ore"); public static final BlockHardenedClay hardened_clay = get("hardened_clay"); @@ -192,6 +268,7 @@ public abstract class Blocks { public static final BlockPressurePlateWeighted heavy_weighted_pressure_plate = get("heavy_weighted_pressure_plate"); public static final BlockHellRock hellrock = get("hellrock"); public static final BlockHopper hopper = get("hopper"); + public static final BlockFlower houstonia = get("houstonia"); public static final BlockStaticLiquid hydrogen = get("hydrogen"); public static final BlockIce ice = get("ice"); public static final Block iodine_block = get("iodine_block"); @@ -205,7 +282,11 @@ public abstract class Blocks { public static final BlockDoor jungle_door = get("jungle_door"); public static final BlockFence jungle_fence = get("jungle_fence"); public static final BlockFenceGate jungle_fence_gate = get("jungle_fence_gate"); - public static final BlockLeaves jungle_leaves = get("jungle_leaves"); + public static final BlockLeaves jungle_leaves_autumn = get("jungle_leaves_autumn"); + public static final BlockLeaves jungle_leaves_snowy = get("jungle_leaves_snowy"); + public static final BlockLeaves jungle_leaves_spring = get("jungle_leaves_spring"); + public static final BlockLeaves jungle_leaves_summer = get("jungle_leaves_summer"); + public static final BlockLeaves jungle_leaves_winter = get("jungle_leaves_winter"); public static final BlockLog jungle_log = get("jungle_log"); public static final Block jungle_planks = get("jungle_planks"); public static final BlockSapling jungle_sapling = get("jungle_sapling"); @@ -215,17 +296,34 @@ public abstract class Blocks { public static final Block lamp = get("lamp"); public static final Block lapis_block = get("lapis_block"); public static final BlockOre lapis_ore = get("lapis_ore"); + public static final BlockDoublePlant large_fern = get("large_fern"); + public static final BlockDoublePlant large_tallgrass = get("large_tallgrass"); public static final BlockStaticLiquid lava = get("lava"); public static final Block lead_block = get("lead_block"); public static final BlockOre lead_ore = get("lead_ore"); public static final BlockLever lever = get("lever"); + public static final BlockCarpet light_blue_carpet = get("light_blue_carpet"); + public static final BlockColoredClay light_blue_clay = get("light_blue_clay"); + public static final BlockStainedGlass light_blue_glass = get("light_blue_glass"); + public static final BlockStainedGlassPane light_blue_glass_pane = get("light_blue_glass_pane"); + public static final BlockWool light_blue_wool = get("light_blue_wool"); public static final BlockPressurePlateWeighted light_weighted_pressure_plate = get("light_weighted_pressure_plate"); + public static final BlockCarpet lime_carpet = get("lime_carpet"); + public static final BlockColoredClay lime_clay = get("lime_clay"); + public static final BlockStainedGlass lime_glass = get("lime_glass"); + public static final BlockStainedGlassPane lime_glass_pane = get("lime_glass_pane"); + public static final BlockWool lime_wool = get("lime_wool"); public static final BlockFurnace lit_furnace = get("lit_furnace"); public static final BlockPumpkin lit_pumpkin = get("lit_pumpkin"); public static final BlockRedstoneLight lit_redstone_lamp = get("lit_redstone_lamp"); public static final BlockRedstoneOre lit_redstone_ore = get("lit_redstone_ore"); public static final Block lithium_block = get("lithium_block"); public static final BlockOre lithium_ore = get("lithium_ore"); + public static final BlockCarpet magenta_carpet = get("magenta_carpet"); + public static final BlockColoredClay magenta_clay = get("magenta_clay"); + public static final BlockStainedGlass magenta_glass = get("magenta_glass"); + public static final BlockStainedGlassPane magenta_glass_pane = get("magenta_glass_pane"); + public static final BlockWool magenta_wool = get("magenta_wool"); public static final BlockStaticLiquid magma = get("magma"); public static final Block magnesium_block = get("magnesium_block"); public static final BlockOre magnesium_ore = get("magnesium_ore"); @@ -234,7 +332,11 @@ public abstract class Blocks { public static final BlockDoor maple_door = get("maple_door"); public static final BlockFence maple_fence = get("maple_fence"); public static final BlockFenceGate maple_fence_gate = get("maple_fence_gate"); - public static final BlockLeaves maple_leaves = get("maple_leaves"); + public static final BlockLeaves maple_leaves_autumn = get("maple_leaves_autumn"); + public static final BlockLeaves maple_leaves_snowy = get("maple_leaves_snowy"); + public static final BlockLeaves maple_leaves_spring = get("maple_leaves_spring"); + public static final BlockLeaves maple_leaves_summer = get("maple_leaves_summer"); + public static final BlockLeaves maple_leaves_winter = get("maple_leaves_winter"); public static final BlockLog maple_log = get("maple_log"); public static final Block maple_planks = get("maple_planks"); public static final BlockSapling maple_sapling = get("maple_sapling"); @@ -247,6 +349,8 @@ public abstract class Blocks { public static final BlockTreasure moon_cheese = get("moon_cheese"); public static final Block moon_rock = get("moon_rock"); public static final Block mossy_cobblestone = get("mossy_cobblestone"); + public static final BlockWall mossy_cobblestone_wall = get("mossy_cobblestone_wall"); + public static final Block mossy_stonebrick = get("mossy_stonebrick"); public static final BlockMycelium mycelium = get("mycelium"); public static final Block neodymium_block = get("neodymium_block"); public static final BlockOre neodymium_ore = get("neodymium_ore"); @@ -262,19 +366,36 @@ public abstract class Blocks { public static final BlockDoor oak_door = get("oak_door"); public static final BlockFence oak_fence = get("oak_fence"); public static final BlockFenceGate oak_fence_gate = get("oak_fence_gate"); - public static final BlockLeaves oak_leaves = get("oak_leaves"); + public static final BlockLeaves oak_leaves_autumn = get("oak_leaves_autumn"); + public static final BlockLeaves oak_leaves_snowy = get("oak_leaves_snowy"); + public static final BlockLeaves oak_leaves_spring = get("oak_leaves_spring"); + public static final BlockLeaves oak_leaves_summer = get("oak_leaves_summer"); + public static final BlockLeaves oak_leaves_winter = get("oak_leaves_winter"); public static final BlockLog oak_log = get("oak_log"); public static final Block oak_planks = get("oak_planks"); public static final BlockSapling oak_sapling = get("oak_sapling"); public static final BlockSlab oak_slab = get("oak_slab"); public static final BlockStairs oak_stairs = get("oak_stairs"); public static final BlockObsidian obsidian = get("obsidian"); + public static final BlockCarpet orange_carpet = get("orange_carpet"); + public static final BlockColoredClay orange_clay = get("orange_clay"); + public static final BlockStainedGlass orange_glass = get("orange_glass"); + public static final BlockStainedGlassPane orange_glass_pane = get("orange_glass_pane"); + public static final BlockFlower orange_tulip = get("orange_tulip"); + public static final BlockWool orange_wool = get("orange_wool"); public static final BlockPackedIce packed_ice = get("packed_ice"); + public static final BlockDoublePlant paeonia = get("paeonia"); public static final Block palladium_block = get("palladium_block"); public static final BlockOre palladium_ore = get("palladium_ore"); public static final Block pentagram = get("pentagram"); public static final Block phosphor_block = get("phosphor_block"); public static final BlockOre phosphor_ore = get("phosphor_ore"); + public static final BlockCarpet pink_carpet = get("pink_carpet"); + public static final BlockColoredClay pink_clay = get("pink_clay"); + public static final BlockStainedGlass pink_glass = get("pink_glass"); + public static final BlockStainedGlassPane pink_glass_pane = get("pink_glass_pane"); + public static final BlockFlower pink_tulip = get("pink_tulip"); + public static final BlockWool pink_wool = get("pink_wool"); public static final BlockPistonBase piston = get("piston"); public static final BlockPistonMoving piston_extension = get("piston_extension"); public static final BlockPistonHead piston_head = get("piston_head"); @@ -282,6 +403,8 @@ public abstract class Blocks { public static final BlockOre platinum_ore = get("platinum_ore"); public static final Block plutonium_block = get("plutonium_block"); public static final BlockOre plutonium_ore = get("plutonium_ore"); + public static final BlockPodzol podzol = get("podzol"); + public static final BlockFlower poppy = get("poppy"); public static final BlockPortal portal = get("portal"); public static final BlockPortalFrame portal_frame = get("portal_frame"); public static final Block potassium_block = get("potassium_block"); @@ -294,8 +417,15 @@ public abstract class Blocks { public static final BlockPumpkin pumpkin = get("pumpkin"); public static final BlockStem pumpkin_stem = get("pumpkin_stem"); public static final BlockBed purple_bed = get("purple_bed"); + public static final BlockCarpet purple_carpet = get("purple_carpet"); + public static final BlockColoredClay purple_clay = get("purple_clay"); + public static final BlockStainedGlass purple_glass = get("purple_glass"); + public static final BlockStainedGlassPane purple_glass_pane = get("purple_glass_pane"); + public static final BlockWool purple_wool = get("purple_wool"); public static final BlockQuartz quartz_block = get("quartz_block"); public static final BlockOre quartz_ore = get("quartz_ore"); + public static final BlockQuartz quartz_ornaments = get("quartz_ornaments"); + public static final BlockQuartzPillar quartz_pillar = get("quartz_pillar"); public static final BlockSlab quartz_slab = get("quartz_slab"); public static final BlockStairs quartz_stairs = get("quartz_stairs"); public static final Block radium_block = get("radium_block"); @@ -303,8 +433,15 @@ public abstract class Blocks { public static final BlockRail rail = get("rail"); public static final BlockBed red_bed = get("red_bed"); public static final BlockButton red_button = get("red_button"); + public static final BlockCarpet red_carpet = get("red_carpet"); + public static final BlockColoredClay red_clay = get("red_clay"); + public static final BlockStainedGlass red_glass = get("red_glass"); + public static final BlockStainedGlassPane red_glass_pane = get("red_glass_pane"); public static final BlockMushroom red_mushroom = get("red_mushroom"); public static final BlockHugeMushroom red_mushroom_block = get("red_mushroom_block"); + public static final BlockFalling red_sand = get("red_sand"); + public static final BlockFlower red_tulip = get("red_tulip"); + public static final BlockWool red_wool = get("red_wool"); public static final BlockRedstoneWire redstone = get("redstone"); public static final BlockCompressedPowered redstone_block = get("redstone_block"); public static final BlockRedstoneLight redstone_lamp = get("redstone_lamp"); @@ -312,10 +449,12 @@ public abstract class Blocks { public static final BlockRedstoneTorch redstone_torch = get("redstone_torch"); public static final BlockReed reeds = get("reeds"); public static final BlockRedstoneRepeater repeater = get("repeater"); - public static final BlockRock rock = get("rock"); + public static final Block rock = get("rock"); + public static final BlockFlower rose = get("rose"); + public static final BlockDoublePlant rose_bush = get("rose_bush"); public static final Block ruby_block = get("ruby_block"); public static final BlockOre ruby_ore = get("ruby_ore"); - public static final BlockSand sand = get("sand"); + public static final BlockFalling sand = get("sand"); public static final BlockSandStone sandstone = get("sandstone"); public static final BlockSlab sandstone_slab = get("sandstone_slab"); public static final BlockStairs sandstone_stairs = get("sandstone_stairs"); @@ -325,10 +464,17 @@ public abstract class Blocks { public static final Block silicon_block = get("silicon_block"); public static final BlockOre silicon_ore = get("silicon_ore"); public static final Block silver_block = get("silver_block"); + public static final BlockCarpet silver_carpet = get("silver_carpet"); + public static final BlockColoredClay silver_clay = get("silver_clay"); + public static final BlockStainedGlass silver_glass = get("silver_glass"); + public static final BlockStainedGlassPane silver_glass_pane = get("silver_glass_pane"); public static final BlockOre silver_ore = get("silver_ore"); + public static final BlockWool silver_wool = get("silver_wool"); public static final BlockSkull skull = get("skull"); public static final BlockStaticLiquid slime = get("slime"); public static final BlockSlime slime_block = get("slime_block"); + public static final Block smooth_rock = get("smooth_rock"); + public static final BlockSandStone smooth_sandstone = get("smooth_sandstone"); public static final BlockSnowBlock snow = get("snow"); public static final BlockSnow snow_layer = get("snow_layer"); public static final Block sodium_block = get("sodium_block"); @@ -337,30 +483,34 @@ public abstract class Blocks { public static final BlockSoulSand soul_sand = get("soul_sand"); public static final BlockWart soul_wart = get("soul_wart"); public static final Block sponge = get("sponge"); + public static final BlockStaticLiquid springwater = get("springwater"); public static final BlockDoor spruce_door = get("spruce_door"); public static final BlockFence spruce_fence = get("spruce_fence"); public static final BlockFenceGate spruce_fence_gate = get("spruce_fence_gate"); - public static final BlockLeaves spruce_leaves = get("spruce_leaves"); + public static final BlockLeaves spruce_leaves_autumn = get("spruce_leaves_autumn"); + public static final BlockLeaves spruce_leaves_snowy = get("spruce_leaves_snowy"); + public static final BlockLeaves spruce_leaves_spring = get("spruce_leaves_spring"); + public static final BlockLeaves spruce_leaves_summer = get("spruce_leaves_summer"); + public static final BlockLeaves spruce_leaves_winter = get("spruce_leaves_winter"); public static final BlockLog spruce_log = get("spruce_log"); public static final Block spruce_planks = get("spruce_planks"); public static final BlockSapling spruce_sapling = get("spruce_sapling"); public static final BlockSlab spruce_slab = get("spruce_slab"); public static final BlockStairs spruce_stairs = get("spruce_stairs"); - public static final BlockStainedGlass stained_glass = get("stained_glass"); - public static final BlockStainedGlassPane stained_glass_pane = get("stained_glass_pane"); - public static final BlockColored stained_hardened_clay = get("stained_hardened_clay"); public static final BlockPistonBase sticky_piston = get("sticky_piston"); public static final BlockStone stone = get("stone"); public static final BlockButton stone_button = get("stone_button"); public static final BlockPressurePlate stone_pressure_plate = get("stone_pressure_plate"); public static final BlockSlab stone_slab = get("stone_slab"); public static final BlockStairs stone_stairs = get("stone_stairs"); - public static final BlockStoneBrick stonebrick = get("stonebrick"); + public static final Block stonebrick = get("stonebrick"); public static final BlockSlab stonebrick_slab = get("stonebrick_slab"); public static final BlockStairs stonebrick_stairs = get("stonebrick_stairs"); public static final BlockTripWire string = get("string"); public static final Block sulfur_block = get("sulfur_block"); public static final BlockOre sulfur_ore = get("sulfur_ore"); + public static final BlockDoublePlant sunflower = get("sunflower"); + public static final BlockDoublePlant syringa = get("syringa"); public static final BlockTallGrass tallgrass = get("tallgrass"); public static final Block thetium_block = get("thetium_block"); public static final BlockOre thetium_ore = get("thetium_ore"); @@ -368,7 +518,11 @@ public abstract class Blocks { public static final BlockDoor tian_door = get("tian_door"); public static final BlockFence tian_fence = get("tian_fence"); public static final BlockFenceGate tian_fence_gate = get("tian_fence_gate"); - public static final BlockLeaves tian_leaves = get("tian_leaves"); + public static final BlockLeaves tian_leaves_autumn = get("tian_leaves_autumn"); + public static final BlockLeaves tian_leaves_snowy = get("tian_leaves_snowy"); + public static final BlockLeaves tian_leaves_spring = get("tian_leaves_spring"); + public static final BlockLeaves tian_leaves_summer = get("tian_leaves_summer"); + public static final BlockLeaves tian_leaves_winter = get("tian_leaves_winter"); public static final BlockLog tian_log = get("tian_log"); public static final Block tian_planks = get("tian_planks"); public static final BlockTianReactor tian_reactor = get("tian_reactor"); @@ -381,6 +535,13 @@ public abstract class Blocks { public static final Block titanium_block = get("titanium_block"); public static final BlockOre titanium_ore = get("titanium_ore"); public static final BlockTNT tnt = get("tnt"); + public static final BlockTNT tnt_1 = get("tnt_1"); + public static final BlockTNT tnt_2 = get("tnt_2"); + public static final BlockTNT tnt_3 = get("tnt_3"); + public static final BlockTNT tnt_4 = get("tnt_4"); + public static final BlockTNT tnt_5 = get("tnt_5"); + public static final BlockTNT tnt_6 = get("tnt_6"); + public static final BlockTNT tnt_7 = get("tnt_7"); public static final BlockTorch torch = get("torch"); public static final BlockTrapDoor trapdoor = get("trapdoor"); public static final BlockChest trapped_chest = get("trapped_chest"); @@ -401,14 +562,22 @@ public abstract class Blocks { public static final BlockWeb web = get("web"); public static final BlockCrops wheat = get("wheat"); public static final BlockBed white_bed = get("white_bed"); + public static final BlockCarpet white_carpet = get("white_carpet"); + public static final BlockColoredClay white_clay = get("white_clay"); + public static final BlockStainedGlass white_glass = get("white_glass"); + public static final BlockStainedGlassPane white_glass_pane = get("white_glass_pane"); + public static final BlockFlower white_tulip = get("white_tulip"); + public static final BlockWool white_wool = get("white_wool"); public static final BlockButton wooden_button = get("wooden_button"); public static final BlockPressurePlate wooden_pressure_plate = get("wooden_pressure_plate"); - public static final BlockColored wool = get("wool"); public static final BlockWorkbench workbench = get("workbench"); + public static final BlockCarpet yellow_carpet = get("yellow_carpet"); + public static final BlockColoredClay yellow_clay = get("yellow_clay"); + public static final BlockStainedGlass yellow_glass = get("yellow_glass"); + public static final BlockStainedGlassPane yellow_glass_pane = get("yellow_glass_pane"); + public static final BlockWool yellow_wool = get("yellow_wool"); public static final Block zinc_block = get("zinc_block"); public static final BlockOre zinc_ore = get("zinc_ore"); - public static final BlockDynamicLiquid flowing_springwater = get("flowing_springwater"); - public static final BlockStaticLiquid springwater = get("springwater"); private static T get(String id) { if(!BlockRegistry.REGISTRY.containsKey(id)) diff --git a/common/src/main/java/common/init/CraftingRegistry.java b/common/src/main/java/common/init/CraftingRegistry.java index d5d491f0..cbe4afd6 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -8,13 +8,15 @@ import java.util.Set; import common.block.Block; import common.block.artificial.BlockBed; +import common.block.artificial.BlockCarpet; import common.block.artificial.BlockQuartz; -import common.block.artificial.BlockStoneBrick; +import common.block.artificial.BlockStainedGlass; +import common.block.artificial.BlockStainedGlassPane; import common.block.artificial.BlockWall; +import common.block.artificial.BlockWool; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockFlower; -import common.block.natural.BlockDirt; -import common.block.natural.BlockSand; +import common.block.natural.BlockColoredClay; import common.block.natural.BlockSandStone; import common.collect.Lists; import common.collect.Maps; @@ -23,6 +25,7 @@ import common.entity.animal.EntitySheep; import common.inventory.InventoryCrafting; import common.item.Item; import common.item.ItemArmor; +import common.item.ItemBanner; import common.item.ItemDye; import common.item.ItemStack; import common.tags.TagObject; @@ -40,9 +43,9 @@ public abstract class CraftingRegistry }; private static final Object[][] COMPRESSED = new Object[][] { {Blocks.emerald_block, new ItemStack(Items.emerald, 9)}, - {Blocks.lapis_block, new ItemStack(Items.dye, 9, DyeColor.BLUE.getDyeDamage())}, + {Blocks.lapis_block, new ItemStack(Items.lapis_lazuli, 9)}, {Blocks.redstone_block, new ItemStack(Items.redstone, 9)}, - {Blocks.coal_block, new ItemStack(Items.coal, 9, 0)}, + {Blocks.coal_block, new ItemStack(Items.coal, 9)}, {Blocks.hay_block, new ItemStack(Items.wheats, 9)}, {Blocks.slime_block, new ItemStack(Items.slime_ball, 9)} }; @@ -143,7 +146,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.gold_nugget, 9), "#", '#', Items.gold_ingot); addShapeless(new ItemStack(Items.mushroom_stew), Blocks.brown_mushroom, Blocks.red_mushroom, Items.bowl); - add(new ItemStack(Items.cookie, 8), "#X#", 'X', new ItemStack(Items.dye, 1, DyeColor.BROWN.getDyeDamage()), '#', Items.wheats); + add(new ItemStack(Items.cookie, 8), "#X#", 'X', Items.cocoa, '#', Items.wheats); add(new ItemStack(Blocks.melon_block), "MMM", "MMM", "MMM", 'M', Items.melon); add(new ItemStack(Items.melon_stem), "M", 'M', Items.melon); add(new ItemStack(Items.pumpkin_stem, 4), "M", 'M', Blocks.pumpkin); @@ -155,70 +158,72 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.trapped_chest), "#-", '#', Blocks.chest, '-', Blocks.tripwire_hook); add(new ItemStack(Blocks.warp_chest), "###", "#E#", "###", '#', Blocks.obsidian, 'E', Items.charged_orb); add(new ItemStack(Blocks.furnace), "###", "# #", "###", '#', Blocks.cobblestone); - add(new ItemStack(Blocks.sandstone), "##", "##", '#', new ItemStack(Blocks.sand, 1, BlockSand.EnumType.SAND.getMetadata())); - add(new ItemStack(Blocks.sandstone, 4, BlockSandStone.EnumType.SMOOTH.getMetadata()), "##", "##", '#', new ItemStack(Blocks.sandstone, 1, BlockSandStone.EnumType.DEFAULT.getMetadata())); - add(new ItemStack(Blocks.quartz_block, 2, BlockQuartz.EnumType.LINES_Y.getMetadata()), "#", "#", '#', new ItemStack(Blocks.quartz_block, 1, BlockQuartz.EnumType.DEFAULT.getMetadata())); + add(new ItemStack(Blocks.sandstone), "##", "##", '#', Blocks.sand); + add(new ItemStack(Blocks.smooth_sandstone, 4), "##", "##", '#', Blocks.sandstone); + add(new ItemStack(Blocks.quartz_pillar, 2), "#", "#", '#', Blocks.quartz_block); add(new ItemStack(Blocks.stonebrick, 4), "##", "##", '#', Blocks.stone); - addShapeless(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.MOSSY_META), Blocks.stonebrick, Blocks.vine); + addShapeless(new ItemStack(Blocks.mossy_stonebrick), Blocks.stonebrick, Blocks.vine); addShapeless(new ItemStack(Blocks.mossy_cobblestone, 1), Blocks.cobblestone, Blocks.vine); add(new ItemStack(Blocks.iron_bars, 16), "###", "###", '#', Items.iron_ingot); add(new ItemStack(Blocks.glass_pane, 16), "###", "###", '#', Blocks.glass); add(new ItemStack(Blocks.redstone_lamp, 1), " R ", "RGR", " R ", 'R', Items.redstone, 'G', Blocks.glowstone); add(new ItemStack(Blocks.beacon, 1), "GGG", "GSG", "OOO", 'G', Blocks.glass, 'S', Items.charge_crystal, 'O', Blocks.obsidian); add(new ItemStack(Blocks.blood_brick, 1), "NN", "NN", 'N', Items.bloodbrick); - add(new ItemStack(Blocks.dirt, 4, BlockDirt.DirtType.COARSE_DIRT.getMetadata()), "DG", "GD", 'D', new ItemStack(Blocks.dirt, 1, BlockDirt.DirtType.DIRT.getMetadata()), 'G', Blocks.gravel); + add(new ItemStack(Blocks.coarse_dirt, 4), "DG", "GD", 'D', Blocks.dirt, 'G', Blocks.gravel); add(new ItemStack(Blocks.lamp, 1), " R ", "RGR", " R ", 'R', Blocks.glass, 'G', Blocks.glowstone); - for (int i = 0; i < 16; ++i) + for (DyeColor color : DyeColor.values()) { - addShapeless(new ItemStack(Blocks.wool, 1, i), new ItemStack(Items.dye, 1, 15 - i), new ItemStack(Blocks.wool, 1, 0)); - add(new ItemStack(Blocks.stained_hardened_clay, 8, 15 - i), "###", "#X#", "###", '#', new ItemStack(Blocks.hardened_clay), 'X', new ItemStack(Items.dye, 1, i)); - add(new ItemStack(Blocks.stained_glass, 8, 15 - i), "###", "#X#", "###", '#', new ItemStack(Blocks.glass), 'X', new ItemStack(Items.dye, 1, i)); - add(new ItemStack(Blocks.stained_glass_pane, 16, i), "###", "###", '#', new ItemStack(Blocks.stained_glass, 1, i)); + ItemDye dye = ItemDye.getByColor(color); + if(color != DyeColor.WHITE) + addShapeless(new ItemStack(BlockWool.getByColor(color)), dye, Blocks.white_wool); + add(new ItemStack(BlockColoredClay.getByColor(color), 8), "###", "#X#", "###", '#', Blocks.hardened_clay, 'X', dye); + add(new ItemStack(BlockStainedGlass.getByColor(color), 8), "###", "#X#", "###", '#', Blocks.glass, 'X', dye); + add(new ItemStack(BlockStainedGlassPane.getByColor(color), 16), "###", "###", '#', BlockStainedGlass.getByColor(color)); } - addShapeless(new ItemStack(Items.dye, 1, DyeColor.YELLOW.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.DANDELION.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.ROSE.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.POPPY.getMeta())); - addShapeless(new ItemStack(Items.dye, 3, DyeColor.WHITE.getDyeDamage()), Items.bone); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.PINK.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.ORANGE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.YELLOW.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.LIME.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.GRAY.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.SILVER.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.GRAY.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 3, DyeColor.SILVER.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.LIGHT_BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.CYAN.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.PURPLE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.PURPLE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.PINK.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 3, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.PINK.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 4, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.LIGHT_BLUE.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.BLUE_ORCHID.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.ALLIUM.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.SILVER.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.HOUSTONIA.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.RED_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.ORANGE.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.ORANGE_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.SILVER.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.WHITE_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.PINK.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.PINK_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.SILVER.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.OXEYE_DAISY.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.YELLOW.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.SUNFLOWER.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.SYRINGA.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.ROSE.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.PINK.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.PAEONIA.getMeta())); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.YELLOW)), Blocks.dandelion); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED)), Blocks.rose); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED)), Blocks.poppy); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.WHITE), 3), Items.bone); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PINK), 2), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.ORANGE), 2), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.YELLOW))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.LIME), 2), new ItemStack(ItemDye.getByColor(DyeColor.GREEN)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.GRAY), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLACK)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER), 2), new ItemStack(ItemDye.getByColor(DyeColor.GRAY)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER), 3), new ItemStack(ItemDye.getByColor(DyeColor.BLACK)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.LIGHT_BLUE), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.CYAN), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.GREEN))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PURPLE), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.RED))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 2), new ItemStack(ItemDye.getByColor(DyeColor.PURPLE)), new ItemStack(ItemDye.getByColor(DyeColor.PINK))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 3), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.PINK))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 4), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.LIGHT_BLUE)), Blocks.blue_orchid); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA)), Blocks.allium); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER)), Blocks.houstonia); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED)), Blocks.red_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.ORANGE)), Blocks.orange_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER)), Blocks.white_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PINK)), Blocks.pink_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER)), Blocks.daisy); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.YELLOW), 2), Blocks.sunflower); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 2), Blocks.syringa); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED), 2), Blocks.rose_bush); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PINK), 2), Blocks.paeonia); - for (int j = 0; j < 16; ++j) + for (DyeColor color : DyeColor.values()) { - add(new ItemStack(Blocks.carpet, 3, j), "##", '#', new ItemStack(Blocks.wool, 1, j)); + add(new ItemStack(BlockCarpet.getByColor(color), 3), "##", '#', BlockWool.getByColor(color)); } recipes.add(new RecipesArmorDyes()); recipes.add(new RecipeFireworks()); recipes.add(new RecipeRepairItem()); - for (DyeColor enumdyecolor : DyeColor.values()) + for (DyeColor color : DyeColor.values()) { - add(new ItemStack(Items.banner, 1, enumdyecolor.getDyeDamage()), "###", "###", " | ", '#', new ItemStack(Blocks.wool, 1, enumdyecolor.getMetadata()), '|', Items.stick); + add(ItemBanner.getColoredBanner(color), "###", "###", " | ", '#', BlockWool.getByColor(color), '|', Items.stick); } recipes.add(new RecipeDuplicatePattern()); @@ -226,7 +231,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.paper, 3), "###", '#', Items.reeds); addShapeless(new ItemStack(Items.book, 1), Items.paper, Items.paper, Items.paper, Items.leather); - addShapeless(new ItemStack(Items.writable_book, 1), Items.book, new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), Items.feather); + addShapeless(new ItemStack(Items.writable_book, 1), Items.book, Items.ink_sack, Items.feather); for(WoodType wood : WoodType.values()) { Item planks = ItemRegistry.getRegisteredItem(wood.getName() + "_planks"); add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_fence"), 3), "W#W", "W#W", '#', Items.stick, 'W', planks); @@ -234,7 +239,7 @@ public abstract class CraftingRegistry add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_door"), 3), "##", "##", "##", '#', planks); addBasic(new ItemStack(planks, 4), "#", '#', ItemRegistry.getRegisteredItem(wood.getName() + "_log")); Item slab = ItemRegistry.getRegisteredItem(wood.getName() + "_slab"); - add(new ItemStack(slab, 6, 0), "###", '#', planks); + add(new ItemStack(slab, 6), "###", '#', planks); add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_stairs"), 4), "# ", "## ", "###", '#', planks); add(new ItemStack(Blocks.daylight_detector), "GGG", "QQQ", "WWW", 'G', Blocks.glass, 'Q', Items.quartz, 'W', slab); @@ -256,12 +261,12 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.wooden_pressure_plate, 1), "##", '#', planks); add(new ItemStack(Blocks.piston, 1), "TTT", "#X#", "#R#", '#', Blocks.cobblestone, 'X', Items.iron_ingot, 'R', Items.redstone, 'T', planks); for(DyeColor color : BlockBed.COLORS) { - add(new ItemStack(ItemRegistry.getRegisteredItem(color.getName() + "_bed"), 1), "###", "XXX", '#', new ItemStack(Blocks.wool, 1, color.getMetadata()), 'X', planks); + add(new ItemStack(ItemRegistry.getRegisteredItem(color.getName() + "_bed"), 1), "###", "XXX", '#', BlockWool.getByColor(color), 'X', planks); } } - add(new ItemStack(Blocks.cobblestone_wall, 6, BlockWall.EnumType.NORMAL.getMetadata()), "###", "###", '#', Blocks.cobblestone); - add(new ItemStack(Blocks.cobblestone_wall, 6, BlockWall.EnumType.MOSSY.getMetadata()), "###", "###", '#', Blocks.mossy_cobblestone); + add(new ItemStack(Blocks.cobblestone_wall, 6), "###", "###", '#', Blocks.cobblestone); + add(new ItemStack(Blocks.mossy_cobblestone_wall, 6), "###", "###", '#', Blocks.mossy_cobblestone); add(new ItemStack(Blocks.blood_brick_fence, 6), "###", "###", '#', Blocks.blood_brick); add(new ItemStack(Items.lead, 2), "~~ ", "~O ", " ~", '~', Items.string, 'O', Items.slime_ball); @@ -271,17 +276,17 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.brick_block, 1), "##", "##", '#', Items.brick); add(new ItemStack(Blocks.glowstone, 1), "##", "##", '#', Items.glowstone_dust); add(new ItemStack(Blocks.quartz_block, 1), "##", "##", '#', Items.quartz); - add(new ItemStack(Blocks.wool, 1), "##", "##", '#', Items.string); + add(new ItemStack(Blocks.white_wool, 1), "##", "##", '#', Items.string); add(new ItemStack(Blocks.tnt, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Blocks.sand); - add(new ItemStack(Blocks.tnt, 1, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', new ItemStack(Blocks.tnt, 1, 0)); - add(new ItemStack(Blocks.tnt, 1, 2), "##", "##", '#', new ItemStack(Blocks.tnt, 1, 1)); - addShapeless(new ItemStack(Blocks.tnt, 1, 3), new ItemStack(Blocks.tnt, 1, 2), new ItemStack(Blocks.tnt, 1, 2)); - addShapeless(new ItemStack(Blocks.tnt, 1, 4), new ItemStack(Blocks.tnt, 1, 3), new ItemStack(Blocks.tnt, 1, 3)); - addShapeless(new ItemStack(Blocks.tnt, 1, 5), new ItemStack(Blocks.tnt, 1, 4), new ItemStack(Blocks.tnt, 1, 4)); - addShapeless(new ItemStack(Blocks.tnt, 1, 6), new ItemStack(Blocks.tnt, 1, 5), new ItemStack(Blocks.tnt, 1, 5)); - addShapeless(new ItemStack(Blocks.tnt, 1, 7), new ItemStack(Blocks.tnt, 1, 6), new ItemStack(Blocks.tnt, 1, 6)); - add(new ItemStack(Blocks.nuke, 1), "###", "###", "###", '#', new ItemStack(Blocks.tnt, 1, 7)); + add(new ItemStack(Blocks.tnt_1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Blocks.tnt); + add(new ItemStack(Blocks.tnt_2), "##", "##", '#', Blocks.tnt_1); + addShapeless(new ItemStack(Blocks.tnt_3), Blocks.tnt_2, Blocks.tnt_2); + addShapeless(new ItemStack(Blocks.tnt_4), Blocks.tnt_3, Blocks.tnt_3); + addShapeless(new ItemStack(Blocks.tnt_5), Blocks.tnt_4, Blocks.tnt_4); + addShapeless(new ItemStack(Blocks.tnt_6), Blocks.tnt_5, Blocks.tnt_5); + addShapeless(new ItemStack(Blocks.tnt_7), Blocks.tnt_6, Blocks.tnt_6); + add(new ItemStack(Blocks.nuke, 1), "###", "###", "###", '#', Blocks.tnt_7); add(new ItemStack(Blocks.ladder, 3), "# #", "###", "# #", '#', Items.stick); @@ -291,7 +296,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.sugar, 1), "#", '#', Items.reeds); add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', Items.coal, '#', Items.stick); - add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', new ItemStack(Items.coal, 1, 1), '#', Items.stick); + add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', Items.charcoal, '#', Items.stick); add(new ItemStack(Items.glass_bottle, 3), "# #", " # ", '#', Blocks.glass); add(new ItemStack(Blocks.rail, 16), "X X", "X#X", "X X", 'X', Items.iron_ingot, '#', Items.stick); add(new ItemStack(Blocks.golden_rail, 6), "X X", "X#X", "XRX", 'X', Items.gold_ingot, 'R', Items.redstone, '#', Items.stick); @@ -302,10 +307,10 @@ public abstract class CraftingRegistry add(new ItemStack(Items.brewing_stand, 1), " B ", "###", '#', Blocks.cobblestone, 'B', Items.blaze_rod); add(new ItemStack(Blocks.lit_pumpkin, 1), "A", "B", 'A', Blocks.pumpkin, 'B', Blocks.torch); add(new ItemStack(Items.chest_minecart, 1), "A", "B", 'A', Blocks.chest, 'B', Items.minecart); - add(new ItemStack(Items.tnt_minecart, 1), "A", "B", 'A', new ItemStack(Blocks.tnt, 1, 0), 'B', Items.minecart); + add(new ItemStack(Items.tnt_minecart, 1), "A", "B", 'A', Blocks.tnt, 'B', Items.minecart); add(new ItemStack(Items.hopper_minecart, 1), "A", "B", 'A', Blocks.hopper, 'B', Items.minecart); add(new ItemStack(Items.bucket, 1), "# #", " # ", '#', Items.iron_ingot); - add(new ItemStack(Items.flower_pot, 1), "# #", " # ", '#', Items.brick); + add(new ItemStack(Items.flowerpot, 1), "# #", " # ", '#', Items.brick); addShapeless(new ItemStack(Items.flint_and_steel, 1), new ItemStack(Items.iron_ingot, 1), new ItemStack(Items.flint, 1)); add(new ItemStack(Items.bread, 1), "###", '#', Items.wheats); @@ -317,9 +322,9 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.blood_brick_stairs, 4), "# ", "## ", "###", '#', Blocks.blood_brick); add(new ItemStack(Blocks.sandstone_stairs, 4), "# ", "## ", "###", '#', Blocks.sandstone); add(new ItemStack(Blocks.quartz_stairs, 4), "# ", "## ", "###", '#', Blocks.quartz_block); - add(new ItemStack(Items.golden_apple, 1, 0), "###", "#X#", "###", '#', Items.gold_ingot, 'X', Items.apple); - add(new ItemStack(Items.golden_apple, 1, 1), "###", "#X#", "###", '#', Blocks.gold_block, 'X', Items.apple); - add(new ItemStack(Items.golden_carrot, 1, 0), "###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.carrot); + add(new ItemStack(Items.golden_apple, 1), "###", "#X#", "###", '#', Items.gold_ingot, 'X', Items.apple); + add(new ItemStack(Items.charged_apple, 1), "###", "#X#", "###", '#', Blocks.gold_block, 'X', Items.apple); + add(new ItemStack(Items.golden_carrot, 1), "###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.carrot); add(new ItemStack(Items.speckled_melon, 1), "###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.melon); add(new ItemStack(Blocks.lever, 1), "X", "#", '#', Blocks.cobblestone, 'X', Items.stick); add(new ItemStack(Blocks.redstone_torch, 1), "X", "#", '#', Items.stick, 'X', Items.redstone); @@ -337,18 +342,18 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.anvil, 1), "III", " i ", "iii", 'I', Blocks.iron_block, 'i', Items.iron_ingot); addShapeless(new ItemStack(Items.charged_orb, 1), Items.orb, Items.blaze_powder); addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, Items.coal); - addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, new ItemStack(Items.coal, 1, 1)); + addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, Items.charcoal); add(new ItemStack(Blocks.hopper), "I I", "ICI", " I ", 'I', Items.iron_ingot, 'C', Blocks.chest); add(new ItemStack(Items.dynamite, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Items.clay_ball); - add(new ItemStack(Items.dynamite, 1, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', new ItemStack(Items.dynamite, 1, 0)); - add(new ItemStack(Items.dynamite, 1, 2), "##", "##", '#', new ItemStack(Items.dynamite, 1, 1)); - addShapeless(new ItemStack(Items.dynamite, 1, 3), new ItemStack(Items.dynamite, 1, 2), new ItemStack(Items.dynamite, 1, 2)); - addShapeless(new ItemStack(Items.dynamite, 1, 4), new ItemStack(Items.dynamite, 1, 3), new ItemStack(Items.dynamite, 1, 3)); - addShapeless(new ItemStack(Items.dynamite, 1, 5), new ItemStack(Items.dynamite, 1, 4), new ItemStack(Items.dynamite, 1, 4)); - addShapeless(new ItemStack(Items.dynamite, 1, 6), new ItemStack(Items.dynamite, 1, 5), new ItemStack(Items.dynamite, 1, 5)); - addShapeless(new ItemStack(Items.dynamite, 1, 7), new ItemStack(Items.dynamite, 1, 6), new ItemStack(Items.dynamite, 1, 6)); + add(new ItemStack(Items.dynamite_1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Items.dynamite); + add(new ItemStack(Items.dynamite_2), "##", "##", '#', Items.dynamite_1); + addShapeless(new ItemStack(Items.dynamite_3), Items.dynamite_2, Items.dynamite_2); + addShapeless(new ItemStack(Items.dynamite_4), Items.dynamite_3, Items.dynamite_3); + addShapeless(new ItemStack(Items.dynamite_5), Items.dynamite_4, Items.dynamite_4); + addShapeless(new ItemStack(Items.dynamite_6), Items.dynamite_5, Items.dynamite_5); + addShapeless(new ItemStack(Items.dynamite_7), Items.dynamite_6, Items.dynamite_6); add(new ItemStack(Items.portal_frame, 1), "XYX", "X#X", "XXX", 'X', Blocks.obsidian, 'Y', Items.orb, '#', Items.charged_orb); add(new ItemStack(Items.experience_bottle, 1), "YXY", "X#X", "YXY", 'X', Blocks.glass_pane, 'Y', Blocks.glowstone, '#', Items.emerald); @@ -359,7 +364,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.chick_magnet, 1), "A A", "N N", " C ", 'A', Items.aluminium_ingot, 'N', Items.nickel_ingot, 'C', Items.cobalt_ingot); add(new ItemStack(Items.magnet, 1), "I I", "N N", " R ", 'I', Items.iron_ingot, 'N', Items.neodymium_ingot, 'R', Items.redstone); - addShapeless(new ItemStack(Items.potion, 1, 16384), new ItemStack(Items.potion, 1, 0), Items.gunpowder); + addShapeless(new ItemStack(Items.splash_potion), Items.potion, Items.gunpowder); add(new ItemStack(Blocks.construction_table), "---", "-#-", "---", '#', Blocks.workbench, '-', Items.iron_ingot); add(new ItemStack(Blocks.bedrock), "#####", "#####", "#####", "#####", "#####", '#', Blocks.obsidian); @@ -422,7 +427,7 @@ public abstract class CraftingRegistry } else if (recipeComponents[i + 1] instanceof Block) { - itemstack = new ItemStack((Block)recipeComponents[i + 1], 1, 32767); + itemstack = new ItemStack((Block)recipeComponents[i + 1]); } else if (recipeComponents[i + 1] instanceof ItemStack) { @@ -608,9 +613,9 @@ public abstract class CraftingRegistry { ItemStack itemstack2 = inv.getStackInSlot(j); - if (itemstack2 != null && itemstack2.getItem() == Items.dye) + if (itemstack2 != null && itemstack2.getItem() instanceof ItemDye dye) { - k = itemstack2.getMetadata(); + k = dye.getColor().getDyeDamage(); break; } } @@ -683,7 +688,7 @@ public abstract class CraftingRegistry if (itemstack != null && itemstack.getItem() != Items.banner) { - if (itemstack.getItem() == Items.dye) + if (itemstack.getItem() instanceof ItemDye) { if (flag2) { @@ -713,7 +718,7 @@ public abstract class CraftingRegistry } else if (p_179533_1_.getSizeInventory() == tileentitybanner$enumbannerpattern.getCraftingLayers().length * tileentitybanner$enumbannerpattern.getCraftingLayers()[0].length()) { - int j = -1; + DyeColor j = null; for (int k = 0; k < p_179533_1_.getSizeInventory() && flag; ++k) { @@ -723,13 +728,13 @@ public abstract class CraftingRegistry if (itemstack1 != null && itemstack1.getItem() != Items.banner) { - if (itemstack1.getItem() != Items.dye) + if (!(itemstack1.getItem() instanceof ItemDye dye)) { flag = false; break; } - if (j != -1 && j != itemstack1.getMetadata()) + if (j != null && j != dye.getColor()) { flag = false; break; @@ -741,7 +746,7 @@ public abstract class CraftingRegistry break; } - j = itemstack1.getMetadata(); + j = dye.getColor(); } else if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) != 32) { @@ -789,7 +794,7 @@ public abstract class CraftingRegistry return false; } - int j = TileEntityBanner.getBaseColor(itemstack2); + DyeColor j = TileEntityBanner.getBaseColor(itemstack2); boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0; if (itemstack != null) @@ -918,7 +923,7 @@ public abstract class CraftingRegistry { ++l; } - else if (itemstack.getItem() == Items.dye) + else if (itemstack.getItem() instanceof ItemDye) { ++k; } @@ -1004,9 +1009,9 @@ public abstract class CraftingRegistry if (itemstack2 != null) { - if (itemstack2.getItem() == Items.dye) + if (itemstack2.getItem() instanceof ItemDye dye) { - list.add(ItemDye.dyeColors[itemstack2.getMetadata() & 15]); + list.add(ItemDye.FIREWORK_COLORS[dye.getColor().getDyeDamage()]); } else if (itemstack2.getItem() == Items.glowstone_dust) { @@ -1058,9 +1063,9 @@ public abstract class CraftingRegistry if (itemstack1 != null) { - if (itemstack1.getItem() == Items.dye) + if (itemstack1.getItem() instanceof ItemDye dye) { - list1.add(ItemDye.dyeColors[itemstack1.getMetadata() & 15]); + list1.add(ItemDye.FIREWORK_COLORS[dye.getColor().getDyeDamage()]); } else if (itemstack1.getItem() == Items.firework_charge) { @@ -1223,7 +1228,9 @@ public abstract class CraftingRegistry i1 = 0; } - return new ItemStack(itemstack2.getItem(), 1, i1); + ItemStack stack = new ItemStack(itemstack2.getItem()); + stack.setItemDamage(i1); + return stack; } } @@ -1290,7 +1297,7 @@ public abstract class CraftingRegistry } else { - if (itemstack1.getItem() != Items.dye) + if (!(itemstack1.getItem() instanceof ItemDye)) { return false; } @@ -1347,12 +1354,12 @@ public abstract class CraftingRegistry } else { - if (itemstack1.getItem() != Items.dye) + if (!(itemstack1.getItem() instanceof ItemDye dye)) { return null; } - float[] afloat = EntitySheep.getDyeRgb(DyeColor.byDyeDamage(itemstack1.getMetadata())); + float[] afloat = EntitySheep.getDyeRgb(dye.getColor()); int l1 = (int)(afloat[0] * 255.0F); int i2 = (int)(afloat[1] * 255.0F); int j2 = (int)(afloat[2] * 255.0F); @@ -1524,11 +1531,6 @@ public abstract class CraftingRegistry { return false; } - - if (stack.getMetadata() != 32767 && stack.getMetadata() != ingredient.getMetadata()) - { - return false; - } } } } @@ -1621,7 +1623,7 @@ public abstract class CraftingRegistry for (ItemStack itemstack1 : list) { - if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata())) + if (itemstack.getItem() == itemstack1.getItem()) { flag = true; list.remove(itemstack1); diff --git a/common/src/main/java/common/init/DispenserRegistry.java b/common/src/main/java/common/init/DispenserRegistry.java index db74a2af..131e42a1 100755 --- a/common/src/main/java/common/init/DispenserRegistry.java +++ b/common/src/main/java/common/init/DispenserRegistry.java @@ -36,7 +36,6 @@ import common.item.ItemStack; import common.rng.Random; import common.tileentity.TileEntityDispenser; import common.util.BlockPos; -import common.util.ExtMath; import common.util.Facing; import common.util.RegistryDefaulted; import common.world.State; @@ -62,29 +61,33 @@ public abstract class DispenserRegistry { return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ()); } }); - REGISTRY.putObject(Items.die, new BehaviorProjectileDispense() - { - protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) - { - return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(), - ItemDie.DIE_SIDES[ExtMath.clampi(item.getMetadata(), 0, ItemDie.DIE_SIDES.length - 1)]); - } - protected float getInaccuracy() - { - return super.getInaccuracy() * 5.0F; - } - protected float getVelocity() - { - return super.getVelocity() * 0.25F; - } - }); - REGISTRY.putObject(Items.dynamite, new BehaviorProjectileDispense() - { - protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) - { - return new EntityDynamite(worldIn, position.getX(), position.getY(), position.getZ(), item.getMetadata()); - } - }); + for(final ItemDie die : ItemDie.getDieItems()) { + REGISTRY.putObject(die, new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) + { + return new EntityDie(worldIn, position.getX(), position.getY(), position.getZ(), die.getSides()); + } + protected float getInaccuracy() + { + return super.getInaccuracy() * 5.0F; + } + protected float getVelocity() + { + return super.getVelocity() * 0.25F; + } + }); + } + for(int z = 0; z < 8; z++) { + final int power = z; + REGISTRY.putObject(ItemRegistry.getRegisteredItem("dynamite" + (power == 0 ? "" : "_" + power)), new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) + { + return new EntityDynamite(worldIn, position.getX(), position.getY(), position.getZ(), power); + } + }); + } REGISTRY.putObject(Items.snowball, new BehaviorProjectileDispense() { protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) @@ -107,16 +110,13 @@ public abstract class DispenserRegistry { return super.getVelocity() * 1.25F; } }); - REGISTRY.putObject(Items.potion, new IBehaviorDispenseItem() - { - private final BehaviorDefaultDispenseItem field_150843_b = new BehaviorDefaultDispenseItem(); - public ItemStack dispense(IBlockSource source, final ItemStack stack) - { - return ItemPotion.isSplash(stack.getMetadata()) ? (new BehaviorProjectileDispense() - { + for(ItemPotion potion : ItemPotion.getPotions()) { + if(potion.isSplashPotion()) + REGISTRY.putObject(potion, new BehaviorProjectileDispense() + { protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) { - return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), stack.copy()); + return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), item.copy()); } protected float getInaccuracy() { @@ -126,9 +126,8 @@ public abstract class DispenserRegistry { { return super.getVelocity() * 1.25F; } - }).dispense(source, stack): this.field_150843_b.dispense(source, stack); - } - }); + }); + } IBehaviorDispenseItem disp = new BehaviorDefaultDispenseItem() { public ItemStack dispenseStack(IBlockSource source, ItemStack stack) @@ -307,7 +306,7 @@ public abstract class DispenserRegistry { } else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(new ItemStack(item)) < 0) { - this.field_150840_b.dispense(source, new ItemStack(item, 1, 0)); + this.field_150840_b.dispense(source, new ItemStack(item)); } return stack; @@ -315,7 +314,7 @@ public abstract class DispenserRegistry { }); REGISTRY.putObject(Items.flint_and_steel, new BehaviorDefaultDispenseItem() { - private boolean field_150839_b = true; + private boolean success = true; protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); @@ -329,22 +328,24 @@ public abstract class DispenserRegistry { { stack.size = 0; } + this.success = true; } else if (world.getState(blockpos).getBlock() == Blocks.tnt) { Blocks.tnt.onBlockDestroyedByPlayer(world, blockpos, Blocks.tnt.getState().withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); world.setBlockToAir(blockpos); + this.success = true; } else { - this.field_150839_b = false; + this.success = false; } return stack; } protected void playDispenseSound(IBlockSource source) { - if (this.field_150839_b) + if (this.success) { source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); } @@ -354,59 +355,56 @@ public abstract class DispenserRegistry { } } }); - REGISTRY.putObject(Items.dye, new BehaviorDefaultDispenseItem() - { - private boolean field_150838_b = true; - protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) - { - if (DyeColor.WHITE == DyeColor.byDyeDamage(stack.getMetadata())) - { - World world = source.getWorld(); - BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); - - if (ItemDye.applyBonemeal(stack, world, blockpos)) - { - if (!world.client) - { - world.playAuxSFX(2005, blockpos, 0); - } - } - else - { - this.field_150838_b = false; - } - - return stack; - } - else - { - return super.dispenseStack(source, stack); - } - } - protected void playDispenseSound(IBlockSource source) - { - if (this.field_150838_b) - { - source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); - } - else - { - source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0); - } - } - }); - REGISTRY.putObject(ItemRegistry.getItemFromBlock(Blocks.tnt), new BehaviorDefaultDispenseItem() + REGISTRY.putObject(Items.bonemeal, new BehaviorDefaultDispenseItem() { + private boolean success = true; protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); - EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, stack.getMetadata()); - world.spawnEntityInWorld(entitytntprimed); - world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F); - --stack.size; + + if (ItemDye.applyBonemeal(stack, world, blockpos)) + { + if (!world.client) + { + world.playAuxSFX(2005, blockpos, 0); + } + this.success = true; + } + else + { + this.success = false; + } + return stack; } + protected void playDispenseSound(IBlockSource source) + { + if (this.success) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + else + { + source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0); + } + } }); + for(int z = 0; z < 8; z++) { + final int power = z; + REGISTRY.putObject(ItemRegistry.getRegisteredItem("tnt" + (power == 0 ? "" : "_" + power)), new BehaviorDefaultDispenseItem() + { + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, power); + world.spawnEntityInWorld(entitytntprimed); + world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F); + --stack.size; + return stack; + } + }); + } } } diff --git a/common/src/main/java/common/init/FlammabilityRegistry.java b/common/src/main/java/common/init/FlammabilityRegistry.java index 0d0a632e..fd214fc6 100755 --- a/common/src/main/java/common/init/FlammabilityRegistry.java +++ b/common/src/main/java/common/init/FlammabilityRegistry.java @@ -3,6 +3,14 @@ package common.init; import java.util.Map; import common.block.Block; +import common.block.artificial.BlockCarpet; +import common.block.artificial.BlockWool; +import common.block.foliage.BlockDoublePlant; +import common.block.foliage.BlockFlower; +import common.block.foliage.BlockLeaves; +import common.block.foliage.BlockTallGrass; +import common.block.foliage.LeavesType; +import common.block.tech.BlockTNT; import common.collect.Maps; public abstract class FlammabilityRegistry { @@ -22,21 +30,35 @@ public abstract class FlammabilityRegistry { setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence"), 5, 20); setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence_gate"), 5, 20); setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), 5, 5); - setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_leaves"), 30, 60); + for(LeavesType type : LeavesType.values()) { + setFlammable(BlockLeaves.getLeavesBlock(wood, type), 30, 60); + } setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"), 15, 100); } + for(BlockTNT block : BlockTNT.TNTS) { + setFlammable(block, 15, 100); + } + for(BlockTallGrass block : BlockTallGrass.BUSHES) { + setFlammable(block, 60, 100); + } + for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { + setFlammable(block, 60, 100); + } + for(BlockFlower block : BlockFlower.FLOWERS) { + setFlammable(block, 60, 100); + } + for(BlockWool block : BlockWool.WOOLS) { + setFlammable(block, 30, 60); + } + for(BlockCarpet block : BlockCarpet.CARPETS) { + setFlammable(block, 60, 20); + } setFlammable(Blocks.bookshelf, 30, 20); - setFlammable(Blocks.tnt, 15, 100); - setFlammable(Blocks.tallgrass, 60, 100); - setFlammable(Blocks.double_plant, 60, 100); - setFlammable(Blocks.flower, 60, 100); setFlammable(Blocks.deadbush, 60, 100); setFlammable(Blocks.dry_leaves, 60, 100); - setFlammable(Blocks.wool, 30, 60); setFlammable(Blocks.vine, 15, 100); setFlammable(Blocks.coal_block, 5, 5); setFlammable(Blocks.hay_block, 60, 20); - setFlammable(Blocks.carpet, 60, 20); } public static int getFlammability(Block block) { diff --git a/common/src/main/java/common/init/ItemRegistry.java b/common/src/main/java/common/init/ItemRegistry.java index 83b991e9..1aded2e9 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -2,25 +2,22 @@ package common.init; import java.util.Map; import java.util.Set; -import java.util.function.Function; - import common.attributes.UsageSlot; import common.block.Block; import common.block.artificial.BlockBed; import common.block.artificial.BlockDoor; import common.block.artificial.BlockFence; import common.block.artificial.BlockSlab; -import common.block.artificial.BlockStoneBrick; +import common.block.artificial.BlockStainedGlassPane; import common.block.artificial.BlockWall; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockFlower; import common.block.foliage.BlockLeaves; import common.block.foliage.BlockSapling; -import common.block.natural.BlockDirt; +import common.block.foliage.BlockTallGrass; import common.block.natural.BlockOre; -import common.block.natural.BlockSand; -import common.block.natural.BlockSandStone; import common.block.tech.BlockButton; +import common.block.tech.BlockTNT; import common.collect.Maps; import common.collect.Sets; import common.color.DyeColor; @@ -31,7 +28,6 @@ import common.entity.npc.SpeciesInfo; import common.item.CheatTab; import common.item.Item; import common.item.ItemAmmo; -import common.item.ItemAnvilBlock; import common.item.ItemAppleGold; import common.item.ItemArmor; import common.item.ItemAxe; @@ -50,8 +46,6 @@ import common.item.ItemCamera; import common.item.ItemCarrotOnAStick; import common.item.ItemChargedOrb; import common.item.ItemChest; -import common.item.ItemCloth; -import common.item.ItemCoal; import common.item.ItemColored; import common.item.ItemDie; import common.item.ItemDispenser; @@ -81,7 +75,6 @@ import common.item.ItemHugeMushroom; import common.item.ItemInfoWand; import common.item.ItemKey; import common.item.ItemLead; -import common.item.ItemLeaves; import common.item.ItemLightning; import common.item.ItemLilyPad; import common.item.ItemMagnet; @@ -90,7 +83,6 @@ import common.item.ItemMetal; import common.item.ItemMetalBlock; import common.item.ItemMinecart; import common.item.ItemMonsterPlacer; -import common.item.ItemMultiTexture; import common.item.ItemNameTag; import common.item.ItemNpcSpawner; import common.item.ItemNugget; @@ -117,13 +109,14 @@ import common.item.ItemShovel; import common.item.ItemStack; import common.item.ItemStick; import common.item.ItemSword; -import common.item.ItemTNT; import common.item.ItemTiny; import common.item.ItemWall; import common.item.ItemWeatherToken; import common.potion.Potion; import common.potion.PotionHelper; +import common.util.Pair; import common.util.RegistryNamespaced; +import common.util.Util; import common.world.Weather; public abstract class ItemRegistry { @@ -156,25 +149,10 @@ public abstract class ItemRegistry { public static ItemStack getFromIdName(String name, ItemStack def) { if(name == null) return def; - String[] tok = name.split(":"); - if(tok.length < 1 || tok.length > 2) - return def; - Item item = REGISTRY.getObject(tok[0]); + Item item = REGISTRY.getObject(name); if(item == null) return def; - short data = 0; - if(tok.length == 2) { - try { - int i = Integer.parseUnsignedInt(tok[1]); - if(i >= 32768) - return def; - data = (short)i; - } - catch(NumberFormatException e) { - return def; - } - } - return new ItemStack(item, 1, data); + return new ItemStack(item); } private static ItemBlock registerFlat(Block block) { @@ -214,7 +192,6 @@ public abstract class ItemRegistry { } private static void registerTools(ToolMaterial material, String name, String prefix) { -// String loc = name.substring(0, 1).toUpperCase() + name.substring(1); if(material.hasTools()) { registerItem(name + "_shovel", (new ItemShovel(material)).setDisplay(prefix + "schaufel")); registerItem(name + "_pickaxe", (new ItemPickaxe(material)).setDisplay(prefix + "spitzhacke")); @@ -237,131 +214,36 @@ public abstract class ItemRegistry { } static void register() { - registerBlock(Blocks.grass, new ItemColored(Blocks.grass, false)); - registerBlock(Blocks.dirt, (new ItemMultiTexture(Blocks.dirt, Blocks.dirt, new Function() { - public String apply(ItemStack p_apply_1_) { - return BlockDirt.DirtType.byMetadata(p_apply_1_.getMetadata()).getDisplay(); - } - })).setDisplay("Erde")); -// registerBlock(Blocks.planks, (new ItemMultiTexture(Blocks.planks, Blocks.planks, new Function() { -// public String apply(ItemStack p_apply_1_) { -// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); -// } -// })).setUnlocalizedName("wood")); -// registerBlock(Blocks.sapling, (new ItemMultiTexture(Blocks.sapling, Blocks.sapling, true, new Function() { -// public String apply(ItemStack p_apply_1_) { -// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); -// } -// })).setUnlocalizedName("sapling")); - registerBlock(Blocks.sand, (new ItemMultiTexture(Blocks.sand, Blocks.sand, new Function() { - public String apply(ItemStack p_apply_1_) { - return BlockSand.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay(); - } - })).setDisplay("Sand")); -// registerBlock(Blocks.log, (new ItemMultiTexture(Blocks.log, Blocks.log, new Function() { -// public String apply(ItemStack p_apply_1_) { -// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); -// } -// })).setUnlocalizedName("log")); -// registerBlock(Blocks.log2, (new ItemMultiTexture(Blocks.log2, Blocks.log2, new Function() { -// public String apply(ItemStack p_apply_1_) { -// return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata() + 4).getUnlocalizedName(); -// } -// })).setUnlocalizedName("log")); + registerBlock(Blocks.grass, new ItemColored(Blocks.grass)); registerBlock(Blocks.dispenser, new ItemDispenser(Blocks.dispenser)); - registerBlock(Blocks.sandstone, (new ItemMultiTexture(Blocks.sandstone, Blocks.sandstone, new Function() { - public String apply(ItemStack p_apply_1_) { - return BlockSandStone.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay(); - } - })).setDisplay("Sandstein")); - registerFlat(Blocks.golden_rail); - registerFlat(Blocks.detector_rail); + registerBlock(Blocks.dropper, new ItemDispenser(Blocks.dropper)); registerBlock(Blocks.sticky_piston, new ItemPiston(Blocks.sticky_piston)); - registerFlat(Blocks.web); - registerBlock(Blocks.tallgrass, (new ItemColored(Blocks.tallgrass, true, "")).setSubtypeNames(new String[] {"Busch", "Gras", "Farn"})); - registerFlat(Blocks.deadbush); registerBlock(Blocks.piston, new ItemPiston(Blocks.piston)); - registerBlock(Blocks.wool, (new ItemCloth(Blocks.wool, -1)).setDisplay("Wolle")); - registerBlock(Blocks.flower, (new ItemMultiTexture(Blocks.flower, Blocks.flower, true, new Function() { - public String apply(ItemStack stack) { - return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.BASE, stack.getMetadata()).getDisplay(); - } - })).setDisplay("Blume")); - registerFlat(Blocks.brown_mushroom); - registerFlat(Blocks.red_mushroom); - registerBlock(Blocks.tnt, new ItemTNT(Blocks.tnt)); registerBlock(Blocks.nuke, new ItemBlock(Blocks.nuke).setColor(TextColor.RED)); - registerFlat(Blocks.torch); registerBlock(Blocks.chest, new ItemChest(Blocks.chest)); - registerFlat(Blocks.ladder); - registerFlat(Blocks.rail); - registerFlat(Blocks.lever, "lever"); registerBlock(Blocks.stone_pressure_plate, new ItemPressurePlate(Blocks.stone_pressure_plate)); registerBlock(Blocks.wooden_pressure_plate, new ItemPressurePlate(Blocks.wooden_pressure_plate)); - registerFlat(Blocks.redstone_torch); -// registerBlock(Blocks.stone_button, new ItemButton(Blocks.stone_button)); registerBlock(Blocks.snow_layer, new ItemSnow(Blocks.snow_layer)); -// registerBlock(Blocks.oak_fence, new ItemFence(Blocks.oak_fence)); -// registerBlock(Blocks.spruce_fence, new ItemFence(Blocks.spruce_fence)); -// registerBlock(Blocks.birch_fence, new ItemFence(Blocks.birch_fence)); -// registerBlock(Blocks.jungle_fence, new ItemFence(Blocks.jungle_fence)); -// registerBlock(Blocks.dark_oak_fence, new ItemFence(Blocks.dark_oak_fence)); -// registerBlock(Blocks.acacia_fence, new ItemFence(Blocks.acacia_fence)); - registerBlock(Blocks.stonebrick, (new ItemMultiTexture(Blocks.stonebrick, Blocks.stonebrick, new Function() { - public String apply(ItemStack p_apply_1_) { - return BlockStoneBrick.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay(); - } - })).setDisplay("Steinziegel")); registerBlock(Blocks.brown_mushroom_block, new ItemHugeMushroom(Blocks.brown_mushroom_block)); registerBlock(Blocks.red_mushroom_block, new ItemHugeMushroom(Blocks.red_mushroom_block)); - registerFlat(Blocks.iron_bars); - registerFlat(Blocks.glass_pane, "glass"); - registerBlock(Blocks.vine, new ItemColored(Blocks.vine, false, "")); + registerBlock(Blocks.vine, new ItemColored(Blocks.vine, "")); registerBlock(Blocks.waterlily, new ItemLilyPad(Blocks.waterlily)); -// registerBlock(Blocks.blood_brick_fence, new ItemFence(Blocks.blood_brick_fence)); -// registerBlock(Blocks.black_brick_fence, new ItemFence(Blocks.black_brick_fence)); - registerFlat(Blocks.tripwire_hook, "tripwire_hook"); - registerBlock(Blocks.cobblestone_wall, - (new ItemWall(Blocks.cobblestone_wall, Blocks.cobblestone_wall, new Function() { - public String apply(ItemStack p_apply_1_) { - return BlockWall.EnumType.byMetadata(p_apply_1_.getMetadata()).getDisplay(); - } - })).setDisplay("Bruchsteinmauer")); -// registerBlock(Blocks.wooden_button, new ItemButton(Blocks.wooden_button)); - registerBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setDisplay("Amboss")); registerBlock(Blocks.trapped_chest, new ItemChest(Blocks.trapped_chest)); registerBlock(Blocks.light_weighted_pressure_plate, new ItemPressurePlate(Blocks.light_weighted_pressure_plate)); registerBlock(Blocks.heavy_weighted_pressure_plate, new ItemPressurePlate(Blocks.heavy_weighted_pressure_plate)); - registerFlat(Blocks.hopper, "items/hopper"); - registerBlock(Blocks.quartz_block, - (new ItemMultiTexture(Blocks.quartz_block, Blocks.quartz_block, new String[] {"Quarzblock", "GemeiĂŸelter Quarzblock", "Quarzsäule"})) - .setDisplay("Quarzblock")); - registerBlock(Blocks.black_quartz_block, - (new ItemMultiTexture(Blocks.black_quartz_block, Blocks.black_quartz_block, new String[] {"Schwarzer Quarzblock", "Schwarzer gemeiĂŸelter Quarzblock", "Schwarze Quarzsäule"})) - .setDisplay("Schwarzer Quarzblock")); - registerFlat(Blocks.activator_rail); - registerBlock(Blocks.dropper, new ItemDispenser(Blocks.dropper)); - registerBlock(Blocks.stained_hardened_clay, (new ItemCloth(Blocks.stained_hardened_clay, null)).setDisplay("gefärbter Ton")); - registerBlock(Blocks.carpet, (new ItemCloth(Blocks.carpet, 1)).setDisplay("Teppich")); - registerBlock(Blocks.double_plant, (new ItemDoublePlant(Blocks.double_plant, Blocks.double_plant, new Function() { - public String apply(ItemStack p_apply_1_) { - return BlockDoublePlant.EnumPlantType.byMetadata(p_apply_1_.getMetadata()).getDisplay(); - } - })).setDisplay("Pflanze")); - registerBlock(Blocks.stained_glass, (new ItemCloth(Blocks.stained_glass, null)).setDisplay("Glas")); - registerBlock(Blocks.stained_glass_pane, (new ItemCloth(Blocks.stained_glass_pane, null, "glass")).setDisplay("Glasscheibe")); -// registerBlock(Blocks.cherry_fence, new ItemFence(Blocks.cherry_fence)); -// registerBlock(Blocks.maple_fence, new ItemFence(Blocks.maple_fence)); - registerFlat(Blocks.blue_mushroom); -// registerBlock(Blocks.red_button, new ItemButton(Blocks.red_button)); - registerBlock(Blocks.rock, (new ItemMultiTexture(Blocks.rock, Blocks.rock, new Function() { - public String apply(ItemStack stack) { - return stack.getMetadata() == 1 ? "Glatter Felsen" : "Felsen"; - } - })).setDisplay("Felsen")); + + for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) { + registerBlock(BlockTallGrass.getByType(type), (new ItemColored(Blocks.tallgrass, ""))); + } + for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) { + registerBlock(BlockDoublePlant.getByType(type), new ItemDoublePlant(BlockDoublePlant.getByType(type), type)); + } + for(BlockWall wall : BlockWall.WALLS) { + registerBlock(wall, new ItemWall(wall)); + } for(BlockLeaves leaves : BlockLeaves.LEAVES) { - registerBlock(leaves, new ItemLeaves(leaves)); // .setDisplay(BlockRegistry.getNameFromBlock(leaves))); + registerBlock(leaves, new ItemColored(leaves, 8)); } for(BlockSlab slab : BlockSlab.SLABS) { registerBlock(slab, new ItemSlab(slab)); @@ -372,9 +254,36 @@ public abstract class ItemRegistry { for(BlockButton button : BlockButton.BUTTONS) { registerBlock(button, new ItemButton(button)); } + for(int z = 0; z < BlockTNT.TNTS.length; z++) { + registerBlock(BlockTNT.getByPower(z), new ItemBlock(BlockTNT.getByPower(z)).setColor(TextColor.RED)); + } + + for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { + registerFlat(BlockFlower.getByType(type)); + } + for(BlockStainedGlassPane pane : BlockStainedGlassPane.PANES) { + registerFlat(pane); + } for(BlockSapling sapling : BlockSapling.SAPLINGS) { registerFlat(sapling); } + registerFlat(Blocks.golden_rail); + registerFlat(Blocks.detector_rail); + registerFlat(Blocks.web); + registerFlat(Blocks.deadbush); + registerFlat(Blocks.brown_mushroom); + registerFlat(Blocks.red_mushroom); + registerFlat(Blocks.torch); + registerFlat(Blocks.ladder); + registerFlat(Blocks.rail); + registerFlat(Blocks.redstone_torch); + registerFlat(Blocks.iron_bars); + registerFlat(Blocks.activator_rail); + registerFlat(Blocks.blue_mushroom); + registerFlat(Blocks.lever, "lever"); + registerFlat(Blocks.glass_pane, "glass"); + registerFlat(Blocks.tripwire_hook, "tripwire_hook"); + registerFlat(Blocks.hopper, "items/hopper"); Item bucket = (new ItemBucket(null, false)).setDisplay("Eimer"); @@ -391,8 +300,6 @@ public abstract class ItemRegistry { } registerItem("milk_bucket", (new ItemBucketMilk()).setDisplay("Milch").setContainerItem(bucket)); -// registerItem("painting", (new ItemHangingEntity(EntityPainting.class)).setDisplay("Gemälde")); -// registerItem("item_frame", (new ItemHangingEntity(EntityFrame.class)).setDisplay("Rahmen")); registerItem("boat", (new ItemBoat()).setDisplay("Boot")); registerItem("minecart", (new ItemMinecart(EntityCart.EnumMinecartType.RIDEABLE)).setDisplay("Lore")); registerItem("chest_minecart", (new ItemMinecart(EntityCart.EnumMinecartType.CHEST)).setDisplay("GĂ¼terlore")); @@ -401,13 +308,13 @@ public abstract class ItemRegistry { .setColor(TextColor.RED)); for(EntityInfo egg : EntityRegistry.SPAWN_EGGS.values()) { registerItem(egg.id().toLowerCase() + "_spawner", (new ItemMonsterPlacer(egg.id())) - .setDisplay("Spawner").setMaxStackSize(ItemStack.MAX_SIZE)); + .setDisplay("Spawner").setMaxAmount(ItemStack.MAX_SIZE)); } for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) { for(CharacterInfo charinfo : species.chars) { if(charinfo.spawner) registerItem(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner") - .setMaxStackSize(ItemStack.MAX_SIZE)); + .setMaxAmount(ItemStack.MAX_SIZE)); } } @@ -415,8 +322,10 @@ public abstract class ItemRegistry { registerItem("info_wand", (new ItemInfoWand()).setDisplay("Infowerkzeug")); registerItem("lightning_wand", (new ItemLightning()).setDisplay("Geladenes Zepter")); registerItem("banhammer", (new ItemBanHammer()).setDisplay("Hammer der Verbannung").setTab(CheatTab.TOOLS)); - registerItem("key", (new ItemKey()).setDisplay("SchlĂ¼ssel").setTab(CheatTab.TOOLS).setMaxStackSize(128)); - registerItem("die", (new ItemDie()).setDisplay("WĂ¼rfel").setMaxStackSize(128)); + registerItem("key", (new ItemKey()).setDisplay("SchlĂ¼ssel").setTab(CheatTab.TOOLS).setMaxAmount(128)); + for(Pair sides : ItemDie.DIE_SIDES) { + registerItem("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("WĂ¼rfel").setMaxAmount(128)); + } registerItem("chick_magnet", (new ItemMagnet(true)).setDisplay("KĂ¼kenmagnet")); registerItem("magnet", (new ItemMagnet(false)).setDisplay("Magnet")); registerItem("camera", (new ItemCamera()).setDisplay("Kamera").setTab(CheatTab.TOOLS)); @@ -428,79 +337,89 @@ public abstract class ItemRegistry { registerItem("flint_and_steel", (new ItemFlintAndSteel(Blocks.fire)).setDisplay("Feuerzeug")); registerItem("burning_soul", (new ItemFlintAndSteel(Blocks.soul_fire)).setDisplay("Brennende Seele")); registerItem("dark_lighter", (new ItemFlintAndSteel(Blocks.black_fire)).setDisplay("Verdunkelndes Feuerzeug")); - registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxStackSize(128)); + registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxAmount(128)); registerItem("bow", (new ItemBow()).setDisplay("Bogen")); registerItem("boltgun", (new ItemBoltgun()).setDisplay("Bolter")); registerItem("bolt", (new ItemAmmo(5, 1.0f, 128)).setDisplay("Bolter-Munition")); - registerItem("arrow", (new Item()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxStackSize(128)); - Item coal = (new ItemCoal()).setDisplay("Kohle"); + registerItem("arrow", (new Item()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxAmount(128)); + Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS); registerItem("coal", coal); - registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxStackSize(256)); + registerItem("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS)); + registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(256)); registerItem("bowl", (new ItemSmall()).setDisplay("SchĂ¼ssel").setTab(CheatTab.MISC)); registerItem("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe")); - registerItem((new ItemSmallBlock(Blocks.string)).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxStackSize(1024)); - registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxStackSize(512)); - registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(256)); - registerItem((new ItemSeeds(Blocks.wheat, Blocks.farmland)).setDisplay("Weizenkörner").setMaxStackSize(256)); - registerItem("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxStackSize(128)); + registerItem((new ItemSmallBlock(Blocks.string)).setDisplay("Faden").setTab(CheatTab.TECHNOLOGY).setMaxAmount(1024)); + registerItem("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(512)); + registerItem("gunpowder", (new Item()).setDisplay("Schwarzpulver").setPotionEffect(PotionHelper.gunpowderEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); + registerItem((new ItemSeeds(Blocks.wheat, Blocks.farmland)).setDisplay("Weizenkörner").setMaxAmount(256)); + registerItem("wheats", (new Item()).setDisplay("Weizen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); registerItem("bread", (new ItemFood(5, false)).setDisplay("Brot")); - registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxStackSize(128)); + registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(128)); registerItem("porkchop", (new ItemFood(3, true)).setDisplay("Rohes Schweinefleisch")); registerItem("cooked_porkchop", (new ItemFood(8, true)).setDisplay("Gebratenes Schweinefleisch")); registerItem("golden_apple", (new ItemAppleGold(4, false)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F) .setDisplay("Goldener Apfel")); + registerItem("charged_apple", (new ItemAppleGold(4, true)).setPotionEffect(Potion.REGENERATION, 5, 1, 1.0F) + .setDisplay("Geladener Apfel")); registerItem((new ItemSign()).setDisplay("Schild")); -// registerItem("oak_door", (new ItemDoor(Blocks.oak_door)).setUnlocalizedName("doorOak")); -// registerItem("water_bucket", (new ItemBucket(Blocks.flowing_water)).setUnlocalizedName("bucketWater").setContainerItem(bucket)); -// registerItem("lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(bucket)); registerItem("saddle", (new ItemSaddle()).setDisplay("Sattel")); -// registerItem("iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron")); - registerItem((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxStackSize(256)); - registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxStackSize(128)); + registerItem((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(256)); + registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128)); registerItem("leather", (new Item()).setDisplay("Leder").setTab(CheatTab.MATERIALS)); registerItem("brick", (new Item()).setDisplay("Ziegel").setTab(CheatTab.MATERIALS)); - registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxStackSize(128)); - registerItem((new ItemSmallBlock(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxStackSize(128)); - registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxStackSize(256)); + registerItem("clay_ball", (new Item()).setDisplay("Ton").setTab(CheatTab.MATERIALS).setMaxAmount(128)); + registerItem((new ItemSmallBlock(Blocks.reeds)).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS).setMaxAmount(128)); + registerItem("paper", (new Item()).setDisplay("Papier").setTab(CheatTab.MATERIALS).setMaxAmount(256)); registerItem("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC)); - registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxStackSize(128)); - registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxStackSize(128)); + registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128)); + registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128)); registerItem("navigator", (new ItemSpaceNavigator()).setDisplay("Elektronischer Navigator").setTab(CheatTab.TOOLS)); registerItem("exterminator", (new ItemExterminator()).setDisplay("Weltenzerstörer").setTab(CheatTab.TOOLS)); registerItem("fishing_rod", (new ItemFishingRod()).setDisplay("Angel")); registerItem("glowstone_dust", (new Item()).setDisplay("Glowstonestaub").setPotionEffect(PotionHelper.glowstoneEffect) - .setTab(CheatTab.MATERIALS).setMaxStackSize(256)); - registerItem("fish", (new ItemFishFood(false)).setDisplay("Fisch").setHasSubtypes(true)); - registerItem("cooked_fish", (new ItemFishFood(true)).setDisplay("Fisch").setHasSubtypes(true)); - Item dye = (new ItemDye()).setDisplay("Farbstoff").setMaxStackSize(512); - registerItem("dye", dye); - registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxStackSize(128)); - registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(512)); - registerItem((new ItemSmallBlock(Blocks.cake)).setMaxStackSize(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION)); + .setTab(CheatTab.MATERIALS).setMaxAmount(256)); + for(ItemFishFood.FishType type : ItemFishFood.FishType.values()) { + registerItem(type.getName(), (new ItemFishFood(false, type)).setDisplay(type.getDisplay())); + if(type.canCook()) + registerItem("cooked_" + type.getName(), (new ItemFishFood(true, type)).setDisplay(type.getDisplay())); + } + Item lapis = null; + for(DyeColor color : DyeColor.values()) { + Item dye = (new ItemDye(color)).setDisplay(color.getDyeName()).setMaxAmount(512); + if(color == DyeColor.BLUE) + lapis = dye; + registerItem(color.getDye(), dye); + } + registerItem("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(128)); + registerItem("sugar", (new Item()).setDisplay("Zucker").setPotionEffect(PotionHelper.sugarEffect).setTab(CheatTab.MATERIALS).setMaxAmount(512)); + registerItem((new ItemSmallBlock(Blocks.cake)).setMaxAmount(1).setDisplay("Kuchen").setTab(CheatTab.DECORATION)); registerItem((new ItemSmallBlock(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.TECHNOLOGY)); - registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxStackSize(128)); + registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(128)); registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone")); - registerItem((new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setDisplay("KĂ¼rbiskerne").setMaxStackSize(256)); - registerItem((new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setDisplay("Melonenkerne").setMaxStackSize(256)); + registerItem((new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setDisplay("KĂ¼rbiskerne").setMaxAmount(256)); + registerItem((new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setDisplay("Melonenkerne").setMaxAmount(256)); registerItem("beef", (new ItemFood(3, true)).setDisplay("Rohes Rindfleisch")); registerItem("cooked_beef", (new ItemFood(8, true)).setDisplay("Steak")); registerItem("chicken", (new ItemFood(2, true)).setDisplay("Rohes HĂ¼hnchen")); registerItem("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes HĂ¼hnchen")); registerItem("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch")); registerItem("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.TOOLS)); - registerItem("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxStackSize(256)); - registerItem("ghast_tear", (new ItemTiny()).setDisplay("Ghastträne").setPotionEffect(PotionHelper.ghastTearEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(256)); - registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxStackSize(256)); - registerItem((new ItemSeeds(Blocks.soul_wart, Blocks.soul_sand)).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxStackSize(128)); - registerItem("potion", (new ItemPotion()).setDisplay("Trank")); + registerItem("blaze_rod", (new ItemRod()).setDisplay("Lohenrute").setTab(CheatTab.MATERIALS).setMaxAmount(256)); + registerItem("ghast_tear", (new ItemTiny()).setDisplay("Ghastträne").setPotionEffect(PotionHelper.ghastTearEffect).setTab(CheatTab.MATERIALS).setMaxAmount(256)); + registerItem("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(256)); + registerItem((new ItemSeeds(Blocks.soul_wart, Blocks.soul_sand)).setDisplay("Seelenwarze").setPotionEffect("+4").setMaxAmount(128)); + for(int data : ItemPotion.getValidDataValues()) { + ItemPotion potion = new ItemPotion(data); + registerItem(ItemPotion.getPotionName(potion), potion.setDisplay("Trank")); + } registerItem("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche")); registerItem("spider_eye", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 1.0F).setDisplay("Spinnenauge") - .setPotionEffect(PotionHelper.spiderEyeEffect).setMaxStackSize(128)); + .setPotionEffect(PotionHelper.spiderEyeEffect).setMaxAmount(128)); registerItem("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge") - .setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxStackSize(128)); + .setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(128)); registerItem("blaze_powder", (new Item()).setDisplay("Lohenstaub").setPotionEffect(PotionHelper.blazePowderEffect) - .setTab(CheatTab.MATERIALS).setMaxStackSize(256)); - registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(128)); + .setTab(CheatTab.MATERIALS).setMaxAmount(256)); + registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128)); registerItem((new ItemSmallBlock(Blocks.brewing_stand)).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY)); registerItem((new ItemSmallBlock(Blocks.cauldron)).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY)); registerItem("charged_orb", (new ItemChargedOrb()).setDisplay("Geladene Kugel")); @@ -512,11 +431,11 @@ public abstract class ItemRegistry { registerItem("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC)); Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS); registerItem("emerald", emerald); - registerItem((new ItemSmallBlock(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION)); - registerItem((new ItemSeedFood(3, Blocks.carrot, Blocks.farmland)).setDisplay("Karotte").setMaxStackSize(128)); - registerItem((new ItemSeedFood(1, Blocks.potato, Blocks.farmland)).setDisplay("Kartoffel").setMaxStackSize(128)); - registerItem("baked_potato", (new ItemFood(5, false)).setDisplay("Ofenkartoffel").setMaxStackSize(128)); - registerItem("poisonous_potato", (new ItemFood(2, false)).setPotionEffect(Potion.POISON, 5, 0, 0.6F).setDisplay("Giftige Kartoffel").setMaxStackSize(128)); + registerItem((new ItemSmallBlock(Blocks.flowerpot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION)); + registerItem((new ItemSeedFood(3, Blocks.carrot, Blocks.farmland)).setDisplay("Karotte").setMaxAmount(128)); + registerItem((new ItemSeedFood(1, Blocks.potato, Blocks.farmland)).setDisplay("Kartoffel").setMaxAmount(128)); + registerItem("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)); registerItem("golden_carrot", (new ItemFood(6, false)).setDisplay("Goldene Karotte") .setPotionEffect(PotionHelper.goldenCarrotEffect).setTab(CheatTab.MISC)); registerItem((new ItemSmallBlock(Blocks.skull)).setDisplay("Schädel").setTab(CheatTab.DECORATION)); @@ -525,7 +444,7 @@ public abstract class ItemRegistry { registerItem("pumpkin_pie", (new ItemFood(8, false)).setDisplay("KĂ¼rbiskuchen").setTab(CheatTab.MISC)); registerItem("fireworks", (new ItemFirework()).setDisplay("Feuerwerksrakete")); registerItem("firework_charge", (new ItemFireworkCharge()).setDisplay("Feuerwerksstern").setTab(CheatTab.MATERIALS)); - registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC)); + registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC)); registerItem((new ItemSmallBlock(Blocks.comparator)).setDisplay("Redstone-Komparator").setTab(CheatTab.TECHNOLOGY)); registerItem("bloodbrick", (new Item()).setDisplay("Blutroter Ziegel").setTab(CheatTab.MATERIALS)); registerItem("blackbrick", (new Item()).setDisplay("Schwarzer Ziegel").setTab(CheatTab.MATERIALS)); @@ -533,38 +452,22 @@ public abstract class ItemRegistry { registerItem("quartz", quartz); Item bquartz = (new Item()).setDisplay("Schwarzes Quarz").setTab(CheatTab.METALS); registerItem("black_quartz", bquartz); - registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxStackSize(128)); + registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxAmount(128)); registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild")); registerItem((new ItemBanner()).setDisplay("Banner")); -// registerItem("spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce")); -// registerItem("birch_door", (new ItemDoor(Blocks.birch_door)).setUnlocalizedName("doorBirch")); -// registerItem("jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle")); -// registerItem("acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia")); -// registerItem("dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak")); - registerItem("dynamite", (new ItemDynamite()).setDisplay("Dynamit").setColor(TextColor.RED)); -// registerItem("cherry_door", (new ItemDoor(Blocks.cherry_door)).setUnlocalizedName("doorCherry")); -// registerItem("maple_door", (new ItemDoor(Blocks.maple_door)).setUnlocalizedName("doorMaple")); + 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)); + } registerItem("chain", (new ItemMagnetic()).setDisplay("Kette").setTab(CheatTab.MATERIALS)); for(OreType ore : OreType.values()) { -// String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); -// registerItemBlock(BlockRegistry.getRegisteredBlock(ore.name + "_ore")); -// registerItemBlock(BlockRegistry.getRegisteredBlock(ore.name + "_block")); -// if(ore.gem != null) { Item itm = (new Item()).setDisplay(ore.itemDisplay).setTab(CheatTab.METALS); registerItem(ore.item, itm); ((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setDropItem(new ItemStack(itm, ore.dropQuantity), ore.bonusChance, ore.experience); -// } -// else { -// Item itm = (new Item()).setUnlocalizedName("ingot" + loc).setCreativeTab(CreativeTab.tabMaterialsFood); -// registerItem(ore.name + "_ingot", itm); -// ((BlockOre)BlockRegistry.getRegisteredBlock(ore.name + "_ore")).setSmeltItem(new ItemStack(itm)); -// } registerTools(ore.material, ore.name, ore.display); } for(MetalType metal : MetalType.values()) { -// String loc = metal.name.substring(0, 1).toUpperCase() + metal.name.substring(1); Block oreBlock = BlockRegistry.getRegisteredBlock(metal.name + "_ore"); ItemBlock ore = new ItemMetalBlock(oreBlock, metal, true); registerBlock(oreBlock, ore); @@ -588,10 +491,10 @@ public abstract class ItemRegistry { registerTools(tool.material, tool.name, tool.display); } for(BlockDoor door : BlockDoor.DOORS) { - registerItem(new ItemDoor(door)); // .setDisplay(door.getDisplay())); + registerItem(new ItemDoor(door)); } for(DyeColor color : BlockBed.COLORS) { - registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxStackSize(1).setDisplay(color.getSubject(0) + " Bett")); + registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxAmount(1).setDisplay(color.getSubject(0) + " Bett")); } registerItem("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee")); @@ -611,7 +514,7 @@ public abstract class ItemRegistry { ((BlockOre)BlockRegistry.getRegisteredBlock("coal_ore")).setDropItem(new ItemStack(coal), 0); ((BlockOre)BlockRegistry.getRegisteredBlock("emerald_ore")).setDropItem(new ItemStack(emerald), 3); - ((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(dye, 4, DyeColor.BLUE.getDyeDamage()), 4, 2); + ((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(lapis, 4), 4, 2); ((BlockOre)BlockRegistry.getRegisteredBlock("quartz_ore")).setDropItem(new ItemStack(quartz), 2); ((BlockOre)BlockRegistry.getRegisteredBlock("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3); @@ -620,54 +523,21 @@ public abstract class ItemRegistry { registerSpecial(FluidRegistry.getFluidBlock(z)); registerSpecial(FluidRegistry.getStaticBlock(z)); } -// for(EnumDyeColor color : BlockBed.COLORS) { -// registerSpecial(BlockRegistry.getRegisteredBlock(color.getName() + "_bed")); -// } -// for(BlockDoor door : BlockDoor.DOORS) { -// registerSpecial(door); -// } - registerSpecial(Blocks.air); - -// registerSpecial(Blocks.flowing_water); -// registerSpecial(Blocks.water); -// registerSpecial(Blocks.flowing_lava); -// registerSpecial(Blocks.lava); - -// registerSpecial(Blocks.wheat); -// registerSpecial(Blocks.carrots); -// registerSpecial(Blocks.potatoes); -// registerSpecial(Blocks.soul_wart); -// registerSpecial(Blocks.pumpkin_stem); -// registerSpecial(Blocks.melon_stem); registerSpecial(Blocks.cocoa); -// registerSpecial(Blocks.reeds); - registerSpecial(Blocks.fire); registerSpecial(Blocks.soul_fire); registerSpecial(Blocks.black_fire); registerSpecial(Blocks.portal); registerSpecial(Blocks.floor_portal); -// registerSpecial(Blocks.standing_sign); registerSpecial(Blocks.wall_sign); -// registerSpecial(Blocks.standing_banner); registerSpecial(Blocks.wall_banner); -// registerSpecial(Blocks.cake); -// registerSpecial(Blocks.brewing_stand); -// registerSpecial(Blocks.cauldron); -// registerSpecial(Blocks.flower_pot); -// registerSpecial(Blocks.skull); - -// registerSpecial(Blocks.tripwire); registerSpecial(Blocks.piston_head); registerSpecial(Blocks.piston_extension); registerSpecial(Blocks.lit_redstone_ore); registerSpecial(Blocks.lit_redstone_lamp); -// registerSpecial(Blocks.redstone_wire); registerSpecial(Blocks.unlit_redstone_torch); -// registerSpecial(Blocks.unpowered_repeater); registerSpecial(Blocks.powered_repeater); -// registerSpecial(Blocks.unpowered_comparator); registerSpecial(Blocks.powered_comparator); registerSpecial(Blocks.daylight_detector_inverted); diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index ecd134e4..f4500027 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -18,7 +18,11 @@ public abstract class Items { public static final ItemDoor acacia_door = get("acacia_door"); public static final ItemFence acacia_fence = get("acacia_fence"); public static final ItemBlock acacia_fence_gate = get("acacia_fence_gate"); - public static final ItemLeaves acacia_leaves = get("acacia_leaves"); + public static final ItemColored acacia_leaves_autumn = get("acacia_leaves_autumn"); + public static final ItemColored acacia_leaves_snowy = get("acacia_leaves_snowy"); + public static final ItemColored acacia_leaves_spring = get("acacia_leaves_spring"); + public static final ItemColored acacia_leaves_summer = get("acacia_leaves_summer"); + public static final ItemColored acacia_leaves_winter = get("acacia_leaves_winter"); public static final ItemBlock acacia_log = get("acacia_log"); public static final ItemBlock acacia_planks = get("acacia_planks"); public static final ItemBlock acacia_sapling = get("acacia_sapling"); @@ -27,13 +31,16 @@ public abstract class Items { public static final ItemBucket acid_bucket = get("acid_bucket"); public static final ItemBlock activator_rail = get("activator_rail"); public static final Item ahrd_fragment = get("ahrd_fragment"); + public static final ItemBlock allium = get("allium"); public static final ItemMetalBlock aluminium_block = get("aluminium_block"); public static final ItemMetal aluminium_ingot = get("aluminium_ingot"); public static final ItemMetalBlock aluminium_ore = get("aluminium_ore"); public static final ItemMetalBlock antimony_block = get("antimony_block"); public static final ItemMetalBlock antimony_ore = get("antimony_ore"); public static final ItemMetal antimony_powder = get("antimony_powder"); - public static final ItemAnvilBlock anvil = get("anvil"); + public static final ItemBlock anvil = get("anvil"); + public static final ItemBlock anvil_damaged_1 = get("anvil_damaged_1"); + public static final ItemBlock anvil_damaged_2 = get("anvil_damaged_2"); public static final ItemFood apple = get("apple"); public static final ItemBlock ardite_block = get("ardite_block"); public static final ItemArmor ardite_boots = get("ardite_boots"); @@ -57,7 +64,11 @@ public abstract class Items { public static final ItemDoor birch_door = get("birch_door"); public static final ItemFence birch_fence = get("birch_fence"); public static final ItemBlock birch_fence_gate = get("birch_fence_gate"); - public static final ItemLeaves birch_leaves = get("birch_leaves"); + public static final ItemColored birch_leaves_autumn = get("birch_leaves_autumn"); + public static final ItemColored birch_leaves_snowy = get("birch_leaves_snowy"); + public static final ItemColored birch_leaves_spring = get("birch_leaves_spring"); + public static final ItemColored birch_leaves_summer = get("birch_leaves_summer"); + public static final ItemColored birch_leaves_winter = get("birch_leaves_winter"); public static final ItemBlock birch_log = get("birch_log"); public static final ItemBlock birch_planks = get("birch_planks"); public static final ItemBlock birch_sapling = get("birch_sapling"); @@ -71,14 +82,22 @@ public abstract class Items { public static final ItemFence black_brick_fence = get("black_brick_fence"); public static final ItemSlab black_brick_slab = get("black_brick_slab"); public static final ItemBlock black_brick_stairs = get("black_brick_stairs"); + public static final ItemBlock black_carpet = get("black_carpet"); + public static final ItemBlock black_clay = get("black_clay"); + public static final ItemBlock black_glass = get("black_glass"); + public static final ItemBlock black_glass_pane = get("black_glass_pane"); + public static final ItemBlock black_lotus = get("black_lotus"); public static final ItemMetalBlock black_metal_block = get("black_metal_block"); public static final ItemMetal black_metal_ingot = get("black_metal_ingot"); public static final ItemMetalBlock black_metal_ore = get("black_metal_ore"); public static final Item black_quartz = get("black_quartz"); - public static final ItemMultiTexture black_quartz_block = get("black_quartz_block"); + public static final ItemBlock black_quartz_block = get("black_quartz_block"); public static final ItemBlock black_quartz_ore = get("black_quartz_ore"); + public static final ItemBlock black_quartz_ornaments = get("black_quartz_ornaments"); + public static final ItemBlock black_quartz_pillar = get("black_quartz_pillar"); public static final ItemSlab black_quartz_slab = get("black_quartz_slab"); public static final ItemBlock black_quartz_stairs = get("black_quartz_stairs"); + public static final ItemBlock black_wool = get("black_wool"); public static final Item blackbrick = get("blackbrick"); public static final ItemBlock blackened_cobble = get("blackened_cobble"); public static final ItemBlock blackened_dirt = get("blackened_dirt"); @@ -87,7 +106,11 @@ public abstract class Items { public static final ItemDoor blackwood_door = get("blackwood_door"); public static final ItemFence blackwood_fence = get("blackwood_fence"); public static final ItemBlock blackwood_fence_gate = get("blackwood_fence_gate"); - public static final ItemLeaves blackwood_leaves = get("blackwood_leaves"); + public static final ItemColored blackwood_leaves_autumn = get("blackwood_leaves_autumn"); + public static final ItemColored blackwood_leaves_snowy = get("blackwood_leaves_snowy"); + public static final ItemColored blackwood_leaves_spring = get("blackwood_leaves_spring"); + public static final ItemColored blackwood_leaves_summer = get("blackwood_leaves_summer"); + public static final ItemColored blackwood_leaves_winter = get("blackwood_leaves_winter"); public static final ItemBlock blackwood_log = get("blackwood_log"); public static final ItemBlock blackwood_planks = get("blackwood_planks"); public static final ItemBlock blackwood_sapling = get("blackwood_sapling"); @@ -101,11 +124,18 @@ public abstract class Items { public static final ItemBlock blood_brick_stairs = get("blood_brick_stairs"); public static final ItemBucket blood_bucket = get("blood_bucket"); public static final Item bloodbrick = get("bloodbrick"); + public static final ItemBlock blue_carpet = get("blue_carpet"); + public static final ItemBlock blue_clay = get("blue_clay"); + public static final ItemBlock blue_glass = get("blue_glass"); + public static final ItemBlock blue_glass_pane = get("blue_glass_pane"); public static final ItemBlock blue_mushroom = get("blue_mushroom"); + public static final ItemBlock blue_orchid = get("blue_orchid"); + public static final ItemBlock blue_wool = get("blue_wool"); public static final ItemBoat boat = get("boat"); public static final ItemAmmo bolt = get("bolt"); public static final ItemBoltgun boltgun = get("boltgun"); public static final ItemStick bone = get("bone"); + public static final ItemDye bonemeal = get("bonemeal"); public static final ItemBook book = get("book"); public static final ItemBlock bookshelf = get("bookshelf"); public static final ItemBow bow = get("bow"); @@ -116,19 +146,26 @@ public abstract class Items { public static final ItemBlock brick_block = get("brick_block"); public static final ItemSlab brick_slab = get("brick_slab"); public static final ItemBlock brick_stairs = get("brick_stairs"); + public static final ItemBlock brown_carpet = get("brown_carpet"); + public static final ItemBlock brown_clay = get("brown_clay"); + public static final ItemBlock brown_glass = get("brown_glass"); + public static final ItemBlock brown_glass_pane = get("brown_glass_pane"); public static final ItemBlock brown_mushroom = get("brown_mushroom"); public static final ItemHugeMushroom brown_mushroom_block = get("brown_mushroom_block"); + public static final ItemBlock brown_wool = get("brown_wool"); public static final ItemBucket bucket = get("bucket"); public static final ItemFlintAndSteel burning_soul = get("burning_soul"); public static final ItemBlock cactus = get("cactus"); + public static final ItemDye cactus_green = get("cactus_green"); public static final ItemSmallBlock cake = get("cake"); public static final ItemMetalBlock calcium_block = get("calcium_block"); public static final ItemMetalBlock calcium_ore = get("calcium_ore"); public static final ItemMetal calcium_powder = get("calcium_powder"); public static final ItemCamera camera = get("camera"); - public static final ItemCloth carpet = get("carpet"); public static final ItemSeedFood carrot = get("carrot"); public static final ItemCarrotOnAStick carrot_on_a_stick = get("carrot_on_a_stick"); + public static final ItemBlock carved_sandstone = get("carved_sandstone"); + public static final ItemBlock carved_stonebrick = get("carved_stonebrick"); public static final ItemSmallBlock cauldron = get("cauldron"); public static final ItemBlock cell_rock = get("cell_rock"); public static final ItemMagnetic chain = get("chain"); @@ -136,12 +173,17 @@ public abstract class Items { public static final ItemArmor chain_chestplate = get("chain_chestplate"); public static final ItemArmor chain_helmet = get("chain_helmet"); public static final ItemArmor chain_leggings = get("chain_leggings"); + public static final Item charcoal = get("charcoal"); public static final ItemEffect charge_crystal = get("charge_crystal"); public static final ItemChargedOrb charged_orb = get("charged_orb"); public static final ItemDoor cherry_door = get("cherry_door"); public static final ItemFence cherry_fence = get("cherry_fence"); public static final ItemBlock cherry_fence_gate = get("cherry_fence_gate"); - public static final ItemLeaves cherry_leaves = get("cherry_leaves"); + public static final ItemColored cherry_leaves_autumn = get("cherry_leaves_autumn"); + public static final ItemColored cherry_leaves_snowy = get("cherry_leaves_snowy"); + public static final ItemColored cherry_leaves_spring = get("cherry_leaves_spring"); + public static final ItemColored cherry_leaves_summer = get("cherry_leaves_summer"); + public static final ItemColored cherry_leaves_winter = get("cherry_leaves_winter"); public static final ItemBlock cherry_log = get("cherry_log"); public static final ItemBlock cherry_planks = get("cherry_planks"); public static final ItemBlock cherry_sapling = get("cherry_sapling"); @@ -163,9 +205,10 @@ public abstract class Items { public static final ItemArmor cloth_chestplate = get("cloth_chestplate"); public static final ItemArmor cloth_helmet = get("cloth_helmet"); public static final ItemArmor cloth_leggings = get("cloth_leggings"); - public static final ItemCoal coal = get("coal"); + public static final Item coal = get("coal"); public static final ItemBlock coal_block = get("coal_block"); public static final ItemBlock coal_ore = get("coal_ore"); + public static final ItemBlock coarse_dirt = get("coarse_dirt"); public static final ItemMetalBlock cobalt_block = get("cobalt_block"); public static final ItemMetal cobalt_ingot = get("cobalt_ingot"); public static final ItemMetalBlock cobalt_ore = get("cobalt_ore"); @@ -173,28 +216,42 @@ public abstract class Items { public static final ItemSlab cobblestone_slab = get("cobblestone_slab"); public static final ItemBlock cobblestone_stairs = get("cobblestone_stairs"); public static final ItemWall cobblestone_wall = get("cobblestone_wall"); + public static final ItemDye cocoa = get("cocoa"); public static final ItemSmallBlock comparator = get("comparator"); public static final ItemBlock construction_table = get("construction_table"); public static final ItemFood cooked_beef = get("cooked_beef"); public static final ItemFood cooked_chicken = get("cooked_chicken"); - public static final ItemFishFood cooked_fish = get("cooked_fish"); public static final ItemFood cooked_porkchop = get("cooked_porkchop"); public static final ItemFood cookie = get("cookie"); public static final ItemMetalBlock copper_block = get("copper_block"); public static final ItemMetal copper_ingot = get("copper_ingot"); public static final ItemMetalBlock copper_ore = get("copper_ore"); public static final ItemBlock core = get("core"); + public static final ItemBlock cracked_stonebrick = get("cracked_stonebrick"); + public static final ItemBlock cyan_carpet = get("cyan_carpet"); + public static final ItemBlock cyan_clay = get("cyan_clay"); + public static final ItemDye cyan_dye = get("cyan_dye"); + public static final ItemBlock cyan_glass = get("cyan_glass"); + public static final ItemBlock cyan_glass_pane = get("cyan_glass_pane"); + public static final ItemBlock cyan_wool = get("cyan_wool"); + public static final ItemBlock daisy = get("daisy"); + public static final ItemBlock dandelion = get("dandelion"); public static final ItemFlintAndSteel dark_lighter = get("dark_lighter"); public static final ItemDoor dark_oak_door = get("dark_oak_door"); public static final ItemFence dark_oak_fence = get("dark_oak_fence"); public static final ItemBlock dark_oak_fence_gate = get("dark_oak_fence_gate"); - public static final ItemLeaves dark_oak_leaves = get("dark_oak_leaves"); + public static final ItemColored dark_oak_leaves_autumn = get("dark_oak_leaves_autumn"); + public static final ItemColored dark_oak_leaves_snowy = get("dark_oak_leaves_snowy"); + public static final ItemColored dark_oak_leaves_spring = get("dark_oak_leaves_spring"); + public static final ItemColored dark_oak_leaves_summer = get("dark_oak_leaves_summer"); + public static final ItemColored dark_oak_leaves_winter = get("dark_oak_leaves_winter"); public static final ItemBlock dark_oak_log = get("dark_oak_log"); public static final ItemBlock dark_oak_planks = get("dark_oak_planks"); public static final ItemBlock dark_oak_sapling = get("dark_oak_sapling"); public static final ItemSlab dark_oak_slab = get("dark_oak_slab"); public static final ItemBlock dark_oak_stairs = get("dark_oak_stairs"); public static final ItemBlock daylight_detector = get("daylight_detector"); + public static final ItemColored dead_bush = get("dead_bush"); public static final ItemBlock deadbush = get("deadbush"); public static final ItemBlock detector_rail = get("detector_rail"); public static final Item diamond = get("diamond"); @@ -211,15 +268,25 @@ public abstract class Items { public static final ItemShears diamond_shears = get("diamond_shears"); public static final ItemShovel diamond_shovel = get("diamond_shovel"); public static final ItemSword diamond_sword = get("diamond_sword"); - public static final ItemDie die = get("die"); - public static final ItemMultiTexture dirt = get("dirt"); + public static final ItemDie die_10 = get("die_10"); + public static final ItemDie die_12 = get("die_12"); + public static final ItemDie die_20 = get("die_20"); + public static final ItemDie die_4 = get("die_4"); + public static final ItemDie die_6 = get("die_6"); + public static final ItemDie die_8 = get("die_8"); + public static final ItemBlock dirt = get("dirt"); public static final ItemDispenser dispenser = get("dispenser"); - public static final ItemDoublePlant double_plant = get("double_plant"); public static final ItemBlock dragon_egg = get("dragon_egg"); public static final ItemDispenser dropper = get("dropper"); public static final ItemBlock dry_leaves = get("dry_leaves"); - public static final ItemDye dye = get("dye"); public static final ItemDynamite dynamite = get("dynamite"); + public static final ItemDynamite dynamite_1 = get("dynamite_1"); + public static final ItemDynamite dynamite_2 = get("dynamite_2"); + public static final ItemDynamite dynamite_3 = get("dynamite_3"); + public static final ItemDynamite dynamite_4 = get("dynamite_4"); + public static final ItemDynamite dynamite_5 = get("dynamite_5"); + public static final ItemDynamite dynamite_6 = get("dynamite_6"); + public static final ItemDynamite dynamite_7 = get("dynamite_7"); public static final ItemEgg egg = get("egg"); public static final Item emerald = get("emerald"); public static final ItemBlock emerald_block = get("emerald_block"); @@ -231,10 +298,10 @@ public abstract class Items { public static final ItemBlock farmland = get("farmland"); public static final Item feather = get("feather"); public static final Item fermented_spider_eye = get("fermented_spider_eye"); + public static final ItemColored fern = get("fern"); public static final ItemFireball fire_charge = get("fire_charge"); public static final ItemFireworkCharge firework_charge = get("firework_charge"); public static final ItemFirework fireworks = get("fireworks"); - public static final ItemFishFood fish = get("fish"); public static final ItemFishingRod fishing_rod = get("fishing_rod"); public static final Item flint = get("flint"); public static final ItemFlintAndSteel flint_and_steel = get("flint_and_steel"); @@ -242,8 +309,20 @@ public abstract class Items { public static final ItemBlock floor_tiles_black = get("floor_tiles_black"); public static final ItemBlock floor_tiles_red = get("floor_tiles_red"); public static final ItemBlock floor_tiles_white = get("floor_tiles_white"); - public static final ItemMultiTexture flower = get("flower"); - public static final ItemSmallBlock flower_pot = get("flower_pot"); + public static final ItemSmallBlock flowerpot = get("flowerpot"); + public static final ItemBlock flowerpot_allium = get("flowerpot_allium"); + public static final ItemBlock flowerpot_black_lotus = get("flowerpot_black_lotus"); + public static final ItemBlock flowerpot_blue_orchid = get("flowerpot_blue_orchid"); + public static final ItemBlock flowerpot_cactus = get("flowerpot_cactus"); + public static final ItemBlock flowerpot_daisy = get("flowerpot_daisy"); + public static final ItemBlock flowerpot_dandelion = get("flowerpot_dandelion"); + public static final ItemBlock flowerpot_houstonia = get("flowerpot_houstonia"); + public static final ItemBlock flowerpot_orange_tulip = get("flowerpot_orange_tulip"); + public static final ItemBlock flowerpot_pink_tulip = get("flowerpot_pink_tulip"); + public static final ItemBlock flowerpot_poppy = get("flowerpot_poppy"); + public static final ItemBlock flowerpot_red_tulip = get("flowerpot_red_tulip"); + public static final ItemBlock flowerpot_rose = get("flowerpot_rose"); + public static final ItemBlock flowerpot_white_tulip = get("flowerpot_white_tulip"); public static final ItemBlock furnace = get("furnace"); public static final ItemTiny ghast_tear = get("ghast_tear"); public static final Item ghi_fragment = get("ghi_fragment"); @@ -268,11 +347,23 @@ public abstract class Items { public static final ItemShovel gold_shovel = get("gold_shovel"); public static final ItemSword gold_sword = get("gold_sword"); public static final ItemAppleGold golden_apple = get("golden_apple"); + public static final ItemAppleGold charged_apple = get("charged_apple"); public static final ItemFood golden_carrot = get("golden_carrot"); public static final ItemBlock golden_rail = get("golden_rail"); public static final ItemBucket goo_bucket = get("goo_bucket"); public static final ItemColored grass = get("grass"); public static final ItemBlock gravel = get("gravel"); + public static final ItemBlock gray_carpet = get("gray_carpet"); + public static final ItemBlock gray_clay = get("gray_clay"); + public static final ItemDye gray_dye = get("gray_dye"); + public static final ItemBlock gray_glass = get("gray_glass"); + public static final ItemBlock gray_glass_pane = get("gray_glass_pane"); + public static final ItemBlock gray_wool = get("gray_wool"); + public static final ItemBlock green_carpet = get("green_carpet"); + public static final ItemBlock green_clay = get("green_clay"); + public static final ItemBlock green_glass = get("green_glass"); + public static final ItemBlock green_glass_pane = get("green_glass_pane"); + public static final ItemBlock green_wool = get("green_wool"); public static final Item gunpowder = get("gunpowder"); public static final ItemAxe gyriyn_axe = get("gyriyn_axe"); public static final ItemBlock gyriyn_block = get("gyriyn_block"); @@ -286,9 +377,11 @@ public abstract class Items { public static final ItemBlock hellrock = get("hellrock"); public static final ItemBlock hopper = get("hopper"); public static final ItemMinecart hopper_minecart = get("hopper_minecart"); + public static final ItemBlock houstonia = get("houstonia"); public static final ItemBucket hydrogen_bucket = get("hydrogen_bucket"); public static final ItemBlock ice = get("ice"); public static final ItemInfoWand info_wand = get("info_wand"); + public static final ItemDye ink_sack = get("ink_sack"); public static final ItemMetalBlock iodine_block = get("iodine_block"); public static final ItemMetalBlock iodine_ore = get("iodine_ore"); public static final ItemMetal iodine_powder = get("iodine_powder"); @@ -313,7 +406,11 @@ public abstract class Items { public static final ItemDoor jungle_door = get("jungle_door"); public static final ItemFence jungle_fence = get("jungle_fence"); public static final ItemBlock jungle_fence_gate = get("jungle_fence_gate"); - public static final ItemLeaves jungle_leaves = get("jungle_leaves"); + public static final ItemColored jungle_leaves_autumn = get("jungle_leaves_autumn"); + public static final ItemColored jungle_leaves_snowy = get("jungle_leaves_snowy"); + public static final ItemColored jungle_leaves_spring = get("jungle_leaves_spring"); + public static final ItemColored jungle_leaves_summer = get("jungle_leaves_summer"); + public static final ItemColored jungle_leaves_winter = get("jungle_leaves_winter"); public static final ItemBlock jungle_log = get("jungle_log"); public static final ItemBlock jungle_planks = get("jungle_planks"); public static final ItemBlock jungle_sapling = get("jungle_sapling"); @@ -323,7 +420,10 @@ public abstract class Items { public static final ItemBlock ladder = get("ladder"); public static final ItemBlock lamp = get("lamp"); public static final ItemBlock lapis_block = get("lapis_block"); + public static final ItemDye lapis_lazuli = get("lapis_lazuli"); public static final ItemBlock lapis_ore = get("lapis_ore"); + public static final ItemDoublePlant large_fern = get("large_fern"); + public static final ItemDoublePlant large_tallgrass = get("large_tallgrass"); public static final ItemBucket lava_bucket = get("lava_bucket"); public static final ItemLead lead = get("lead"); public static final ItemMetalBlock lead_block = get("lead_block"); @@ -335,13 +435,31 @@ public abstract class Items { public static final ItemArmor leather_helmet = get("leather_helmet"); public static final ItemArmor leather_leggings = get("leather_leggings"); public static final ItemBlock lever = get("lever"); + public static final ItemBlock light_blue_carpet = get("light_blue_carpet"); + public static final ItemBlock light_blue_clay = get("light_blue_clay"); + public static final ItemDye light_blue_dye = get("light_blue_dye"); + public static final ItemBlock light_blue_glass = get("light_blue_glass"); + public static final ItemBlock light_blue_glass_pane = get("light_blue_glass_pane"); + public static final ItemBlock light_blue_wool = get("light_blue_wool"); public static final ItemPressurePlate light_weighted_pressure_plate = get("light_weighted_pressure_plate"); public static final ItemLightning lightning_wand = get("lightning_wand"); + public static final ItemBlock lime_carpet = get("lime_carpet"); + public static final ItemBlock lime_clay = get("lime_clay"); + public static final ItemDye lime_dye = get("lime_dye"); + public static final ItemBlock lime_glass = get("lime_glass"); + public static final ItemBlock lime_glass_pane = get("lime_glass_pane"); + public static final ItemBlock lime_wool = get("lime_wool"); public static final ItemBlock lit_furnace = get("lit_furnace"); public static final ItemBlock lit_pumpkin = get("lit_pumpkin"); public static final ItemMetalBlock lithium_block = get("lithium_block"); public static final ItemMetal lithium_ingot = get("lithium_ingot"); public static final ItemMetalBlock lithium_ore = get("lithium_ore"); + public static final ItemBlock magenta_carpet = get("magenta_carpet"); + public static final ItemBlock magenta_clay = get("magenta_clay"); + public static final ItemDye magenta_dye = get("magenta_dye"); + public static final ItemBlock magenta_glass = get("magenta_glass"); + public static final ItemBlock magenta_glass_pane = get("magenta_glass_pane"); + public static final ItemBlock magenta_wool = get("magenta_wool"); public static final ItemBucket magma_bucket = get("magma_bucket"); public static final Item magma_cream = get("magma_cream"); public static final ItemMetalBlock magnesium_block = get("magnesium_block"); @@ -354,7 +472,11 @@ public abstract class Items { public static final ItemDoor maple_door = get("maple_door"); public static final ItemFence maple_fence = get("maple_fence"); public static final ItemBlock maple_fence_gate = get("maple_fence_gate"); - public static final ItemLeaves maple_leaves = get("maple_leaves"); + public static final ItemColored maple_leaves_autumn = get("maple_leaves_autumn"); + public static final ItemColored maple_leaves_snowy = get("maple_leaves_snowy"); + public static final ItemColored maple_leaves_spring = get("maple_leaves_spring"); + public static final ItemColored maple_leaves_summer = get("maple_leaves_summer"); + public static final ItemColored maple_leaves_winter = get("maple_leaves_winter"); public static final ItemBlock maple_log = get("maple_log"); public static final ItemBlock maple_planks = get("maple_planks"); public static final ItemBlock maple_sapling = get("maple_sapling"); @@ -370,6 +492,8 @@ public abstract class Items { public static final ItemBlock moon_cheese = get("moon_cheese"); public static final ItemBlock moon_rock = get("moon_rock"); public static final ItemBlock mossy_cobblestone = get("mossy_cobblestone"); + public static final ItemWall mossy_cobblestone_wall = get("mossy_cobblestone_wall"); + public static final ItemBlock mossy_stonebrick = get("mossy_stonebrick"); public static final ItemSoup mushroom_stew = get("mushroom_stew"); public static final ItemBlock mycelium = get("mycelium"); public static final ItemNameTag name_tag = get("name_tag"); @@ -401,15 +525,27 @@ public abstract class Items { public static final ItemDoor oak_door = get("oak_door"); public static final ItemFence oak_fence = get("oak_fence"); public static final ItemBlock oak_fence_gate = get("oak_fence_gate"); - public static final ItemLeaves oak_leaves = get("oak_leaves"); + public static final ItemColored oak_leaves_autumn = get("oak_leaves_autumn"); + public static final ItemColored oak_leaves_snowy = get("oak_leaves_snowy"); + public static final ItemColored oak_leaves_spring = get("oak_leaves_spring"); + public static final ItemColored oak_leaves_summer = get("oak_leaves_summer"); + public static final ItemColored oak_leaves_winter = get("oak_leaves_winter"); public static final ItemBlock oak_log = get("oak_log"); public static final ItemBlock oak_planks = get("oak_planks"); public static final ItemBlock oak_sapling = get("oak_sapling"); public static final ItemSlab oak_slab = get("oak_slab"); public static final ItemBlock oak_stairs = get("oak_stairs"); public static final ItemBlock obsidian = get("obsidian"); + public static final ItemBlock orange_carpet = get("orange_carpet"); + public static final ItemBlock orange_clay = get("orange_clay"); + public static final ItemDye orange_dye = get("orange_dye"); + public static final ItemBlock orange_glass = get("orange_glass"); + public static final ItemBlock orange_glass_pane = get("orange_glass_pane"); + public static final ItemBlock orange_tulip = get("orange_tulip"); + public static final ItemBlock orange_wool = get("orange_wool"); public static final ItemFragile orb = get("orb"); public static final ItemBlock packed_ice = get("packed_ice"); + public static final ItemDoublePlant paeonia = get("paeonia"); public static final ItemMetalBlock palladium_block = get("palladium_block"); public static final ItemMetal palladium_ingot = get("palladium_ingot"); public static final ItemMetalBlock palladium_ore = get("palladium_ore"); @@ -418,6 +554,13 @@ public abstract class Items { public static final ItemMetalBlock phosphor_block = get("phosphor_block"); public static final ItemMetalBlock phosphor_ore = get("phosphor_ore"); public static final ItemMetal phosphor_powder = get("phosphor_powder"); + public static final ItemBlock pink_carpet = get("pink_carpet"); + public static final ItemBlock pink_clay = get("pink_clay"); + public static final ItemDye pink_dye = get("pink_dye"); + public static final ItemBlock pink_glass = get("pink_glass"); + public static final ItemBlock pink_glass_pane = get("pink_glass_pane"); + public static final ItemBlock pink_tulip = get("pink_tulip"); + public static final ItemBlock pink_wool = get("pink_wool"); public static final ItemPiston piston = get("piston"); public static final ItemMetalBlock platinum_block = get("platinum_block"); public static final ItemMetal platinum_ingot = get("platinum_ingot"); @@ -425,7 +568,9 @@ public abstract class Items { public static final ItemMetalBlock plutonium_block = get("plutonium_block"); public static final ItemMetal plutonium_ingot = get("plutonium_ingot"); public static final ItemMetalBlock plutonium_ore = get("plutonium_ore"); + public static final ItemBlock podzol = get("podzol"); public static final ItemFood poisonous_potato = get("poisonous_potato"); + public static final ItemBlock poppy = get("poppy"); public static final ItemFood porkchop = get("porkchop"); public static final ItemBlock portal_frame = get("portal_frame"); public static final ItemMetalBlock potassium_block = get("potassium_block"); @@ -433,6 +578,32 @@ public abstract class Items { public static final ItemMetal potassium_powder = get("potassium_powder"); public static final ItemSeedFood potato = get("potato"); public static final ItemPotion potion = get("potion"); + public static final ItemPotion potion_damage = get("potion_damage"); + public static final ItemPotion potion_damage_2 = get("potion_damage_2"); + public static final ItemPotion potion_fire_resistance_3600 = get("potion_fire_resistance_3600"); + public static final ItemPotion potion_fire_resistance_9600 = get("potion_fire_resistance_9600"); + public static final ItemPotion potion_health = get("potion_health"); + public static final ItemPotion potion_health_2 = get("potion_health_2"); + public static final ItemPotion potion_night_vision_3600 = get("potion_night_vision_3600"); + public static final ItemPotion potion_night_vision_9600 = get("potion_night_vision_9600"); + public static final ItemPotion potion_poison_2400 = get("potion_poison_2400"); + public static final ItemPotion potion_poison_2_450 = get("potion_poison_2_450"); + public static final ItemPotion potion_poison_900 = get("potion_poison_900"); + public static final ItemPotion potion_regeneration_2400 = get("potion_regeneration_2400"); + public static final ItemPotion potion_regeneration_2_450 = get("potion_regeneration_2_450"); + public static final ItemPotion potion_regeneration_900 = get("potion_regeneration_900"); + public static final ItemPotion potion_slowness_1800 = get("potion_slowness_1800"); + public static final ItemPotion potion_slowness_4800 = get("potion_slowness_4800"); + public static final ItemPotion potion_speed_2_1800 = get("potion_speed_2_1800"); + public static final ItemPotion potion_speed_3600 = get("potion_speed_3600"); + public static final ItemPotion potion_speed_9600 = get("potion_speed_9600"); + public static final ItemPotion potion_stability_3600 = get("potion_stability_3600"); + public static final ItemPotion potion_stability_9600 = get("potion_stability_9600"); + public static final ItemPotion potion_strength_2_1800 = get("potion_strength_2_1800"); + public static final ItemPotion potion_strength_3600 = get("potion_strength_3600"); + public static final ItemPotion potion_strength_9600 = get("potion_strength_9600"); + public static final ItemPotion potion_weakness_1800 = get("potion_weakness_1800"); + public static final ItemPotion potion_weakness_4800 = get("potion_weakness_4800"); public static final ItemMetalBlock praseodymium_block = get("praseodymium_block"); public static final ItemMetal praseodymium_ingot = get("praseodymium_ingot"); public static final ItemMetalBlock praseodymium_ore = get("praseodymium_ore"); @@ -440,9 +611,17 @@ public abstract class Items { public static final ItemFood pumpkin_pie = get("pumpkin_pie"); public static final ItemSeeds pumpkin_stem = get("pumpkin_stem"); public static final ItemBed purple_bed = get("purple_bed"); + public static final ItemBlock purple_carpet = get("purple_carpet"); + public static final ItemBlock purple_clay = get("purple_clay"); + public static final ItemDye purple_dye = get("purple_dye"); + public static final ItemBlock purple_glass = get("purple_glass"); + public static final ItemBlock purple_glass_pane = get("purple_glass_pane"); + public static final ItemBlock purple_wool = get("purple_wool"); public static final Item quartz = get("quartz"); - public static final ItemMultiTexture quartz_block = get("quartz_block"); + public static final ItemBlock quartz_block = get("quartz_block"); public static final ItemBlock quartz_ore = get("quartz_ore"); + public static final ItemBlock quartz_ornaments = get("quartz_ornaments"); + public static final ItemBlock quartz_pillar = get("quartz_pillar"); public static final ItemSlab quartz_slab = get("quartz_slab"); public static final ItemBlock quartz_stairs = get("quartz_stairs"); public static final ItemMetalBlock radium_block = get("radium_block"); @@ -473,11 +652,20 @@ public abstract class Items { public static final ItemBucket recursive_mercury_bucket = get("recursive_mercury_bucket"); public static final ItemBucket recursive_nukage_bucket = get("recursive_nukage_bucket"); public static final ItemBucket recursive_slime_bucket = get("recursive_slime_bucket"); + public static final ItemBucket recursive_springwater_bucket = get("recursive_springwater_bucket"); public static final ItemBucket recursive_water_bucket = get("recursive_water_bucket"); public static final ItemBed red_bed = get("red_bed"); public static final ItemButton red_button = get("red_button"); + public static final ItemBlock red_carpet = get("red_carpet"); + public static final ItemBlock red_clay = get("red_clay"); + public static final ItemDye red_dye = get("red_dye"); + public static final ItemBlock red_glass = get("red_glass"); + public static final ItemBlock red_glass_pane = get("red_glass_pane"); public static final ItemBlock red_mushroom = get("red_mushroom"); public static final ItemHugeMushroom red_mushroom_block = get("red_mushroom_block"); + public static final ItemBlock red_sand = get("red_sand"); + public static final ItemBlock red_tulip = get("red_tulip"); + public static final ItemBlock red_wool = get("red_wool"); public static final ItemRedstone redstone = get("redstone"); public static final ItemBlock redstone_block = get("redstone_block"); public static final ItemBlock redstone_lamp = get("redstone_lamp"); @@ -485,14 +673,16 @@ public abstract class Items { public static final ItemBlock redstone_torch = get("redstone_torch"); public static final ItemSmallBlock reeds = get("reeds"); public static final ItemSmallBlock repeater = get("repeater"); - public static final ItemMultiTexture rock = get("rock"); + public static final ItemBlock rock = get("rock"); + public static final ItemBlock rose = get("rose"); + public static final ItemDoublePlant rose_bush = get("rose_bush"); public static final ItemFood rotten_flesh = get("rotten_flesh"); public static final Item ruby = get("ruby"); public static final ItemBlock ruby_block = get("ruby_block"); public static final ItemBlock ruby_ore = get("ruby_ore"); public static final ItemSaddle saddle = get("saddle"); - public static final ItemMultiTexture sand = get("sand"); - public static final ItemMultiTexture sandstone = get("sandstone"); + public static final ItemBlock sand = get("sand"); + public static final ItemBlock sandstone = get("sandstone"); public static final ItemSlab sandstone_slab = get("sandstone_slab"); public static final ItemBlock sandstone_stairs = get("sandstone_stairs"); public static final ItemMetalBlock selenium_block = get("selenium_block"); @@ -503,12 +693,20 @@ public abstract class Items { public static final ItemMetal silicon_ingot = get("silicon_ingot"); public static final ItemMetalBlock silicon_ore = get("silicon_ore"); public static final ItemMetalBlock silver_block = get("silver_block"); + public static final ItemBlock silver_carpet = get("silver_carpet"); + public static final ItemBlock silver_clay = get("silver_clay"); + public static final ItemDye silver_dye = get("silver_dye"); + public static final ItemBlock silver_glass = get("silver_glass"); + public static final ItemBlock silver_glass_pane = get("silver_glass_pane"); public static final ItemMetal silver_ingot = get("silver_ingot"); public static final ItemMetalBlock silver_ore = get("silver_ore"); + public static final ItemBlock silver_wool = get("silver_wool"); public static final ItemSmallBlock skull = get("skull"); public static final Item slime_ball = get("slime_ball"); public static final ItemBlock slime_block = get("slime_block"); public static final ItemBucket slime_bucket = get("slime_bucket"); + public static final ItemBlock smooth_rock = get("smooth_rock"); + public static final ItemBlock smooth_sandstone = get("smooth_sandstone"); public static final ItemBlock snow = get("snow"); public static final ItemSnow snow_layer = get("snow_layer"); public static final ItemSnowball snowball = get("snowball"); @@ -519,19 +717,48 @@ public abstract class Items { public static final ItemSeeds soul_wart = get("soul_wart"); public static final Item speckled_melon = get("speckled_melon"); public static final ItemFood spider_eye = get("spider_eye"); + public static final ItemPotion splash_potion = get("splash_potion"); + public static final ItemPotion splash_potion_damage = get("splash_potion_damage"); + public static final ItemPotion splash_potion_damage_2 = get("splash_potion_damage_2"); + public static final ItemPotion splash_potion_fire_resistance_2701 = get("splash_potion_fire_resistance_2701"); + public static final ItemPotion splash_potion_fire_resistance_7201 = get("splash_potion_fire_resistance_7201"); + public static final ItemPotion splash_potion_health = get("splash_potion_health"); + public static final ItemPotion splash_potion_health_2 = get("splash_potion_health_2"); + public static final ItemPotion splash_potion_night_vision_2701 = get("splash_potion_night_vision_2701"); + public static final ItemPotion splash_potion_night_vision_7201 = get("splash_potion_night_vision_7201"); + public static final ItemPotion splash_potion_poison_1801 = get("splash_potion_poison_1801"); + public static final ItemPotion splash_potion_poison_2_338 = get("splash_potion_poison_2_338"); + public static final ItemPotion splash_potion_poison_676 = get("splash_potion_poison_676"); + public static final ItemPotion splash_potion_regeneration_1801 = get("splash_potion_regeneration_1801"); + public static final ItemPotion splash_potion_regeneration_2_338 = get("splash_potion_regeneration_2_338"); + public static final ItemPotion splash_potion_regeneration_676 = get("splash_potion_regeneration_676"); + public static final ItemPotion splash_potion_slowness_1351 = get("splash_potion_slowness_1351"); + public static final ItemPotion splash_potion_slowness_3601 = get("splash_potion_slowness_3601"); + public static final ItemPotion splash_potion_speed_2701 = get("splash_potion_speed_2701"); + public static final ItemPotion splash_potion_speed_2_1351 = get("splash_potion_speed_2_1351"); + public static final ItemPotion splash_potion_speed_7201 = get("splash_potion_speed_7201"); + public static final ItemPotion splash_potion_stability_2701 = get("splash_potion_stability_2701"); + public static final ItemPotion splash_potion_stability_7201 = get("splash_potion_stability_7201"); + public static final ItemPotion splash_potion_strength_2701 = get("splash_potion_strength_2701"); + public static final ItemPotion splash_potion_strength_2_1351 = get("splash_potion_strength_2_1351"); + public static final ItemPotion splash_potion_strength_7201 = get("splash_potion_strength_7201"); + public static final ItemPotion splash_potion_weakness_1351 = get("splash_potion_weakness_1351"); + public static final ItemPotion splash_potion_weakness_3601 = get("splash_potion_weakness_3601"); public static final ItemBlock sponge = get("sponge"); + public static final ItemBucket springwater_bucket = get("springwater_bucket"); public static final ItemDoor spruce_door = get("spruce_door"); public static final ItemFence spruce_fence = get("spruce_fence"); public static final ItemBlock spruce_fence_gate = get("spruce_fence_gate"); - public static final ItemLeaves spruce_leaves = get("spruce_leaves"); + public static final ItemColored spruce_leaves_autumn = get("spruce_leaves_autumn"); + public static final ItemColored spruce_leaves_snowy = get("spruce_leaves_snowy"); + public static final ItemColored spruce_leaves_spring = get("spruce_leaves_spring"); + public static final ItemColored spruce_leaves_summer = get("spruce_leaves_summer"); + public static final ItemColored spruce_leaves_winter = get("spruce_leaves_winter"); public static final ItemBlock spruce_log = get("spruce_log"); public static final ItemBlock spruce_planks = get("spruce_planks"); public static final ItemBlock spruce_sapling = get("spruce_sapling"); public static final ItemSlab spruce_slab = get("spruce_slab"); public static final ItemBlock spruce_stairs = get("spruce_stairs"); - public static final ItemCloth stained_glass = get("stained_glass"); - public static final ItemCloth stained_glass_pane = get("stained_glass_pane"); - public static final ItemCloth stained_hardened_clay = get("stained_hardened_clay"); public static final ItemStick stick = get("stick"); public static final ItemPiston sticky_piston = get("sticky_piston"); public static final ItemBlock stone = get("stone"); @@ -544,7 +771,7 @@ public abstract class Items { public static final ItemSlab stone_slab = get("stone_slab"); public static final ItemBlock stone_stairs = get("stone_stairs"); public static final ItemSword stone_sword = get("stone_sword"); - public static final ItemMultiTexture stonebrick = get("stonebrick"); + public static final ItemBlock stonebrick = get("stonebrick"); public static final ItemSlab stonebrick_slab = get("stonebrick_slab"); public static final ItemBlock stonebrick_stairs = get("stonebrick_stairs"); public static final ItemSmallBlock string = get("string"); @@ -552,6 +779,8 @@ public abstract class Items { public static final ItemMetalBlock sulfur_block = get("sulfur_block"); public static final ItemMetalBlock sulfur_ore = get("sulfur_ore"); public static final ItemMetal sulfur_powder = get("sulfur_powder"); + public static final ItemDoublePlant sunflower = get("sunflower"); + public static final ItemDoublePlant syringa = get("syringa"); public static final ItemColored tallgrass = get("tallgrass"); public static final ItemAxe thetium_axe = get("thetium_axe"); public static final ItemBlock thetium_block = get("thetium_block"); @@ -569,7 +798,11 @@ public abstract class Items { public static final ItemDoor tian_door = get("tian_door"); public static final ItemFence tian_fence = get("tian_fence"); public static final ItemBlock tian_fence_gate = get("tian_fence_gate"); - public static final ItemLeaves tian_leaves = get("tian_leaves"); + public static final ItemColored tian_leaves_autumn = get("tian_leaves_autumn"); + public static final ItemColored tian_leaves_snowy = get("tian_leaves_snowy"); + public static final ItemColored tian_leaves_spring = get("tian_leaves_spring"); + public static final ItemColored tian_leaves_summer = get("tian_leaves_summer"); + public static final ItemColored tian_leaves_winter = get("tian_leaves_winter"); public static final ItemBlock tian_log = get("tian_log"); public static final ItemBlock tian_planks = get("tian_planks"); public static final ItemBlock tian_reactor = get("tian_reactor"); @@ -583,7 +816,14 @@ public abstract class Items { public static final ItemMetalBlock titanium_block = get("titanium_block"); public static final ItemMetal titanium_ingot = get("titanium_ingot"); public static final ItemMetalBlock titanium_ore = get("titanium_ore"); - public static final ItemTNT tnt = get("tnt"); + public static final ItemBlock tnt = get("tnt"); + public static final ItemBlock tnt_1 = get("tnt_1"); + public static final ItemBlock tnt_2 = get("tnt_2"); + public static final ItemBlock tnt_3 = get("tnt_3"); + public static final ItemBlock tnt_4 = get("tnt_4"); + public static final ItemBlock tnt_5 = get("tnt_5"); + public static final ItemBlock tnt_6 = get("tnt_6"); + public static final ItemBlock tnt_7 = get("tnt_7"); public static final ItemMinecart tnt_minecart = get("tnt_minecart"); public static final ItemBlock torch = get("torch"); public static final ItemBlock trapdoor = get("trapdoor"); @@ -624,6 +864,12 @@ public abstract class Items { public static final ItemSeeds wheat = get("wheat"); public static final Item wheats = get("wheats"); public static final ItemBed white_bed = get("white_bed"); + public static final ItemBlock white_carpet = get("white_carpet"); + public static final ItemBlock white_clay = get("white_clay"); + public static final ItemBlock white_glass = get("white_glass"); + public static final ItemBlock white_glass_pane = get("white_glass_pane"); + public static final ItemBlock white_tulip = get("white_tulip"); + public static final ItemBlock white_wool = get("white_wool"); public static final ItemAxe wood_axe = get("wood_axe"); public static final ItemHoe wood_hoe = get("wood_hoe"); public static final ItemPickaxe wood_pickaxe = get("wood_pickaxe"); @@ -631,15 +877,24 @@ public abstract class Items { public static final ItemSword wood_sword = get("wood_sword"); public static final ItemButton wooden_button = get("wooden_button"); public static final ItemPressurePlate wooden_pressure_plate = get("wooden_pressure_plate"); - public static final ItemCloth wool = get("wool"); public static final ItemBlock workbench = get("workbench"); public static final Item writable_book = get("writable_book"); public static final Item written_book = get("written_book"); + public static final ItemBlock yellow_carpet = get("yellow_carpet"); + public static final ItemBlock yellow_clay = get("yellow_clay"); + public static final ItemDye yellow_dye = get("yellow_dye"); + public static final ItemBlock yellow_glass = get("yellow_glass"); + public static final ItemBlock yellow_glass_pane = get("yellow_glass_pane"); + public static final ItemBlock yellow_wool = get("yellow_wool"); public static final ItemMetalBlock zinc_block = get("zinc_block"); public static final ItemMetal zinc_ingot = get("zinc_ingot"); public static final ItemMetalBlock zinc_ore = get("zinc_ore"); - public static final ItemBucket recursive_springwater_bucket = get("recursive_springwater_bucket"); - public static final ItemBucket springwater_bucket = get("springwater_bucket"); + public static final ItemFishFood cod = get("cod"); + public static final ItemFishFood cooked_cod = get("cooked_cod"); + public static final ItemFishFood salmon = get("salmon"); + public static final ItemFishFood cooked_salmon = get("cooked_salmon"); + public static final ItemFishFood clownfish = get("clownfish"); + public static final ItemFishFood pufferfish = get("pufferfish"); private static T get(String id) { if(!ItemRegistry.REGISTRY.containsKey(id)) diff --git a/common/src/main/java/common/init/SmeltingRegistry.java b/common/src/main/java/common/init/SmeltingRegistry.java index 4a316bc7..7da3b400 100755 --- a/common/src/main/java/common/init/SmeltingRegistry.java +++ b/common/src/main/java/common/init/SmeltingRegistry.java @@ -4,7 +4,6 @@ import java.util.Map; import java.util.Map.Entry; import common.block.Block; -import common.block.artificial.BlockStoneBrick; import common.collect.Maps; import common.color.DyeColor; import common.item.Item; @@ -20,40 +19,35 @@ public abstract class SmeltingRegistry private static boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { - return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata()); + return stack2.getItem() == stack1.getItem(); } static void register() { -// add(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); -// add(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); -// add(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); add(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); + add(Blocks.red_sand, new ItemStack(Blocks.glass), 0.1F); add(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); add(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); add(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); -// addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F); -// addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F); add(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); - add(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 0.1F); + add(Blocks.stonebrick, new ItemStack(Blocks.cracked_stonebrick), 0.1F); add(Items.clay_ball, new ItemStack(Items.brick), 0.3F); add(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F); - add(Blocks.cactus, new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage()), 0.2F); + add(Blocks.cactus, new ItemStack(Items.cactus_green), 0.2F); add(Items.potato, new ItemStack(Items.baked_potato), 0.35F); add(Blocks.hellrock, new ItemStack(Items.bloodbrick), 0.1F); -// add(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F); - for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) + for (ItemFishFood.FishType fish : ItemFishFood.FishType.values()) { - if (itemfishfood$fishtype.canCook()) + if (fish.canCook()) { - add(new ItemStack(Items.fish, 1, itemfishfood$fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, itemfishfood$fishtype.getMetadata()), 0.35F); + add(ItemRegistry.getRegisteredItem(fish.getName()), new ItemStack(ItemRegistry.getRegisteredItem("cooked_" + fish.getName())), 0.35F); } } add(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F); add(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F); - add(Blocks.lapis_ore, new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), 0.2F); + add(Blocks.lapis_ore, new ItemStack(Items.lapis_lazuli), 0.2F); add(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); add(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); @@ -66,8 +60,7 @@ public abstract class SmeltingRegistry add(BlockRegistry.getRegisteredBlock(metal.name + "_ore"), new ItemStack(item), 0.7F); } for(WoodType wood : WoodType.values()) { - add(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), new ItemStack(Items.coal, 1, 1), 0.15F); -// add(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); + add(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), new ItemStack(Items.charcoal), 0.15F); } } @@ -78,7 +71,7 @@ public abstract class SmeltingRegistry private static void add(Item input, ItemStack stack, float experience) { - add(new ItemStack(input, 1, 32767), stack, experience); + add(new ItemStack(input), stack, experience); } private static void add(ItemStack input, ItemStack stack, float experience) diff --git a/common/src/main/java/common/init/TradeRegistry.java b/common/src/main/java/common/init/TradeRegistry.java index c9d13561..9d1ffefa 100755 --- a/common/src/main/java/common/init/TradeRegistry.java +++ b/common/src/main/java/common/init/TradeRegistry.java @@ -28,43 +28,15 @@ public abstract class TradeRegistry { new ItemForGem(Items.cake, new PriceInfo(1, 1)), new GemForItem(Items.string, new PriceInfo(15, 20)), new GemForItem(Items.coal, new PriceInfo(16, 24)), - new ItemForGemItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, - new PriceInfo(6, 6)), + new ItemForGemItem(Items.cod, new PriceInfo(6, 6), Items.cooked_cod, new PriceInfo(6, 6)), new EnchForGem(Items.fishing_rod, new PriceInfo(7, 8)), - new GemForItem(ItemRegistry.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)), + new GemForItem(Items.white_wool, new PriceInfo(16, 22)), new ItemForGem(Items.iron_shears, new PriceInfo(3, 4)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 0), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 1), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 2), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 3), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 4), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 5), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 6), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 7), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 8), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 9), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 10), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 11), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 12), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 13), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 14), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 15), - new PriceInfo(1, 2)), + new ItemForGem(Items.white_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.black_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.brown_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.gray_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.silver_wool, new PriceInfo(1, 2)), new GemForItem(Items.string, new PriceInfo(15, 20)), new ItemForGem(Items.arrow, new PriceInfo(-12, -8)), new ItemForGem(Items.bow, new PriceInfo(2, 3)), @@ -77,7 +49,6 @@ public abstract class TradeRegistry { new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4)), new GemForItem(Items.written_book, new PriceInfo(2, 2)), -// new ItemForGem(Items.clock, new PriceInfo(10, 12)), new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3)), new BookForGem(), @@ -86,11 +57,9 @@ public abstract class TradeRegistry { new GemForItem(Items.rotten_flesh, new PriceInfo(36, 40)), new GemForItem(Items.gold_ingot, new PriceInfo(8, 10)), new ItemForGem(Items.redstone, new PriceInfo(-4, -1)), - new ItemForGem(new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), - new PriceInfo(-2, -1)), + new ItemForGem(Items.ink_sack, new PriceInfo(-2, -1)), new ItemForGem(Items.charged_orb, new PriceInfo(7, 11)), - new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.glowstone), - new PriceInfo(-3, -1)), + new ItemForGem(Items.glowstone, new PriceInfo(-3, -1)), new ItemForGem(Items.experience_bottle, new PriceInfo(3, 11)), new GemForItem(Items.coal, new PriceInfo(16, 24)), new ItemForGem(Items.iron_helmet, new PriceInfo(4, 6)), @@ -142,7 +111,7 @@ public abstract class TradeRegistry { i = this.price.getPrice(random); } - recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i, 0), Items.emerald)); + recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i), Items.emerald)); } } @@ -172,8 +141,8 @@ public abstract class TradeRegistry { j = this.field_179408_d.getPrice(random); } - recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i, this.buyingItemStack.getMetadata()), - new ItemStack(Items.emerald), new ItemStack(this.sellingItemstack.getItem(), j, this.sellingItemstack.getMetadata()))); + recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i), + new ItemStack(Items.emerald), new ItemStack(this.sellingItemstack.getItem(), j))); } } @@ -208,8 +177,8 @@ public abstract class TradeRegistry { i = this.priceInfo.getPrice(random); } - ItemStack itemstack = new ItemStack(Items.emerald, i, 0); - ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem(), 1, this.enchantedItemStack.getMetadata()); + ItemStack itemstack = new ItemStack(Items.emerald, i); + ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem()); itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, random.range(5, 19)); recipeList.add(new MerchantRecipe(itemstack, itemstack1)); } @@ -240,12 +209,12 @@ public abstract class TradeRegistry { ItemStack itemstack1; if(i < 0) { - itemstack = new ItemStack(Items.emerald, 1, 0); - itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i, this.itemToBuy.getMetadata()); + itemstack = new ItemStack(Items.emerald); + itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i); } else { - itemstack = new ItemStack(Items.emerald, i, 0); - itemstack1 = new ItemStack(this.itemToBuy.getItem(), 1, this.itemToBuy.getMetadata()); + itemstack = new ItemStack(Items.emerald, i); + itemstack1 = new ItemStack(this.itemToBuy.getItem()); } recipeList.add(new MerchantRecipe(itemstack, itemstack1)); diff --git a/common/src/main/java/common/init/UniverseRegistry.java b/common/src/main/java/common/init/UniverseRegistry.java index 3c894bea..2d7cff48 100755 --- a/common/src/main/java/common/init/UniverseRegistry.java +++ b/common/src/main/java/common/init/UniverseRegistry.java @@ -5,9 +5,8 @@ import java.util.Map; import java.util.Map.Entry; import common.biome.Biome; -import common.block.BlockColored; +import common.block.artificial.BlockWool; import common.block.foliage.LeavesType; -import common.block.natural.BlockSand; import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; @@ -557,7 +556,7 @@ public abstract class UniverseRegistry { .setPerlinGen(Blocks.sand.getState(), Blocks.air.getState(), 63) .setTimeQualifier(1), "sol"); registerDimension("Mars", new Planet(6, "mars", 0xd6905b, 0xbd723a, 0xbd9273, 16487781L, 24623L, 3.71f, 208.0f) - .setPerlinGen(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND), + .setPerlinGen(Blocks.red_sand.getState(), Blocks.air.getState(), 63).setTimeQualifier(1), "sol"); registerDimension("Jupiter", new Planet(7, "jupiter", 0xffd5ba, 0xb89f90, 0xc7b5a9, 103989391L, 9925L, 24.79f, 163.0f).enableDenseFog() .setFlatGen(Blocks.hydrogen.getState(), 256).setTimeQualifier(1).setCloudHeight(576.0f), "sol"); @@ -615,7 +614,7 @@ public abstract class UniverseRegistry { .enableMobs().enableSnow().setWeather(Weather.SNOW), "transylvania"); registerDimension("'WĂ¼stenplanet Me'sar'", new Planet(104, "mesar", 0xff7f3f, 0xff6022, 0xff6f00, 56643366L, 87340L, 11.0f, 333.15f) .setTimeQualifier(5).setPerlinGen(Blocks.rock.getState(), Blocks.air.getState(), 63) - .setBiomeReplacer(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND)) + .setBiomeReplacer(Blocks.red_sand.getState()) .setBiomeGen(Biome.MESA, true, 3, 1000, 100000, 100000) .enableCavesRavines(Blocks.lava.getState()).enableMobs() .addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true) @@ -656,7 +655,7 @@ public abstract class UniverseRegistry { .addLiquid(Blocks.flowing_springwater.getState(), 50, 8, 255, false), "tianxin"); registerDimension("Cyberspace", new Area(-3, "cyberspace", 0x000000, 0x000000, 293.15f, 15) - .setFlatGen(Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.GREEN), 2) + .setFlatGen(Blocks.green_clay.getState(), 2) .enableMobs()); registerDomain("Hölle", "hell"); diff --git a/common/src/main/java/common/inventory/Container.java b/common/src/main/java/common/inventory/Container.java index 59197f1e..c1c0cbe8 100755 --- a/common/src/main/java/common/inventory/Container.java +++ b/common/src/main/java/common/inventory/Container.java @@ -327,7 +327,7 @@ public abstract class Container } else if (slot7.isItemValid(itemstack10)) { - if (itemstack9.getItem() == itemstack10.getItem() && itemstack9.getMetadata() == itemstack10.getMetadata() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) + if (itemstack9.getItem() == itemstack10.getItem() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) { int i2 = clickedButton == 0 ? itemstack10.size : 1; @@ -356,7 +356,7 @@ public abstract class Container inventoryplayer.setItemStack(itemstack9); } } - else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && (!itemstack9.getHasSubtypes() || itemstack9.getMetadata() == itemstack10.getMetadata()) && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) + else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) { int l1 = itemstack9.size; @@ -603,7 +603,7 @@ public abstract class Container Slot slot = (Slot)this.inventorySlots.get(i); ItemStack itemstack = slot.getStack(); - if (itemstack != null && itemstack.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getMetadata() == itemstack.getMetadata()) && ItemStack.areItemStackTagsEqual(stack, itemstack)) + if (itemstack != null && itemstack.getItem() == stack.getItem() && ItemStack.areItemStackTagsEqual(stack, itemstack)) { int j = itemstack.size + stack.size; diff --git a/common/src/main/java/common/inventory/ContainerEnchantment.java b/common/src/main/java/common/inventory/ContainerEnchantment.java index 32e26deb..18d70ff4 100755 --- a/common/src/main/java/common/inventory/ContainerEnchantment.java +++ b/common/src/main/java/common/inventory/ContainerEnchantment.java @@ -332,7 +332,7 @@ public class ContainerEnchantment extends Container } else if (itemstack1.size >= 1) { - ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata())); + ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem())); --itemstack1.size; } } diff --git a/common/src/main/java/common/inventory/ContainerRepair.java b/common/src/main/java/common/inventory/ContainerRepair.java index 522df450..06b6adf2 100755 --- a/common/src/main/java/common/inventory/ContainerRepair.java +++ b/common/src/main/java/common/inventory/ContainerRepair.java @@ -7,6 +7,7 @@ import common.block.tech.BlockAnvil; import common.enchantment.Enchantment; import common.enchantment.EnchantmentHelper; import common.entity.npc.EntityNPC; +import common.init.BlockRegistry; import common.init.Blocks; import common.init.Items; import common.item.ItemStack; @@ -100,19 +101,19 @@ public class ContainerRepair extends Container ContainerRepair.this.maximumCost = 0; State iblockstate = worldIn.getState(blockPosIn); - if (/* !playerIn.creative && */ !worldIn.client && Vars.anvilRepairDecay && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().floatv() < 0.12F) + if (/* !playerIn.creative && */ !worldIn.client && Vars.anvilRepairDecay && iblockstate.getBlock() instanceof BlockAnvil anvil && playerIn.getRNG().floatv() < 0.12F) { - int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); + int l = anvil.getAnvilDamage(); ++l; - if (l > 2) + if (l >= BlockAnvil.ANVILS.length) { worldIn.setBlockToAir(blockPosIn); worldIn.playAuxSFX(1020, blockPosIn, 0); } else { - worldIn.setState(blockPosIn, iblockstate.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(l)), 2); + worldIn.setState(blockPosIn, BlockAnvil.getByDamage(l).getState().withProperty(BlockAnvil.FACING, iblockstate.getValue(BlockAnvil.FACING)), 2); worldIn.playAuxSFX(1021, blockPosIn, 0); } } @@ -231,7 +232,7 @@ public class ContainerRepair extends Container damage = 0; } - if (damage < newStack.getMetadata()) + if (damage < newStack.getItemDamage()) { newStack.setItemDamage(damage); totalCost += 2; diff --git a/common/src/main/java/common/inventory/InventoryHelper.java b/common/src/main/java/common/inventory/InventoryHelper.java index 97dbb15e..8eb86cb0 100755 --- a/common/src/main/java/common/inventory/InventoryHelper.java +++ b/common/src/main/java/common/inventory/InventoryHelper.java @@ -50,7 +50,7 @@ public class InventoryHelper } stack.size -= i; - EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i, stack.getMetadata())); + EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i)); if (stack.hasTagCompound()) { diff --git a/common/src/main/java/common/inventory/InventoryPlayer.java b/common/src/main/java/common/inventory/InventoryPlayer.java index 8802577e..1d8515a8 100755 --- a/common/src/main/java/common/inventory/InventoryPlayer.java +++ b/common/src/main/java/common/inventory/InventoryPlayer.java @@ -65,19 +65,6 @@ public class InventoryPlayer implements IInventory return -1; } - private int getInventorySlotContainItemAndDamage(Item itemIn, int metadataIn) - { - for (int i = 0; i < this.mainInventory.length; ++i) - { - if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemIn && this.mainInventory[i].getMetadata() == metadataIn) - { - return i; - } - } - - return -1; - } - /** * stores an itemstack in the users inventory */ @@ -85,7 +72,7 @@ public class InventoryPlayer implements IInventory { for (int i = 0; i < this.mainInventory.length; ++i) { - if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].size < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].size < this.getInventoryStackLimit() && (!this.mainInventory[i].getHasSubtypes() || this.mainInventory[i].getMetadata() == itemStackIn.getMetadata()) && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn)) + if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].size < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].size < this.getInventoryStackLimit() && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn)) { return i; } @@ -110,10 +97,10 @@ public class InventoryPlayer implements IInventory return -1; } - public boolean setCurrentItem(Item itemIn, int metadataIn, boolean isMetaSpecific) // , boolean p_146030_4_) + public boolean setCurrentItem(Item itemIn) // , boolean p_146030_4_) { // ItemStack itemstack = this.getCurrentItem(); - int i = isMetaSpecific ? this.getInventorySlotContainItemAndDamage(itemIn, metadataIn) : this.getInventorySlotContainItem(itemIn); + int i = this.getInventorySlotContainItem(itemIn); if (i >= 0 && i < 9) { @@ -212,7 +199,7 @@ public class InventoryPlayer implements IInventory { if (this.mainInventory[j] == null) { - this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); + this.mainInventory[j] = new ItemStack(item, 0); if (itemStackIn.hasTagCompound()) { diff --git a/common/src/main/java/common/item/CheatTab.java b/common/src/main/java/common/item/CheatTab.java index b92c840b..b7be4c1a 100755 --- a/common/src/main/java/common/item/CheatTab.java +++ b/common/src/main/java/common/item/CheatTab.java @@ -24,7 +24,7 @@ public enum CheatTab { }, PLANTS("Pflanzen") { protected Item getIconItem() { - return ItemRegistry.getItemFromBlock(Blocks.oak_leaves); + return ItemRegistry.getItemFromBlock(Blocks.oak_leaves_spring); } }, DECORATION("Dekoration") { diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index daa6b611..9f82916b 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -15,8 +15,6 @@ import common.model.ItemMeshDefinition; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.rng.Random; -import common.tags.TagObject; import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; @@ -26,35 +24,25 @@ import common.world.World; public class Item { - protected static final Random itemRand = new Random(); - - protected int maxStackSize = 64; - private int maxDamage; - protected boolean hasSubtypes; + private int maxAmount = 64; + private int maxDamage = 0; private Item containerItem; private String potionEffect; private String display; - private CheatTab tabToDisplayOn; + private CheatTab tab; private TextColor color = null; - public Item setMaxStackSize(int maxStackSize) + public final Item setMaxAmount(int max) { - this.maxStackSize = maxStackSize; + this.maxAmount = max; + this.maxDamage = 0; return this; } - public Item setHasSubtypes(boolean hasSubtypes) + public final Item setMaxDamage(int max) { - this.hasSubtypes = hasSubtypes; - return this; - } - - /** - * set max damage of an Item - */ - public Item setMaxDamage(int maxDamageIn) - { - this.maxDamage = maxDamageIn; + this.maxAmount = 1; + this.maxDamage = max; return this; } @@ -64,27 +52,21 @@ public class Item return this; } - public Item setContainerItem(Item containerItem) + public final Item setContainerItem(Item containerItem) { this.containerItem = containerItem; return this; } - /** - * Sets the string representing this item's effect on a potion when used as an ingredient. - */ - public Item setPotionEffect(String potionEffect) + public final Item setPotionEffect(String potionEffect) { this.potionEffect = potionEffect; return this; } - /** - * returns this; - */ - public Item setTab(CheatTab tab) + public final Item setTab(CheatTab tab) { - this.tabToDisplayOn = tab; + this.tab = tab; return this; } @@ -93,7 +75,22 @@ public class Item this.color = color; return this; } - + + + public final int getItemStackLimit() + { + return this.maxAmount; + } + + public final int getMaxDamage() + { + return this.maxDamage; + } + + public final boolean isDamageable() + { + return this.maxDamage > 0; + } public Block getBlock() @@ -101,17 +98,6 @@ public class Item return null; } - /** - * Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data - */ - public boolean updateItemStackNBT(TagObject nbt) - { - return false; - } - - /** - * Called when a Block is right-clicked with this Item - */ public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { return false; @@ -126,105 +112,41 @@ public class Item return 1.0F; } - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) { return itemStackIn; } - /** - * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using - * the Item before the action is complete. - */ public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) { return stack; } - /** - * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?* - */ - public int getItemStackLimit() - { - return this.maxStackSize; - } - - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) + public int getMetadata() { return 0; } - public boolean getHasSubtypes() - { - return this.hasSubtypes; - } - - /** - * Returns the maximum damage an item can take. - */ - public int getMaxDamage() - { - return this.maxDamage; - } - - public boolean isDamageable() - { - return this.maxDamage > 0 && !this.hasSubtypes; - } - - /** - * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise - * the damage on the stack. - */ public boolean hitEntity(ItemStack stack, EntityLiving target, EntityLiving attacker) { return false; } - /** - * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic. - */ public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn) { return false; } - /** - * Check whether this Item can harvest the given Block - */ public boolean canHarvestBlock(Block blockIn) { return false; } - /** - * Returns true if the item can be used on the given entity, e.g. shears on sheep. - */ public boolean itemInteractionForEntity(ItemStack stack, EntityNPC playerIn, EntityLiving target) { return false; } -// public String getUnlocalizedNameInefficiently(ItemStack stack) -// { -// String s = this.getUnlocalizedName(stack); -// return s == null ? "" : s; // I18n.translate(s); -// } - -// /** -// * Returns the unlocalized name of this item. -// */ -// public String getUnlocalizedName() -// { -// return "item." + this.unlocalizedName; -// } - public String getDisplay(ItemStack stack) { return this.display; @@ -235,9 +157,6 @@ public class Item return this.containerItem; } - /** - * True if this Item has a container item (a.k.a. crafting result) - */ public boolean hasContainerItem() { return this.containerItem != null; @@ -248,24 +167,6 @@ public class Item return 16777215; } -// /** -// * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and -// * update it's contents. -// */ -// public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) -// { -// } -// -// /** -// * Called when item is crafted/smelted. Used only by maps so far. -// */ -// public void onCreated(ItemStack stack, World worldIn, EntityNPC playerIn) -// { -// } - - /** - * returns the action that specifies what animation to play when the items is being used - */ public ItemAction getItemUseAction(ItemStack stack) { return ItemAction.NONE; @@ -276,17 +177,11 @@ public class Item return ItemAction.NONE; } - /** - * How long it takes to use or consume an item - */ public int getMaxItemUseDuration(ItemStack stack) { return 0; } - /** - * Called when the player stops using an Item (stops holding the right mouse button). - */ public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityNPC playerIn, int timeLeft) { } @@ -301,18 +196,10 @@ public class Item return this.getPotionEffect(stack) != null; } - /** - * allows items to add custom lines of information to the mouseover description - */ public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { } -// public String getItemStackDisplayName(ItemStack stack) -// { -// return this.getUnlocalizedName(stack); -// } - public boolean hasEffect(ItemStack stack) { return stack.isItemEnchanted(); @@ -323,9 +210,6 @@ public class Item return this.color != null ? this.color : (stack.isItemEnchanted() ? TextColor.NEON : TextColor.WHITE); } - /** - * Checks isDamagable and if it cannot be stacked - */ public boolean isItemTool(ItemStack stack) { return this.getItemStackLimit() == 1 && this.isDamageable(); @@ -350,38 +234,21 @@ public class Item return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } - /** - * Return the enchantability factor of the item, most of the time is based on material. - */ public int getItemEnchantability() { return 0; } - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ public void getSubItems(Item itemIn, CheatTab tab, List subItems) { - subItems.add(new ItemStack(itemIn, 1, 0)); + subItems.add(new ItemStack(itemIn)); } - /** - * gets the tab this item is displayed on - */ public CheatTab getTab() { - return this.tabToDisplayOn; + return this.tab; } -// public boolean canItemEditBlocks() -// { -// return false; -// } - - /** - * Return whether this item is repairable in an anvil. - */ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return false; @@ -395,235 +262,13 @@ public class Item { } -// public boolean canBeDyed() { -// return false; -// } - public boolean isFragile() { return false; } -// public boolean isValidMeta(int meta) { -// return true; // meta == 0; -// } -// -// public int getDefaultMeta() { -// return 0; -// } - public final Set getValidTags() { return Sets.newHashSet(); } - -// private static final Set VALID_TAGS = Sets.newHashSet("Name", "ench", "RepairCost"); - - protected final boolean validateNbt(TagObject tag) { - return true; - } - -// private final boolean isValidNbt(ItemStack stack) { -// if(!stack.hasTagCompound()) { -// return true; -// } -// NBTTagCompound tag = stack.getTagCompound(); -// if(tag.hasNoTags()) { -// return false; -// } -// Set keys = tag.getKeySet(); -// int z = keys.size(); -// boolean validate = false; -// if(z > 0) { -// for(String v : VALID_TAGS) { -// if(keys.contains(v)) { -// z--; -// if(z == 0) { -// break; -// } -// } -// } -// } -//// if(adv && z > 0) { -////// for(String v : ADV_TAGS) { -//// if(keys.contains("Unbreakable")) { -//// z--; -////// if(z == 0) { -////// break; -////// } -//// } -////// } -//// } -// if(z > 0) { -// for(String v : this.getValidTags()) { -// if(keys.contains(v)) { -// validate = true; -// z--; -// if(z == 0) { -// break; -// } -// } -// } -// } -// if(z > 0) { -// return false; -// } -//// if(tag.hasKey("display")) { -//// if(!tag.hasTag("display")) { -//// return false; -//// } -//// NBTTagCompound display = tag.getCompoundTag("display"); -//// keys = display.getKeySet(); -//// z = keys.size(); -// if(tag.hasKey("Name")) { -// if(!tag.hasString("Name")) { -// return false; -// } -// if(tag.getString("Name").length() > 64) { -// return false; -// } -//// z--; -// } -//// if(display.hasKey("Lore")) { -//// if(!adv) { -//// display.removeTag("Lore"); -//// if(display.hasNoTags()) { -//// tag.removeTag("display"); -//// if(tag.hasNoTags()) { -//// stack.setTagCompound(null); -//// return true; -//// } -//// } -//// } -//// else { -//// if(!display.hasList("Lore")) { -//// return false; -//// } -//// NBTTagList lore = display.getTagList("Lore", 8); -//// if(lore.hasNoTags()) { -//// return false; -//// } -//// } -//// z--; -//// } -//// if(display.hasKey("color")) { -//// if(!display.hasInt("color")) { -//// return false; -//// } -//// if(!this.canBeDyed()) { -//// return false; -//// } -//// z--; -//// } -//// if(z > 0) { -//// return false; -//// } -//// } -// if(tag.hasKey("RepairCost")) { -// if(!tag.hasInt("RepairCost")) { -// return false; -// } -// if(tag.getInteger("RepairCost") < 1) { -// return false; -// } -// } -// if(tag.hasKey("ench")) { -// if(!tag.hasList("ench")) { -// return false; -// } -// NBTTagList ench = tag.getTagList("ench", 10); -// if(ench.hasNoTags()) { -// return false; -// } -// if(ench.tagCount() > Enchantment.getNames().size()) { -// return false; -// } -// Enchantment[] ecn = new Enchantment[ench.tagCount()]; -// for(int e = 0; e < ench.tagCount(); e++) { -// NBTTagCompound ec = ench.getCompoundTagAt(e); -// if(ec.getKeySet().size() != 2 || !ec.hasShort("id") || !ec.hasShort("lvl")) { -// return false; -// } -// int id = ec.getShort("id"); -// int lvl = ec.getShort("lvl"); -// Enchantment en = Enchantment.getEnchantmentById(id); -// if(en == null) { -// return false; -// } -//// if(!adv && (lvl < en.getMinLevel() || lvl > en.getMaxLevel())) { -//// return false; -//// } -//// if(!adv && !en.canApply(stack)) { -//// return false; -//// } -// ecn[e] = en; -// } -// for(int e = 0; e < ecn.length; e++) { -// for(int f = 0; f < ecn.length; f++) { -// if(f != e && ecn[e] == ecn[f]) { -// return false; -// } -// } -// } -// } -//// if(adv) { -//// if(tag.hasKey("Unbreakable")) { -//// if(!tag.hasBoolean("Unbreakable")) { -//// return false; -//// } -//// } -//// if(tag.hasKey("HideFlags")) { -//// if(!tag.hasInt("HideFlags")) { -//// return false; -//// } -//// } -//// } -// if(validate) { -// if(this.validateNbt(stack.getTagCompound())) { -// if(tag.hasNoTags()) { -// stack.setTagCompound(null); -// } -// } -// else { -// return false; -// } -// } -// return true; -// } - -// boolean validate(ItemStack stack) { -//// if(!bypass && this.isSpecialItem()) { -//// return false; -//// } -// boolean flag = true; -// if(this.isDamageable() && (stack.getItemDamage() < 0 || (stack.getItemDamage() > this.getMaxDamage()))) { -// stack.setItemDamage(0); -// flag = false; -// } -// if(stack.stackSize > stack.getMaxStackSize()) { -// stack.stackSize = stack.getMaxStackSize(); -// flag = false; -// } -// else if(stack.stackSize < 1) { -// stack.stackSize = 1; -// flag = false; -// } -// if(!this.isValidNbt(stack)) { -// stack.setTagCompound(null); -// flag = false; -// } -// return flag; -// } - -// public boolean canBreakBlocks() { -// return true; -// } -// -// public boolean canUseInAir() { -// return false; -// } -// -// public boolean ignoresBlocks() { -// return false; -// } public float getRadiation(ItemStack stack) { return 0.0f; @@ -649,7 +294,7 @@ public class Item return Transforms.ITEM; } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), name); } @@ -658,6 +303,6 @@ public class Item } public void getRenderItems(Item itemIn, List subItems) { - this.getSubItems(itemIn, null, subItems); + subItems.add(new ItemStack(itemIn)); } } diff --git a/common/src/main/java/common/item/ItemAmmo.java b/common/src/main/java/common/item/ItemAmmo.java index e76602ab..c11cc9fc 100755 --- a/common/src/main/java/common/item/ItemAmmo.java +++ b/common/src/main/java/common/item/ItemAmmo.java @@ -5,7 +5,7 @@ public class ItemAmmo extends ItemMagnetic { private final float explosion; public ItemAmmo(int damage, float explosion, int stack) { - this.maxStackSize = stack; + this.setMaxAmount(stack); this.setTab(CheatTab.COMBAT); this.damage = damage; this.explosion = explosion; diff --git a/common/src/main/java/common/item/ItemAnvilBlock.java b/common/src/main/java/common/item/ItemAnvilBlock.java deleted file mode 100755 index 8bf8549e..00000000 --- a/common/src/main/java/common/item/ItemAnvilBlock.java +++ /dev/null @@ -1,24 +0,0 @@ -package common.item; - -import common.block.Block; - -public class ItemAnvilBlock extends ItemMultiTexture -{ - public ItemAnvilBlock(Block block) - { - super(block, block, new String[] {"Amboss", "Leicht beschädigter Amboss", "Stark beschädigter Amboss"}); - } - - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) - { - return damage << 2; - } - - public boolean isMagnetic() { - return true; - } -} diff --git a/common/src/main/java/common/item/ItemAppleGold.java b/common/src/main/java/common/item/ItemAppleGold.java index a2b796a3..e2e4d597 100755 --- a/common/src/main/java/common/item/ItemAppleGold.java +++ b/common/src/main/java/common/item/ItemAppleGold.java @@ -1,7 +1,5 @@ package common.item; -import java.util.List; - import common.color.TextColor; import common.entity.npc.EntityNPC; import common.potion.Potion; @@ -10,24 +8,18 @@ import common.world.World; public class ItemAppleGold extends ItemFood { - public ItemAppleGold(int amount, boolean isWolfFood) + private final boolean powered; + + public ItemAppleGold(int amount, boolean powered) { - super(amount, isWolfFood); - this.setHasSubtypes(true); - this.setColor(TextColor.NEON); + super(amount, false); + this.powered = powered; + this.setColor(powered ? TextColor.MAGENTA : TextColor.NEON); } public boolean hasEffect(ItemStack stack) { - return stack.getMetadata() > 0; - } - - /** - * Return an item rarity from EnumRarity - */ - public TextColor getColor(ItemStack stack) - { - return stack.getMetadata() == 0 ? super.getColor(stack) : TextColor.MAGENTA; + return this.powered; } protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player) @@ -37,7 +29,7 @@ public class ItemAppleGold extends ItemFood player.addEffect(new PotionEffect(Potion.ABSORPTION, 2400, 0)); } - if (stack.getMetadata() > 0) + if (this.powered) { if (!worldIn.client) { @@ -51,13 +43,4 @@ public class ItemAppleGold extends ItemFood super.onFoodEaten(stack, worldIn, player); } } - - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - subItems.add(new ItemStack(itemIn, 1, 0)); - subItems.add(new ItemStack(itemIn, 1, 1)); - } } diff --git a/common/src/main/java/common/item/ItemArmor.java b/common/src/main/java/common/item/ItemArmor.java index 3c5722cd..4bbcc844 100755 --- a/common/src/main/java/common/item/ItemArmor.java +++ b/common/src/main/java/common/item/ItemArmor.java @@ -91,7 +91,6 @@ public class ItemArmor extends Item // this.renderIndex = renderIndex; this.damageReduceAmount = material.getDamageReduction(armorType); this.setMaxDamage(material.getDurability(armorType)); - this.maxStackSize = 1; this.setTab(CheatTab.COMBAT); DispenserRegistry.REGISTRY.putObject(this, dispenserBehavior); } @@ -272,11 +271,11 @@ public class ItemArmor extends Item super.getTransform()); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { if(this.material.canBeDyed()) return provider.getModel(this.getTransform(), name, name + "_overlay"); else - return super.getModel(provider, name, meta); + return super.getModel(provider, name); } public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { diff --git a/common/src/main/java/common/item/ItemBanner.java b/common/src/main/java/common/item/ItemBanner.java index c5c76f61..1020ecfb 100755 --- a/common/src/main/java/common/item/ItemBanner.java +++ b/common/src/main/java/common/item/ItemBanner.java @@ -7,6 +7,7 @@ import common.block.tile.BlockWallSign; import common.color.DyeColor; import common.entity.npc.EntityNPC; import common.init.Blocks; +import common.init.Items; import common.model.ItemMeshDefinition; import common.model.Model; import common.model.ModelProvider; @@ -24,8 +25,20 @@ public class ItemBanner extends ItemBlock { super(Blocks.banner); this.setTab(CheatTab.DECORATION); - this.setHasSubtypes(true); - this.setMaxDamage(0); + } + + public static ItemStack getColoredBanner(DyeColor color) { + return Items.banner.getColored(color); + } + + private ItemStack getColored(DyeColor color) { + TagObject tag = new TagObject(); + TileEntityBanner.setBaseColorAndPatterns(tag, color.getDyeDamage(), null); + TagObject tile = new TagObject(); + tile.setObject("BlockEntityTag", tag); + ItemStack stack = new ItemStack(this); + stack.setTagCompound(tile); + return stack; } /** @@ -134,15 +147,9 @@ public class ItemBanner extends ItemBlock */ public void getSubItems(Item itemIn, CheatTab tab, List subItems) { - for (DyeColor enumdyecolor : DyeColor.values()) + for (DyeColor color : DyeColor.values()) { - TagObject nbttagcompound = new TagObject(); - TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), null); - TagObject nbttagcompound1 = new TagObject(); - nbttagcompound1.setObject("BlockEntityTag", nbttagcompound); - ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage()); - itemstack.setTagCompound(nbttagcompound1); - subItems.add(itemstack); + subItems.add(this.getColored(color)); } } @@ -165,7 +172,7 @@ public class ItemBanner extends ItemBlock } else { - enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata()); + enumdyecolor = DyeColor.WHITE; } return enumdyecolor; @@ -204,16 +211,12 @@ public class ItemBanner extends ItemBlock { public String getModelLocation(ItemStack stack) { - return "item/banner#0" + '#' + "inventory"; + return "item/banner" + '#' + "inventory"; } }; } - - public void getRenderItems(Item itemIn, List subItems) { - subItems.add(new ItemStack(itemIn, 1, 0)); - } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(provider.getEntityModel(), this.getTransform()); } } diff --git a/common/src/main/java/common/item/ItemBlock.java b/common/src/main/java/common/item/ItemBlock.java index 8cdc5013..20d91680 100755 --- a/common/src/main/java/common/item/ItemBlock.java +++ b/common/src/main/java/common/item/ItemBlock.java @@ -1,7 +1,5 @@ package common.item; -import java.util.List; - import common.block.Block; import common.color.TextColor; import common.entity.Entity; @@ -22,21 +20,30 @@ public class ItemBlock extends Item { protected final Block block; protected final String flatTexture; + protected final int fixedMeta; - public ItemBlock(Block block, String flatTexture) + public ItemBlock(Block block, String flatTexture, int fixedMeta) { this.block = block; this.flatTexture = flatTexture; + this.fixedMeta = fixedMeta; + } + + public ItemBlock(Block block, int fixedMeta) + { + this(block, null, fixedMeta); + } + + public ItemBlock(Block block, String flatTexture) + { + this(block, flatTexture, 0); } public ItemBlock(Block block) { - this(block, null); + this(block, null, 0); } - /** - * Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item." - */ public ItemBlock setDisplay(String unlocalizedName) { super.setDisplay(unlocalizedName); @@ -72,7 +79,7 @@ public class ItemBlock extends Item } else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack)) { - int i = this.getMetadata(stack.getMetadata()); + int i = this.getMetadata(); State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); if (worldIn.setState(pos, iblockstate1, 3)) @@ -181,18 +188,15 @@ public class ItemBlock extends Item return this.block.getTab(); } - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - this.block.getSubBlocks(itemIn, tab, subItems); - } - public Block getBlock() { return this.block; } + + public int getMetadata() + { + return this.fixedMeta; + } // public Set getValidTags() { // return Sets.newHashSet("BlockEntityTag"); @@ -215,11 +219,11 @@ public class ItemBlock extends Item return this.flatTexture != null ? super.getTransform() : this.block.getTransform(); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return this.flatTexture != null ? provider.getModel(this.getTransform(), !this.flatTexture.isEmpty() ? this.flatTexture : this.block.getModel(provider, - BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata(meta))).getPrimary() /* "blocks/" + name */) : + BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata())).getPrimary() /* "blocks/" + name */) : provider.getModel(this.block.getModel(provider, - BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata(meta))), this.getTransform()); + BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata())), this.getTransform()); } } diff --git a/common/src/main/java/common/item/ItemBoat.java b/common/src/main/java/common/item/ItemBoat.java index 2d78fcf3..e99e4cde 100755 --- a/common/src/main/java/common/item/ItemBoat.java +++ b/common/src/main/java/common/item/ItemBoat.java @@ -17,7 +17,7 @@ public class ItemBoat extends Item { public ItemBoat() { - this.maxStackSize = 1; + this.setMaxAmount(1); this.setTab(CheatTab.SPAWNERS); } diff --git a/common/src/main/java/common/item/ItemBow.java b/common/src/main/java/common/item/ItemBow.java index 4ee6e402..86181393 100755 --- a/common/src/main/java/common/item/ItemBow.java +++ b/common/src/main/java/common/item/ItemBow.java @@ -17,7 +17,6 @@ public class ItemBow extends Item { public ItemBow() { - this.maxStackSize = 1; this.setMaxDamage(384); this.setTab(CheatTab.COMBAT); } @@ -139,19 +138,20 @@ public class ItemBow extends Item } public void getRenderItems(Item itemIn, List subItems) { - subItems.add(new ItemStack(itemIn, 1, 0)); + super.getRenderItems(itemIn, subItems); for(int z = 0; z < 3; z++) { - subItems.add(new ItemStack(itemIn, 1, 1 + z)); + final int data = z + 1; + subItems.add(new ItemStack(new ItemBow() { + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(this.getTransform(), "bow_pulling_" + data); + } + })); } } public Transforms getTransform() { return Transforms.RANGED; } - - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), meta == 0 ? "bow" : ("bow_pulling_" + (meta - 1))); - } public boolean canBeWielded() { return true; diff --git a/common/src/main/java/common/item/ItemBucket.java b/common/src/main/java/common/item/ItemBucket.java index ad0b2dd1..e1ab1e72 100755 --- a/common/src/main/java/common/item/ItemBucket.java +++ b/common/src/main/java/common/item/ItemBucket.java @@ -101,7 +101,7 @@ public class ItemBucket extends Item public ItemBucket(BlockDynamicLiquid liquid, boolean recursive) { - this.maxStackSize = liquid == null ? 16 : 1; + this.setMaxAmount(liquid == null ? 16 : 1); this.liquid = liquid; this.recursive = recursive; this.setTab(liquid == null ? CheatTab.TOOLS : CheatTab.LIQUIDS); @@ -178,7 +178,7 @@ public class ItemBucket extends Item return this.fillBucket(itemStackIn, playerIn, new ItemStack( ItemRegistry.getRegisteredItem(BlockRegistry.getNameFromBlock(block instanceof BlockDynamicLiquid ? FluidRegistry.getStaticBlock((BlockDynamicLiquid)block) : block) + - "_bucket"), 1, 0)); + "_bucket"))); } } } @@ -316,8 +316,8 @@ public class ItemBucket extends Item return true; } - public Model getModel(ModelProvider provider, String name, int meta) { - return this.recursive ? provider.getModel(this.getTransform(), name.substring("recursive_".length())) : super.getModel(provider, name, meta); + public Model getModel(ModelProvider provider, String name) { + return this.recursive ? provider.getModel(this.getTransform(), name.substring("recursive_".length())) : super.getModel(provider, name); } // public ItemMeshDefinition getMesher() { diff --git a/common/src/main/java/common/item/ItemBucketMilk.java b/common/src/main/java/common/item/ItemBucketMilk.java index 90f2e490..6485c168 100755 --- a/common/src/main/java/common/item/ItemBucketMilk.java +++ b/common/src/main/java/common/item/ItemBucketMilk.java @@ -11,7 +11,7 @@ public class ItemBucketMilk extends Item { public ItemBucketMilk() { - this.setMaxStackSize(1); + this.setMaxAmount(1); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/ItemButton.java b/common/src/main/java/common/item/ItemButton.java index 95b923b0..607d8815 100755 --- a/common/src/main/java/common/item/ItemButton.java +++ b/common/src/main/java/common/item/ItemButton.java @@ -12,7 +12,7 @@ public class ItemButton extends ItemBlock { this.button = block; } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(provider.getModel(this.button.getTexture()).add(5, 6, 6, 11, 10, 10) .d().uv(5, 6, 11, 10).noCull().u().uv(5, 10, 11, 6).noCull() .ns().uv(5, 12, 11, 16).noCull().we().uv(6, 12, 10, 16).noCull(), this.getTransform()); diff --git a/common/src/main/java/common/item/ItemCamera.java b/common/src/main/java/common/item/ItemCamera.java index 7a19ef90..6682fc47 100755 --- a/common/src/main/java/common/item/ItemCamera.java +++ b/common/src/main/java/common/item/ItemCamera.java @@ -6,7 +6,7 @@ import common.world.World; public class ItemCamera extends ItemMagnetic { public ItemCamera() { - this.setMaxStackSize(1); + this.setMaxAmount(1); } public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { diff --git a/common/src/main/java/common/item/ItemCarrotOnAStick.java b/common/src/main/java/common/item/ItemCarrotOnAStick.java index 83d923ce..580e908c 100755 --- a/common/src/main/java/common/item/ItemCarrotOnAStick.java +++ b/common/src/main/java/common/item/ItemCarrotOnAStick.java @@ -11,7 +11,6 @@ public class ItemCarrotOnAStick extends Item public ItemCarrotOnAStick() { this.setTab(CheatTab.TOOLS); - this.setMaxStackSize(1); this.setMaxDamage(25); } @@ -41,7 +40,7 @@ public class ItemCarrotOnAStick extends Item { EntityPig entitypig = (EntityPig)playerIn.vehicle; - if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 7) + if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getItemDamage() >= 7) { entitypig.getAIControlledByPlayer().boostSpeed(); itemStackIn.damageItem(7, playerIn); diff --git a/common/src/main/java/common/item/ItemChargedOrb.java b/common/src/main/java/common/item/ItemChargedOrb.java index 0b295150..3efa71b3 100755 --- a/common/src/main/java/common/item/ItemChargedOrb.java +++ b/common/src/main/java/common/item/ItemChargedOrb.java @@ -17,7 +17,6 @@ public class ItemChargedOrb extends ItemFragile { public ItemChargedOrb() { - this.maxStackSize = 1; this.setTab(CheatTab.TOOLS); this.setMaxDamage(16); this.setColor(TextColor.DMAGENTA); @@ -61,9 +60,9 @@ public class ItemChargedOrb extends ItemFragile for (int i = 0; i < 16; ++i) { - double d0 = (double)((float)pos.getX() + (5.0F + itemRand.floatv() * 6.0F) / 16.0F); + double d0 = (double)((float)pos.getX() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F); double d1 = (double)((float)pos.getY() + 0.8125F); - double d2 = (double)((float)pos.getZ() + (5.0F + itemRand.floatv() * 6.0F) / 16.0F); + double d2 = (double)((float)pos.getZ() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F); double d3 = 0.0D; double d4 = 0.0D; double d5 = 0.0D; diff --git a/common/src/main/java/common/item/ItemChest.java b/common/src/main/java/common/item/ItemChest.java index 57e502cc..93fd5e91 100755 --- a/common/src/main/java/common/item/ItemChest.java +++ b/common/src/main/java/common/item/ItemChest.java @@ -10,7 +10,7 @@ public class ItemChest extends ItemBlock { super(block); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(provider.getEntityModel(), this.getTransform()); } diff --git a/common/src/main/java/common/item/ItemCloth.java b/common/src/main/java/common/item/ItemCloth.java index 6c20acbf..62e4bbf8 100755 --- a/common/src/main/java/common/item/ItemCloth.java +++ b/common/src/main/java/common/item/ItemCloth.java @@ -7,41 +7,21 @@ import common.model.ModelProvider; public class ItemCloth extends ItemBlock { - private final Integer display; + private final DyeColor color; - public ItemCloth(Block block, Integer display, String flatTexture) + public ItemCloth(Block block, String flatTexture, DyeColor color) { super(block, flatTexture); - this.setMaxDamage(0); - this.setHasSubtypes(true); - this.display = display; + this.color = color; } - public ItemCloth(Block block, Integer display) + public ItemCloth(Block block, DyeColor color) { - this(block, display, null); + this(block, null, color); } - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) - { - return damage; - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. - */ - public String getDisplay(ItemStack stack) - { - return DyeColor.byMetadata(stack.getMetadata()).getSubject(this.display) + " " + super.getDisplay(stack); - } - - public Model getModel(ModelProvider provider, String name, int meta) { - return this.flatTexture != null ? provider.getModel(this.getTransform(), "blocks/" + DyeColor.byMetadata(meta).getName() + "_" + - this.flatTexture) : super.getModel(provider, name, meta); + public Model getModel(ModelProvider provider, String name) { + return this.flatTexture != null ? provider.getModel(this.getTransform(), "blocks/" + this.color.getName() + "_" + + this.flatTexture) : super.getModel(provider, name); } } diff --git a/common/src/main/java/common/item/ItemCoal.java b/common/src/main/java/common/item/ItemCoal.java deleted file mode 100755 index aa192aee..00000000 --- a/common/src/main/java/common/item/ItemCoal.java +++ /dev/null @@ -1,38 +0,0 @@ -package common.item; - -import java.util.List; - -import common.model.Model; -import common.model.ModelProvider; - -public class ItemCoal extends Item -{ - public ItemCoal() - { - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setTab(CheatTab.METALS); - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. - */ - public String getDisplay(ItemStack stack) - { - return stack.getMetadata() == 1 ? "Holzkohle" : super.getDisplay(stack); - } - - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - subItems.add(new ItemStack(itemIn, 1, 0)); - subItems.add(new ItemStack(itemIn, 1, 1)); - } - - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), meta == 1 ? "charcoal" : "coal"); - } -} diff --git a/common/src/main/java/common/item/ItemColored.java b/common/src/main/java/common/item/ItemColored.java index 97f58a3f..8c69cc88 100755 --- a/common/src/main/java/common/item/ItemColored.java +++ b/common/src/main/java/common/item/ItemColored.java @@ -4,60 +4,23 @@ import common.block.Block; public class ItemColored extends ItemBlock { - private final Block coloredBlock; - private String[] subtypeNames; - - public ItemColored(Block block, boolean hasSubtypes, String flatTexture) + public ItemColored(Block block, String flatTexture) { super(block, flatTexture); - this.coloredBlock = block; - - if (hasSubtypes) - { - this.setMaxDamage(0); - this.setHasSubtypes(true); - } } - public ItemColored(Block block, boolean hasSubtypes) + public ItemColored(Block block, int fixedMeta) { - this(block, hasSubtypes, null); + super(block, fixedMeta); + } + + public ItemColored(Block block) + { + super(block); } public int getColorFromItemStack(ItemStack stack, int renderPass) { - return this.coloredBlock.getRenderColor(this.coloredBlock.getStateFromMeta(stack.getMetadata())); - } - - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) - { - return damage; - } - - public ItemColored setSubtypeNames(String[] names) - { - this.subtypeNames = names; - return this; - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. - */ - public String getDisplay(ItemStack stack) - { - if (this.subtypeNames == null) - { - return super.getDisplay(stack); - } - else - { - int i = stack.getMetadata(); - return i >= 0 && i < this.subtypeNames.length ? this.subtypeNames[i] : super.getDisplay(stack); - } + return this.block.getRenderColor(this.block.getState()); } } diff --git a/common/src/main/java/common/item/ItemDie.java b/common/src/main/java/common/item/ItemDie.java index 1afefd93..ee57801b 100755 --- a/common/src/main/java/common/item/ItemDie.java +++ b/common/src/main/java/common/item/ItemDie.java @@ -1,7 +1,9 @@ package common.item; -import java.util.List; +import java.util.Collection; +import java.util.Map; +import common.collect.Maps; import common.color.TextColor; import common.entity.npc.EntityNPC; import common.entity.projectile.EntityDie; @@ -9,20 +11,47 @@ import common.init.SoundEvent; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.util.ExtMath; +import common.util.Pair; import common.world.World; public class ItemDie extends Item { - public static final int[] DIE_SIDES = new int[] {4, 6, 8, 10, 12, 20}; - public static final TextColor[] DIE_COLORS = new TextColor[] {TextColor.DGREEN, TextColor.NEON, TextColor.DMAGENTA, - TextColor.MAGENTA, TextColor.DRED, TextColor.ORANGE}; + public static final Pair[] DIE_SIDES = new Pair[] { + new Pair(4, TextColor.DGREEN), + new Pair(6, TextColor.NEON), + new Pair(8, TextColor.DMAGENTA), + new Pair(10, TextColor.MAGENTA), + new Pair(12, TextColor.DRED), + new Pair(20, TextColor.ORANGE) + }; + public static final Map DICE = Maps.newTreeMap(); - public ItemDie() + private final int sides; + private final TextColor color; + + public static final ItemDie getBySides(int sides) { + ItemDie die = DICE.get(sides); + return die == null ? DICE.get(6) : die; + } + + public static Collection getDieItems() { + return DICE.values(); + } + + public ItemDie(int sides, TextColor color) { + this.sides = sides; + this.color = color; this.setTab(CheatTab.TOOLS); - this.setMaxDamage(0); - this.setHasSubtypes(true); + DICE.put(sides, this); + } + + public int getSides() { + return this.sides; + } + + public TextColor getDieColor() { + return this.color; } public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) @@ -36,32 +65,24 @@ public class ItemDie extends Item if (!worldIn.client) { - worldIn.spawnEntityInWorld(new EntityDie(worldIn, playerIn, DIE_SIDES[ExtMath.clampi(itemStackIn.getMetadata(), - 0, DIE_SIDES.length - 1)], false)); // playerIn.creative)); + worldIn.spawnEntityInWorld(new EntityDie(worldIn, playerIn, this.sides, false)); // playerIn.creative)); } // playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]); return itemStackIn; } - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - for(int z = 0; z < DIE_SIDES.length; z++) { - subItems.add(new ItemStack(itemIn, 1, z)); - } - } - public String getDisplay(ItemStack stack) { - return super.getDisplay(stack) + " W" + DIE_SIDES[ExtMath.clampi(stack.getMetadata(), 0, DIE_SIDES.length - 1)]; + return super.getDisplay(stack) + " W" + this.sides; } public Transforms getTransform() { return Transforms.DICE; } - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(provider.getModel("items/die_d" + DIE_SIDES[meta] + "_side").add().nswe() - .du("items/die_d" + DIE_SIDES[meta] + "_top"), this.getTransform()); + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(provider.getModel("items/die_d" + this.sides + "_side").add().nswe() + .du("items/die_d" + this.sides + "_top"), this.getTransform()); } } diff --git a/common/src/main/java/common/item/ItemDispenser.java b/common/src/main/java/common/item/ItemDispenser.java index 1a90ccf6..edc5df9e 100755 --- a/common/src/main/java/common/item/ItemDispenser.java +++ b/common/src/main/java/common/item/ItemDispenser.java @@ -7,7 +7,7 @@ public class ItemDispenser extends ItemBlock { super(block); } - public int getMetadata(int damage) { + public int getMetadata() { return 2; } } diff --git a/common/src/main/java/common/item/ItemDoublePlant.java b/common/src/main/java/common/item/ItemDoublePlant.java index 2e1875e8..670e619f 100755 --- a/common/src/main/java/common/item/ItemDoublePlant.java +++ b/common/src/main/java/common/item/ItemDoublePlant.java @@ -1,7 +1,5 @@ package common.item; -import java.util.function.Function; - import common.block.Block; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockDoublePlant.EnumPlantType; @@ -9,22 +7,24 @@ import common.color.Colorizer; import common.model.Model; import common.model.ModelProvider; -public class ItemDoublePlant extends ItemMultiTexture +public class ItemDoublePlant extends ItemBlock { - public ItemDoublePlant(Block block, Block block2, Function nameFunction) + private final BlockDoublePlant.EnumPlantType type; + + public ItemDoublePlant(Block block, BlockDoublePlant.EnumPlantType type) { - super(block, block2, true, nameFunction); + super(block, ""); + this.type = type; } public int getColorFromItemStack(ItemStack stack, int renderPass) { - BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.byMetadata(stack.getMetadata()); - return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D); + return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), "blocks/" + ( - BlockDoublePlant.EnumPlantType.byMetadata(meta) == EnumPlantType.SUNFLOWER ? "sunflower_front" : - BlockDoublePlant.EnumPlantType.byMetadata(meta).getName() + "_top")); + this.type == EnumPlantType.SUNFLOWER ? "sunflower_front" : + this.type.getName() + "_top")); } } diff --git a/common/src/main/java/common/item/ItemDye.java b/common/src/main/java/common/item/ItemDye.java index af0b10b9..fe11e9e8 100755 --- a/common/src/main/java/common/item/ItemDye.java +++ b/common/src/main/java/common/item/ItemDye.java @@ -1,7 +1,5 @@ package common.item; -import java.util.List; - import common.block.Block; import common.block.artificial.BlockBed; import common.block.foliage.IGrowable; @@ -24,23 +22,24 @@ import common.world.AWorldServer; public class ItemDye extends Item { - public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320}; - - public ItemDye() - { - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setTab(CheatTab.MATERIALS); + public static final int[] FIREWORK_COLORS = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320}; + private static final ItemDye[] DIES = new ItemDye[DyeColor.values().length]; + + private final DyeColor color; + + public static ItemDye getByColor(DyeColor color) { + return DIES[color.getMetadata()]; } - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. - */ - public String getDisplay(ItemStack stack) + public ItemDye(DyeColor color) { - int i = stack.getMetadata(); - return DyeColor.byDyeDamage(i).getDye(); + this.color = color; + this.setTab(CheatTab.MATERIALS); + DIES[this.color.getMetadata()] = this; + } + + public DyeColor getColor() { + return this.color; } /** @@ -54,9 +53,7 @@ public class ItemDye extends Item } else { - DyeColor enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata()); - - if (enumdyecolor == DyeColor.WHITE) + if (this.color == DyeColor.WHITE) { if (applyBonemeal(stack, worldIn, pos)) { @@ -68,7 +65,7 @@ public class ItemDye extends Item return true; } } - else if (enumdyecolor == DyeColor.BROWN) + else if (this.color == DyeColor.BROWN) { State iblockstate = worldIn.getState(pos); Block block = iblockstate.getBlock(); @@ -103,7 +100,7 @@ public class ItemDye extends Item } State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() instanceof BlockBed) { - Block bedBlock = BlockRegistry.getRegisteredBlock(enumdyecolor.getName() + "_bed"); + Block bedBlock = BlockRegistry.getRegisteredBlock(this.color.getName() + "_bed"); if(bedBlock != Blocks.air) { if (iblockstate.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT) { @@ -134,7 +131,7 @@ public class ItemDye extends Item else if(iblockstate.getBlock() == Blocks.beacon) { TileEntity te = worldIn.getTileEntity(pos); if(te instanceof TileEntityBeacon) { - ((TileEntityBeacon)te).setBeamColor(enumdyecolor); + ((TileEntityBeacon)te).setBeamColor(this.color); // if(!playerIn.creative) --stack.size; } @@ -186,10 +183,10 @@ public class ItemDye extends Item for (int i = 0; i < amount; ++i) { - double d0 = itemRand.gaussian() * 0.02D; - double d1 = itemRand.gaussian() * 0.02D; - double d2 = itemRand.gaussian() * 0.02D; - worldIn.spawnParticle(ParticleType.GROW, (double)((float)pos.getX() + itemRand.floatv()), (double)pos.getY() + (double)itemRand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.floatv()), d0, d1, d2); + double d0 = worldIn.rand.gaussian() * 0.02D; + double d1 = worldIn.rand.gaussian() * 0.02D; + double d2 = worldIn.rand.gaussian() * 0.02D; + worldIn.spawnParticle(ParticleType.GROW, (double)((float)pos.getX() + worldIn.rand.floatv()), (double)pos.getY() + (double)worldIn.rand.floatv() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + worldIn.rand.floatv()), d0, d1, d2); } } } @@ -202,11 +199,10 @@ public class ItemDye extends Item if (target instanceof EntitySheep) { EntitySheep entitysheep = (EntitySheep)target; - DyeColor enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata()); - if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor) + if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != this.color) { - entitysheep.setFleeceColor(enumdyecolor); + entitysheep.setFleeceColor(this.color); --stack.size; } @@ -218,18 +214,7 @@ public class ItemDye extends Item } } - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - for (int i = 0; i < 16; ++i) - { - subItems.add(new ItemStack(itemIn, 1, i)); - } - } - - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), "dye_" + DyeColor.byDyeDamage(meta).getName()); + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(this.getTransform(), "dye_" + this.color.getName()); } } diff --git a/common/src/main/java/common/item/ItemDynamite.java b/common/src/main/java/common/item/ItemDynamite.java index d3433506..85380ddf 100755 --- a/common/src/main/java/common/item/ItemDynamite.java +++ b/common/src/main/java/common/item/ItemDynamite.java @@ -1,61 +1,36 @@ package common.item; -import java.util.List; - import common.entity.npc.EntityNPC; import common.entity.projectile.EntityDynamite; import common.init.SoundEvent; -import common.model.Model; -import common.model.ModelProvider; +import common.util.ExtMath; import common.world.World; -public class ItemDynamite extends Item -{ - private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII"}; - - public ItemDynamite() - { - this.maxStackSize = 32; - this.setTab(CheatTab.TOOLS); - this.setMaxDamage(0); - this.setHasSubtypes(true); - } +public class ItemDynamite extends Item { + public static final ItemDynamite[] DYNAMITE = new ItemDynamite[8]; - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) - { -// if (!playerIn.creative) -// { - --itemStackIn.size; -// } + private final int power; - worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F); + public static ItemDynamite getByPower(int power) { + return DYNAMITE[ExtMath.clampi(power, 0, DYNAMITE.length - 1)]; + } - if (!worldIn.client) - { - worldIn.spawnEntityInWorld(new EntityDynamite(worldIn, playerIn, itemStackIn.getMetadata())); - } + public ItemDynamite(int power) { + this.power = power; + this.setMaxAmount(32); + this.setTab(CheatTab.TOOLS); + DYNAMITE[power] = this; + } -// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]); - return itemStackIn; - } - - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - for(int z = 0; z < 8; z++) { - subItems.add(new ItemStack(itemIn, 1, z)); - } - } - - public String getDisplay(ItemStack stack) - { - int exp = stack.getMetadata() & 7; - return super.getDisplay(stack) + (exp == 0 ? "" : " " + TIERS[exp-1]); - } + public int getExplosionPower() { + return this.power; + } - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), "dynamite" + (meta == 0 ? "" : ("_" + meta))); - } + public ItemStack onItemRightClick(ItemStack stack, World world, EntityNPC player) { + --stack.size; + world.playSoundAtEntity(player, SoundEvent.THROW, 0.5F); + if(!world.client) + world.spawnEntityInWorld(new EntityDynamite(world, player, this.power)); + return stack; + } } diff --git a/common/src/main/java/common/item/ItemEditWand.java b/common/src/main/java/common/item/ItemEditWand.java index 6d1baa92..ccceb58d 100755 --- a/common/src/main/java/common/item/ItemEditWand.java +++ b/common/src/main/java/common/item/ItemEditWand.java @@ -7,7 +7,7 @@ import common.world.World; public class ItemEditWand extends Item { public ItemEditWand() { - this.maxStackSize = 1; + this.setMaxAmount(1); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/ItemEnchantedBook.java b/common/src/main/java/common/item/ItemEnchantedBook.java index 37a1079e..b857cde1 100755 --- a/common/src/main/java/common/item/ItemEnchantedBook.java +++ b/common/src/main/java/common/item/ItemEnchantedBook.java @@ -142,7 +142,7 @@ public class ItemEnchantedBook extends Item public RngLoot getRandom(Random rand, int minChance, int maxChance, int weight) { - ItemStack itemstack = new ItemStack(Items.book, 1, 0); + ItemStack itemstack = new ItemStack(Items.book); EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30); return new RngLoot(itemstack, minChance, maxChance, weight); } @@ -196,12 +196,8 @@ public class ItemEnchantedBook extends Item { public String getModelLocation(ItemStack stack) { - return "item/enchanted_book#0" + '#' + "inventory"; + return "item/enchanted_book" + '#' + "inventory"; } }; } - - public void getRenderItems(Item itemIn, List subItems) { - subItems.add(new ItemStack(itemIn, 1, 0)); - } } diff --git a/common/src/main/java/common/item/ItemExterminator.java b/common/src/main/java/common/item/ItemExterminator.java index cd5287d0..3abe8633 100755 --- a/common/src/main/java/common/item/ItemExterminator.java +++ b/common/src/main/java/common/item/ItemExterminator.java @@ -9,7 +9,7 @@ import common.world.AWorldServer; public class ItemExterminator extends ItemMagnetic { public ItemExterminator() { - this.setMaxStackSize(1); + this.setMaxAmount(1); this.setColor(TextColor.DRED); } diff --git a/common/src/main/java/common/item/ItemFence.java b/common/src/main/java/common/item/ItemFence.java index cd6c5c01..a3691e3d 100755 --- a/common/src/main/java/common/item/ItemFence.java +++ b/common/src/main/java/common/item/ItemFence.java @@ -10,7 +10,7 @@ public class ItemFence extends ItemBlock { super(block); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(provider.getModel(((BlockFence)this.block).getTexture()) .add(6, 0, 0, 10, 16, 4) .d().uv(6, 0, 10, 4) diff --git a/common/src/main/java/common/item/ItemFireworkCharge.java b/common/src/main/java/common/item/ItemFireworkCharge.java index 14e9ba12..2c902d0d 100755 --- a/common/src/main/java/common/item/ItemFireworkCharge.java +++ b/common/src/main/java/common/item/ItemFireworkCharge.java @@ -104,9 +104,9 @@ public class ItemFireworkCharge extends Item flag = false; boolean flag1 = false; - for (int j = 0; j < ItemDye.dyeColors.length; ++j) + for (int j = 0; j < ItemDye.FIREWORK_COLORS.length; ++j) { - if (i == ItemDye.dyeColors[j]) + if (i == ItemDye.FIREWORK_COLORS[j]) { flag1 = true; s = s + DyeColor.byDyeDamage(j).getDisplay(); @@ -142,7 +142,7 @@ public class ItemFireworkCharge extends Item for (int k = 0; k < 16; ++k) { - if (l == ItemDye.dyeColors[k]) + if (l == ItemDye.FIREWORK_COLORS[k]) { flag5 = true; s1 = s1 + DyeColor.byDyeDamage(k).getDisplay(); @@ -178,7 +178,7 @@ public class ItemFireworkCharge extends Item // return Sets.newHashSet("Explosion"); // } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), "firework_charge", "firework_charge_overlay"); } } diff --git a/common/src/main/java/common/item/ItemFishFood.java b/common/src/main/java/common/item/ItemFishFood.java index 2a0f9b4d..3a785a37 100755 --- a/common/src/main/java/common/item/ItemFishFood.java +++ b/common/src/main/java/common/item/ItemFishFood.java @@ -1,9 +1,5 @@ package common.item; -import java.util.List; -import java.util.Map; - -import common.collect.Maps; import common.entity.npc.EntityNPC; import common.model.Model; import common.model.ModelProvider; @@ -14,31 +10,37 @@ import common.world.World; public class ItemFishFood extends ItemFood { - /** Indicates whether this fish is "cooked" or not. */ private final boolean cooked; + private final FishType type; - public ItemFishFood(boolean cooked) + public ItemFishFood(boolean cooked, FishType type) { super(0, false); this.cooked = cooked; + this.type = type; + } + + public FishType getType() { + return this.type; + } + + public boolean isCooked() { + return this.cooked; } public int getHealAmount(ItemStack stack) { - ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); - return this.cooked && itemfishfood$fishtype.canCook() ? itemfishfood$fishtype.getCookedHealAmount() : itemfishfood$fishtype.getUncookedHealAmount(); + return this.cooked && this.type.canCook() ? this.type.getCookedHealAmount() : this.type.getUncookedHealAmount(); } public String getPotionEffect(ItemStack stack) { - return ItemFishFood.FishType.byItemStack(stack) == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null; + return this.type == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null; } protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player) { - ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); - - if (itemfishfood$fishtype == ItemFishFood.FishType.PUFFERFISH) + if (this.type == ItemFishFood.FishType.PUFFERFISH) { player.addEffect(new PotionEffect(Potion.POISON, 1200, 3)); player.addEffect(new PotionEffect(Potion.NAUSEA, 300, 1)); @@ -47,32 +49,13 @@ public class ItemFishFood extends ItemFood super.onFoodEaten(stack, worldIn, player); } - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - public void getSubItems(Item itemIn, CheatTab tab, List subItems) - { - for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) - { - if (!this.cooked || itemfishfood$fishtype.canCook()) - { - subItems.add(new ItemStack(this, 1, itemfishfood$fishtype.getMetadata())); - } - } - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. - */ public String getDisplay(ItemStack stack) { - ItemFishFood.FishType type = ItemFishFood.FishType.byItemStack(stack); - return (type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + type.getName(); + return (this.type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + this.type.getDisplay(); } - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + FishType.byMetadata(meta).getTexture()); + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + this.type.getName()); } public static enum FishType @@ -82,29 +65,28 @@ public class ItemFishFood extends ItemFood CLOWNFISH("clownfish", 2, "Clownfisch", 1), PUFFERFISH("pufferfish", 3, "Kugelfisch", 1); - private static final Map META_LOOKUP = Maps.newHashMap(); private final int meta; - private final String texture; private final String name; + private final String display; private final int uncookedHealAmount; private final int cookedHealAmount; private boolean cookable = false; - private FishType(String texture, int meta, String name, int uncookedHeal, int cookedHeal) + private FishType(String name, int meta, String display, int uncookedHeal, int cookedHeal) { - this.texture = texture; - this.meta = meta; this.name = name; + this.meta = meta; + this.display = display; this.uncookedHealAmount = uncookedHeal; this.cookedHealAmount = cookedHeal; this.cookable = true; } - private FishType(String texture, int meta, String name, int uncookedHeal) + private FishType(String name, int meta, String display, int uncookedHeal) { - this.texture = texture; - this.meta = meta; this.name = name; + this.meta = meta; + this.display = display; this.uncookedHealAmount = uncookedHeal; this.cookedHealAmount = 0; this.cookable = false; @@ -115,16 +97,16 @@ public class ItemFishFood extends ItemFood return this.meta; } + public String getDisplay() + { + return this.display; + } + public String getName() { return this.name; } - public String getTexture() - { - return this.texture; - } - public int getUncookedHealAmount() { return this.uncookedHealAmount; @@ -139,23 +121,5 @@ public class ItemFishFood extends ItemFood { return this.cookable; } - - public static ItemFishFood.FishType byMetadata(int meta) - { - ItemFishFood.FishType itemfishfood$fishtype = (ItemFishFood.FishType)META_LOOKUP.get(Integer.valueOf(meta)); - return itemfishfood$fishtype == null ? COD : itemfishfood$fishtype; - } - - public static ItemFishFood.FishType byItemStack(ItemStack stack) - { - return stack.getItem() instanceof ItemFishFood ? byMetadata(stack.getMetadata()) : COD; - } - - static { - for (ItemFishFood.FishType itemfishfood$fishtype : values()) - { - META_LOOKUP.put(Integer.valueOf(itemfishfood$fishtype.getMetadata()), itemfishfood$fishtype); - } - } } } diff --git a/common/src/main/java/common/item/ItemFishingRod.java b/common/src/main/java/common/item/ItemFishingRod.java index f7278f83..601c30ba 100755 --- a/common/src/main/java/common/item/ItemFishingRod.java +++ b/common/src/main/java/common/item/ItemFishingRod.java @@ -15,7 +15,6 @@ public class ItemFishingRod extends Item public ItemFishingRod() { this.setMaxDamage(64); - this.setMaxStackSize(1); this.setTab(CheatTab.TOOLS); } @@ -80,15 +79,15 @@ public class ItemFishingRod extends Item } public void getRenderItems(Item itemIn, List subItems) { - subItems.add(new ItemStack(itemIn, 1, 0)); - subItems.add(new ItemStack(itemIn, 1, 1)); + super.getRenderItems(itemIn, subItems); + subItems.add(new ItemStack(new ItemFishingRod() { + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(this.getTransform(), "fishing_rod_cast"); + } + })); } public Transforms getTransform() { return Transforms.TOOL_FLIP; } - - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), meta == 1 ? "fishing_rod_cast" : "fishing_rod"); - } } diff --git a/common/src/main/java/common/item/ItemFlintAndSteel.java b/common/src/main/java/common/item/ItemFlintAndSteel.java index 55ff3be0..a32f0139 100755 --- a/common/src/main/java/common/item/ItemFlintAndSteel.java +++ b/common/src/main/java/common/item/ItemFlintAndSteel.java @@ -15,7 +15,6 @@ public class ItemFlintAndSteel extends Item public ItemFlintAndSteel(BlockFire fireBlock) { this.fireBlock = fireBlock; - this.maxStackSize = 1; this.setMaxDamage(64); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/ItemGlassBottle.java b/common/src/main/java/common/item/ItemGlassBottle.java index d4b046a7..3b2811cf 100755 --- a/common/src/main/java/common/item/ItemGlassBottle.java +++ b/common/src/main/java/common/item/ItemGlassBottle.java @@ -55,7 +55,7 @@ public class ItemGlassBottle extends Item if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potion))) { - playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potion, 1, 0), false); + playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potion), false); } } } @@ -64,7 +64,7 @@ public class ItemGlassBottle extends Item } } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), "potion_bottle_empty"); } } diff --git a/common/src/main/java/common/item/ItemGunBase.java b/common/src/main/java/common/item/ItemGunBase.java index 73f56abe..4ae5041d 100755 --- a/common/src/main/java/common/item/ItemGunBase.java +++ b/common/src/main/java/common/item/ItemGunBase.java @@ -15,7 +15,6 @@ public abstract class ItemGunBase extends Item public ItemGunBase(int durability) { - this.maxStackSize = 1; this.setMaxDamage(durability); this.setTab(CheatTab.COMBAT); } diff --git a/common/src/main/java/common/item/ItemHoe.java b/common/src/main/java/common/item/ItemHoe.java index 9e7b7b76..2b630181 100755 --- a/common/src/main/java/common/item/ItemHoe.java +++ b/common/src/main/java/common/item/ItemHoe.java @@ -1,7 +1,6 @@ package common.item; import common.block.Block; -import common.block.natural.BlockDirt; import common.entity.npc.EntityNPC; import common.init.Blocks; import common.init.ToolMaterial; @@ -18,7 +17,6 @@ public class ItemHoe extends Item public ItemHoe(ToolMaterial material) { this.theToolMaterial = material; - this.maxStackSize = 1; this.setMaxDamage(material.getDurability()); this.setTab(CheatTab.TOOLS); } @@ -48,14 +46,12 @@ public class ItemHoe extends Item if (block == Blocks.dirt) { - switch ((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT)) - { - case DIRT: - return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getState()); + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getState()); + } - case COARSE_DIRT: - return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); - } + if (block == Blocks.coarse_dirt) + { + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getState()); } } diff --git a/common/src/main/java/common/item/ItemHorseArmor.java b/common/src/main/java/common/item/ItemHorseArmor.java index 3b60d1f2..86d14c20 100755 --- a/common/src/main/java/common/item/ItemHorseArmor.java +++ b/common/src/main/java/common/item/ItemHorseArmor.java @@ -9,7 +9,7 @@ public class ItemHorseArmor extends Item { public ItemHorseArmor(ToolMaterial material, String texture) { this.material = material; this.texture = texture; - this.setMaxStackSize(1); + this.setMaxAmount(1); this.setTab(CheatTab.COMBAT); } diff --git a/common/src/main/java/common/item/ItemHugeMushroom.java b/common/src/main/java/common/item/ItemHugeMushroom.java index 9ed68418..eb1c35d5 100755 --- a/common/src/main/java/common/item/ItemHugeMushroom.java +++ b/common/src/main/java/common/item/ItemHugeMushroom.java @@ -7,7 +7,7 @@ public class ItemHugeMushroom extends ItemBlock { super(block); } - public int getMetadata(int damage) { + public int getMetadata() { return 14; } } diff --git a/common/src/main/java/common/item/ItemLeaves.java b/common/src/main/java/common/item/ItemLeaves.java deleted file mode 100755 index efe717c4..00000000 --- a/common/src/main/java/common/item/ItemLeaves.java +++ /dev/null @@ -1,45 +0,0 @@ -package common.item; - -import common.block.foliage.BlockLeaves; -import common.block.foliage.LeavesType; - -public class ItemLeaves extends ItemBlock -{ - protected final BlockLeaves leaves; - - public ItemLeaves(BlockLeaves block) - { - super(block); - this.leaves = block; - this.setMaxDamage(0); - this.setHasSubtypes(true); - } - - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) - { - return damage | 8; - } - - public int getColorFromItemStack(ItemStack stack, int renderPass) - { - return this.leaves.getRenderColor(this.leaves.getStateFromMeta(stack.getMetadata())); - } - -// /** -// * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have -// * different names based on their damage or NBT. -// */ -// public String getUnlocalizedName(ItemStack stack) -// { -// return super.getUnlocalizedName() + "." + this.leaves.getWoodType().getUnlocalizedName(); -// } - - public String getDisplay(ItemStack stack) - { - return this.block.getDisplay() + " (" + LeavesType.getById(stack.getMetadata()).getDisplayName() + ")"; - } -} diff --git a/common/src/main/java/common/item/ItemLilyPad.java b/common/src/main/java/common/item/ItemLilyPad.java index efe834d0..1650934e 100755 --- a/common/src/main/java/common/item/ItemLilyPad.java +++ b/common/src/main/java/common/item/ItemLilyPad.java @@ -1,7 +1,7 @@ package common.item; import common.block.Block; -import common.block.BlockDirectional; +import common.block.foliage.BlockLilyPad; import common.block.liquid.BlockLiquid; import common.entity.npc.EntityNPC; import common.init.Blocks; @@ -14,7 +14,7 @@ public class ItemLilyPad extends ItemColored { public ItemLilyPad(Block block) { - super(block, false, ""); + super(block, ""); } public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) @@ -46,7 +46,7 @@ public class ItemLilyPad extends ItemColored if (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) { - worldIn.setState(blockpos1, Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, playerIn.getHorizontalFacing().getOpposite())); + worldIn.setState(blockpos1, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, playerIn.getHorizontalFacing().getOpposite())); // if (!playerIn.creative) // { @@ -60,9 +60,4 @@ public class ItemLilyPad extends ItemColored return itemStackIn; } } - - public int getColorFromItemStack(ItemStack stack, int renderPass) - { - return Blocks.waterlily.getRenderColor(Blocks.waterlily.getStateFromMeta(stack.getMetadata())); - } } diff --git a/common/src/main/java/common/item/ItemMagnet.java b/common/src/main/java/common/item/ItemMagnet.java index f2b85279..53aca673 100755 --- a/common/src/main/java/common/item/ItemMagnet.java +++ b/common/src/main/java/common/item/ItemMagnet.java @@ -16,7 +16,7 @@ public class ItemMagnet extends Item { public ItemMagnet(boolean chicken) { this.setTab(CheatTab.TOOLS); - this.setMaxStackSize(1); + this.setMaxAmount(1); this.chicken = chicken; } diff --git a/common/src/main/java/common/item/ItemMinecart.java b/common/src/main/java/common/item/ItemMinecart.java index ccc8a414..7ed0e155 100755 --- a/common/src/main/java/common/item/ItemMinecart.java +++ b/common/src/main/java/common/item/ItemMinecart.java @@ -82,7 +82,7 @@ public class ItemMinecart extends Item public ItemMinecart(EntityCart.EnumMinecartType type) { - this.maxStackSize = 1; + this.setMaxAmount(1); this.minecartType = type; this.setTab(CheatTab.SPAWNERS); // if(type != EntityMinecart.EnumMinecartType.COMMAND_BLOCK) diff --git a/common/src/main/java/common/item/ItemMonsterPlacer.java b/common/src/main/java/common/item/ItemMonsterPlacer.java index c7faf25f..ee1209c8 100755 --- a/common/src/main/java/common/item/ItemMonsterPlacer.java +++ b/common/src/main/java/common/item/ItemMonsterPlacer.java @@ -226,7 +226,7 @@ public class ItemMonsterPlacer extends Item // subItems.add(new ItemStack(itemIn, 1, 0)); // } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), "spawn_egg", "spawn_egg_overlay"); } } diff --git a/common/src/main/java/common/item/ItemMultiTexture.java b/common/src/main/java/common/item/ItemMultiTexture.java deleted file mode 100755 index 4a85c9f0..00000000 --- a/common/src/main/java/common/item/ItemMultiTexture.java +++ /dev/null @@ -1,61 +0,0 @@ -package common.item; - -import java.util.function.Function; - -import common.block.Block; - -public class ItemMultiTexture extends ItemBlock -{ - protected final Block theBlock; - protected final Function nameFunction; - - public ItemMultiTexture(Block block, Block block2, boolean flatTexture, Function nameFunction) - { - super(block, flatTexture ? "" : null); - this.theBlock = block2; - this.nameFunction = nameFunction; - this.setMaxDamage(0); - this.setHasSubtypes(true); - } - - public ItemMultiTexture(Block block, Block block2, Function nameFunction) - { - this(block, block2, false, nameFunction); - } - - public ItemMultiTexture(Block block, Block block2, final String[] namesByMeta) - { - this(block, block2, false, new Function() - { - public String apply(ItemStack p_apply_1_) - { - int i = p_apply_1_.getMetadata(); - - if (i < 0 || i >= namesByMeta.length) - { - i = 0; - } - - return namesByMeta[i]; - } - }); - } - - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) - { - return damage; - } - - /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. - */ - public String getDisplay(ItemStack stack) - { - return this.nameFunction.apply(stack); - } -} diff --git a/common/src/main/java/common/item/ItemNpcSpawner.java b/common/src/main/java/common/item/ItemNpcSpawner.java index edc04b25..eddd7f21 100755 --- a/common/src/main/java/common/item/ItemNpcSpawner.java +++ b/common/src/main/java/common/item/ItemNpcSpawner.java @@ -211,7 +211,7 @@ public class ItemNpcSpawner extends Item // subItems.add(new ItemStack(itemIn, 1, 0)); // } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), "npc_spawner", "npc_spawner_overlay"); } } diff --git a/common/src/main/java/common/item/ItemPiston.java b/common/src/main/java/common/item/ItemPiston.java index 1b83d880..7e758130 100755 --- a/common/src/main/java/common/item/ItemPiston.java +++ b/common/src/main/java/common/item/ItemPiston.java @@ -16,7 +16,7 @@ public class ItemPiston extends ItemBlock * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is * placed as a Block (mostly used with ItemBlocks). */ - public int getMetadata(int damage) + public int getMetadata() { return 7; } @@ -25,7 +25,7 @@ public class ItemPiston extends ItemBlock return true; } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(provider.getModel("piston_side").add().nswe().d("piston_bottom").u("piston_top" + (this.block == Blocks.sticky_piston ? "_sticky" : "")), this.getTransform()); } diff --git a/common/src/main/java/common/item/ItemPotion.java b/common/src/main/java/common/item/ItemPotion.java index 29a9c7bd..8aba65f0 100755 --- a/common/src/main/java/common/item/ItemPotion.java +++ b/common/src/main/java/common/item/ItemPotion.java @@ -1,5 +1,6 @@ package common.item; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -20,60 +21,41 @@ import common.world.World; public class ItemPotion extends Item { - private Map> effectCache = Maps.>newHashMap(); + private static final Map POTIONS = Maps.newTreeMap(); private static final Map, Integer> SUB_ITEMS_CACHE = Maps., Integer>newLinkedHashMap(); + + private final int data; + + private List effectCache; + + public static ItemPotion getPotionItem(int data) { + return POTIONS.getOrDefault(data, (data & 16384) != 0 ? Items.splash_potion : Items.potion); + } + + public static Collection getPotions() { + return POTIONS.values(); + } - public ItemPotion() + public ItemPotion(int data) { - this.setMaxStackSize(1); - this.setHasSubtypes(true); - this.setMaxDamage(0); + this.data = data; + this.setMaxAmount(1); this.setTab(CheatTab.MAGIC); this.setColor(TextColor.ORK); + POTIONS.put(data, this); + } + + public int getPotionData() { + return this.data; } - public List getEffects(ItemStack stack) + public List getEffects() { -// if (stack.hasTagCompound() && stack.getTagCompound().hasList("CustomPotionEffects")) -// { -// List list1 = Lists.newArrayList(); -// NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10); -// -// for (int i = 0; i < nbttaglist.tagCount(); ++i) -// { -// NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); -// PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound); -// -// if (potioneffect != null) -// { -// list1.add(potioneffect); -// } -// } -// -// return list1; -// } -// else -// { - List list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata())); + List list = this.effectCache; if (list == null) { - list = PotionHelper.getPotionEffects(stack.getMetadata()); - this.effectCache.put(Integer.valueOf(stack.getMetadata()), list); - } - - return list; -// } - } - - public List getEffects(int meta) - { - List list = (List)this.effectCache.get(Integer.valueOf(meta)); - - if (list == null) - { - list = PotionHelper.getPotionEffects(meta); - this.effectCache.put(Integer.valueOf(meta), list); + list = this.effectCache = PotionHelper.getPotionEffects(this.data); } return list; @@ -92,7 +74,7 @@ public class ItemPotion extends Item if (!worldIn.client) { - List list = this.getEffects(stack); + List list = this.getEffects(); if (list != null) { @@ -142,7 +124,7 @@ public class ItemPotion extends Item */ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) { - if (isSplash(itemStackIn.getMetadata())) + if (this.isSplashPotion()) { // if (!playerIn.creative) // { @@ -165,28 +147,24 @@ public class ItemPotion extends Item return itemStackIn; } } - - /** - * returns wether or not a potion is a throwable splash potion based on damage value - */ - public static boolean isSplash(int meta) - { - return (meta & 16384) != 0; + + public boolean isSplashPotion() { + return (this.data & 16384) != 0; } - public int getColorFromDamage(int meta) + public int getColorFromDamage() { - return PotionHelper.getLiquidColor(meta); + return PotionHelper.getLiquidColor(this.data); } public int getColorFromItemStack(ItemStack stack, int renderPass) { - return renderPass > 0 ? 16777215 : this.getColorFromDamage(stack.getMetadata()); + return renderPass > 0 ? 16777215 : this.getColorFromDamage(); } - public boolean isEffectInstant(int meta) + public boolean isEffectInstant() { - List list = this.getEffects(meta); + List list = this.getEffects(); if (list != null && !list.isEmpty()) { @@ -208,20 +186,20 @@ public class ItemPotion extends Item public String getDisplay(ItemStack stack) { - if ((stack.getMetadata() & 16383) == 0) + if ((this.data & 16383) == 0) { - return (isSplash(stack.getMetadata()) ? "Werfbare " : "") + "Wasserflasche"; + return (this.isSplashPotion() ? "Werfbare " : "") + "Wasserflasche"; } else { String s = ""; - if (isSplash(stack.getMetadata())) + if (this.isSplashPotion()) { s = "Werfbarer "; } - List list = Items.potion.getEffects(stack); + List list = this.getEffects(); if (list != null && !list.isEmpty()) { @@ -231,7 +209,7 @@ public class ItemPotion extends Item } else { - String s1 = PotionHelper.getPotionPrefix(stack.getMetadata()); + String s1 = PotionHelper.getPotionPrefix(this.data); return s1.trim() + " " + super.getDisplay(stack); } } @@ -242,9 +220,9 @@ public class ItemPotion extends Item */ public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { - if ((stack.getMetadata() & 16383) != 0) + if ((this.data & 16383) != 0) { - List list = Items.potion.getEffects(stack); + List list = this.getEffects(); List implications = Lists.newArrayList(); if (list != null && !list.isEmpty()) @@ -289,17 +267,25 @@ public class ItemPotion extends Item public boolean hasEffect(ItemStack stack) { - List list = this.getEffects(stack); + List list = this.getEffects(); return list != null && !list.isEmpty(); } + + public static String getPotionName(ItemPotion potion) { //TODO: fix potion names + if((potion.getPotionData() & 16383) == 0) + return potion.isSplashPotion() ? "splash_potion" : "potion"; + List list = potion.getEffects(); + if(list == null || list.isEmpty()) + return (potion.isSplashPotion() ? "splash_potion_" : "potion_") + PotionHelper.getPotionPrefixIndex(potion.getPotionData()); + PotionEffect effect = list.get(0); + return (potion.isSplashPotion() ? "splash_potion_" : "potion_") + effect.getPotion().getName() + (effect.getAmplifier() == 0 ? "" : "_" + (effect.getAmplifier() + 1)) + (effect.getPotion().isInstant() ? "" : "_" + effect.getDuration()); + } - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - public void getSubItems(Item itemIn, CheatTab tab, List subItems) + public static List getValidDataValues() { - super.getSubItems(itemIn, tab, subItems); - subItems.add(new ItemStack(itemIn, 1, 16384)); + List data = Lists.newArrayList(); + data.add(0); + data.add(16384); if (SUB_ITEMS_CACHE.isEmpty()) { @@ -350,47 +336,28 @@ public class ItemPotion extends Item while (iterator.hasNext()) { int j1 = ((Integer)iterator.next()).intValue(); - subItems.add(new ItemStack(itemIn, 1, j1)); + data.add(j1); } + + return data; } -// public Set getValidTags() { -// return Sets.newHashSet("CustomPotionEffects"); -// } - -// public boolean validateNbt(NBTTagCompound tag, boolean adv) { -// if(tag.hasKey("CustomPotionEffects")) { -// if(!adv) { -// return false; -// } -// if(!tag.hasList("CustomPotionEffects")) { -// return false; -// } -// NBTTagList effects = tag.getTagList("CustomPotionEffects", 10); -// if(effects.hasNoTags()) { -// return false; -// } -// } -// return true; -// } - public ItemMeshDefinition getMesher() { return new ItemMeshDefinition() { public String getModelLocation(ItemStack stack) { - return ItemPotion.isSplash(stack.getMetadata()) ? ("item/potion#16384" + '#' + "inventory") : ("item/potion#0" + '#' + "inventory"); + return ItemPotion.this.isSplashPotion() ? ("item/splash_potion" + '#' + "inventory") : ("item/potion" + '#' + "inventory"); } }; } public void getRenderItems(Item itemIn, List subItems) { - subItems.add(new ItemStack(itemIn, 1, 0)); - subItems.add(new ItemStack(itemIn, 1, 16384)); + if(this.data == 0 || this.data == 16384) + super.getRenderItems(itemIn, subItems); } - public Model getModel(ModelProvider provider, String name, int meta) { - return provider.getModel(this.getTransform(), "potion_overlay", - isSplash(meta) ? "potion_bottle_splash" : "potion_bottle_drinkable"); + public Model getModel(ModelProvider provider, String name) { + return provider.getModel(this.getTransform(), "potion_overlay", this.isSplashPotion() ? "potion_bottle_splash" : "potion_bottle_drinkable"); } } diff --git a/common/src/main/java/common/item/ItemPressurePlate.java b/common/src/main/java/common/item/ItemPressurePlate.java index e644b4b5..3338435c 100755 --- a/common/src/main/java/common/item/ItemPressurePlate.java +++ b/common/src/main/java/common/item/ItemPressurePlate.java @@ -10,7 +10,7 @@ public class ItemPressurePlate extends ItemBlock { super(block); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(provider.getModel(((BlockBasePressurePlate)this.block).getTexture()) .add(1, 6, 1, 15, 10, 15) .d().uv(1, 1, 15, 15).noCull() diff --git a/common/src/main/java/common/item/ItemRecord.java b/common/src/main/java/common/item/ItemRecord.java index d43a90ef..5f5f032f 100755 --- a/common/src/main/java/common/item/ItemRecord.java +++ b/common/src/main/java/common/item/ItemRecord.java @@ -8,7 +8,7 @@ public class ItemRecord extends Item { this.setTab(CheatTab.MISC); } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel(this.getTransform(), "record_old"); } } diff --git a/common/src/main/java/common/item/ItemSaddle.java b/common/src/main/java/common/item/ItemSaddle.java index be30a91d..b25254d5 100755 --- a/common/src/main/java/common/item/ItemSaddle.java +++ b/common/src/main/java/common/item/ItemSaddle.java @@ -8,7 +8,7 @@ public class ItemSaddle extends Item { public ItemSaddle() { - this.maxStackSize = 1; + this.setMaxAmount(1); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/ItemShears.java b/common/src/main/java/common/item/ItemShears.java index b3e3556b..d82b517e 100755 --- a/common/src/main/java/common/item/ItemShears.java +++ b/common/src/main/java/common/item/ItemShears.java @@ -14,7 +14,6 @@ public class ItemShears extends Item public ItemShears(ToolMaterial material) { - this.setMaxStackSize(1); this.setMaxDamage(material.getDurability() - 12); this.setTab(CheatTab.TOOLS); this.material = material; diff --git a/common/src/main/java/common/item/ItemSlab.java b/common/src/main/java/common/item/ItemSlab.java index e30370b7..043a0cc3 100755 --- a/common/src/main/java/common/item/ItemSlab.java +++ b/common/src/main/java/common/item/ItemSlab.java @@ -16,8 +16,6 @@ public class ItemSlab extends ItemBlock { super(slab); this.slab = slab; -// this.setMaxDamage(0); -// this.setHasSubtypes(true); } // /** diff --git a/common/src/main/java/common/item/ItemSnow.java b/common/src/main/java/common/item/ItemSnow.java index f19ba090..a1bb1954 100755 --- a/common/src/main/java/common/item/ItemSnow.java +++ b/common/src/main/java/common/item/ItemSnow.java @@ -14,13 +14,8 @@ public class ItemSnow extends ItemBlock public ItemSnow(Block block) { super(block); - this.setMaxDamage(0); - this.setHasSubtypes(true); } - /** - * Called when a Block is right-clicked with this Item - */ public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { if (stack.size == 0) @@ -65,13 +60,4 @@ public class ItemSnow extends ItemBlock return super.onItemUse(stack, playerIn, worldIn, blockpos, side, hitX, hitY, hitZ); } } - - /** - * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is - * placed as a Block (mostly used with ItemBlocks). - */ - public int getMetadata(int damage) - { - return damage; - } } diff --git a/common/src/main/java/common/item/ItemSoup.java b/common/src/main/java/common/item/ItemSoup.java index daf6ebaa..39d7c223 100755 --- a/common/src/main/java/common/item/ItemSoup.java +++ b/common/src/main/java/common/item/ItemSoup.java @@ -10,7 +10,7 @@ public class ItemSoup extends ItemFood public ItemSoup(int healAmount) { super(healAmount, false); - this.setMaxStackSize(1); + this.setMaxAmount(1); } /** diff --git a/common/src/main/java/common/item/ItemSpaceNavigator.java b/common/src/main/java/common/item/ItemSpaceNavigator.java index eb3841f6..14633f63 100755 --- a/common/src/main/java/common/item/ItemSpaceNavigator.java +++ b/common/src/main/java/common/item/ItemSpaceNavigator.java @@ -25,7 +25,7 @@ public class ItemSpaceNavigator extends ItemMagnetic { } public ItemSpaceNavigator() { - this.setMaxStackSize(1); + this.setMaxAmount(1); this.setColor(TextColor.DGREEN); } diff --git a/common/src/main/java/common/item/ItemStack.java b/common/src/main/java/common/item/ItemStack.java index abe7cbb5..6baa83f1 100755 --- a/common/src/main/java/common/item/ItemStack.java +++ b/common/src/main/java/common/item/ItemStack.java @@ -15,7 +15,6 @@ import common.enchantment.Enchantment; import common.enchantment.EnchantmentHelper; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.init.BlockRegistry; import common.init.ItemRegistry; import common.rng.Random; import common.tags.TagObject; @@ -26,12 +25,11 @@ import common.world.World; public final class ItemStack { public static final int MAX_SIZE = 67108864; - public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); + private static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); public int size; private Item item; private TagObject tag; - private int meta; public ItemStack(Block block) { @@ -40,12 +38,7 @@ public final class ItemStack public ItemStack(Block block, int amount) { - this(block, amount, 0); - } - - public ItemStack(Block block, int amount, int meta) - { - this(ItemRegistry.getItemFromBlock(block), amount, meta); + this(ItemRegistry.getItemFromBlock(block), amount); } public ItemStack(Item item) @@ -55,23 +48,8 @@ public final class ItemStack public ItemStack(Item item, int amount) { - this(item, amount, 0); - } - - public ItemStack(Item item, int amount, int meta) - { -// this.canDestroyCacheBlock = null; -// this.canDestroyCacheResult = false; -// this.canPlaceOnCacheBlock = null; -// this.canPlaceOnCacheResult = false; this.item = item; this.size = amount; - this.meta = meta; - - if (this.meta < 0) - { - this.meta = 0; - } } public static String formatAmount(int amount) { @@ -100,10 +78,6 @@ public final class ItemStack private ItemStack() { -// this.canDestroyCacheBlock = null; -// this.canDestroyCacheResult = false; -// this.canPlaceOnCacheBlock = null; -// this.canPlaceOnCacheResult = false; } /** @@ -111,7 +85,7 @@ public final class ItemStack */ public ItemStack splitStack(int amount) { - ItemStack itemstack = new ItemStack(this.item, amount, this.meta); + ItemStack itemstack = new ItemStack(this.item, amount); if (this.tag != null) { @@ -168,136 +142,70 @@ public final class ItemStack return this.getItem().onItemUseFinish(this, worldIn, playerIn); } - /** - * Write the stack fields to a object. Return the new object. - */ public TagObject writeTags(TagObject tag) { - String resourcelocation = ItemRegistry.getNameFromItem(this.item); - tag.setString("id", resourcelocation == null ? "air" : resourcelocation.toString()); - tag.setInt("Count", this.size); - tag.setShort("Damage", (short)this.meta); - - if (this.tag != null) - { - tag.setObject("tag", this.tag); - } - + if(this.tag != null) + tag.merge(this.tag); + tag.setString("id", this.item == null ? "air" : ItemRegistry.getNameFromItem(this.item)); + tag.setInt("size", this.size); return tag; } - /** - * Read the stack fields from a object. - */ - public void readTags(TagObject tag) + private void readTags(TagObject tag) { - if (tag.hasString("id")) - { - this.item = ItemRegistry.getRegisteredItem(tag.getString("id")); - } - else - { - this.item = ItemRegistry.getItemById(tag.getShort("id")); - } - - this.size = tag.getInt("Count"); - this.meta = tag.getShort("Damage"); - - if (this.meta < 0) - { - this.meta = 0; - } - - if (tag.hasObject("tag")) - { - this.tag = tag.getObject("tag"); - - if (this.item != null) - { - this.item.updateItemStackNBT(this.tag); - } - } + if(!tag.hasString("id") || !tag.hasInt("size")) + return; + this.item = ItemRegistry.getRegisteredItem(tag.getString("id")); + this.size = tag.getInt("size"); + tag.remove("id"); + tag.remove("size"); + if(!tag.isEmpty()) + this.tag = tag; } - /** - * Returns maximum size of the stack. - */ public int getMaxStackSize() { return this.getItem().getItemStackLimit(); } - /** - * Returns true if the ItemStack can hold 2 or more units of the item. - */ public boolean isStackable() { return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged()); } - /** - * true if this itemStack is damageable - */ public boolean isItemStackDamageable() { return this.item != null && this.item.getMaxDamage() > 0; } - -// public void setItemStackDamageable(boolean breakable) -// { -// if(!breakable) { -// if(this.stackTagCompound == null) { -// this.setTagCompound(new TagObject()); -// } -// this.stackTagCompound.setBoolean("Unbreakable", true); -// this.setItemDamage(0); -// } -// else { -// if(this.stackTagCompound != null) { -// this.stackTagCompound.removeTag("Unbreakable"); -// if(this.stackTagCompound.hasNoTags()) { -// this.stackTagCompound = null; -// } -// } -// } -// } - public boolean getHasSubtypes() - { - return this.item.getHasSubtypes(); - } - - /** - * returns true when a damageable item is damaged - */ public boolean isItemDamaged() { - return this.isItemStackDamageable() && this.meta > 0; + return this.isItemStackDamageable() && this.getItemDamage() > 0; } public int getItemDamage() { - return this.meta; + return this.isItemStackDamageable() && this.tag != null && this.tag.hasInt("dmg") ? this.tag.getInt("dmg") : 0; } - public int getMetadata() + public void setItemDamage(int damage) { - return this.meta; + if(!this.isItemStackDamageable()) + return; + if(damage <= 0) { + if(this.tag != null) { + this.tag.remove("dmg"); + if(this.tag.isEmpty()) + this.tag = null; + } + } + else { + if(this.tag == null) + this.tag = new TagObject(); + this.tag.setInt("dmg", damage); + } } - public void setItemDamage(int meta) - { - this.meta = meta; - - if (this.meta < 0) - { - this.meta = 0; - } - } - - /** - * Returns the max damage an item in the stack can take. - */ public int getMaxDamage() { return this.item.getMaxDamage(); @@ -338,18 +246,14 @@ public final class ItemStack } } - this.meta += amount; - return this.meta > this.getMaxDamage(); + int damage = this.getItemDamage() + amount; + this.setItemDamage(damage); + return damage > this.getMaxDamage(); } } - /** - * Damages the item in the ItemStack - */ public void damageItem(int amount, EntityLiving entityIn) { -// if (!(entityIn.isPlayer()) || !((EntityNPC)entityIn).creative) -// { if (this.isItemStackDamageable()) { if (this.attemptDamageItem(amount, entityIn.getRNG())) @@ -360,7 +264,6 @@ public final class ItemStack if (entityIn.isPlayer()) { EntityNPC entityplayer = (EntityNPC)entityIn; -// entityplayer.triggerAchievement(StatRegistry.objectBreakStats[ItemRegistry.getIdFromItem(this.item)]); if (this.size == 0 && this.getItem() instanceof ItemBow) { @@ -373,10 +276,9 @@ public final class ItemStack this.size = 0; } - this.meta = 0; + this.setItemDamage(0); } } -// } } /** @@ -418,12 +320,9 @@ public final class ItemStack return this.item.itemInteractionForEntity(this, playerIn, entityIn); } - /** - * Returns a new stack with the same properties. - */ public ItemStack copy() { - ItemStack itemstack = new ItemStack(this.item, this.size, this.meta); + ItemStack itemstack = new ItemStack(this.item, this.size); if (this.tag != null) { @@ -451,7 +350,7 @@ public final class ItemStack */ private boolean isItemStackEqual(ItemStack other) { - return this.size != other.size ? false : (this.item != other.item ? false : (this.meta != other.meta ? false : (this.tag == null && other.tag != null ? false : this.tag == null || this.tag.equals(other.tag)))); + return this.size != other.size ? false : (this.item != other.item ? false : (this.tag == null && other.tag != null ? false : this.tag == null || this.tag.equals(other.tag))); } /** @@ -468,7 +367,7 @@ public final class ItemStack */ public boolean isItemEqual(ItemStack other) { - return other != null && this.item == other.item && this.meta == other.meta; + return other != null && this.item == other.item; } // public String getUnlocalizedName() @@ -579,29 +478,18 @@ public final class ItemStack return this.tag == null ? null : this.tag.getList("ench"); } - /** - * Assigns a NBTTagCompound to the ItemStack, does not validate that only non-stackable items can have it. - */ public void setTagCompound(TagObject nbt) { this.tag = nbt; } - /** - * returns the display name of the itemstack - */ public String getDisplayName() { String s = this.getItem().getDisplay(this); if (this.tag != null && this.tag.hasString("Name")) { -// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); -// -// if (nbttagcompound.hasString("Name")) -// { s = this.tag.getString("Name"); -// } } return s; @@ -622,131 +510,26 @@ public final class ItemStack this.tag = new TagObject(); } -// if (!this.stackTagCompound.hasTag("display")) -// { -// this.stackTagCompound.setTag("display", new NBTTagCompound()); -// } - this.tag.setString("Name", displayName); return this; } -// public ItemStack setStackLore(String displayLore) -// { -// if (this.stackTagCompound == null) -// { -// this.stackTagCompound = new NBTTagCompound(); -// } -// -// if (!this.stackTagCompound.hasTag("display")) -// { -// this.stackTagCompound.setTag("display", new NBTTagCompound()); -// } -// -// NBTTagList nbttaglist = new NBTTagList(); -// for(String s : displayLore.split("\\n")) { -// nbttaglist.appendTag(new NBTTagString(s)); -// } -// this.stackTagCompound.getCompoundTag("display").setTag("Lore", nbttaglist); -// return this; -// } -// -// public String getStackLore() -// { -// if (this.stackTagCompound == null) -// { -// return null; -// } -// -// if (!this.stackTagCompound.hasTag("display")) -// { -// return null; -// } -// -// NBTTagList nbttaglist = this.stackTagCompound.getCompoundTag("display").getTagList("Lore", 8); -// StringBuilder sb = new StringBuilder(); -// for(int z = 0; z < nbttaglist.tagCount(); z++) { -// if(sb.length() > 0) { -// sb.append("\n"); -// } -// sb.append(nbttaglist.getStringTagAt(z)); -// } -// return sb.toString(); -// } - -// public ItemStack setStackFlags(int flags) -// { -// if(flags != 0) { -// if (this.stackTagCompound == null) -// { -// this.stackTagCompound = new NBTTagCompound(); -// } -// -// this.stackTagCompound.setInteger("HideFlags", flags); -// } -// else { -// if (this.stackTagCompound != null) -// { -// this.stackTagCompound.removeTag("HideFlags"); -// if (this.stackTagCompound.hasNoTags()) -// { -// this.setTagCompound((NBTTagCompound)null); -// } -// } -// } -// return this; -// } - - /** - * Clear any custom name set for this ItemStack - */ public void clearCustomName() { if (this.tag != null) { if (this.tag.hasString("Name")) { -// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); this.tag.remove("Name"); if (this.tag.isEmpty()) { -// this.stackTagCompound.removeTag("display"); -// -// if (this.stackTagCompound.hasNoTags()) -// { this.setTagCompound(null); -// } } } } } -// public void clearLore() -// { -// if (this.stackTagCompound != null) -// { -// if (this.stackTagCompound.hasTag("display")) -// { -// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); -// nbttagcompound.removeTag("Lore"); -// -// if (nbttagcompound.hasNoTags()) -// { -// this.stackTagCompound.removeTag("display"); -// -// if (this.stackTagCompound.hasNoTags()) -// { -// this.setTagCompound((NBTTagCompound)null); -// } -// } -// } -// } -// } - - /** - * Returns true if the itemstack has a display name - */ public boolean hasDisplayName() { return this.tag != null && this.tag.hasString("Name"); @@ -756,59 +539,14 @@ public final class ItemStack { List list = Lists.newArrayList(); String s = this.getColoredName(); - -// if (this.hasDisplayName()) -// { -// s = ChatFormat.ITALIC + s; -// } - if(this.size != 1) s = TextColor.YELLOW + "" + this.size + " " + TextColor.RESET + s; - s = s + TextColor.RESET; - -// if (advanced) -// { - String s1 = ""; - - if (this.getHasSubtypes()) - { - s1 = s1 + String.format("%d", this.meta); - } -// else -// { -// s = s + String.format("#%04d", i); -// } - - if (s1.length() > 0) - { - s = s + " (" + s1 + ")"; - } - -// s = s + s1; -// } -// else if (!this.hasDisplayName() && this.item == Items.filled_map) -// { -// s = s + " #" + this.itemDamage; -// } - list.add(s); -// int i1 = 0; -// -// if (this.hasTagCompound() && this.stackTagCompound.hasKey("HideFlags", 99)) -// { -// i1 = this.stackTagCompound.getInteger("HideFlags"); -// } - -// if ((i1 & 32) == 0) -// { this.item.addInformation(this, playerIn, list); -// } if (this.hasTagCompound()) { -// if ((i1 & 1) == 0) -// { List nbttaglist = this.getEnchantmentTagList(); if (nbttaglist != null) @@ -824,37 +562,6 @@ public final class ItemStack } } } -// } - -// if (this.stackTagCompound.hasTag("display")) -// { -// NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); -// -// if (nbttagcompound.hasInt("color")) -// { -// if (advanced) -// { -// list.add("Color: #" + Integer.toHexString(nbttagcompound.getInteger("color")).toUpperCase()); -// } -// else -// { -// list.add(ChatFormat.ITALIC + I18n.translate("item.dyed")); -// } -// } -// -//// if (nbttagcompound.getTagId("Lore") == 9) -//// { -//// NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); -//// -//// if (nbttaglist1.tagCount() > 0) -//// { -//// for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) -//// { -//// list.add(ChatFormat.DARK_PURPLE + "" + ChatFormat.ITALIC + nbttaglist1.getStringTagAt(j1)); -//// } -//// } -//// } -// } } int damage = this.item.getAttackDamageBonus(); @@ -890,58 +597,6 @@ public final class ItemStack } } -// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanDestroy") && (i1 & 8) == 0) -// { -// NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanDestroy", 8); -// -// if (nbttaglist2.tagCount() > 0) -// { -// list.add(""); -// list.add(ChatFormat.GRAY + I18n.formatKey("item.canBreak")); -// -// for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1) -// { -// Block block = BlockRegistry.getByIdFallback(nbttaglist2.getStringTagAt(k1)); -// -// if (block != null) -// { -// list.add(ChatFormat.DARK_GRAY + block.getLocalizedName()); -// } -// else -// { -// list.add(ChatFormat.DARK_GRAY + "missingno"); -// } -// } -// } -// } -// -// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanPlaceOn") && (i1 & 16) == 0) -// { -// NBTTagList nbttaglist3 = this.stackTagCompound.getTagList("CanPlaceOn", 8); -// -// if (nbttaglist3.tagCount() > 0) -// { -// list.add(""); -// list.add(ChatFormat.GRAY + I18n.formatKey("item.canPlace")); -// -// for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1) -// { -// Block block1 = BlockRegistry.getByIdFallback(nbttaglist3.getStringTagAt(l1)); -// -// if (block1 != null) -// { -// list.add(ChatFormat.DARK_GRAY + block1.getLocalizedName()); -// } -// else -// { -// list.add(ChatFormat.DARK_GRAY + "missingno"); -// } -// } -// } -// } - -// if (advanced) -// { if (this.isItemStackDamageable()) { list.add(String.format("Haltbarkeit: %d" + (this.isItemDamaged() ? " / %d" : ""), @@ -957,7 +612,6 @@ public final class ItemStack { list.add(TextColor.GRAY + String.format("NBT-Tags: %d", this.getTagCompound().keySet().size())); } -// } return list; } @@ -1085,46 +739,11 @@ public final class ItemStack this.tag.setList(key, value); } -// public boolean canEditBlocks() -// { -// return this.getItem().canItemEditBlocks(); -// } - - /** - * Return whether this stack is on an item frame. - */ -// public boolean isOnItemFrame() -// { -// return this.itemFrame != null; -// } -// -// /** -// * Set the item frame this stack is on. -// */ -// public void setItemFrame(EntityFrame frame) -// { -// this.itemFrame = frame; -// } -// -// /** -// * Return the item frame this stack is on. Returns null if not on an item frame. -// */ -// public EntityFrame getItemFrame() -// { -// return this.itemFrame; -// } - - /** - * Get this stack's repair cost, or 0 if no repair cost is defined. - */ public int getRepairCost() { return this.hasTagCompound() && this.tag.hasInt("RepairCost") ? this.tag.getInt("RepairCost") : 0; } - /** - * Set this stack's repair cost. - */ public void setRepairCost(int cost) { if(cost == 0) { @@ -1159,74 +778,4 @@ public final class ItemStack { this.item = newItem; } - -// public boolean canDestroy(Block blockIn) -// { -// if (blockIn == this.canDestroyCacheBlock) -// { -// return this.canDestroyCacheResult; -// } -// else -// { -// this.canDestroyCacheBlock = blockIn; -// -// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanDestroy")) -// { -// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanDestroy", 8); -// -// for (int i = 0; i < nbttaglist.tagCount(); ++i) -// { -// Block block = BlockRegistry.getByIdFallback(nbttaglist.getStringTagAt(i)); -// -// if (block == blockIn) -// { -// this.canDestroyCacheResult = true; -// return true; -// } -// } -// } -// -// this.canDestroyCacheResult = false; -// return false; -// } -// } - -// public boolean canPlaceOn(Block blockIn) -// { -// if (blockIn == this.canPlaceOnCacheBlock) -// { -// return this.canPlaceOnCacheResult; -// } -// else -// { -// this.canPlaceOnCacheBlock = blockIn; -// -// if (this.hasTagCompound() && this.stackTagCompound.hasList("CanPlaceOn")) -// { -// NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanPlaceOn", 8); -// -// for (int i = 0; i < nbttaglist.tagCount(); ++i) -// { -// Block block = BlockRegistry.getByIdFallback(nbttaglist.getStringTagAt(i)); -// -// if (block == blockIn) -// { -// this.canPlaceOnCacheResult = true; -// return true; -// } -// } -// } -// -// this.canPlaceOnCacheResult = false; -// return false; -// } -// } - -// public boolean validate() { -// return this.item != null && this.item.validate(this); -// } - -// public StackID getStackId() { -// return new StackID(this); -// } } diff --git a/common/src/main/java/common/item/ItemSword.java b/common/src/main/java/common/item/ItemSword.java index 2a741fa3..ea1610a3 100755 --- a/common/src/main/java/common/item/ItemSword.java +++ b/common/src/main/java/common/item/ItemSword.java @@ -18,7 +18,6 @@ public class ItemSword extends Item public ItemSword(ToolMaterial material) { this.material = material; - this.maxStackSize = 1; this.setMaxDamage(material.getDurability()); this.setTab(CheatTab.COMBAT); this.attackDamage = 4 + material.getDamage(); diff --git a/common/src/main/java/common/item/ItemTNT.java b/common/src/main/java/common/item/ItemTNT.java deleted file mode 100755 index 6aa1b7de..00000000 --- a/common/src/main/java/common/item/ItemTNT.java +++ /dev/null @@ -1,28 +0,0 @@ -package common.item; - -import common.block.Block; -import common.color.TextColor; - -public class ItemTNT extends ItemBlock -{ - private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII"}; - - public ItemTNT(Block block) - { - super(block); - this.setMaxDamage(0); - this.setHasSubtypes(true); - this.setColor(TextColor.RED); - } - - public int getMetadata(int damage) - { - return (damage & 7) << 1; - } - - public String getDisplay(ItemStack stack) - { - int exp = stack.getMetadata() & 7; - return super.getDisplay(stack) + (exp == 0 ? "" : " " + TIERS[exp-1]); - } -} diff --git a/common/src/main/java/common/item/ItemTool.java b/common/src/main/java/common/item/ItemTool.java index 28e0768f..b287c04c 100755 --- a/common/src/main/java/common/item/ItemTool.java +++ b/common/src/main/java/common/item/ItemTool.java @@ -14,7 +14,6 @@ public abstract class ItemTool extends Item { public ItemTool(int damage, ToolMaterial material) { this.material = material; - this.maxStackSize = 1; this.setMaxDamage(material.getDurability()); this.efficiency = material.getEfficiency(); this.damage = damage + material.getDamage(); diff --git a/common/src/main/java/common/item/ItemWall.java b/common/src/main/java/common/item/ItemWall.java index 9e138fdc..50b9893c 100755 --- a/common/src/main/java/common/item/ItemWall.java +++ b/common/src/main/java/common/item/ItemWall.java @@ -1,20 +1,20 @@ package common.item; -import java.util.function.Function; - -import common.block.Block; import common.block.artificial.BlockWall; import common.model.Model; import common.model.ModelProvider; -public class ItemWall extends ItemMultiTexture { - public ItemWall(Block block, Block block2, Function nameFunction) { - super(block, block2, nameFunction); +public class ItemWall extends ItemBlock { + private final BlockWall wallBlock; + + public ItemWall(BlockWall block) { + super(block); + this.wallBlock = block; } - public Model getModel(ModelProvider provider, String name, int meta) { + public Model getModel(ModelProvider provider, String name) { return provider.getModel( - provider.getModel(this.block.getStateFromMeta(this.getMetadata(meta)).getValue(BlockWall.VARIANT).getName()) + provider.getModel(this.wallBlock.getTexture()) .add(4, 0, 4, 12, 16, 12) .d().uv(4, 4, 12, 12) .u().uv(4, 4, 12, 12).noCull() diff --git a/common/src/main/java/common/item/ItemWand.java b/common/src/main/java/common/item/ItemWand.java index f0a494d0..c5a2017a 100755 --- a/common/src/main/java/common/item/ItemWand.java +++ b/common/src/main/java/common/item/ItemWand.java @@ -14,7 +14,7 @@ import common.world.AWorldServer; public abstract class ItemWand extends Item { public ItemWand() { - this.maxStackSize = 1; + this.setMaxAmount(1); this.setTab(CheatTab.TOOLS); } diff --git a/common/src/main/java/common/item/ItemWeatherToken.java b/common/src/main/java/common/item/ItemWeatherToken.java index bff9568e..a0937dd2 100755 --- a/common/src/main/java/common/item/ItemWeatherToken.java +++ b/common/src/main/java/common/item/ItemWeatherToken.java @@ -12,7 +12,7 @@ public class ItemWeatherToken extends ItemMagnetic { public ItemWeatherToken(Weather weather) { this.weather = weather; - this.setMaxStackSize(1); + this.setMaxAmount(1); this.setColor(TextColor.VIOLET); } diff --git a/common/src/main/java/common/item/RngLoot.java b/common/src/main/java/common/item/RngLoot.java index b8c9c4e2..1a61cd2e 100755 --- a/common/src/main/java/common/item/RngLoot.java +++ b/common/src/main/java/common/item/RngLoot.java @@ -14,10 +14,10 @@ public class RngLoot extends RngItem private int minStackSize; private int maxStackSize; - public RngLoot(Item item, int amount, int min, int max, int weight) + public RngLoot(Item item, int min, int max, int weight) { super(weight); - this.item = new ItemStack(item, 1, amount); + this.item = new ItemStack(item); this.minStackSize = min; this.maxStackSize = max; } diff --git a/common/src/main/java/common/network/PacketBuffer.java b/common/src/main/java/common/network/PacketBuffer.java index 5de7b2f3..9adf71bd 100755 --- a/common/src/main/java/common/network/PacketBuffer.java +++ b/common/src/main/java/common/network/PacketBuffer.java @@ -119,7 +119,6 @@ public class PacketBuffer { } this.writeShort(ItemRegistry.getIdFromItem(stack.getItem())); this.writeVarInt(stack.size); - this.writeShort(stack.getMetadata()); this.writeTag(stack.getTagCompound()); } @@ -128,8 +127,7 @@ public class PacketBuffer { if(id < 0) return null; int amt = this.readVarInt(); - int meta = this.readShort(); - ItemStack stack = new ItemStack(ItemRegistry.getItemById(id), amt, meta); + ItemStack stack = new ItemStack(ItemRegistry.getItemById(id), amt); stack.setTagCompound(this.readTag()); return stack; } diff --git a/common/src/main/java/common/properties/IProperty.java b/common/src/main/java/common/properties/IProperty.java deleted file mode 100755 index af1e3889..00000000 --- a/common/src/main/java/common/properties/IProperty.java +++ /dev/null @@ -1,17 +0,0 @@ -package common.properties; - -import java.util.Collection; - -public interface IProperty> -{ - String getName(); - - Collection getAllowedValues(); - - Class getValueClass(); - - /** - * Get the name for the given value. - */ - String getName(T value); -} diff --git a/common/src/main/java/common/properties/Property.java b/common/src/main/java/common/properties/Property.java new file mode 100755 index 00000000..3331a098 --- /dev/null +++ b/common/src/main/java/common/properties/Property.java @@ -0,0 +1,38 @@ +package common.properties; + +import java.util.Collection; + +public abstract class Property> { + private final Class type; + private final String name; + + protected Property(String name, Class type) { + this.type = type; + this.name = name; + } + + public String getName() { + return this.name; + } + + public Class getType() { + return this.type; + } + + public abstract Collection getStates(); + public abstract String getName(T value); + + public boolean equals(Object obj) { + if(this == obj) + return true; + if(obj != null && this.getClass() == obj.getClass()) { + Property other = (Property)obj; + return this.type.equals(other.type) && this.name.equals(other.name); + } + return false; + } + + public int hashCode() { + return 31 * this.type.hashCode() + this.name.hashCode(); + } +} diff --git a/common/src/main/java/common/properties/PropertyBool.java b/common/src/main/java/common/properties/PropertyBool.java index 2db7c379..66c7599b 100755 --- a/common/src/main/java/common/properties/PropertyBool.java +++ b/common/src/main/java/common/properties/PropertyBool.java @@ -4,30 +4,22 @@ import java.util.Collection; import common.collect.ImmutableSet; -public class PropertyBool extends PropertyHelper -{ - private final ImmutableSet allowedValues = ImmutableSet.of(Boolean.valueOf(true), Boolean.valueOf(false)); +public class PropertyBool extends Property { + private final ImmutableSet bools = ImmutableSet.of(true, false); - protected PropertyBool(String name) - { - super(name, Boolean.class); - } + public static PropertyBool create(String name) { + return new PropertyBool(name); + } - public Collection getAllowedValues() - { - return this.allowedValues; - } + private PropertyBool(String name) { + super(name, Boolean.class); + } - public static PropertyBool create(String name) - { - return new PropertyBool(name); - } + public Collection getStates() { + return this.bools; + } - /** - * Get the name for the given value. - */ - public String getName(Boolean value) - { - return value.toString(); - } + public String getName(Boolean value) { + return value.toString(); + } } diff --git a/common/src/main/java/common/properties/PropertyDirection.java b/common/src/main/java/common/properties/PropertyDirection.java deleted file mode 100755 index 88ba891f..00000000 --- a/common/src/main/java/common/properties/PropertyDirection.java +++ /dev/null @@ -1,41 +0,0 @@ -package common.properties; - -import java.util.Collection; -import java.util.function.Predicate; - -import common.collect.Filter; -import common.collect.Lists; -import common.util.Facing; -import common.util.Predicates; - -public class PropertyDirection extends PropertyEnum -{ - protected PropertyDirection(String name, Collection values) - { - super(name, Facing.class, values); - } - - /** - * Create a new PropertyDirection with the given name - */ - public static PropertyDirection create(String name) - { - return create(name, Predicates.alwaysTrue()); - } - - /** - * Create a new PropertyDirection with all directions that match the given Predicate - */ - public static PropertyDirection create(String name, Predicate filter) - { - return create(name, Filter.filter(Lists.newArrayList(Facing.values()), filter)); - } - - /** - * Create a new PropertyDirection for the given direction values - */ - public static PropertyDirection create(String name, Collection values) - { - return new PropertyDirection(name, values); - } -} diff --git a/common/src/main/java/common/properties/PropertyEnum.java b/common/src/main/java/common/properties/PropertyEnum.java index eccbeeb6..76fe6e8a 100755 --- a/common/src/main/java/common/properties/PropertyEnum.java +++ b/common/src/main/java/common/properties/PropertyEnum.java @@ -1,69 +1,59 @@ package common.properties; import java.util.Collection; -import java.util.Map; -import java.util.function.Predicate; +import java.util.Set; -import common.collect.Filter; import common.collect.ImmutableSet; -import common.collect.Lists; -import common.collect.Maps; +import common.collect.Sets; import common.util.Identifyable; -import common.util.Predicates; -public class PropertyEnum & Identifyable> extends PropertyHelper -{ - private final ImmutableSet allowedValues; - private final Map nameToValue = Maps.newHashMap(); +public class PropertyEnum & Identifyable> extends Property { + private final ImmutableSet states; - protected PropertyEnum(String name, Class valueClass, Collection allowedValues) - { - super(name, valueClass); - this.allowedValues = ImmutableSet.copyOf(allowedValues); + public static & Identifyable> PropertyEnum create(String name, Class clazz) { + return new PropertyEnum(name, clazz, clazz.getEnumConstants()); + } - for (T t : allowedValues) - { - String s = ((Identifyable)t).getName(); + public static & Identifyable> PropertyEnum create(String name, Class clazz, T... values) { + return new PropertyEnum(name, clazz, values); + } - if (this.nameToValue.containsKey(s)) - { - throw new IllegalArgumentException("Multiple values have the same name \'" + s + "\'"); - } + private PropertyEnum(String name, Class type, T[] states) { + super(name, type); + Set check = Sets.newHashSet(); + for(T state : states) { + String id = state.getName(); + if(check.contains(id)) + throw new IllegalArgumentException("Mehrere Werte haben den Namen '" + id + "'"); + check.add(id); + } + check.clear(); + this.states = ImmutableSet.copyOf(states); + } - this.nameToValue.put(s, t); - } - } + public Collection getStates() { + return this.states; + } - public Collection getAllowedValues() - { - return this.allowedValues; - } + public String getName(T value) { + return value.getName(); + } - /** - * Get the name for the given value. - */ - public String getName(T value) - { - return ((Identifyable)value).getName(); - } + public boolean equals(Object obj) { + if(this == obj) + return true; + if(obj != null && this.getClass() == obj.getClass()) { + if(!super.equals(obj)) + return false; + PropertyEnum other = (PropertyEnum)obj; + return this.states.equals(other.states); + } + return false; + } - public static & Identifyable> PropertyEnum create(String name, Class clazz) - { - return create(name, clazz, Predicates.alwaysTrue()); - } - - public static & Identifyable> PropertyEnum create(String name, Class clazz, Predicate filter) - { - return create(name, clazz, Filter.filter(Lists.newArrayList(clazz.getEnumConstants()), filter)); - } - - public static & Identifyable> PropertyEnum create(String name, Class clazz, T... values) - { - return create(name, clazz, Lists.newArrayList(values)); - } - - public static & Identifyable> PropertyEnum create(String name, Class clazz, Collection values) - { - return new PropertyEnum(name, clazz, values); - } + public int hashCode() { + int i = super.hashCode(); + i = 31 * i + this.states.hashCode(); + return i; + } } diff --git a/common/src/main/java/common/properties/PropertyHelper.java b/common/src/main/java/common/properties/PropertyHelper.java deleted file mode 100755 index 671ff281..00000000 --- a/common/src/main/java/common/properties/PropertyHelper.java +++ /dev/null @@ -1,50 +0,0 @@ -package common.properties; - -public abstract class PropertyHelper> implements IProperty -{ - private final Class valueClass; - private final String name; - - protected PropertyHelper(String name, Class valueClass) - { - this.valueClass = valueClass; - this.name = name; - } - - public String getName() - { - return this.name; - } - - public Class getValueClass() - { - return this.valueClass; - } - -// public String toString() -// { -// return Objects.toStringHelper(this).add("name", this.name).add("clazz", this.valueClass).add("values", this.getAllowedValues()).toString(); -// } - - public boolean equals(Object p_equals_1_) - { - if (this == p_equals_1_) - { - return true; - } - else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) - { - PropertyHelper propertyhelper = (PropertyHelper)p_equals_1_; - return this.valueClass.equals(propertyhelper.valueClass) && this.name.equals(propertyhelper.name); - } - else - { - return false; - } - } - - public int hashCode() - { - return 31 * this.valueClass.hashCode() + this.name.hashCode(); - } -} diff --git a/common/src/main/java/common/properties/PropertyInteger.java b/common/src/main/java/common/properties/PropertyInteger.java index c6bd59b0..638c9396 100755 --- a/common/src/main/java/common/properties/PropertyInteger.java +++ b/common/src/main/java/common/properties/PropertyInteger.java @@ -6,81 +6,49 @@ import java.util.Set; import common.collect.ImmutableSet; import common.collect.Sets; -public class PropertyInteger extends PropertyHelper -{ - private final ImmutableSet allowedValues; +public class PropertyInteger extends Property { + private final ImmutableSet values; - protected PropertyInteger(String name, int min, int max) - { - super(name, Integer.class); + public static PropertyInteger create(String name, int min, int max) { + return new PropertyInteger(name, min, max); + } - if (min < 0) - { - throw new IllegalArgumentException("Min value of " + name + " must be 0 or greater"); - } - else if (max <= min) - { - throw new IllegalArgumentException("Max value of " + name + " must be greater than min (" + min + ")"); - } - else - { - Set set = Sets.newHashSet(); + private PropertyInteger(String name, int min, int max) { + super(name, Integer.class); + if(min < 0) + throw new IllegalArgumentException("Mindestwert von " + name + " muss 0 oder höher sein"); + else if(max <= min) + throw new IllegalArgumentException("Maximalwert von " + name + " muss grĂ¶ĂŸer als der Mindestwert sein (" + min + ")"); + Set set = Sets.newHashSetWithExpectedSize(1 + max - min); + for(int z = min; z <= max; z++) { + set.add(z); + } + this.values = ImmutableSet.copyOf(set); + } - for (int i = min; i <= max; ++i) - { - set.add(Integer.valueOf(i)); - } + public Collection getStates() { + return this.values; + } - this.allowedValues = ImmutableSet.copyOf(set); - } - } + public String getName(Integer value) { + return value.toString(); + } - public Collection getAllowedValues() - { - return this.allowedValues; - } + public boolean equals(Object obj) { + if(this == obj) + return true; + if(obj != null && this.getClass() == obj.getClass()) { + if(!super.equals(obj)) + return false; + PropertyInteger other = (PropertyInteger)obj; + return this.values.equals(other.values); + } + return false; + } - public boolean equals(Object p_equals_1_) - { - if (this == p_equals_1_) - { - return true; - } - else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) - { - if (!super.equals(p_equals_1_)) - { - return false; - } - else - { - PropertyInteger propertyinteger = (PropertyInteger)p_equals_1_; - return this.allowedValues.equals(propertyinteger.allowedValues); - } - } - else - { - return false; - } - } - - public int hashCode() - { - int i = super.hashCode(); - i = 31 * i + this.allowedValues.hashCode(); - return i; - } - - public static PropertyInteger create(String name, int min, int max) - { - return new PropertyInteger(name, min, max); - } - - /** - * Get the name for the given value. - */ - public String getName(Integer value) - { - return value.toString(); - } + public int hashCode() { + int i = super.hashCode(); + i = 31 * i + this.values.hashCode(); + return i; + } } diff --git a/common/src/main/java/common/tileentity/TileEntityBanner.java b/common/src/main/java/common/tileentity/TileEntityBanner.java index 6f09ac23..be5d13b0 100755 --- a/common/src/main/java/common/tileentity/TileEntityBanner.java +++ b/common/src/main/java/common/tileentity/TileEntityBanner.java @@ -49,12 +49,12 @@ public class TileEntityBanner extends TileEntity } else { - this.baseColor = stack.getMetadata() & 15; + this.baseColor = DyeColor.WHITE.getDyeDamage(); } } else { - this.baseColor = stack.getMetadata() & 15; + this.baseColor = DyeColor.WHITE.getDyeDamage(); } this.patternList = null; @@ -104,10 +104,10 @@ public class TileEntityBanner extends TileEntity return this.baseColor; } - public static int getBaseColor(ItemStack stack) + public static DyeColor getBaseColor(ItemStack stack) { TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); - return nbttagcompound != null && nbttagcompound.hasInt("Base") ? nbttagcompound.getInt("Base") : stack.getMetadata(); + return nbttagcompound != null && nbttagcompound.hasInt("Base") ? DyeColor.byDyeDamage(nbttagcompound.getInt("Base")) : DyeColor.WHITE; } /** @@ -248,13 +248,13 @@ public class TileEntityBanner extends TileEntity HALF_HORIZONTAL_MIRROR("half_horizontal_bottom", "hhb", "Unten %s geteilt", null, true, " ", "###", "###"), BORDER("border", "bo", "%s Bord", 1, false, "###", "# #", "###"), CURLY_BORDER("curly_border", "cbo", "%s Spickelbord", 1, false, new ItemStack(Blocks.vine)), - RUNE("rune", "run", "%s Rune", -1, false, new ItemStack(Items.golden_apple, 1, 0)), + RUNE("rune", "run", "%s Rune", -1, false, new ItemStack(Items.golden_apple)), GRADIENT("gradient", "gra", "%s Farbverlauf", 1, false, "# #", " # ", " # "), GRADIENT_UP("gradient_up", "gru", "%s Farbverlauf (Invertiert)", 1, false, " # ", " # ", "# #"), BRICKS("bricks", "bri", "Feld %s gemauert", null, true, new ItemStack(Blocks.brick_block)), - SKULL("skull", "sku", "%s Schädel", 1, false, new ItemStack(Items.skull, 1, 0)), - FLOWER("flower", "flo", "%s Blume", -1, false, new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.OXEYE_DAISY.getMeta())), - THING("thing", "thi", "%s ", 0, false, new ItemStack(Items.golden_apple, 1, 1)); + SKULL("skull", "sku", "%s Schädel", 1, false, new ItemStack(Items.skull)), + FLOWER("flower", "flo", "%s Blume", -1, false, new ItemStack(Items.daisy)), + THING("thing", "thi", "%s ", 0, false, new ItemStack(Items.charged_apple)); private String patternName; private String patternID; diff --git a/common/src/main/java/common/tileentity/TileEntityBeacon.java b/common/src/main/java/common/tileentity/TileEntityBeacon.java index da2d009b..aec178d7 100755 --- a/common/src/main/java/common/tileentity/TileEntityBeacon.java +++ b/common/src/main/java/common/tileentity/TileEntityBeacon.java @@ -3,6 +3,8 @@ package common.tileentity; import java.util.List; import common.block.Block; +import common.block.artificial.BlockStainedGlass; +import common.block.artificial.BlockStainedGlassPane; import common.color.DyeColor; import common.entity.types.EntityLiving; import common.init.Blocks; @@ -154,7 +156,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable { State iblockstate = this.worldObj.getState(blockpos$mutableblockpos.set(j, i1, l)); - if (iblockstate.getBlock() != Blocks.stained_glass && iblockstate.getBlock() != Blocks.stained_glass_pane + if (!(iblockstate.getBlock() instanceof BlockStainedGlass) && !(iblockstate.getBlock() instanceof BlockStainedGlassPane) && iblockstate.getBlock().getLightOpacity() >= 15 && iblockstate.getBlock() != Blocks.bedrock) { this.isComplete = false; break; diff --git a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java index f883e9b8..4d8950ef 100755 --- a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java +++ b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java @@ -143,21 +143,20 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka for (int i = 0; i < 3; ++i) { - if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potion) + if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion) { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.getPotionResult(j, itemstack); + ItemPotion result = this.getPotionResult(potion, itemstack); - if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) + if (!potion.isSplashPotion() && result.isSplashPotion()) { flag = true; break; } - List list = Items.potion.getEffects(j); - List list1 = Items.potion.getEffects(k); + List list = potion.getEffects(); + List list1 = result.getEffects(); - if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) + if ((potion.getPotionData() <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && potion != result) { flag = true; break; @@ -182,23 +181,22 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka for (int i = 0; i < 3; ++i) { - if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potion) + if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion) { - int j = this.brewingItemStacks[i].getMetadata(); - int k = this.getPotionResult(j, itemstack); - List list = Items.potion.getEffects(j); - List list1 = Items.potion.getEffects(k); + ItemPotion result = this.getPotionResult(potion, itemstack); + List list = potion.getEffects(); + List list1 = result.getEffects(); - if (j > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null)) + if (potion.getPotionData() > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null)) { - if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) + if (!potion.isSplashPotion() && result.isSplashPotion()) { - this.brewingItemStacks[i].setItemDamage(k); + this.brewingItemStacks[i] = new ItemStack(result); } } - else if (j != k) + else if (potion != result) { - this.brewingItemStacks[i].setItemDamage(k); + this.brewingItemStacks[i] = new ItemStack(result); } } } @@ -219,12 +217,9 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka } } - /** - * The result of brewing a potion of the specified damage value with an ingredient itemstack. - */ - private int getPotionResult(int meta, ItemStack stack) + private ItemPotion getPotionResult(ItemPotion potion, ItemStack stack) { - return stack == null ? meta : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta); + return stack == null ? potion : (stack.getItem().isPotionIngredient(stack) ? ItemPotion.getPotionItem(PotionHelper.applyIngredient(potion.getPotionData(), stack.getItem().getPotionEffect(stack))) : potion); } public void readTags(TagObject compound) diff --git a/common/src/main/java/common/tileentity/TileEntityFurnace.java b/common/src/main/java/common/tileentity/TileEntityFurnace.java index 519647cb..cd25eea3 100755 --- a/common/src/main/java/common/tileentity/TileEntityFurnace.java +++ b/common/src/main/java/common/tileentity/TileEntityFurnace.java @@ -398,10 +398,11 @@ public class TileEntityFurnace extends TileEntityLockable implements ITickable, (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterial() == ToolType.WOOD.material ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : + (item == Items.charcoal ? 1200 : (item instanceof ItemBucket && ((ItemBucket)item).getLiquid() != null && ((ItemBucket)item).getLiquid().getMaterial() == Material.LAVA ? 20000 : (item.getBlock() instanceof BlockSapling ? 100 : - (item == Items.blaze_rod ? 2400 : 0))))))); + (item == Items.blaze_rod ? 2400 : 0)))))))); } } diff --git a/common/src/main/java/common/tileentity/TileEntityHopper.java b/common/src/main/java/common/tileentity/TileEntityHopper.java index 5da8f318..b866b247 100755 --- a/common/src/main/java/common/tileentity/TileEntityHopper.java +++ b/common/src/main/java/common/tileentity/TileEntityHopper.java @@ -685,7 +685,7 @@ public class TileEntityHopper extends TileEntityLockable implements IHopper, ITi public static boolean canCombine(ItemStack stack1, ItemStack stack2) { - return stack1.getItem() != stack2.getItem() ? false : (stack1.getMetadata() != stack2.getMetadata() ? false : (stack1.size > stack1.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(stack1, stack2))); + return stack1.getItem() != stack2.getItem() ? false : (stack1.size > stack1.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(stack1, stack2)); } /** diff --git a/common/src/main/java/common/util/Util.java b/common/src/main/java/common/util/Util.java index 2fc26058..4daca142 100644 --- a/common/src/main/java/common/util/Util.java +++ b/common/src/main/java/common/util/Util.java @@ -33,6 +33,8 @@ public abstract class Util { public static final int PROTOCOL = Version.MAJOR << 16 | Version.MINOR << 8 | Version.PATCH; public static final String VERSION = "v" + Version.MAJOR + "." + Version.MINOR + "." + Version.PATCH + Version.RELEASE; + private static final String[] TIERS = new String[] {"II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}; + private static boolean crashed; public static String strip(String str, int offset, int len, char newl, char tab, char unk) { @@ -532,4 +534,8 @@ public abstract class Util { public static void throwUnchecked(Throwable t) { throw t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t); } + + public static String getTierSuffix(int tier) { + return tier <= 0 ? "" : " " + (tier > TIERS.length ? (tier + 1) : TIERS[tier - 1]); + } } diff --git a/common/src/main/java/common/world/State.java b/common/src/main/java/common/world/State.java index 76772ffd..e21b785c 100755 --- a/common/src/main/java/common/world/State.java +++ b/common/src/main/java/common/world/State.java @@ -15,34 +15,34 @@ import common.collect.Maps; import common.collect.StandardTable; import common.collect.Table; import common.init.BlockRegistry; -import common.properties.IProperty; +import common.properties.Property; public class State { // private static final Joiner COMMA_JOINER = Joiner.on(','); - private static final Function, String> MAP_ENTRY_TO_STRING = - new Function, String>() { - public String apply(Entry entry) { + private static final Function, String> MAP_ENTRY_TO_STRING = + new Function, String>() { + public String apply(Entry entry) { if(entry == null) { return ""; } else { - IProperty prop = entry.getKey(); + Property prop = entry.getKey(); return prop.getName() + "=" + prop.getName(entry.getValue()); } } }; private final Block block; - private final ImmutableMap properties; - private ImmutableTable map; + private final ImmutableMap properties; + private ImmutableTable map; - public State(Block block, ImmutableMap properties) { + public State(Block block, ImmutableMap properties) { this.block = block; this.properties = properties; } - public > State cycleProperty(IProperty property) { - Collection values = property.getAllowedValues(); + public > State cycleProperty(Property property) { + Collection values = property.getStates(); T value = this.getValue(property); Iterator iter = values.iterator(); while(iter.hasNext()) { @@ -55,24 +55,24 @@ public class State { return this.withProperty(property, (T)iter.next()); } - public Collection getPropertyNames() { - return Collections.unmodifiableCollection(this.properties.keySet()); + public Collection getPropertyNames() { + return Collections.unmodifiableCollection(this.properties.keySet()); } - public > T getValue(IProperty property) { + public > T getValue(Property property) { if(!this.properties.containsKey(property)) { throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block); } else { - return (T)((Comparable)property.getValueClass().cast(this.properties.get(property))); + return (T)((Comparable)property.getType().cast(this.properties.get(property))); } } - public , V extends T> State withProperty(IProperty property, V value) { + public , V extends T> State withProperty(Property property, V value) { if(!this.properties.containsKey(property)) { throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + this.block); } - else if(!property.getAllowedValues().contains(value)) { + else if(!property.getStates().contains(value)) { throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + BlockRegistry.getNameFromBlock(this.block) + ", it is not an allowed value"); } @@ -81,7 +81,7 @@ public class State { } } - public ImmutableMap getProperties() { + public ImmutableMap getProperties() { return this.properties; } @@ -117,22 +117,22 @@ public class State { return sb.toString(); } - public void buildTable(Map, State> map) { + public void buildTable(Map, State> map) { if(this.map != null) { throw new IllegalStateException(); } else { - Table table = new StandardTable(); - for(IProperty prop : this.properties.keySet()) { - for(Comparable value : prop.getAllowedValues()) { + Table table = new StandardTable(); + for(Property prop : this.properties.keySet()) { + for(Comparable value : prop.getStates()) { if(value != this.properties.get(prop)) { - Map props = Maps.newHashMap(this.properties); + Map props = Maps.newHashMap(this.properties); props.put(prop, value); table.put(prop, value, map.get(props)); } } } - this.map = ImmutableTable.copyOf(table); + this.map = ImmutableTable.copyOf(table); } } } diff --git a/server/src/main/java/server/biome/BiomeBlackened.java b/server/src/main/java/server/biome/BiomeBlackened.java index 04383c2d..653d486e 100644 --- a/server/src/main/java/server/biome/BiomeBlackened.java +++ b/server/src/main/java/server/biome/BiomeBlackened.java @@ -4,6 +4,7 @@ import common.biome.Biome; import common.block.foliage.BlockFlower; import common.entity.npc.EntityMetalhead; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.rng.WeightedList; import common.util.BlockPos; @@ -11,7 +12,7 @@ import server.worldgen.tree.WorldGenBaseTree; import server.worldgen.tree.WorldGenTree; public class BiomeBlackened extends GenBiome { - protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), Blocks.blackwood_leaves.getState()); + protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), WoodType.BLACKWOOD); public BiomeBlackened() { super(Biome.BLACKENED); diff --git a/server/src/main/java/server/biome/BiomeForest.java b/server/src/main/java/server/biome/BiomeForest.java index 23709f92..af373827 100755 --- a/server/src/main/java/server/biome/BiomeForest.java +++ b/server/src/main/java/server/biome/BiomeForest.java @@ -8,6 +8,7 @@ import common.entity.animal.EntityWolf; import common.entity.npc.EntityElf; import common.entity.npc.EntityWoodElf; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -21,8 +22,8 @@ import server.worldgen.tree.WorldGenTree; public class BiomeForest extends GenBiome { - private static final BlockDoublePlant.EnumPlantType[] FLOWER_TYPES = new BlockDoublePlant.EnumPlantType[] { - BlockDoublePlant.EnumPlantType.SYRINGA, BlockDoublePlant.EnumPlantType.ROSE, BlockDoublePlant.EnumPlantType.PAEONIA + private static final BlockDoublePlant[] FLOWER_TYPES = new BlockDoublePlant[] { + Blocks.syringa, Blocks.rose_bush, Blocks.paeonia }; protected static final WorldGenBirch tallBirch = new WorldGenBirch(false, true); protected static final WorldGenBirch normalBirch = new WorldGenBirch(false, false); @@ -35,13 +36,13 @@ public class BiomeForest extends GenBiome // protected WorldGenBigTree cherryBig; // protected WorldGenBigTree mapleBig; protected WorldGenBaseTree cherry = new WorldGenBaseTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY), - Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.CHERRY); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBaseTree maple = new WorldGenBaseTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE), - Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBigTree cherryBig = new WorldGenBigTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY), - Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.CHERRY); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBigTree mapleBig = new WorldGenBigTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE), - Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); public BiomeForest(Biome base, int type) { diff --git a/server/src/main/java/server/biome/BiomeJungle.java b/server/src/main/java/server/biome/BiomeJungle.java index 34faff3d..8ee66a47 100755 --- a/server/src/main/java/server/biome/BiomeJungle.java +++ b/server/src/main/java/server/biome/BiomeJungle.java @@ -5,6 +5,7 @@ import common.block.foliage.BlockTallGrass; import common.entity.animal.EntityChicken; import common.entity.animal.EntityOcelot; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -21,8 +22,8 @@ import server.worldgen.tree.WorldGenTree; public class BiomeJungle extends GenBiome { private static final State LOG = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - private static final State LEAVES = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final State BUSH = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final WoodType LEAVES = WoodType.JUNGLE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final WoodType BUSH = WoodType.OAK; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); private final boolean edge; @@ -61,7 +62,7 @@ public class BiomeJungle extends GenBiome */ public FeatureGenerator getRandomWorldGenForGrass(Random rand) { - return rand.chance(4) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); + return rand.chance(4) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass); } public void decorate(WorldServer worldIn, Random rand, BlockPos pos) diff --git a/server/src/main/java/server/biome/BiomeMesa.java b/server/src/main/java/server/biome/BiomeMesa.java index 19251d30..bb6426ed 100755 --- a/server/src/main/java/server/biome/BiomeMesa.java +++ b/server/src/main/java/server/biome/BiomeMesa.java @@ -4,9 +4,8 @@ import java.util.Arrays; import common.biome.Biome; import common.block.Block; -import common.block.BlockColored; -import common.block.natural.BlockDirt; -import common.block.natural.BlockSand; +import common.block.artificial.BlockWool; +import common.block.natural.BlockColoredClay; import common.color.DyeColor; import common.init.Blocks; import common.rng.PerlinGen; @@ -37,8 +36,8 @@ public class BiomeMesa extends GenBiome // this.setDisableRain(); // this.setTemperatureLegacy(2.0F).setHumidity(0.0F); // this.mobs.clear(); - this.topBlock = Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND); - this.fillerBlock = Blocks.stained_hardened_clay.getState(); + this.topBlock = Blocks.red_sand.getState(); + this.fillerBlock = Blocks.white_clay.getState(); this.treesPerChunk = -999; this.deadBushPerChunk = 20; this.reedsPerChunk = 3; @@ -107,7 +106,7 @@ public class BiomeMesa extends GenBiome int j1 = x & 15; int k1 = z & 15; int l1 = worldIn.getSeaLevel(); - State iblockstate = Blocks.stained_hardened_clay.getState(); + State iblockstate = Blocks.white_clay.getState(); State iblockstate3 = this.fillerBlock; int k = (int)(noiseVal / 3.0D + 3.0D + rand.doublev() * 0.25D); boolean flag = Math.cos(noiseVal / 3.0D * Math.PI) > 0.0D; @@ -151,7 +150,7 @@ public class BiomeMesa extends GenBiome } else if (i1 >= l1 - 4 && i1 <= l1 + 1) { - iblockstate = Blocks.stained_hardened_clay.getState(); + iblockstate = Blocks.white_clay.getState(); iblockstate3 = this.fillerBlock; } @@ -166,16 +165,16 @@ public class BiomeMesa extends GenBiome { chunkPrimerIn.set(k1, i1, j1, iblockstate3); - if (iblockstate3.getBlock() == Blocks.stained_hardened_clay) + if (iblockstate3.getBlock() instanceof BlockColoredClay) { - chunkPrimerIn.set(k1, i1, j1, iblockstate3.getBlock().getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE)); + chunkPrimerIn.set(k1, i1, j1, Blocks.orange_clay.getState()); } } else if (this.soil && i1 > 86 + k * 2) { if (flag) { - chunkPrimerIn.set(k1, i1, j1, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT)); + chunkPrimerIn.set(k1, i1, j1, Blocks.coarse_dirt.getState()); } else { @@ -204,7 +203,7 @@ public class BiomeMesa extends GenBiome } else { - iblockstate4 = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE); + iblockstate4 = Blocks.orange_clay.getState(); } chunkPrimerIn.set(k1, i1, j1, iblockstate4); @@ -216,7 +215,7 @@ public class BiomeMesa extends GenBiome if (flag1) { - chunkPrimerIn.set(k1, i1, j1, Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE)); + chunkPrimerIn.set(k1, i1, j1, Blocks.orange_clay.getState()); } else { @@ -242,7 +241,7 @@ public class BiomeMesa extends GenBiome if (l1 < 64) { - this.layers[l1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE); + this.layers[l1] = Blocks.orange_clay.getState(); } } @@ -255,7 +254,7 @@ public class BiomeMesa extends GenBiome for (int l = 0; k + l < 64 && l < j; ++l) { - this.layers[k + l] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.YELLOW); + this.layers[k + l] = Blocks.yellow_clay.getState(); } } @@ -268,7 +267,7 @@ public class BiomeMesa extends GenBiome for (int i1 = 0; l3 + i1 < 64 && i1 < i3; ++i1) { - this.layers[l3 + i1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.BROWN); + this.layers[l3 + i1] = Blocks.brown_clay.getState(); } } @@ -281,7 +280,7 @@ public class BiomeMesa extends GenBiome for (int j1 = 0; k4 + j1 < 64 && j1 < i4; ++j1) { - this.layers[k4 + j1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.RED); + this.layers[k4 + j1] = Blocks.red_clay.getState(); } } @@ -295,16 +294,16 @@ public class BiomeMesa extends GenBiome for (int k1 = 0; j4 + k1 < 64 && k1 < i5; ++k1) { - this.layers[j4 + k1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.WHITE); + this.layers[j4 + k1] = Blocks.white_clay.getState(); if (j4 + k1 > 1 && random.chance()) { - this.layers[j4 + k1 - 1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.SILVER); + this.layers[j4 + k1 - 1] = Blocks.silver_clay.getState(); } if (j4 + k1 < 63 && random.chance()) { - this.layers[j4 + k1 + 1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.SILVER); + this.layers[j4 + k1 + 1] = Blocks.silver_clay.getState(); } } } diff --git a/server/src/main/java/server/biome/BiomePlains.java b/server/src/main/java/server/biome/BiomePlains.java index 15a969aa..8b4c1c70 100755 --- a/server/src/main/java/server/biome/BiomePlains.java +++ b/server/src/main/java/server/biome/BiomePlains.java @@ -4,6 +4,7 @@ import common.biome.Biome; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockFlower; import common.entity.animal.EntityHorse; +import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; import server.world.WorldServer; @@ -81,7 +82,7 @@ public class BiomePlains extends GenBiome { this.flowersPerChunk = 4; this.grassPerChunk = 10; - DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); + DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass); for (int i = 0; i < 7; ++i) { @@ -95,7 +96,7 @@ public class BiomePlains extends GenBiome // int n = rand.range(0, 2); if (rand.chance()) { - DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.SUNFLOWER); + DOUBLE_PLANT_GEN.setPlantType(Blocks.sunflower); // for (int i1 = 0; i1 < 10; ++i1) // { diff --git a/server/src/main/java/server/biome/BiomeSavanna.java b/server/src/main/java/server/biome/BiomeSavanna.java index f2124ae1..c54f905e 100755 --- a/server/src/main/java/server/biome/BiomeSavanna.java +++ b/server/src/main/java/server/biome/BiomeSavanna.java @@ -2,7 +2,6 @@ package server.biome; import common.biome.Biome; import common.block.foliage.BlockDoublePlant; -import common.block.natural.BlockDirt; import common.entity.animal.EntityHorse; import common.init.Blocks; import common.rng.Random; @@ -40,7 +39,7 @@ public class BiomeSavanna extends GenBiome public void decorate(WorldServer worldIn, Random rand, BlockPos pos) { - DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); + DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass); for (int i = 0; i < 7; ++i) { @@ -75,7 +74,7 @@ public class BiomeSavanna extends GenBiome } else if (noiseVal > -0.5D) { - this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT); + this.topBlock = Blocks.coarse_dirt.getState(); } this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal); diff --git a/server/src/main/java/server/biome/BiomeSpace.java b/server/src/main/java/server/biome/BiomeSpace.java index b83c9de8..75c8f3bb 100755 --- a/server/src/main/java/server/biome/BiomeSpace.java +++ b/server/src/main/java/server/biome/BiomeSpace.java @@ -1,7 +1,6 @@ package server.biome; import common.biome.Biome; -import common.block.natural.BlockDirt; import common.init.Blocks; import common.rng.Random; import common.rng.WeightedList; @@ -15,7 +14,7 @@ public class BiomeSpace extends GenBiome protected FeatureGenerator asteroidGen1 = new WorldGenAsteroid(Blocks.stone.getState(), Blocks.rock.getState()); protected FeatureGenerator asteroidGen2 = new WorldGenAsteroid(Blocks.dirt.getState(), - Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT)); + Blocks.coarse_dirt.getState()); public BiomeSpace() { diff --git a/server/src/main/java/server/biome/BiomeSwamp.java b/server/src/main/java/server/biome/BiomeSwamp.java index 9c3854d8..157ec583 100755 --- a/server/src/main/java/server/biome/BiomeSwamp.java +++ b/server/src/main/java/server/biome/BiomeSwamp.java @@ -1,8 +1,8 @@ package server.biome; import common.biome.Biome; -import common.block.BlockDirectional; import common.block.foliage.BlockFlower; +import common.block.foliage.BlockLilyPad; import common.entity.npc.EntitySlime; import common.init.Blocks; import common.rng.Random; @@ -60,7 +60,7 @@ public class BiomeSwamp extends GenBiome if (d0 < 0.12D) { - chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, Facing.randHorizontal(rand))); + chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand))); } } diff --git a/server/src/main/java/server/biome/BiomeTaiga.java b/server/src/main/java/server/biome/BiomeTaiga.java index 97812ff5..6d138fbb 100755 --- a/server/src/main/java/server/biome/BiomeTaiga.java +++ b/server/src/main/java/server/biome/BiomeTaiga.java @@ -3,7 +3,6 @@ package server.biome; import common.biome.Biome; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockTallGrass; -import common.block.natural.BlockDirt; import common.entity.animal.EntityWolf; import common.init.Blocks; import common.rng.Random; @@ -57,7 +56,7 @@ public class BiomeTaiga extends GenBiome */ public FeatureGenerator getRandomWorldGenForGrass(Random rand) { - return rand.rarity(5) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); + return rand.rarity(5) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass); } public void decorate(WorldServer worldIn, Random rand, BlockPos pos) @@ -75,7 +74,7 @@ public class BiomeTaiga extends GenBiome } } - DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.FERN); + DOUBLE_PLANT_GEN.setPlantType(Blocks.large_fern); for (int i1 = 0; i1 < 7; ++i1) { @@ -97,11 +96,11 @@ public class BiomeTaiga extends GenBiome if (noiseVal > 1.75D) { - this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT); + this.topBlock = Blocks.coarse_dirt.getState(); } else if (noiseVal > -0.95D) { - this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL); + this.topBlock = Blocks.podzol.getState(); } } diff --git a/server/src/main/java/server/biome/BiomeTian.java b/server/src/main/java/server/biome/BiomeTian.java index 021a9728..0bd9f78e 100755 --- a/server/src/main/java/server/biome/BiomeTian.java +++ b/server/src/main/java/server/biome/BiomeTian.java @@ -7,6 +7,7 @@ import common.entity.animal.EntityMouse; import common.entity.animal.EntityRabbit; import common.entity.npc.EntityCultivator; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.rng.WeightedList; import common.util.BlockPos; @@ -22,12 +23,12 @@ public class BiomeTian extends GenBiome { protected FeatureGenerator spikeGen = new WorldGenSpikes(Blocks.tian_soil, 128, 2, 3, Blocks.obsidian.getState(), true); protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom); - protected WorldGenTree treeGen1 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + protected WorldGenTree treeGen1 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(6, 8); - protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(14, 20); - protected WorldGenTree treeGen3 = new WorldGenBaseTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()); - protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + protected WorldGenTree treeGen3 = new WorldGenBaseTree(false, Blocks.tian_log.getState(), WoodType.TIAN); + protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(12, 15); public BiomeTian() diff --git a/server/src/main/java/server/biome/GenBiome.java b/server/src/main/java/server/biome/GenBiome.java index cc3c27d4..b940ae0f 100755 --- a/server/src/main/java/server/biome/GenBiome.java +++ b/server/src/main/java/server/biome/GenBiome.java @@ -3,12 +3,11 @@ package server.biome; import common.biome.Biome; import common.biome.IBiome; import common.block.Block; -import common.block.BlockColored; import common.block.Material; +import common.block.artificial.BlockWool; import common.block.foliage.BlockFlower; import common.block.foliage.BlockSapling; import common.block.foliage.BlockTallGrass; -import common.block.natural.BlockSand; import common.color.DyeColor; import common.entity.animal.EntityBat; import common.entity.animal.EntityChicken; @@ -133,7 +132,7 @@ public abstract class GenBiome implements IBiome { private final FeatureGenerator clayGen = new WorldGenClay(4); private final FeatureGenerator sandGen = new WorldGenSand(Blocks.sand, 7); private final FeatureGenerator gravelAsSandGen = new WorldGenSand(Blocks.gravel, 6); - private final WorldGenFlowers yellowFlowerGen = new WorldGenFlowers(Blocks.flower, BlockFlower.EnumFlowerType.DANDELION); + private final WorldGenFlowers yellowFlowerGen = new WorldGenFlowers(Blocks.dandelion); private final FeatureGenerator mushroomBrownGen = new WorldGenMushroom(Blocks.brown_mushroom); private final FeatureGenerator mushroomRedGen = new WorldGenMushroom(Blocks.red_mushroom); private final FeatureGenerator bigMushroomGen = new WorldGenBigMushroom(); @@ -259,7 +258,7 @@ public abstract class GenBiome implements IBiome { public FeatureGenerator getRandomWorldGenForGrass(Random rand) { - return new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); + return new WorldGenTallGrass(Blocks.tallgrass); } public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) @@ -366,9 +365,8 @@ public abstract class GenBiome implements IBiome { int k17 = rand.zrange(j14); BlockPos blockpos1 = pos.add(i7, k17, l10); BlockFlower.EnumFlowerType blockflower$enumflowertype = this.pickRandomFlower(rand, blockpos1); - BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock(); - this.yellowFlowerGen.setGeneratedBlock(blockflower, blockflower$enumflowertype); + this.yellowFlowerGen.setGeneratedBlock(BlockFlower.getByType(blockflower$enumflowertype)); this.yellowFlowerGen.generate(world, rand, blockpos1); } } @@ -620,7 +618,12 @@ public abstract class GenBiome implements IBiome { if (j == 0 && iblockstate1.getBlock() == Blocks.sand) { j = rand.zrange(4) + Math.max(0, j1 - 63); - iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE) : Blocks.sandstone.getState(); //TODO: check! + iblockstate1 = Blocks.sandstone.getState(); //TODO: check! + } + else if (j == 0 && iblockstate1.getBlock() == Blocks.red_sand) + { + j = rand.zrange(4) + Math.max(0, j1 - 63); + iblockstate1 = Blocks.orange_clay.getState(); //TODO: check! } } } @@ -668,8 +671,7 @@ public abstract class GenBiome implements IBiome { WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).getWoodType() : WoodType.OAK; State log = type == WoodType.CHERRY ? Blocks.cherry_log.getState() : // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY) : (type == WoodType.MAPLE ? Blocks.maple_log.getState() /* .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE) */ : Blocks.oak_log.getState()); - State leaves = type == WoodType.CHERRY ? Blocks.cherry_leaves.getState() : - (type == WoodType.MAPLE ? Blocks.maple_leaves.getState() : Blocks.oak_leaves.getState()); + WoodType leaves = type == WoodType.CHERRY || type == WoodType.MAPLE ? type : WoodType.OAK; FeatureGenerator worldgenerator = (FeatureGenerator)(rand.chance(10) ? new WorldGenBigTree(true, log, leaves) : new WorldGenBaseTree(true, log, leaves)); int i = 0; int j = 0; @@ -707,13 +709,13 @@ public abstract class GenBiome implements IBiome { break; case TIAN: - worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(6, 20); break; case JUNGLE: State iblockstate = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - State iblockstate1 = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + WoodType iblockstate1 = WoodType.JUNGLE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); label269: for (i = 0; i >= -1; --i) @@ -815,8 +817,8 @@ public abstract class GenBiome implements IBiome { if (rand.chance(8)) { BlockFlower.EnumFlowerType blockflower$enumflowertype = BIOMES[worldIn.getBiomeGenForCoords(blockpos1).id].pickRandomFlower(rand, blockpos1); - BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock(); - State iblockstate = blockflower.getState().withProperty(blockflower.getTypeProperty(), blockflower$enumflowertype); + BlockFlower blockflower = BlockFlower.getByType(blockflower$enumflowertype); + State iblockstate = blockflower.getState(); if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate)) { @@ -825,7 +827,7 @@ public abstract class GenBiome implements IBiome { } else { - State iblockstate1 = Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS); + State iblockstate1 = Blocks.tallgrass.getState(); if (Blocks.tallgrass.canBlockStay(worldIn, blockpos1, iblockstate1)) { diff --git a/server/src/main/java/server/clipboard/ReorderRegistry.java b/server/src/main/java/server/clipboard/ReorderRegistry.java index 3040b082..f2d2e356 100755 --- a/server/src/main/java/server/clipboard/ReorderRegistry.java +++ b/server/src/main/java/server/clipboard/ReorderRegistry.java @@ -7,7 +7,11 @@ import java.util.Set; import common.block.Block; import common.block.artificial.BlockBed; +import common.block.artificial.BlockCarpet; import common.block.artificial.BlockDoor; +import common.block.artificial.BlockFlowerPot; +import common.block.foliage.BlockDoublePlant; +import common.block.foliage.BlockFlower; import common.color.DyeColor; import common.init.BlockRegistry; import common.init.Blocks; @@ -49,7 +53,9 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.tallgrass); PLACE_LAST.add(Blocks.deadbush); PLACE_LAST.add(Blocks.piston_head); - PLACE_LAST.add(Blocks.flower); + for(BlockFlower block : BlockFlower.FLOWERS) { + PLACE_LAST.add(block); + } PLACE_LAST.add(Blocks.brown_mushroom); PLACE_LAST.add(Blocks.red_mushroom_block); PLACE_LAST.add(Blocks.torch); @@ -81,7 +87,9 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.cocoa); PLACE_LAST.add(Blocks.tripwire_hook); PLACE_LAST.add(Blocks.string); - PLACE_LAST.add(Blocks.flower_pot); + for(BlockFlowerPot block : BlockFlowerPot.POTS) { + PLACE_LAST.add(block); + } PLACE_LAST.add(Blocks.carrot); PLACE_LAST.add(Blocks.potato); PLACE_LAST.add(Blocks.wooden_button); @@ -92,8 +100,12 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.powered_comparator); PLACE_LAST.add(Blocks.activator_rail); PLACE_LAST.add(Blocks.iron_trapdoor); - PLACE_LAST.add(Blocks.carpet); - PLACE_LAST.add(Blocks.double_plant); + for(BlockCarpet block : BlockCarpet.CARPETS) { + PLACE_LAST.add(block); + } + for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { + PLACE_LAST.add(block); + } PLACE_LAST.add(Blocks.daylight_detector_inverted); // shouldPlaceLast.add(Blocks.daylight_detector); PLACE_LAST.add(Blocks.blue_mushroom); @@ -138,7 +150,9 @@ public abstract class ReorderRegistry { addAttach(Blocks.piston_head.getStateFromMeta(offset + 1), Facing.DOWN); addCardinals(Blocks.piston_head, offset + 2, offset + 5, offset + 3, offset + 4); } - addAttach(Blocks.flower, Facing.DOWN); + for(BlockFlower block : BlockFlower.FLOWERS) { + addAttach(block, Facing.DOWN); + } addAttach(Blocks.brown_mushroom, Facing.DOWN); addAttach(Blocks.red_mushroom, Facing.DOWN); for (Block blockId : new Block[] { Blocks.torch, Blocks.redstone_torch, Blocks.unlit_redstone_torch }) { @@ -195,7 +209,9 @@ public abstract class ReorderRegistry { addCardinals(Blocks.tripwire_hook, offset + 2, offset + 3, offset + 0, offset + 1); } addAttach(Blocks.string, Facing.DOWN); - addAttach(Blocks.flower_pot, Facing.DOWN); + for(BlockFlowerPot block : BlockFlowerPot.POTS) { + addAttach(block, Facing.DOWN); + } addAttach(Blocks.carrot, Facing.DOWN); addAttach(Blocks.potato, Facing.DOWN); addAttach(Blocks.anvil, Facing.DOWN); @@ -203,8 +219,12 @@ public abstract class ReorderRegistry { addAttach(Blocks.heavy_weighted_pressure_plate, Facing.DOWN); addAttach(Blocks.comparator, Facing.DOWN); addAttach(Blocks.powered_comparator, Facing.DOWN); - addAttach(Blocks.carpet, Facing.DOWN); - addAttach(Blocks.double_plant, Facing.DOWN); + for(BlockCarpet block : BlockCarpet.CARPETS) { + addAttach(block, Facing.DOWN); + } + for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { + addAttach(block, Facing.DOWN); + } addAttach(Blocks.banner, Facing.DOWN); addCardinals(Blocks.wall_banner, 4, 2, 5, 3); addAttach(Blocks.oak_door, Facing.DOWN); diff --git a/server/src/main/java/server/clipboard/RotationRegistry.java b/server/src/main/java/server/clipboard/RotationRegistry.java index 6716e849..693b16d0 100755 --- a/server/src/main/java/server/clipboard/RotationRegistry.java +++ b/server/src/main/java/server/clipboard/RotationRegistry.java @@ -9,7 +9,6 @@ import common.block.Block; import common.block.BlockRotatedPillar; import common.block.artificial.BlockDoor; import common.block.artificial.BlockPortal; -import common.block.artificial.BlockQuartz; import common.block.foliage.BlockLog; import common.block.tech.BlockLever; import common.block.tech.BlockRail; @@ -18,8 +17,7 @@ import common.block.tech.BlockRailDetector; import common.block.tech.BlockRailPowered; import common.collect.Lists; import common.collect.Maps; -import common.properties.IProperty; -import common.properties.PropertyDirection; +import common.properties.Property; import common.util.Facing; import common.util.Vec3i; import common.world.State; @@ -29,7 +27,7 @@ public abstract class RotationRegistry { public static void register() { for(Block block : common.init.BlockRegistry.REGISTRY) { - for(IProperty prop : block.getPropertyMap()) { + for(Property prop : block.getPropertyMap()) { Predicate predicate = null; if(prop == BlockDoor.FACING) { predicate = new Predicate() { @@ -49,7 +47,7 @@ public abstract class RotationRegistry { } byte mask = 0; - for(Object v : prop.getAllowedValues()) { + for(Object v : prop.getStates()) { if(map.get(v) == null) { continue; } @@ -58,14 +56,14 @@ public abstract class RotationRegistry { if(mask == 0) { continue; } - for(Object v : prop.getAllowedValues()) { + for(Object v : prop.getStates()) { if(map.get(v) == null) { continue; } Vec3i dv = null; Facing.Axis axis = null; - if(prop instanceof PropertyDirection) { - dv = ((Facing)v).getDirectionVec(); + if(v instanceof Facing face) { + dv = face.getDirectionVec(); } else if(prop == BlockRotatedPillar.AXIS) { axis = ((Facing.Axis)v); @@ -76,9 +74,6 @@ public abstract class RotationRegistry { else if(prop == BlockLog.LOG_AXIS) { axis = ((BlockLog.EnumAxis)v).getAxis(); } - else if(prop == BlockQuartz.VARIANT) { - axis = ((BlockQuartz.EnumType)v).getAxis(); - } else if(prop == BlockLever.FACING) { dv = ((BlockLever.EnumOrientation)v).getFacing().getDirectionVec(); } diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index 52995821..8b9a84a3 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -284,7 +284,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer this.entity.inventory.dropAllItems(); } if(SVars.skullDrop) { - ItemStack stack = new ItemStack(Items.skull, 1, 0); + ItemStack stack = new ItemStack(Items.skull); this.entity.dropItem(stack, true, false); } @@ -1247,10 +1247,10 @@ public class Player extends User implements ICrafting, Executor, IPlayer // return true; // } int i = stack.size; - int j = stack.getMetadata(); + int j = stack.getItemDamage(); ItemStack itemstack = stack.useItemRightClick(this.entity.worldObj, this.entity); - if (itemstack != stack || itemstack != null && (itemstack.size != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getMetadata() != j)) + if (itemstack != stack || itemstack != null && (itemstack.size != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getItemDamage() != j)) { this.entity.inventory.mainInventory[this.entity.inventory.currentItem] = itemstack; @@ -2925,7 +2925,7 @@ public class Player extends User implements ICrafting, Executor, IPlayer // boolean validSlot = packetIn.getSlotId() >= 1 && packetIn.getSlotId() < 36 + InventoryPlayer.getHotbarSize(); boolean validItem = itemstack.getItem() != null; - boolean validData = itemstack.getMetadata() >= 0 && itemstack.size <= itemstack.getMaxStackSize() && itemstack.size > 0; // TODO: max + boolean validData = itemstack.size <= itemstack.getMaxStackSize() && itemstack.size > 0; // TODO: max if (validItem && validData) { diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index 8e2efbff..37eb8fc5 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -19,15 +19,14 @@ import java.util.zip.InflaterInputStream; import common.biome.Biome; import common.block.Block; -import common.block.BlockColored; import common.block.artificial.BlockCarpet; import common.block.artificial.BlockFlowerPot; import common.block.artificial.BlockQuartz; import common.block.artificial.BlockSlab; import common.block.artificial.BlockStainedGlass; import common.block.artificial.BlockStainedGlassPane; -import common.block.artificial.BlockStoneBrick; import common.block.artificial.BlockWall; +import common.block.artificial.BlockWool; import common.block.foliage.BlockCactus; import common.block.foliage.BlockFlower; import common.block.foliage.BlockLeaves; @@ -35,10 +34,7 @@ import common.block.foliage.BlockLog; import common.block.foliage.BlockTallGrass; import common.block.foliage.LeavesType; import common.block.liquid.BlockLiquid; -import common.block.natural.BlockDirt; import common.block.natural.BlockFire; -import common.block.natural.BlockRock; -import common.block.natural.BlockSand; import common.block.natural.BlockSandStone; import common.block.tech.BlockPistonBase; import common.block.tech.BlockPistonHead; @@ -350,6 +346,7 @@ public abstract class Converter { mapTile(TileEntityComparator.class, "Comparator", "comparator"); mapTile(TileEntityBanner.class, "Banner", "banner"); + /* mapBlock(Blocks.stone.getState(), 1); mapBlock(Blocks.rock.getState().withProperty(BlockRock.SMOOTH, false), 1, 1); mapBlock(Blocks.rock.getState().withProperty(BlockRock.SMOOTH, true), 1, 2); @@ -483,7 +480,7 @@ public abstract class Converter { .withProperty(BlockPistonHead.TYPE, BlockPistonHead.EnumPistonType.STICKY), 34, 14); mapBlock(new BlockFunction() { public State getState(int id, int data) { - return Blocks.wool.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); + return Blocks.wool.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(data)); } }, 35); mapBlock(Blocks.stone, 36); // mapBlockData(Blocks.piston_extension, 36); @@ -738,7 +735,7 @@ public abstract class Converter { mapBlockData(Blocks.dropper, 158); mapBlock(new BlockFunction() { public State getState(int id, int data) { - return Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); + return Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(data)); } }, 159); mapBlock(new BlockFunction() { @@ -843,22 +840,23 @@ public abstract class Converter { mapBlock(Blocks.glass, 217); mapBlockData(Blocks.dropper, 218); for(int id = 219; id <= 234; id++) { - mapBlock(Blocks.wool.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(id - 219)), id); + mapBlock(Blocks.wool.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(id - 219)), id); } for(int id = 235; id <= 250; id++) { - mapBlock(Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(id - 235)), id); + mapBlock(Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(id - 235)), id); } mapBlock(new BlockFunction() { public State getState(int id, int data) { - return Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); + return Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(data)); } }, 251); mapBlock(new BlockFunction() { public State getState(int id, int data) { - return Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); + return Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(data)); } }, 252); mapBlock(Blocks.obsidian, 255); + */ } private static Object read(DataInput input, byte id) throws IOException { diff --git a/server/src/main/java/server/world/Region.java b/server/src/main/java/server/world/Region.java index 3a005257..6f33ace8 100755 --- a/server/src/main/java/server/world/Region.java +++ b/server/src/main/java/server/world/Region.java @@ -28,7 +28,7 @@ import common.init.BlockRegistry; import common.init.Blocks; import common.init.EntityRegistry; import common.log.Log; -import common.properties.IProperty; +import common.properties.Property; import common.tags.TagObject; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -38,12 +38,12 @@ import common.world.BlockArray; import common.world.State; public class Region { - private static Set getSavedProperties(Block block) { - Set stored = Sets.newHashSet(); - Map map = Maps.newHashMap(); + private static Set getSavedProperties(Block block) { + Set stored = Sets.newHashSet(); + Map map = Maps.newHashMap(); for(int z = 0; z < 16; z++) { State sub = block.getStateFromMeta(z); - for(Entry entry : sub.getProperties().entrySet()) { + for(Entry entry : sub.getProperties().entrySet()) { if(map.containsKey(entry.getKey())) { if(!map.get(entry.getKey()).equals(entry.getValue())) stored.add(entry.getKey()); @@ -55,8 +55,8 @@ public class Region { } for(int z = 0; z < 16; z++) { State sub = block.getStateFromMeta(z); - Map smap = sub.getProperties(); - for(IProperty prop : map.keySet()) { + Map smap = sub.getProperties(); + for(Property prop : map.keySet()) { if(!smap.containsKey(prop)) stored.add(prop); } @@ -64,9 +64,9 @@ public class Region { return stored; } - private static String filterProperties(State state, Set stored) { + private static String filterProperties(State state, Set stored) { StringBuilder sb = new StringBuilder(BlockRegistry.getNameFromBlock(state.getBlock())); - for(Entry entry : state.getProperties().entrySet()) { + for(Entry entry : state.getProperties().entrySet()) { if(stored.contains(entry.getKey())) sb.append(',').append(entry.getKey().getName()).append('=').append(entry.getKey().getName(entry.getValue())); } @@ -74,6 +74,11 @@ public class Region { } private static boolean makeMap(TagObject tag) { + Set removed = Sets.newHashSet(); + for(String id : tag.keySet()) { + if(tag.hasChar(id)) + removed.add(id); + } Map mapping = Maps.newHashMap(); Map> current = Maps.newHashMap(); Set taken = Sets.newHashSet(); @@ -81,7 +86,7 @@ public class Region { for(int z = 0; z < 4096; z++) { Block block = BlockRegistry.getBlockById(z); if(block != Blocks.air) { - Set stored = getSavedProperties(block); + Set stored = getSavedProperties(block); for(int n = 0; n < 16; n++) { State state = block.getStateFromMeta(n); String id = filterProperties(state, stored); @@ -102,7 +107,7 @@ public class Region { } mapping.put(id, bid); taken.add(bid); - tag.remove(id); + removed.remove(id); Log.IO.debug("Bestehende Block-ID %d = %s", (int)bid, id); } else { @@ -129,11 +134,11 @@ public class Region { ENCODE_MAP[id] = bid; } } - for(String id : tag.keySet()) { - if(tag.hasChar(id)) - Log.IO.debug("Entfernte Block-ID %d = %s", (int)tag.getChar(id), id); + for(String id : removed) { + tag.remove(id); + Log.IO.debug("Entfernte Block-ID %d = %s", (int)tag.getChar(id), id); } - return !missing.isEmpty() || !tag.isEmpty(); + return !missing.isEmpty() || !removed.isEmpty(); } public static void loadMap() { diff --git a/server/src/main/java/server/worldgen/LootConstants.java b/server/src/main/java/server/worldgen/LootConstants.java index a26738fd..4d392b22 100755 --- a/server/src/main/java/server/worldgen/LootConstants.java +++ b/server/src/main/java/server/worldgen/LootConstants.java @@ -8,64 +8,64 @@ import common.item.RngLoot; import common.rng.WeightedList; public abstract class LootConstants { - public static final WeightedList VILLAGE_BLACKSMITH = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 3), - new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 1, 3, 5), new RngLoot(Items.bread, 0, 1, 3, 15), - new RngLoot(Items.apple, 0, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 0, 1, 1, 5), new RngLoot(Items.iron_sword, 0, 1, 1, 5), - new RngLoot(Items.iron_chestplate, 0, 1, 1, 5), new RngLoot(Items.iron_helmet, 0, 1, 1, 5), new RngLoot(Items.iron_leggings, 0, 1, 1, 5), - new RngLoot(Items.iron_boots, 0, 1, 1, 5), new RngLoot(ItemRegistry.getItemFromBlock(Blocks.obsidian), 0, 3, 7, 5), - new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_sapling), 0, 3, 7, 5), new RngLoot(Items.saddle, 0, 1, 1, 3), - new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1), - new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1)); - public static final WeightedList STRONGHOLD_CHEST = new WeightedList(new RngLoot(Items.orb, 0, 1, 1, 10), - new RngLoot(Items.diamond, 0, 1, 3, 3), new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 1, 3, 5), - new RngLoot(Items.redstone, 0, 4, 9, 5), new RngLoot(Items.bread, 0, 1, 3, 15), new RngLoot(Items.apple, 0, 1, 3, 15), - new RngLoot(Items.iron_pickaxe, 0, 1, 1, 5), new RngLoot(Items.iron_sword, 0, 1, 1, 5), new RngLoot(Items.iron_chestplate, 0, 1, 1, 5), - new RngLoot(Items.iron_helmet, 0, 1, 1, 5), new RngLoot(Items.iron_leggings, 0, 1, 1, 5), new RngLoot(Items.iron_boots, 0, 1, 1, 5), - new RngLoot(Items.golden_apple, 0, 1, 1, 1), new RngLoot(Items.saddle, 0, 1, 1, 1), new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), - new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1), new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1)); - public static final WeightedList STRONGHOLD_LIBRARY = new WeightedList(new RngLoot(Items.book, 0, 1, 3, 20), - new RngLoot(Items.paper, 0, 2, 7, 20), new RngLoot(Items.string, 0, 1, 1, 1), new RngLoot(Items.navigator, 0, 1, 1, 1)); - public static final WeightedList STRONGHOLD_CROSS = new WeightedList(new RngLoot(Items.iron_ingot, 0, 1, 5, 10), - new RngLoot(Items.gold_ingot, 0, 1, 3, 5), new RngLoot(Items.redstone, 0, 4, 9, 5), new RngLoot(Items.coal, 0, 3, 8, 10), - new RngLoot(Items.bread, 0, 1, 3, 15), new RngLoot(Items.apple, 0, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 0, 1, 1, 1)); - public static final WeightedList DESERT_PYRAMID = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 3), - new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 2, 7, 15), new RngLoot(Items.emerald, 0, 1, 3, 2), - new RngLoot(Items.bone, 0, 4, 6, 20), new RngLoot(Items.rotten_flesh, 0, 3, 7, 16), new RngLoot(Items.saddle, 0, 1, 1, 3), - new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1), - new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1)); - public static final WeightedList JUNGLE_MAIN = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 3), - new RngLoot(Items.iron_ingot, 0, 1, 5, 10), new RngLoot(Items.gold_ingot, 0, 2, 7, 15), new RngLoot(Items.emerald, 0, 1, 3, 2), - new RngLoot(Items.bone, 0, 4, 6, 20), new RngLoot(Items.rotten_flesh, 0, 3, 7, 16), new RngLoot(Items.saddle, 0, 1, 1, 3), - new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 1), - new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 1)); - public static final WeightedList JUNGLE_TRAP = new WeightedList(new RngLoot(Items.arrow, 0, 2, 7, 30)); - public static final WeightedList MINESHAFT_CHEST = new WeightedList(new RngLoot(Items.iron_ingot, 0, 1, 5, 10), - new RngLoot(Items.gold_ingot, 0, 1, 3, 5), new RngLoot(Items.redstone, 0, 4, 9, 5), - new RngLoot(Items.dye, DyeColor.BLUE.getDyeDamage(), 4, 9, 5), new RngLoot(Items.diamond, 0, 1, 2, 3), - new RngLoot(Items.coal, 0, 3, 8, 10), new RngLoot(Items.bread, 0, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 0, 1, 1, 1), - new RngLoot(ItemRegistry.getItemFromBlock(Blocks.rail), 0, 4, 8, 1), new RngLoot(Items.melon_stem, 0, 2, 4, 10), - new RngLoot(Items.pumpkin_stem, 0, 2, 4, 10), new RngLoot(Items.saddle, 0, 1, 1, 3), new RngLoot(Items.iron_horse_armor, 0, 1, 1, 1)); - public static final WeightedList HELL_FORTRESS = new WeightedList(new RngLoot(Items.diamond, 0, 1, 3, 5), - new RngLoot(Items.iron_ingot, 0, 1, 5, 5), new RngLoot(Items.gold_ingot, 0, 1, 3, 15), new RngLoot(Items.gold_sword, 0, 1, 1, 5), - new RngLoot(Items.gold_chestplate, 0, 1, 1, 5), new RngLoot(Items.flint_and_steel, 0, 1, 1, 5), - new RngLoot(Items.soul_wart, 0, 3, 7, 5), new RngLoot(Items.saddle, 0, 1, 1, 10), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 8), - new RngLoot(Items.iron_horse_armor, 0, 1, 1, 5), new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 3), - new RngLoot(ItemRegistry.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)); - public static final WeightedList DUNGEON_CHEST = new WeightedList(new RngLoot(Items.saddle, 0, 1, 1, 11), - new RngLoot(Items.iron_ingot, 0, 1, 4, 11), new RngLoot(Items.bread, 0, 1, 1, 11), new RngLoot(Items.wheats, 0, 1, 4, 11), - new RngLoot(Items.gunpowder, 0, 1, 4, 11), new RngLoot(Items.string, 0, 1, 4, 11), new RngLoot(Items.bucket, 0, 1, 1, 11), - new RngLoot(Items.golden_apple, 0, 1, 1, 1), new RngLoot(Items.redstone, 0, 1, 4, 11), new RngLoot(Items.aluminium_ingot, 0, 1, 1, 5), - new RngLoot(Items.copper_ingot, 0, 1, 1, 5), new RngLoot(Items.name_tag, 0, 1, 1, 11), new RngLoot(Items.gold_horse_armor, 0, 1, 1, 3), - new RngLoot(Items.iron_horse_armor, 0, 1, 1, 6), new RngLoot(Items.diamond_horse_armor, 0, 1, 1, 2), - new RngLoot(Items.record_13, 0, 1, 1, 1), new RngLoot(Items.record_cat, 0, 1, 1, 1), new RngLoot(Items.record_blocks, 0, 1, 1, 1), - new RngLoot(Items.record_chirp, 0, 1, 1, 1), new RngLoot(Items.record_far, 0, 1, 1, 1), new RngLoot(Items.record_mall, 0, 1, 1, 1), - new RngLoot(Items.record_mellohi, 0, 1, 1, 1), new RngLoot(Items.record_stal, 0, 1, 1, 1), new RngLoot(Items.record_strad, 0, 1, 1, 1), - new RngLoot(Items.record_ward, 0, 1, 1, 1), new RngLoot(Items.record_11, 0, 1, 1, 1), new RngLoot(Items.record_wait, 0, 1, 1, 1), - new RngLoot(Items.record_delay, 0, 1, 1, 1), new RngLoot(Items.record_extend, 0, 1, 1, 1)); - public static final WeightedList ABANDONED_ITEMS = new WeightedList(new RngLoot(Items.stick, 0, 1, 3, 10), - new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_planks), 0, 1, 3, 10), - new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_log), 0, 1, 3, 10), new RngLoot(Items.stone_axe, 0, 1, 1, 3), - new RngLoot(Items.wood_axe, 0, 1, 1, 5), new RngLoot(Items.stone_pickaxe, 0, 1, 1, 3), new RngLoot(Items.wood_pickaxe, 0, 1, 1, 5), - new RngLoot(Items.apple, 0, 2, 3, 5), new RngLoot(Items.bread, 0, 2, 3, 3), - new RngLoot(ItemRegistry.getItemFromBlock(Blocks.acacia_log), 0, 1, 3, 10)); + public static final WeightedList VILLAGE_BLACKSMITH = new WeightedList(new RngLoot(Items.diamond, 1, 3, 3), + new RngLoot(Items.iron_ingot, 1, 5, 10), new RngLoot(Items.gold_ingot, 1, 3, 5), new RngLoot(Items.bread, 1, 3, 15), + new RngLoot(Items.apple, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 1, 1, 5), new RngLoot(Items.iron_sword, 1, 1, 5), + new RngLoot(Items.iron_chestplate, 1, 1, 5), new RngLoot(Items.iron_helmet, 1, 1, 5), new RngLoot(Items.iron_leggings, 1, 1, 5), + new RngLoot(Items.iron_boots, 1, 1, 5), new RngLoot(ItemRegistry.getItemFromBlock(Blocks.obsidian), 3, 7, 5), + new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_sapling), 3, 7, 5), new RngLoot(Items.saddle, 1, 1, 3), + new RngLoot(Items.iron_horse_armor, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 1, 1, 1), + new RngLoot(Items.diamond_horse_armor, 1, 1, 1)); + public static final WeightedList STRONGHOLD_CHEST = new WeightedList(new RngLoot(Items.orb, 1, 1, 10), + new RngLoot(Items.diamond, 1, 3, 3), new RngLoot(Items.iron_ingot, 1, 5, 10), new RngLoot(Items.gold_ingot, 1, 3, 5), + new RngLoot(Items.redstone, 4, 9, 5), new RngLoot(Items.bread, 1, 3, 15), new RngLoot(Items.apple, 1, 3, 15), + new RngLoot(Items.iron_pickaxe, 1, 1, 5), new RngLoot(Items.iron_sword, 1, 1, 5), new RngLoot(Items.iron_chestplate, 1, 1, 5), + new RngLoot(Items.iron_helmet, 1, 1, 5), new RngLoot(Items.iron_leggings, 1, 1, 5), new RngLoot(Items.iron_boots, 1, 1, 5), + new RngLoot(Items.golden_apple, 1, 1, 1), new RngLoot(Items.saddle, 1, 1, 1), new RngLoot(Items.iron_horse_armor, 1, 1, 1), + new RngLoot(Items.gold_horse_armor, 1, 1, 1), new RngLoot(Items.diamond_horse_armor, 1, 1, 1)); + public static final WeightedList STRONGHOLD_LIBRARY = new WeightedList(new RngLoot(Items.book, 1, 3, 20), + new RngLoot(Items.paper, 2, 7, 20), new RngLoot(Items.string, 1, 1, 1), new RngLoot(Items.navigator, 1, 1, 1)); + public static final WeightedList STRONGHOLD_CROSS = new WeightedList(new RngLoot(Items.iron_ingot, 1, 5, 10), + new RngLoot(Items.gold_ingot, 1, 3, 5), new RngLoot(Items.redstone, 4, 9, 5), new RngLoot(Items.coal, 3, 8, 10), + new RngLoot(Items.bread, 1, 3, 15), new RngLoot(Items.apple, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 1, 1, 1)); + public static final WeightedList DESERT_PYRAMID = new WeightedList(new RngLoot(Items.diamond, 1, 3, 3), + new RngLoot(Items.iron_ingot, 1, 5, 10), new RngLoot(Items.gold_ingot, 2, 7, 15), new RngLoot(Items.emerald, 1, 3, 2), + new RngLoot(Items.bone, 4, 6, 20), new RngLoot(Items.rotten_flesh, 3, 7, 16), new RngLoot(Items.saddle, 1, 1, 3), + new RngLoot(Items.iron_horse_armor, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 1, 1, 1), + new RngLoot(Items.diamond_horse_armor, 1, 1, 1)); + public static final WeightedList JUNGLE_MAIN = new WeightedList(new RngLoot(Items.diamond, 1, 3, 3), + new RngLoot(Items.iron_ingot, 1, 5, 10), new RngLoot(Items.gold_ingot, 2, 7, 15), new RngLoot(Items.emerald, 1, 3, 2), + new RngLoot(Items.bone, 4, 6, 20), new RngLoot(Items.rotten_flesh, 3, 7, 16), new RngLoot(Items.saddle, 1, 1, 3), + new RngLoot(Items.iron_horse_armor, 1, 1, 1), new RngLoot(Items.gold_horse_armor, 1, 1, 1), + new RngLoot(Items.diamond_horse_armor, 1, 1, 1)); + public static final WeightedList JUNGLE_TRAP = new WeightedList(new RngLoot(Items.arrow, 2, 7, 30)); + public static final WeightedList MINESHAFT_CHEST = new WeightedList(new RngLoot(Items.iron_ingot, 1, 5, 10), + new RngLoot(Items.gold_ingot, 1, 3, 5), new RngLoot(Items.redstone, 4, 9, 5), + new RngLoot(Items.lapis_lazuli, 4, 9, 5), new RngLoot(Items.diamond, 1, 2, 3), + new RngLoot(Items.coal, 3, 8, 10), new RngLoot(Items.bread, 1, 3, 15), new RngLoot(Items.iron_pickaxe, 1, 1, 1), + new RngLoot(ItemRegistry.getItemFromBlock(Blocks.rail), 4, 8, 1), new RngLoot(Items.melon_stem, 2, 4, 10), + new RngLoot(Items.pumpkin_stem, 2, 4, 10), new RngLoot(Items.saddle, 1, 1, 3), new RngLoot(Items.iron_horse_armor, 1, 1, 1)); + public static final WeightedList HELL_FORTRESS = new WeightedList(new RngLoot(Items.diamond, 1, 3, 5), + new RngLoot(Items.iron_ingot, 1, 5, 5), new RngLoot(Items.gold_ingot, 1, 3, 15), new RngLoot(Items.gold_sword, 1, 1, 5), + new RngLoot(Items.gold_chestplate, 1, 1, 5), new RngLoot(Items.flint_and_steel, 1, 1, 5), + new RngLoot(Items.soul_wart, 3, 7, 5), new RngLoot(Items.saddle, 1, 1, 10), new RngLoot(Items.gold_horse_armor, 1, 1, 8), + new RngLoot(Items.iron_horse_armor, 1, 1, 5), new RngLoot(Items.diamond_horse_armor, 1, 1, 3), + new RngLoot(ItemRegistry.getItemFromBlock(Blocks.obsidian), 2, 4, 2)); + public static final WeightedList DUNGEON_CHEST = new WeightedList(new RngLoot(Items.saddle, 1, 1, 11), + new RngLoot(Items.iron_ingot, 1, 4, 11), new RngLoot(Items.bread, 1, 1, 11), new RngLoot(Items.wheats, 1, 4, 11), + new RngLoot(Items.gunpowder, 1, 4, 11), new RngLoot(Items.string, 1, 4, 11), new RngLoot(Items.bucket, 1, 1, 11), + new RngLoot(Items.golden_apple, 1, 1, 1), new RngLoot(Items.redstone, 1, 4, 11), new RngLoot(Items.aluminium_ingot, 1, 1, 5), + new RngLoot(Items.copper_ingot, 1, 1, 5), new RngLoot(Items.name_tag, 1, 1, 11), new RngLoot(Items.gold_horse_armor, 1, 1, 3), + new RngLoot(Items.iron_horse_armor, 1, 1, 6), new RngLoot(Items.diamond_horse_armor, 1, 1, 2), + new RngLoot(Items.record_13, 1, 1, 1), new RngLoot(Items.record_cat, 1, 1, 1), new RngLoot(Items.record_blocks, 1, 1, 1), + new RngLoot(Items.record_chirp, 1, 1, 1), new RngLoot(Items.record_far, 1, 1, 1), new RngLoot(Items.record_mall, 1, 1, 1), + new RngLoot(Items.record_mellohi, 1, 1, 1), new RngLoot(Items.record_stal, 1, 1, 1), new RngLoot(Items.record_strad, 1, 1, 1), + new RngLoot(Items.record_ward, 1, 1, 1), new RngLoot(Items.record_11, 1, 1, 1), new RngLoot(Items.record_wait, 1, 1, 1), + new RngLoot(Items.record_delay, 1, 1, 1), new RngLoot(Items.record_extend, 1, 1, 1)); + public static final WeightedList ABANDONED_ITEMS = new WeightedList(new RngLoot(Items.stick, 1, 3, 10), + new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_planks), 1, 3, 10), + new RngLoot(ItemRegistry.getItemFromBlock(Blocks.oak_log), 1, 3, 10), new RngLoot(Items.stone_axe, 1, 1, 3), + new RngLoot(Items.wood_axe, 1, 1, 5), new RngLoot(Items.stone_pickaxe, 1, 1, 3), new RngLoot(Items.wood_pickaxe, 1, 1, 5), + new RngLoot(Items.apple, 2, 3, 5), new RngLoot(Items.bread, 2, 3, 3), + new RngLoot(ItemRegistry.getItemFromBlock(Blocks.acacia_log), 1, 3, 10)); } diff --git a/server/src/main/java/server/worldgen/caves/MapGenCaves.java b/server/src/main/java/server/worldgen/caves/MapGenCaves.java index c3c67d49..e8684b27 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenCaves.java +++ b/server/src/main/java/server/worldgen/caves/MapGenCaves.java @@ -1,8 +1,8 @@ package server.worldgen.caves; import common.block.Block; -import common.block.BlockColored; -import common.block.natural.BlockSand; +import common.block.artificial.BlockWool; +import common.block.natural.BlockColoredClay; import common.color.DyeColor; import common.init.Blocks; import common.rng.Random; @@ -212,7 +212,11 @@ public class MapGenCaves extends MapGenBase if (iblockstate2.getBlock() == Blocks.sand) { - p_180702_5_.set(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE) : Blocks.sandstone.getState()); //TODO: check! + p_180702_5_.set(j3, j2 + 1, i2, Blocks.sandstone.getState()); //TODO: check! + } + else if (iblockstate2.getBlock() == Blocks.red_sand) + { + p_180702_5_.set(j3, j2 + 1, i2, Blocks.orange_clay.getState()); //TODO: check! } if (flag1 && p_180702_5_.get(j3, j2 - 1, i2).getBlock() == this.top) @@ -240,7 +244,7 @@ public class MapGenCaves extends MapGenBase protected boolean func_175793_a(State p_175793_1_, State p_175793_2_) { - return p_175793_1_.getBlock() == this.replace ? true : (p_175793_1_.getBlock() == this.top ? true : (p_175793_1_.getBlock() == this.surface ? true : (p_175793_1_.getBlock() == Blocks.hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.stained_hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.sandstone ? true : /* (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : */ (p_175793_1_.getBlock() == Blocks.mycelium ? true : (p_175793_1_.getBlock() == Blocks.snow_layer ? true : (p_175793_1_.getBlock() == Blocks.sand || p_175793_1_.getBlock() == this.alt) && !p_175793_2_.getBlock().getMaterial().isColdLiquid()))))))); // ); + return p_175793_1_.getBlock() == this.replace ? true : (p_175793_1_.getBlock() == this.top ? true : (p_175793_1_.getBlock() == this.surface ? true : (p_175793_1_.getBlock() == Blocks.hardened_clay ? true : (p_175793_1_.getBlock() instanceof BlockColoredClay ? true : (p_175793_1_.getBlock() == Blocks.sandstone ? true : /* (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : */ (p_175793_1_.getBlock() == Blocks.mycelium ? true : (p_175793_1_.getBlock() == Blocks.snow_layer ? true : (p_175793_1_.getBlock() == Blocks.sand || p_175793_1_.getBlock() == this.alt) && !p_175793_2_.getBlock().getMaterial().isColdLiquid()))))))); // ); } /** diff --git a/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java b/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java index 90b06369..9f8b9e41 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java @@ -1,7 +1,6 @@ package server.worldgen.feature; import common.block.artificial.BlockSlab; -import common.block.natural.BlockSand; import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; @@ -24,7 +23,7 @@ public class WorldGenDesertWells extends FeatureGenerator } State state = worldIn.getState(position); - if (state.getBlock() != Blocks.sand || state.getValue(BlockSand.VARIANT) != BlockSand.EnumType.SAND) + if (state.getBlock() != Blocks.sand) { return false; } diff --git a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java index 548e5845..5c3243e4 100755 --- a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java +++ b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java @@ -1,16 +1,15 @@ package server.worldgen.foliage; import common.block.foliage.BlockDoublePlant; -import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; import server.world.WorldServer; public class FeatureDoublePlant { - private BlockDoublePlant.EnumPlantType type; + private BlockDoublePlant type; - public void setPlantType(BlockDoublePlant.EnumPlantType type) + public void setPlantType(BlockDoublePlant type) { this.type = type; } @@ -23,9 +22,9 @@ public class FeatureDoublePlant { BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); - if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && Blocks.double_plant.canPlaceBlockAt(worldIn, blockpos)) + if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && this.type.canPlaceBlockAt(worldIn, blockpos)) { - Blocks.double_plant.placeAt(worldIn, blockpos, this.type, 2); + this.type.placeAt(worldIn, blockpos, 2); flag = true; } } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java b/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java index 4bc978c3..d3990ecd 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java @@ -10,17 +10,17 @@ import server.worldgen.FeatureGenerator; public class WorldGenFlowers extends FeatureGenerator { private BlockFlower flower; - private State field_175915_b; + private State state; - public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_) + public WorldGenFlowers(BlockFlower block) { - this.setGeneratedBlock(p_i45632_1_, p_i45632_2_); + this.setGeneratedBlock(block); } - public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_) + public void setGeneratedBlock(BlockFlower block) { - this.flower = p_175914_1_; - this.field_175915_b = p_175914_1_.getState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_); + this.flower = block; + this.state = block.getState(); } public boolean generate(WorldServer worldIn, Random rand, BlockPos position) @@ -29,9 +29,9 @@ public class WorldGenFlowers extends FeatureGenerator { BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); - if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b)) + if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.state)) { - worldIn.setState(blockpos, this.field_175915_b, 2); + worldIn.setState(blockpos, this.state, 2); } } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java index 65d93768..5d1566a2 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -12,14 +13,14 @@ import server.worldgen.tree.WorldGenBaseTree; public class WorldGenShrub extends WorldGenBaseTree { - private final State leavesMetadata; + private final WoodType leavesMetadata; private final State woodMetadata; - public WorldGenShrub(State log, State leaves) + public WorldGenShrub(State log, WoodType leaves) { super(false); this.woodMetadata = log; - this.leavesMetadata = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + this.leavesMetadata = leaves; } public boolean generate(WorldServer worldIn, Random rand, BlockPos position) @@ -57,7 +58,7 @@ public class WorldGenShrub extends WorldGenBaseTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java b/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java index 81a1d757..e0257bd3 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java @@ -12,11 +12,13 @@ import server.worldgen.FeatureGenerator; public class WorldGenTallGrass extends FeatureGenerator { + private final BlockTallGrass tallGrass; private final State tallGrassState; - public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_) + public WorldGenTallGrass(BlockTallGrass block) { - this.tallGrassState = Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, p_i45629_1_); + this.tallGrass = block; + this.tallGrassState = block.getState(); } public boolean generate(WorldServer worldIn, Random rand, BlockPos position) @@ -32,7 +34,7 @@ public class WorldGenTallGrass extends FeatureGenerator { BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); - if (worldIn.isAirBlock(blockpos) && Blocks.tallgrass.canBlockStay(worldIn, blockpos, this.tallGrassState)) + if (worldIn.isAirBlock(blockpos) && this.tallGrass.canBlockStay(worldIn, blockpos, this.tallGrassState)) { worldIn.setState(blockpos, this.tallGrassState, 2); } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java b/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java index c5a78585..9cb72a80 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java @@ -1,6 +1,6 @@ package server.worldgen.foliage; -import common.block.BlockDirectional; +import common.block.foliage.BlockLilyPad; import common.init.Blocks; import common.rng.Random; import common.util.BlockPos; @@ -20,7 +20,7 @@ public class WorldGenWaterlily extends FeatureGenerator if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlaceBlockAt(worldIn, new BlockPos(j, k, l))) { - worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, Facing.randHorizontal(rand)), 2); + worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2); } } diff --git a/server/src/main/java/server/worldgen/structure/StructureComponent.java b/server/src/main/java/server/worldgen/structure/StructureComponent.java index bbc96a98..ab5ab6c8 100755 --- a/server/src/main/java/server/worldgen/structure/StructureComponent.java +++ b/server/src/main/java/server/worldgen/structure/StructureComponent.java @@ -3,7 +3,7 @@ package server.worldgen.structure; import java.util.List; import common.block.Block; -import common.block.BlockDirectional; +import common.block.Rotatable; import common.block.artificial.BlockDoor; import common.init.Blocks; import common.item.ItemDoor; @@ -415,7 +415,7 @@ public abstract class StructureComponent } } } - else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof BlockDirectional)) + else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof Rotatable)) { if (blockIn == Blocks.piston || blockIn == Blocks.sticky_piston || blockIn == Blocks.lever || blockIn == Blocks.dispenser) { diff --git a/server/src/main/java/server/worldgen/structure/StructureScattered.java b/server/src/main/java/server/worldgen/structure/StructureScattered.java index 5d2705a2..c6a1fc03 100755 --- a/server/src/main/java/server/worldgen/structure/StructureScattered.java +++ b/server/src/main/java/server/worldgen/structure/StructureScattered.java @@ -1,7 +1,6 @@ package server.worldgen.structure; import common.block.artificial.BlockFlowerPot; -import common.block.artificial.BlockStoneBrick; import common.block.foliage.BlockFlower; import common.block.natural.BlockSandStone; import common.block.tech.BlockLever; @@ -82,8 +81,6 @@ public class StructureScattered int l2 = this.getMetadataWithOffset(Blocks.sandstone_stairs, 2); int i3 = this.getMetadataWithOffset(Blocks.sandstone_stairs, 0); int l = this.getMetadataWithOffset(Blocks.sandstone_stairs, 1); - int i1 = ~DyeColor.ORANGE.getDyeDamage() & 15; - int j1 = ~DyeColor.BLUE.getDyeDamage() & 15; this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 9, 4, Blocks.sandstone.getState(), Blocks.air.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 10, 1, 3, 10, 3, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), 2, 10, 0, structureBoundingBoxIn); @@ -98,29 +95,29 @@ public class StructureScattered this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(l), this.scatteredFeatureSizeX - 1, 10, 2, structureBoundingBoxIn); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 12, 4, 4, Blocks.sandstone.getState(), Blocks.air.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 0, 11, 3, 4, Blocks.air.getState(), Blocks.air.getState(), false); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 9, 1, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 9, 2, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 9, 3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 10, 3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 11, 3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 11, 2, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 11, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 9, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 9, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 9, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 10, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 11, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 11, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 11, 1, 1, structureBoundingBoxIn); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 8, 3, 3, Blocks.sandstone.getState(), Blocks.air.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 8, 2, 2, Blocks.air.getState(), Blocks.air.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 1, 16, 3, 3, Blocks.sandstone.getState(), Blocks.air.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 2, 16, 2, 2, Blocks.air.getState(), Blocks.air.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 5, this.scatteredFeatureSizeX - 6, 4, this.scatteredFeatureSizeZ - 6, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 4, 9, 11, 4, 11, Blocks.air.getState(), Blocks.air.getState(), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 8, 8, 3, 8, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 8, 12, 3, 8, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 12, 8, 3, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 12, 12, 3, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 8, 8, 3, 8, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 8, 12, 3, 8, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 12, 8, 3, 12, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 12, 12, 3, 12, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 5, 4, 4, 11, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 5, 1, 5, this.scatteredFeatureSizeX - 2, 4, 11, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 7, 9, 6, 7, 11, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 7, 7, 9, this.scatteredFeatureSizeX - 7, 7, 11, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 9, 5, 7, 11, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 6, 5, 9, this.scatteredFeatureSizeX - 6, 7, 11, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 9, 5, 7, 11, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 6, 5, 9, this.scatteredFeatureSizeX - 6, 7, 11, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); this.setBlockState(worldIn, Blocks.air.getState(), 5, 5, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 5, 6, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 6, 6, 10, structureBoundingBoxIn); @@ -148,105 +145,105 @@ public class StructureScattered for (int k1 = 5; k1 <= 17; k1 += 2) { - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 4, 1, k1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 4, 2, k1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), this.scatteredFeatureSizeX - 5, 1, k1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), this.scatteredFeatureSizeX - 5, 2, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 4, 1, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 4, 2, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), this.scatteredFeatureSizeX - 5, 1, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), this.scatteredFeatureSizeX - 5, 2, k1, structureBoundingBoxIn); } - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 7, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 8, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 9, 0, 9, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 11, 0, 9, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 8, 0, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 12, 0, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 7, 0, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 13, 0, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 9, 0, 11, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 11, 0, 11, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 12, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 13, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(j1), 10, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 10, 0, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 10, 0, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 9, 0, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 11, 0, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 8, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 12, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 7, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 13, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 9, 0, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 11, 0, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 10, 0, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 10, 0, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.blue_clay.getState(), 10, 0, 10, structureBoundingBoxIn); for (int j3 = 0; j3 <= this.scatteredFeatureSizeX - 1; j3 += this.scatteredFeatureSizeX - 1) { - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 2, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 2, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 2, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 3, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 3, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 3, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 4, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), j3, 4, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 4, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 5, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 5, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 5, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 6, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), j3, 6, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 6, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 7, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 7, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 7, 3, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 8, 1, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 8, 2, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 8, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 4, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), j3, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 5, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 5, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 6, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), j3, 6, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 6, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 7, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 7, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), j3, 7, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 8, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 8, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), j3, 8, 3, structureBoundingBoxIn); } for (int k3 = 2; k3 <= this.scatteredFeatureSizeX - 3; k3 += this.scatteredFeatureSizeX - 3 - 2) { - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 2, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 2, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 2, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 3, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 3, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 3, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 - 1, 4, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), k3, 4, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 + 1, 4, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 5, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 5, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 5, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 - 1, 6, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), k3, 6, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 + 1, 6, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 - 1, 7, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 7, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 + 1, 7, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 8, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3, 8, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 8, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 - 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 + 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 - 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 + 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3 - 1, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), k3, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3 + 1, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 - 1, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 + 1, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3 - 1, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), k3, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3 + 1, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3 - 1, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), k3 + 1, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 - 1, 8, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3, 8, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), k3 + 1, 8, 0, structureBoundingBoxIn); } - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 4, 0, 12, 6, 0, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 4, 0, 12, 6, 0, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); this.setBlockState(worldIn, Blocks.air.getState(), 8, 6, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 12, 6, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 9, 5, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 10, 5, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 11, 5, 0, structureBoundingBoxIn); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -14, 8, 12, -11, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -10, 8, 12, -10, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), false); - this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -9, 8, 12, -9, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 9, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 10, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.orange_clay.getState(), 11, 5, 0, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -14, 8, 12, -11, 12, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -10, 8, 12, -10, 12, Blocks.carved_sandstone.getState(), Blocks.carved_sandstone.getState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -9, 8, 12, -9, 12, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -8, 8, 12, -1, 12, Blocks.sandstone.getState(), Blocks.sandstone.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, -11, 9, 11, -1, 11, Blocks.air.getState(), Blocks.air.getState(), false); this.setBlockState(worldIn, Blocks.stone_pressure_plate.getState(), 10, -11, 10, structureBoundingBoxIn); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, -13, 9, 11, -13, 11, Blocks.tnt.getState(), Blocks.air.getState(), false); this.setBlockState(worldIn, Blocks.air.getState(), 8, -11, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 8, -10, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 7, -10, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 7, -11, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 7, -10, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 7, -11, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 12, -11, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 12, -10, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 13, -10, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 13, -11, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 13, -10, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 13, -11, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 10, -11, 8, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 10, -10, 8, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 10, -10, 7, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 10, -11, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 10, -10, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 10, -11, 7, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 10, -11, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 10, -10, 12, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 10, -10, 13, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 10, -11, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 10, -10, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 10, -11, 13, structureBoundingBoxIn); for (Facing enumfacing : Facing.Plane.HORIZONTAL) { @@ -554,9 +551,9 @@ public class StructureScattered this.setBlockState(worldIn, Blocks.mossy_cobblestone.getState(), 8, -3, 5, structureBoundingBoxIn); this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, -1, 1, 9, -1, 5, false, randomIn, junglePyramidsRandomScatteredStones); this.fillWithAir(worldIn, structureBoundingBoxIn, 8, -3, 8, 10, -1, 10); - this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 8, -2, 11, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 9, -2, 11, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 10, -2, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_stonebrick.getState(), 8, -2, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_stonebrick.getState(), 9, -2, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.carved_stonebrick.getState(), 10, -2, 11, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 8, -2, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 9, -2, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(Facing.getFront(this.getMetadataWithOffset(Blocks.lever, Facing.NORTH.getIndex())))), 10, -2, 12, structureBoundingBoxIn); @@ -649,7 +646,7 @@ public class StructureScattered this.setBlockState(worldIn, Blocks.air.getState(), 1, 3, 4, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 4, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 5, 3, 5, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.flower_pot.getState().withProperty(BlockFlowerPot.CONTENTS, 2 + BlockFlower.EnumFlowerType.BLACK_LOTUS.getMeta()), 1, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.flowerpot_black_lotus.getState(), 1, 3, 5, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.workbench.getState(), 3, 2, 6, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.cauldron.getState(), 4, 2, 6, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 1, structureBoundingBoxIn); diff --git a/server/src/main/java/server/worldgen/structure/StructureStronghold.java b/server/src/main/java/server/worldgen/structure/StructureStronghold.java index b96c6c4b..49d68447 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStronghold.java +++ b/server/src/main/java/server/worldgen/structure/StructureStronghold.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; import common.block.artificial.BlockSlab; -import common.block.artificial.BlockStoneBrick; import common.collect.Lists; import common.collect.Maps; import common.entity.npc.EntityHaunter; @@ -1349,11 +1348,11 @@ public class StructureStronghold if (f < 0.2F) { - this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CRACKED_META); + this.blockstate = Blocks.cracked_stonebrick.getState(); } else if (f < 0.5F) { - this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.MOSSY_META); + this.blockstate = Blocks.mossy_stonebrick.getState(); } // else if (f < 0.55F) // { diff --git a/server/src/main/java/server/worldgen/structure/StructureVillage.java b/server/src/main/java/server/worldgen/structure/StructureVillage.java index d88fb768..0c7f121b 100755 --- a/server/src/main/java/server/worldgen/structure/StructureVillage.java +++ b/server/src/main/java/server/worldgen/structure/StructureVillage.java @@ -1477,7 +1477,7 @@ public class StructureVillage this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 0, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 1, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 0, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(DyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.white_wool.getState(), 1, 3, 0, structureBoundingBoxIn); boolean flag = this.coordBaseMode == Facing.EAST || this.coordBaseMode == Facing.NORTH; this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn); @@ -1643,12 +1643,12 @@ public class StructureVillage if (p_175847_1_.getBlock() == Blocks.cobblestone) { - return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.DEFAULT.getMetadata()); + return Blocks.sandstone.getState(); } if (p_175847_1_.getBlock() == Blocks.oak_planks) { - return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()); + return Blocks.smooth_sandstone.getState(); } if (p_175847_1_.getBlock() == Blocks.oak_stairs) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java index 58583165..cd5cf3ba 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java @@ -6,6 +6,7 @@ import common.block.foliage.BlockCocoa; import common.block.foliage.BlockLeaves; import common.block.foliage.BlockVine; import common.init.Blocks; +import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -16,29 +17,29 @@ import server.world.WorldServer; public class WorldGenBaseTree extends WorldGenTree { private static final State defLog = Blocks.oak_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); - private static final State defLeaves = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); + private static final WoodType defLeaves = WoodType.OAK; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); private final int minTreeHeight; private final boolean vinesGrow; private final State metaWood; - private final State metaLeaves; + private final WoodType metaLeaves; public WorldGenBaseTree(boolean notify) { this(notify, 4, defLog, defLeaves, false); } - public WorldGenBaseTree(boolean notify, State log, State leaves) + public WorldGenBaseTree(boolean notify, State log, WoodType leaves) { this(notify, 4, log, leaves, false); } - public WorldGenBaseTree(boolean notify, int minHeight, State log, State leaves, boolean vines) + public WorldGenBaseTree(boolean notify, int minHeight, State log, WoodType leaves, boolean vines) { super(notify); this.minTreeHeight = minHeight; this.metaWood = log; - this.metaLeaves = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + this.metaLeaves = leaves; this.vinesGrow = vines; } @@ -118,7 +119,7 @@ public class WorldGenBaseTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.metaLeaves, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java index 4daf686b..712dcb0a 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java @@ -8,6 +8,7 @@ import common.block.foliage.BlockLeaves; import common.block.foliage.BlockLog; import common.collect.Lists; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -16,7 +17,7 @@ import server.world.WorldServer; public class WorldGenBigTree extends WorldGenTree { - private final State leavesBase; + private final WoodType leavesBase; private final State logBase; private Random rand; @@ -34,7 +35,7 @@ public class WorldGenBigTree extends WorldGenTree private int leafDistanceLimit = 4; List field_175948_j; - public WorldGenBigTree(boolean notify, State logBase, State leavesBase) + public WorldGenBigTree(boolean notify, State logBase, WoodType leavesBase) { super(notify); this.leavesBase = leavesBase; @@ -43,7 +44,7 @@ public class WorldGenBigTree extends WorldGenTree public WorldGenBigTree(boolean notify) { - this(notify, Blocks.oak_log.getState(), Blocks.oak_leaves.getState()); + this(notify, Blocks.oak_log.getState(), WoodType.OAK); } public WorldGenBigTree setHeightLimit(int lower, int limit) { @@ -176,8 +177,7 @@ public class WorldGenBigTree extends WorldGenTree { for (int i = 0; i < this.leafDistanceLimit; ++i) { - this.func_181631_a(pos.up(i), this.leafSize(i), this.leavesBase.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)) - .withProperty(BlockLeaves.TYPE, this.world.getLeavesGen(pos.up(i)))); + this.func_181631_a(pos.up(i), this.leafSize(i), BlockLeaves.getLeavesBlock(this.leavesBase, this.world.getLeavesGen(pos.up(i))).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java index 58bdda10..54378827 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -12,9 +13,8 @@ import server.world.WorldServer; public class WorldGenBirch extends WorldGenTree { private static final State logBlock = Blocks.birch_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH); - private static final State leavesBlock = Blocks.birch_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.BIRCH) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType leavesBlock = WoodType.BIRCH; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.BIRCH); private boolean useExtraRandomHeight; public WorldGenBirch(boolean notify, boolean extra) @@ -103,7 +103,7 @@ public class WorldGenBirch extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(leavesBlock, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java index 65286b20..e8b95ac4 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -13,9 +14,8 @@ import server.world.WorldServer; public class WorldGenDarkOak extends WorldGenTree { private static final State logBlock = Blocks.dark_oak_log.getState(); // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK); - private static final State leavesBlock = Blocks.dark_oak_leaves.getState() -// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.DARK_OAK) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType leavesBlock = WoodType.DARK_OAK; +// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.DARK_OAK); public WorldGenDarkOak(boolean notify) { @@ -212,7 +212,7 @@ public class WorldGenDarkOak extends WorldGenTree if (block == Blocks.air) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(leavesBlock, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java index 05ddd76b..5f661fc6 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -18,16 +19,16 @@ public abstract class WorldGenHugeTree extends WorldGenTree protected final State woodMetadata; /** Sets the metadata for the leaves used in huge trees */ - protected final State leavesMetadata; + protected final WoodType leavesMetadata; protected int extraRandomHeight; - public WorldGenHugeTree(boolean notify, int base, int extra, State log, State leaves) + public WorldGenHugeTree(boolean notify, int base, int extra, State log, WoodType leaves) { super(notify); this.baseHeight = base; this.extraRandomHeight = extra; this.woodMetadata = log; - this.leavesMetadata = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + this.leavesMetadata = leaves; } protected int func_150533_a(Random p_150533_1_) @@ -123,7 +124,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } @@ -145,7 +146,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java index ba30cdb2..03e15476 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java @@ -2,6 +2,7 @@ package server.worldgen.tree; import common.block.foliage.BlockVine; import common.init.Blocks; +import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -11,7 +12,7 @@ import server.world.WorldServer; public class WorldGenJungle extends WorldGenHugeTree { - public WorldGenJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, State p_i46448_4_, State p_i46448_5_) + public WorldGenJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, State p_i46448_4_, WoodType p_i46448_5_) { super(p_i46448_1_, p_i46448_2_, p_i46448_3_, p_i46448_4_, p_i46448_5_); } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenPine.java b/server/src/main/java/server/worldgen/tree/WorldGenPine.java index 26b98200..c48176c7 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenPine.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenPine.java @@ -2,8 +2,8 @@ package server.worldgen.tree; import common.block.Block; import common.block.Material; -import common.block.natural.BlockDirt; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -13,8 +13,9 @@ import server.world.WorldServer; public class WorldGenPine extends WorldGenHugeTree { private static final State field_181633_e = Blocks.spruce_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); - private static final State field_181634_f = Blocks.spruce_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final State field_181635_g = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL); + private static final WoodType field_181634_f = WoodType.SPRUCE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final State field_181635_g = Blocks.podzol.getState(); + private boolean useBaseHeight; public WorldGenPine(boolean p_i45457_1_, boolean p_i45457_2_) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java index dfd389b5..757f98d4 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -14,9 +15,8 @@ public class WorldGenSavanna extends WorldGenTree { private static final State field_181643_a = Blocks.acacia_log.getState(); // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA); - private static final State field_181644_b = Blocks.acacia_leaves.getState() -// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.ACACIA) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181644_b = WoodType.ACACIA; +// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.ACACIA); public WorldGenSavanna(boolean p_i45463_1_) { @@ -213,7 +213,7 @@ public class WorldGenSavanna extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(p_175924_2_))); + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, BlockLeaves.getLeavesBlock(field_181644_b, worldIn.getLeavesGen(p_175924_2_)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java index 276ed3cb..ceaf681b 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java @@ -5,6 +5,7 @@ import common.block.Material; import common.block.foliage.BlockLeaves; import common.block.foliage.BlockVine; import common.init.Blocks; +import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -15,9 +16,8 @@ public class WorldGenSwamp extends WorldGenTree { private static final State field_181648_a = Blocks.oak_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); - private static final State field_181649_b = Blocks.oak_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181649_b = WoodType.OAK; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); public WorldGenSwamp() { @@ -112,7 +112,7 @@ public class WorldGenSwamp extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181649_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java index 2ae38594..efb87ba1 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -13,9 +14,8 @@ public class WorldGenTaiga1 extends WorldGenTree { private static final State field_181636_a = Blocks.spruce_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); - private static final State field_181637_b = Blocks.spruce_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181637_b = WoodType.SPRUCE; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); public WorldGenTaiga1() { @@ -95,7 +95,7 @@ public class WorldGenTaiga1 extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181637_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java index ba017a36..78f01240 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -13,9 +14,8 @@ public class WorldGenTaiga2 extends WorldGenTree { private static final State field_181645_a = Blocks.spruce_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); - private static final State field_181646_b = Blocks.spruce_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181646_b = WoodType.SPRUCE; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); public WorldGenTaiga2(boolean p_i2025_1_) { @@ -101,7 +101,7 @@ public class WorldGenTaiga2 extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181646_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } }