diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index d6fa8bd0..5ea46871 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.Property; +import common.properties.IProperty; import common.sound.EventType; import common.sound.PositionedSound; import common.util.BlockPos; @@ -1497,6 +1497,8 @@ public class Client implements IThreadListener { return; } + int meta = 0; + boolean flag1 = false; Item item = null; if (this.pointed.type == HitPosition.ObjectType.BLOCK) @@ -1517,7 +1519,8 @@ public class Client implements IThreadListener { } Block block1 = item instanceof ItemBlock && !block.isPickStrict() ? item.getBlock() : block; - // meta = block1.getDamageValue(this.world, blockpos); TODO: data + meta = block1.getDamageValue(this.world, blockpos); + flag1 = item.getHasSubtypes(); } else { @@ -1532,9 +1535,9 @@ public class Client implements IThreadListener { InventoryPlayer inventoryplayer = this.player.inventory; - inventoryplayer.setCurrentItem(item); + inventoryplayer.setCurrentItem(item, meta, flag1); if(this.itemCheat) { - this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item), inventoryplayer.currentItem, this.ctrl())); + this.player.client.addToSendQueue(new CPacketCheat(new ItemStack(item, 1, meta), inventoryplayer.currentItem, this.ctrl())); } } } @@ -1929,7 +1932,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()); } @@ -1954,7 +1957,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 : "Gegens.: n/a") + "\n" + + "Gegens.: " + ItemRegistry.getNameFromItem(held.getItem()) + " x" + held.size + " (" + held.getMetadata() + ")" : "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 e69fc53d..254989d7 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, ritem)); + map.put(EntityDynamite.class, new RenderDynamite(mgr, Items.dynamite, 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 e7914270..5981cfc5 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)); + player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(ItemRegistry.getItemById(i), 1, 0); } 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 b8402af6..619016bb 100755 --- a/client/src/main/java/client/renderer/ItemModelMesher.java +++ b/client/src/main/java/client/renderer/ItemModelMesher.java @@ -32,13 +32,19 @@ public class ItemModelMesher public TextureAtlasSprite getParticleIcon(Item item) { - return this.getItemModel(new ItemStack(item)).getBaseTexture(); + return this.getParticleIcon(item, 0); + } + + public TextureAtlasSprite getParticleIcon(Item item, int meta) + { + return this.getItemModel(new ItemStack(item, 1, meta)).getBaseTexture(); } public IBakedModel getItemModel(ItemStack stack) { Item item = stack.getItem(); - IBakedModel ibakedmodel = this.simpleShapesCache.get(this.getIndex(item)); + IBakedModel ibakedmodel = this.simpleShapesCache.get(Integer.valueOf(this.getIndex(item, + stack.isItemStackDamageable() ? 0 : stack.getMetadata()))); if (ibakedmodel == null) { @@ -58,9 +64,9 @@ public class ItemModelMesher return ibakedmodel; } - private int getIndex(Item item) + private int getIndex(Item item, int meta) { - return ItemRegistry.getIdFromItem(item); + return ItemRegistry.getIdFromItem(item) << 16 | meta; } // public void register(Item item, int meta, ResourceLocation location) @@ -116,9 +122,9 @@ public class ItemModelMesher continue; item.getRenderItems(item, stacks); for(ItemStack stack : stacks) { - this.simpleShapesCache.put(this.getIndex(item), + this.simpleShapesCache.put(this.getIndex(item, stack.getMetadata()), this.modelManager.getModel("item/" + - ItemRegistry.getNameFromItem(item).toString() + '#' + "inventory")); + ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "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 2e581db0..3bd370d4 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() + '#' + "inventory"; - models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString())); + String resourcelocation = "item/" + ItemRegistry.getNameFromItem(item).toString() + "#" + stack.getMetadata() + '#' + "inventory"; + models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getNameFromItem(item).toString(), stack.getMetadata())); 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 f5bddec7..55a9399f 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.Property; +import common.properties.IProperty; import common.util.IRegistry; import common.world.State; @@ -36,7 +36,7 @@ public class ModelManager // Log.info("Builtin: " + BlockRegistry.getNameFromBlock(block)); } else { - Property[] ignored = block.getIgnoredProperties(); + IProperty[] 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 75c9acac..496e619c 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.Property; +import common.properties.IProperty; import common.world.State; public class MultiStateMap extends StateMap { - private final Property name; + private final IProperty name; private final String suffix; - private final List < Property> ignored; + private final List < IProperty> ignored; - private MultiStateMap(Property name, String suffix, List < Property> ignored) + private MultiStateMap(IProperty name, String suffix, List < IProperty> 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 = ((Property)this.name).getName((Comparable)map.remove(this.name)); + s = ((IProperty)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 (Property iproperty : this.ignored) + for (IProperty iproperty : this.ignored) { map.remove(iproperty); } @@ -52,11 +52,11 @@ public class MultiStateMap extends StateMap public static class Builder { - private Property name; + private IProperty name; private String suffix; - private final List < Property> ignored = Lists. < Property> newArrayList(); + private final List < IProperty> ignored = Lists. < IProperty> newArrayList(); - public MultiStateMap.Builder withName(Property builderPropertyIn) + public MultiStateMap.Builder withName(IProperty builderPropertyIn) { this.name = builderPropertyIn; return this; @@ -68,7 +68,7 @@ public class MultiStateMap extends StateMap return this; } - public MultiStateMap.Builder ignore(Property... p_178442_1_) + public MultiStateMap.Builder ignore(IProperty... 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 155c9b8b..d85f8a1d 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.Property; +import common.properties.IProperty; 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(","); } - Property iproperty = (Property)entry.getKey(); + IProperty iproperty = (IProperty)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 f23f318f..376e2aeb 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.init.ItemRegistry; +import common.item.Item; import common.item.ItemStack; public class RenderDynamite extends RenderItemEntity { - public RenderDynamite(RenderManager renderManagerIn, RenderItem renderItemIn) { - super(renderManagerIn, null, renderItemIn); + public RenderDynamite(RenderManager renderManagerIn, Item itemIn, RenderItem renderItemIn) { + super(renderManagerIn, itemIn, renderItemIn); } public ItemStack getStack(EntityDynamite entityIn) { - return new ItemStack(ItemRegistry.getRegisteredItem("dynamite" + (entityIn.explosionSize <= 0 || entityIn.explosionSize >= 8 ? "" : "_" + entityIn.explosionSize))); + return new ItemStack(this.item, 1, 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 5d10f719..a2a790f7 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_cast" + '#' + "inventory"; + modelresourcelocation = "item/fishing_rod#1" + '#' + "inventory"; } else if (item == Items.bow && entityplayer.getItemInUse() != null) { @@ -238,15 +238,15 @@ public class RenderItem if (i >= 18) { - modelresourcelocation = "item/bow_pulling_3" + '#' + "inventory"; + modelresourcelocation = "item/bow#3" + '#' + "inventory"; } else if (i > 13) { - modelresourcelocation = "item/bow_pulling_2" + '#' + "inventory"; + modelresourcelocation = "item/bow#2" + '#' + "inventory"; } else if (i > 0) { - modelresourcelocation = "item/bow_pulling_1" + '#' + "inventory"; + modelresourcelocation = "item/bow#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 2e660e43..41da3446 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); + return new ItemStack(this.item, 1, 0); } 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 0fb4fa68..42567832 100755 --- a/client/src/main/java/client/renderer/entity/RenderPotion.java +++ b/client/src/main/java/client/renderer/entity/RenderPotion.java @@ -2,7 +2,6 @@ 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 @@ -14,6 +13,6 @@ public class RenderPotion extends RenderItemEntity public ItemStack getStack(EntityPotion entityIn) { - return new ItemStack(ItemPotion.getPotionItem(entityIn.getPotionDamage())); + return new ItemStack(this.item, 1, 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 5a8d0ded..616fd3b1 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.Block; +import common.block.tech.BlockTNT; import common.entity.item.EntityTnt; -import common.init.BlockRegistry; +import common.init.Blocks; import common.util.ExtMath; @@ -17,8 +17,12 @@ 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(); @@ -38,8 +42,7 @@ 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); - Block tnt = BlockRegistry.getRegisteredBlock("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize)); - blockrendererdispatcher.renderBlockBrightness(tnt.getState(), entity.getBrightness(partialTicks)); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), entity.getBrightness(partialTicks)); GL11.glTranslatef(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) @@ -51,7 +54,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(tnt.getState(), 1.0F); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), 1.0F); GlState.doPolygonOffset(0.0F, 0.0F); GlState.disablePolygonOffset(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -64,6 +67,9 @@ 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 7e408b49..fb192367 100755 --- a/client/src/main/java/client/renderer/particle/EntityBreakingFX.java +++ b/client/src/main/java/client/renderer/particle/EntityBreakingFX.java @@ -10,9 +10,14 @@ import common.world.World; public class EntityBreakingFX extends EntityFX { - protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_) + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_) { - this(worldIn, posXIn, posYIn, posZIn, 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.motionX *= 0.10000000149011612D; this.motionY *= 0.10000000149011612D; this.motionZ *= 0.10000000149011612D; @@ -21,10 +26,10 @@ public class EntityBreakingFX extends EntityFX this.motionZ += zSpeedIn; } - protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_) + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_) { super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D); - this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_)); + this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_)); this.particleRed = this.particleGreen = this.particleBlue = 1.0F; this.particleGravity = 1.0F; // Blocks.snow.particleGravity; this.particleScale /= 2.0F; @@ -70,7 +75,8 @@ 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_) { - return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0])); + 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); } } diff --git a/client/src/main/java/client/renderer/particle/EntityFirework.java b/client/src/main/java/client/renderer/particle/EntityFirework.java index a92e7479..476388fd 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.FIREWORK_COLORS[0]}; + aint = new int[] {ItemDye.dyeColors[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 13103a48..e18d64fe 100755 --- a/client/src/main/java/client/util/PlayerController.java +++ b/client/src/main/java/client/util/PlayerController.java @@ -189,7 +189,8 @@ public class PlayerController { if(this.stack != null && stack != null) { flag = stack.getItem() == this.stack.getItem() - && ItemStack.areItemStackTagsEqual(stack, this.stack); + && ItemStack.areItemStackTagsEqual(stack, this.stack) + && (stack.isItemStackDamageable() || stack.getMetadata() == this.stack.getMetadata()); } 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 2ba83a93..dbfdf905 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -20,7 +20,6 @@ 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; @@ -654,7 +653,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)}); + 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}); } ParticleType enumparticletypes = ParticleType.WATER_SPLASH; @@ -662,14 +661,13 @@ public class WorldClient extends AWorldClient float f1 = 1.0F; float f2 = 1.0F; if((data & 16383) != 0) { - ItemPotion potion = ItemPotion.getPotionItem(data); - int j1 = potion.getColorFromDamage(); + int j1 = Items.potion.getColorFromDamage(data); 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 (potion.isEffectInstant()) + if (Items.potion.isEffectInstant(data)) { enumparticletypes = ParticleType.SPELL_INSTANT; } diff --git a/client/src/main/resources/textures/blocks/black_clay.png b/client/src/main/resources/textures/blocks/black_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/black_clay.png rename to client/src/main/resources/textures/blocks/black_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/blue_clay.png b/client/src/main/resources/textures/blocks/blue_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/blue_clay.png rename to client/src/main/resources/textures/blocks/blue_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/brown_clay.png b/client/src/main/resources/textures/blocks/brown_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/brown_clay.png rename to client/src/main/resources/textures/blocks/brown_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/cyan_clay.png b/client/src/main/resources/textures/blocks/cyan_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/cyan_clay.png rename to client/src/main/resources/textures/blocks/cyan_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/large_fern_bottom.png b/client/src/main/resources/textures/blocks/double_fern_bottom.png similarity index 100% rename from client/src/main/resources/textures/blocks/large_fern_bottom.png rename to client/src/main/resources/textures/blocks/double_fern_bottom.png diff --git a/client/src/main/resources/textures/blocks/large_fern_top.png b/client/src/main/resources/textures/blocks/double_fern_top.png similarity index 100% rename from client/src/main/resources/textures/blocks/large_fern_top.png rename to client/src/main/resources/textures/blocks/double_fern_top.png diff --git a/client/src/main/resources/textures/blocks/large_tallgrass_bottom.png b/client/src/main/resources/textures/blocks/double_grass_bottom.png similarity index 100% rename from client/src/main/resources/textures/blocks/large_tallgrass_bottom.png rename to client/src/main/resources/textures/blocks/double_grass_bottom.png diff --git a/client/src/main/resources/textures/blocks/large_tallgrass_top.png b/client/src/main/resources/textures/blocks/double_grass_top.png similarity index 100% rename from client/src/main/resources/textures/blocks/large_tallgrass_top.png rename to client/src/main/resources/textures/blocks/double_grass_top.png diff --git a/client/src/main/resources/textures/blocks/rose_bush_bottom.png b/client/src/main/resources/textures/blocks/double_rose_bottom.png similarity index 100% rename from client/src/main/resources/textures/blocks/rose_bush_bottom.png rename to client/src/main/resources/textures/blocks/double_rose_bottom.png diff --git a/client/src/main/resources/textures/blocks/rose_bush_top.png b/client/src/main/resources/textures/blocks/double_rose_top.png similarity index 100% rename from client/src/main/resources/textures/blocks/rose_bush_top.png rename to client/src/main/resources/textures/blocks/double_rose_top.png diff --git a/client/src/main/resources/textures/blocks/gray_clay.png b/client/src/main/resources/textures/blocks/gray_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/gray_clay.png rename to client/src/main/resources/textures/blocks/gray_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/green_clay.png b/client/src/main/resources/textures/blocks/green_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/green_clay.png rename to client/src/main/resources/textures/blocks/green_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/light_blue_clay.png b/client/src/main/resources/textures/blocks/light_blue_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/light_blue_clay.png rename to client/src/main/resources/textures/blocks/light_blue_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/lime_clay.png b/client/src/main/resources/textures/blocks/lime_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/lime_clay.png rename to client/src/main/resources/textures/blocks/lime_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/magenta_clay.png b/client/src/main/resources/textures/blocks/magenta_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/magenta_clay.png rename to client/src/main/resources/textures/blocks/magenta_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/orange_clay.png b/client/src/main/resources/textures/blocks/orange_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/orange_clay.png rename to client/src/main/resources/textures/blocks/orange_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/daisy.png b/client/src/main/resources/textures/blocks/oxeye_daisy.png similarity index 100% rename from client/src/main/resources/textures/blocks/daisy.png rename to client/src/main/resources/textures/blocks/oxeye_daisy.png diff --git a/client/src/main/resources/textures/blocks/pink_clay.png b/client/src/main/resources/textures/blocks/pink_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/pink_clay.png rename to client/src/main/resources/textures/blocks/pink_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/purple_clay.png b/client/src/main/resources/textures/blocks/purple_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/purple_clay.png rename to client/src/main/resources/textures/blocks/purple_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/red_clay.png b/client/src/main/resources/textures/blocks/red_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/red_clay.png rename to client/src/main/resources/textures/blocks/red_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/silver_clay.png b/client/src/main/resources/textures/blocks/silver_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/silver_clay.png rename to client/src/main/resources/textures/blocks/silver_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/carved_stonebrick.png b/client/src/main/resources/textures/blocks/stonebrick_chiseled.png similarity index 100% rename from client/src/main/resources/textures/blocks/carved_stonebrick.png rename to client/src/main/resources/textures/blocks/stonebrick_chiseled.png diff --git a/client/src/main/resources/textures/blocks/cracked_stonebrick.png b/client/src/main/resources/textures/blocks/stonebrick_cracked.png similarity index 100% rename from client/src/main/resources/textures/blocks/cracked_stonebrick.png rename to client/src/main/resources/textures/blocks/stonebrick_cracked.png diff --git a/client/src/main/resources/textures/blocks/stonebrick.png b/client/src/main/resources/textures/blocks/stonebrick_default.png similarity index 100% rename from client/src/main/resources/textures/blocks/stonebrick.png rename to client/src/main/resources/textures/blocks/stonebrick_default.png diff --git a/client/src/main/resources/textures/blocks/mossy_stonebrick.png b/client/src/main/resources/textures/blocks/stonebrick_mossy.png similarity index 100% rename from client/src/main/resources/textures/blocks/mossy_stonebrick.png rename to client/src/main/resources/textures/blocks/stonebrick_mossy.png diff --git a/client/src/main/resources/textures/blocks/tallgrass.png b/client/src/main/resources/textures/blocks/tall_grass.png similarity index 100% rename from client/src/main/resources/textures/blocks/tallgrass.png rename to client/src/main/resources/textures/blocks/tall_grass.png diff --git a/client/src/main/resources/textures/blocks/white_clay.png b/client/src/main/resources/textures/blocks/white_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/white_clay.png rename to client/src/main/resources/textures/blocks/white_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/blocks/yellow_clay.png b/client/src/main/resources/textures/blocks/yellow_stained_hardened_clay.png similarity index 100% rename from client/src/main/resources/textures/blocks/yellow_clay.png rename to client/src/main/resources/textures/blocks/yellow_stained_hardened_clay.png diff --git a/client/src/main/resources/textures/items/charged_apple.png b/client/src/main/resources/textures/items/charged_apple.png deleted file mode 100755 index 8dc6dfed..00000000 Binary files a/client/src/main/resources/textures/items/charged_apple.png and /dev/null differ diff --git a/client/src/main/resources/textures/items/flowerpot.png b/client/src/main/resources/textures/items/flower_pot.png similarity index 100% rename from client/src/main/resources/textures/items/flowerpot.png rename to client/src/main/resources/textures/items/flower_pot.png diff --git a/common/src/main/java/common/ai/EntityAIEatGrass.java b/common/src/main/java/common/ai/EntityAIEatGrass.java index f1dfb8c2..47e76e47 100755 --- a/common/src/main/java/common/ai/EntityAIEatGrass.java +++ b/common/src/main/java/common/ai/EntityAIEatGrass.java @@ -1,5 +1,6 @@ package common.ai; +import common.block.foliage.BlockTallGrass; import common.entity.animal.EntitySheep; import common.init.BlockRegistry; import common.init.Blocks; @@ -34,7 +35,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 || + return (state.getBlock() == Blocks.tallgrass && state.getValue(BlockTallGrass.TYPE) == BlockTallGrass.EnumType.GRASS) || this.entityWorld.getState(blockpos.down()).getBlock() == Blocks.grass; } } @@ -85,7 +86,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) + if (state.getBlock() == Blocks.tallgrass && state.getValue(BlockTallGrass.TYPE) == BlockTallGrass.EnumType.GRASS) { if (Vars.mobGrief) { diff --git a/common/src/main/java/common/ai/EntityAIShareItems.java b/common/src/main/java/common/ai/EntityAIShareItems.java index ad9cc717..a43c7927 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); + itemstack1 = new ItemStack(item, l, itemstack.getMetadata()); } 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); + itemstack1 = new ItemStack(Items.bread, k, 0); } 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 a5b138d4..77413613 100755 --- a/common/src/main/java/common/ai/EntityAITakePlace.java +++ b/common/src/main/java/common/ai/EntityAITakePlace.java @@ -3,11 +3,10 @@ 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.item.Item; +import common.init.ItemRegistry; import common.item.ItemStack; import common.rng.Random; import common.util.BlockPos; @@ -18,12 +17,45 @@ 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(stack.getItem(), state); + PLACEABLE.put(new StackKey(stack), state); } private static void addPlaceable(Block block) { @@ -31,9 +63,7 @@ public class EntityAITakePlace extends EntityAIBase } static { - for(BlockFlower block : BlockFlower.FLOWERS) { - addPlaceable(block); - } + addPlaceable(Blocks.flower); addPlaceable(Blocks.brown_mushroom); addPlaceable(Blocks.red_mushroom); addPlaceable(Blocks.blue_mushroom); @@ -55,7 +85,7 @@ public class EntityAITakePlace extends EntityAIBase this.place = false; return this.entity.getRNG().chance(20); } - else if(this.entity.getRNG().chance(200) && PLACEABLE.containsKey(this.entity.getHeldItem().getItem())) { + else if(this.entity.getRNG().chance(200) && PLACEABLE.containsKey(new StackKey(this.entity.getHeldItem()))) { this.place = this.entity.getRNG().rarity(10); return true; } @@ -72,11 +102,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(this.entity.getHeldItem().getItem())) + if(stack == null || !PLACEABLE.containsKey(new StackKey(this.entity.getHeldItem()))) return; Block replace = world.getState(blockpos).getBlock(); Block below = world.getState(blockpos.down()).getBlock(); - State state = PLACEABLE.get(this.entity.getHeldItem().getItem()); + State state = PLACEABLE.get(new StackKey(this.entity.getHeldItem())); 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 ed17ee6a..a7008c7c 100755 --- a/common/src/main/java/common/ai/EntityAITempt.java +++ b/common/src/main/java/common/ai/EntityAITempt.java @@ -1,7 +1,5 @@ package common.ai; -import java.util.function.Predicate; - import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.item.Item; @@ -40,7 +38,7 @@ public class EntityAITempt extends EntityAIBase /** True if this EntityAITempt task is running */ private boolean isRunning; - private Predicate temptItem; + private Item temptItem; private double range; private double distance; @@ -50,19 +48,11 @@ public class EntityAITempt extends EntityAIBase private boolean scaredByPlayerMovement; private boolean avoidWater; - 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) { + public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Item temptItemIn, boolean scaredByPlayerMovementIn) { this(temptedEntityIn, speedIn, temptItemIn, 2.5, 10.0, scaredByPlayerMovementIn); } - public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Predicate temptItemIn, double distance, double range, boolean scaredByPlayerMovementIn) + public EntityAITempt(EntityLiving temptedEntityIn, double speedIn, Item temptItemIn, double distance, double range, boolean scaredByPlayerMovementIn) { this.temptedEntity = temptedEntityIn; this.speed = speedIn; @@ -101,7 +91,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 : this.temptItem.test(itemstack); + return itemstack == null ? false : itemstack.getItem() == this.temptItem; } } } diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index 3086a8d1..e7d2cc63 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.Property; +import common.properties.IProperty; 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(Property prop : keys) { + for(IProperty 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)).getStates()); + list.add((properties.get(z)).getAllowedValues()); } return list; } - private static ImmutableList getPropertyList(Property[] properties) { - Arrays.sort(properties, new Comparator() { - public int compare(Property p1, Property p2) { + private static ImmutableList getPropertyList(IProperty[] properties) { + Arrays.sort(properties, new Comparator() { + public int compare(IProperty p1, IProperty 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)); + spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); } } } @@ -621,6 +621,10 @@ public class Block { } } + public int damageDropped(State state) { + return 0; + } + public float getExplosionResistance(Entity exploder) { return this.blockResistance / 5.0F; } @@ -848,9 +852,14 @@ public class Block { } public ItemStack createStackedBlock(State state) { + int i = 0; Item item = ItemRegistry.getItemFromBlock(this); - // TODO: data - return new ItemStack(item); + + if(item != null && item.getHasSubtypes()) { + i = this.getMetaFromState(state); + } + + return new ItemStack(item, 1, i); } public int quantityDroppedWithBonus(int fortune, Random random) { @@ -892,6 +901,14 @@ 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; } @@ -934,8 +951,8 @@ public class Block { return state; } - protected Property[] getProperties() { - return new Property[0]; + protected IProperty[] getProperties() { + return new IProperty[0]; } protected final void setDefaultState(State state) { @@ -974,7 +991,7 @@ public class Block { return provider.getModel(name).add().all(); } - public Property[] getIgnoredProperties() { + public IProperty[] getIgnoredProperties() { return null; } diff --git a/common/src/main/java/common/block/BlockColored.java b/common/src/main/java/common/block/BlockColored.java new file mode 100755 index 00000000..6ff3755b --- /dev/null +++ b/common/src/main/java/common/block/BlockColored.java @@ -0,0 +1,49 @@ +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 new file mode 100755 index 00000000..0cb7a7a0 --- /dev/null +++ b/common/src/main/java/common/block/BlockDirectional.java @@ -0,0 +1,12 @@ +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 deleted file mode 100644 index c4361340..00000000 --- a/common/src/main/java/common/block/Directional.java +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index 8dbba560..00000000 --- a/common/src/main/java/common/block/DirectionalDown.java +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index c3f8dc37..00000000 --- a/common/src/main/java/common/block/DirectionalUp.java +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100755 index 4bf6bfa5..00000000 --- a/common/src/main/java/common/block/Rotatable.java +++ /dev/null @@ -1,8 +0,0 @@ -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 22a5317b..371619d0 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.Rotatable; +import common.block.BlockDirectional; 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.Property; +import common.properties.IProperty; 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 Block implements Rotatable { +public class BlockBed extends BlockDirectional { public static enum EnumPartType implements Identifyable { HEAD("head"), FOOT("foot"); @@ -188,8 +188,8 @@ public class BlockBed extends Block implements Rotatable { return ((Facing)state.getValue(FACING)).getHorizontalIndex() | (state.getValue(PART) == BlockBed.EnumPartType.HEAD ? 8 : 0); } - protected Property[] getProperties() { - return new Property[] {FACING, PART}; + protected IProperty[] getProperties() { + return new IProperty[] {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 9907df78..425c641a 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {BITES}; + return new IProperty[] {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 a3764475..6deb687b 100755 --- a/common/src/main/java/common/block/artificial/BlockCarpet.java +++ b/common/src/main/java/common/block/artificial/BlockCarpet.java @@ -1,12 +1,18 @@ 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; @@ -15,27 +21,25 @@ import common.world.World; public class BlockCarpet extends Block { - public static final BlockCarpet[] CARPETS = new BlockCarpet[DyeColor.values().length]; - - private final DyeColor color; - - public static BlockCarpet getByColor(DyeColor color) { - return CARPETS[color.getMetadata()]; - } + public static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); - public BlockCarpet(DyeColor color) + public BlockCarpet() { super(Material.FLEECE); - this.color = color; + 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(); - CARPETS[color.ordinal()] = this; + this.setBlockBoundsFromMeta(0); } - - public DyeColor getColor() { - return this.color; - } + +// /** +// * Get the MapColor for this Block and the given BlockState +// */ +// public MapColor getMapColor(IBlockState state) +// { +// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); +// } /** * Used to determine ambient occlusion and culling when rebuilding chunks for render @@ -55,15 +59,15 @@ public class BlockCarpet extends Block */ public void setBlockBoundsForItemRender() { - this.setBlockBoundsFromMeta(); + this.setBlockBoundsFromMeta(0); } public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { - this.setBlockBoundsFromMeta(); + this.setBlockBoundsFromMeta(0); } - private void setBlockBoundsFromMeta() + protected void setBlockBoundsFromMeta(int meta) { int i = 0; float f = (float)(1 * (1 + i)) / 16.0F; @@ -107,11 +111,52 @@ 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(this.color.getName() + "_wool").add(0, 0, 0, 16, 1, 16).nswe().uv(0, 15, 16, 16).d().u().noCull(); + return provider.getModel(state.getValue(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 08ad3d34..eb445ea5 100755 --- a/common/src/main/java/common/block/artificial/BlockDoor.java +++ b/common/src/main/java/common/block/artificial/BlockDoor.java @@ -3,7 +3,6 @@ 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; @@ -14,8 +13,9 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -29,8 +29,9 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockDoor extends Block implements Rotatable +public class BlockDoor extends Block { + 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"); @@ -445,9 +446,9 @@ public class BlockDoor extends Block implements Rotatable return (combinedMeta & 16) != 0; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {HALF, FACING, OPEN, HINGE, POWERED}; + return new IProperty[] {HALF, FACING, OPEN, HINGE, POWERED}; } private static ModelRotation getRotation(Facing rot, int offset) { @@ -499,8 +500,8 @@ public class BlockDoor extends Block implements Rotatable } } - public Property[] getIgnoredProperties() { - return new Property[] {POWERED}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {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 cc7b7fb1..dfd3cad4 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {NORTH, EAST, WEST, SOUTH}; + return new IProperty[] {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 f86f67a9..887479fc 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.Rotatable; +import common.block.BlockDirectional; 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.Property; +import common.properties.IProperty; 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 Block implements Rotatable +public class BlockFenceGate extends BlockDirectional { public static final PropertyBool OPEN = PropertyBool.create("open"); public static final PropertyBool POWERED = PropertyBool.create("powered"); @@ -200,9 +200,9 @@ public class BlockFenceGate extends Block implements Rotatable return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, OPEN, POWERED, IN_WALL}; + return new IProperty[] {FACING, OPEN, POWERED, IN_WALL}; } public Transforms getTransform() { @@ -406,7 +406,7 @@ public class BlockFenceGate extends Block implements Rotatable .rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite())); } - public Property[] getIgnoredProperties() { - return new Property[] {POWERED}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {POWERED}; } } diff --git a/common/src/main/java/common/block/artificial/BlockFlowerPot.java b/common/src/main/java/common/block/artificial/BlockFlowerPot.java index 5276b3b9..7c3436b5 100755 --- a/common/src/main/java/common/block/artificial/BlockFlowerPot.java +++ b/common/src/main/java/common/block/artificial/BlockFlowerPot.java @@ -1,13 +1,9 @@ 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; @@ -17,6 +13,8 @@ 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; @@ -24,7 +22,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockFlowerPot extends Block +public class BlockFlowerPot extends Block // Container { private static final Model flower_pot_cactus = ModelProvider.getModelProvider().getModel("flower_pot") .add(5, 0, 5, 6, 6, 11) @@ -101,18 +99,23 @@ public class BlockFlowerPot extends Block .u("dirt").uv(6, 6, 10, 10).noCull() ; - public static final List POTS = Lists.newArrayList(); - - private final Block content; + public static final PropertyInteger CONTENTS = PropertyInteger.create("contents", 0, 1 + BlockFlower.EnumFlowerType.values().length); - public BlockFlowerPot(Block content) + public BlockFlowerPot() { super(Material.SMALL); - this.content = content; + this.setDefaultState(this.getBaseState().withProperty(CONTENTS, 0)); // .withProperty(LEGACY_DATA, Integer.valueOf(0))); 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 */ @@ -131,18 +134,43 @@ public class BlockFlowerPot extends Block 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 (this.content != null) + if (state.getValue(CONTENTS) > 0) { return false; } @@ -150,13 +178,14 @@ public class BlockFlowerPot extends Block { Block block = itemstack.getItem().getBlock(); - if (!(block instanceof BlockFlower) && block != Blocks.cactus) + if (block != Blocks.flower && block != Blocks.cactus) { return false; } else { - worldIn.setState(pos, BlockRegistry.getRegisteredBlock("flowerpot_" + BlockRegistry.getNameFromBlock(this.content)).getState(), 2); + worldIn.setState(pos, state.withProperty(CONTENTS, block == Blocks.cactus ? 1 : (2 + (itemstack.getMetadata() >= + BlockFlower.EnumFlowerType.values().length ? 0 : itemstack.getMetadata()))), 2); // tileentityflowerpot.setFlowerPotData(itemstack.getItem(), itemstack.getMetadata()); // tileentityflowerpot.markDirty(); // worldIn.markBlockForUpdate(pos); @@ -179,7 +208,18 @@ public class BlockFlowerPot extends Block public Item getItem(World worldIn, BlockPos pos) { - return worldIn.getState(pos).getBlock() == this && this.content != null ? ItemRegistry.getItemFromBlock(this.content) : Items.flowerpot; + 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; } public boolean isPickStrict() @@ -206,31 +246,117 @@ public class BlockFlowerPot extends Block public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) { - if(this.content != null) - spawnAsEntity(worldIn, pos, new ItemStack(this.content)); + 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))); 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.flowerpot; + return Items.flower_pot; } + /** + * 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) { - if(this.content == null) + switch(state.getValue(CONTENTS)) { + case 0: return flower_pot; - else if(this.content == Blocks.cactus) + case 1: return flower_pot_cactus; - else { - String plant = BlockRegistry.getNameFromBlock(this.content); +// case FERN: +// return flower_pot_fern; + default: + String plant = BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.BASE, state.getValue(CONTENTS) - 2).getName().toLowerCase(); 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 c9de3f01..eefc04f3 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.Property; +import common.properties.IProperty; import common.util.BlockPos; import common.util.Facing; import common.world.State; @@ -61,14 +61,14 @@ public class BlockHay extends BlockRotatedPillar return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AXIS}; + return new IProperty[] {AXIS}; } public ItemStack createStackedBlock(State state) { - return new ItemStack(ItemRegistry.getItemFromBlock(this)); + return new ItemStack(ItemRegistry.getItemFromBlock(this), 1, 0); } /** diff --git a/common/src/main/java/common/block/artificial/BlockLadder.java b/common/src/main/java/common/block/artificial/BlockLadder.java index d2b49b1f..20c8ac2f 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.Rotatable; +import common.block.BlockDirectional; import common.block.Material; import common.entity.types.EntityLiving; import common.item.CheatTab; @@ -9,7 +9,8 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -17,8 +18,10 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockLadder extends Block implements Rotatable +public class BlockLadder extends Block { + public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); + public BlockLadder() { super(Material.SMALL); @@ -158,9 +161,9 @@ public class BlockLadder extends Block implements Rotatable return ((Facing)state.getValue(FACING)).getIndex(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { @@ -168,6 +171,6 @@ public class BlockLadder extends Block implements Rotatable .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(FACING))); + .rotate(ModelRotation.getNorthRot(state.getValue(BlockDirectional.FACING))); } } diff --git a/common/src/main/java/common/block/artificial/BlockPane.java b/common/src/main/java/common/block/artificial/BlockPane.java index 857376d6..2125ba39 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.Property; +import common.properties.IProperty; 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 instanceof BlockStainedGlass || blockIn instanceof BlockStainedGlassPane || blockIn instanceof BlockPane; + return blockIn.isFullBlock() || blockIn == this || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.stained_glass_pane || blockIn instanceof BlockPane; } public boolean canSilkHarvest() @@ -201,9 +201,9 @@ public class BlockPane extends Block return 0; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {NORTH, EAST, WEST, SOUTH}; + return new IProperty[] {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 36e1b045..a140f4b1 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AXIS, DIM}; + return new IProperty[] {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 b33a0722..0c5a300f 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -3,7 +3,6 @@ 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; @@ -16,8 +15,9 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -26,8 +26,9 @@ import common.util.Facing; import common.world.State; import common.world.World; -public class BlockPortalFrame extends Block implements Rotatable +public class BlockPortalFrame extends Block { + public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyBool ORB = PropertyBool.create("orb"); public BlockPortalFrame() @@ -132,9 +133,9 @@ public class BlockPortalFrame extends Block implements Rotatable return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, ORB}; + return new IProperty[] {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 85201d24..5e78fc2d 100755 --- a/common/src/main/java/common/block/artificial/BlockQuartz.java +++ b/common/src/main/java/common/block/artificial/BlockQuartz.java @@ -1,36 +1,195 @@ 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 { - private final boolean dark; - private final boolean ornaments; +public class BlockQuartz extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockQuartz.EnumType.class); - public BlockQuartz(boolean dark, boolean ornaments) { - super(Material.SOLID); - this.dark = dark; - this.ornaments = ornaments; - this.setTab(CheatTab.BLOCKS); - } + 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 boolean isDark() { - return this.dark; - } + /** + * 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 hasOrnaments() { - return this.ornaments; - } + case X: + return this.getState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_X); - 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"); - } + 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; + } + } + } } diff --git a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java deleted file mode 100644 index ca6c6724..00000000 --- a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java +++ /dev/null @@ -1,87 +0,0 @@ -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 1b68aedf..f5f0c268 100755 --- a/common/src/main/java/common/block/artificial/BlockSkull.java +++ b/common/src/main/java/common/block/artificial/BlockSkull.java @@ -1,7 +1,6 @@ package common.block.artificial; -import common.block.Block; -import common.block.Rotatable; +import common.block.BlockDirectional; import common.block.Material; import common.entity.Entity; import common.entity.types.EntityLiving; @@ -10,14 +9,14 @@ import common.item.Item; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; import common.world.State; import common.world.World; -public class BlockSkull extends Block implements Rotatable { +public class BlockSkull extends BlockDirectional { public BlockSkull() { super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); @@ -40,8 +39,8 @@ public class BlockSkull extends Block implements Rotatable { return state.getValue(FACING).getHorizontalIndex(); } - protected Property[] getProperties() { - return new Property[] {FACING}; + protected IProperty[] getProperties() { + return new IProperty[] {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 3ae3d0db..223745c7 100755 --- a/common/src/main/java/common/block/artificial/BlockSlab.java +++ b/common/src/main/java/common/block/artificial/BlockSlab.java @@ -3,7 +3,6 @@ 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; @@ -13,8 +12,9 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -23,8 +23,9 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockSlab extends Block implements Directional +public class BlockSlab extends Block { + 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(); @@ -71,9 +72,9 @@ public class BlockSlab extends Block implements Directional return dir == Facing.DOWN ? 0 : (dir == Facing.UP ? 1 : (dir.getHorizontalIndex() + 2)); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, DOUBLE, SEAMLESS}; + return new IProperty[] {FACING, DOUBLE, SEAMLESS}; } public boolean canSilkHarvest() @@ -95,7 +96,7 @@ public class BlockSlab extends Block implements Directional if (item != null) { - spawnAsEntity(worldIn, pos, new ItemStack(item)); + spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); } } } diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlass.java b/common/src/main/java/common/block/artificial/BlockStainedGlass.java index 84121a8b..8ca8637c 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlass.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlass.java @@ -1,34 +1,52 @@ 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 BlockStainedGlass[] GLASS = new BlockStainedGlass[DyeColor.values().length]; - - private final DyeColor color; - - public static BlockStainedGlass getByColor(DyeColor color) { - return GLASS[color.getMetadata()]; - } + public static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); - public BlockStainedGlass(DyeColor color) { - this.color = color; - GLASS[color.ordinal()] = this; + public BlockStainedGlass() { + this.setDefaultState(this.getBaseState().withProperty(COLOR, DyeColor.WHITE)); } - - public DyeColor getColor() { - return this.color; + + 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 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(this.color.getName() + "_glass").add().all(); + return provider.getModel(state.getValue(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 2b103321..9c295817 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java @@ -1,50 +1,103 @@ 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.Property; +import common.properties.IProperty; +import common.properties.PropertyEnum; import common.world.State; public class BlockStainedGlassPane extends BlockPane { - 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 static final PropertyEnum COLOR = PropertyEnum.create("color", DyeColor.class); - public BlockStainedGlassPane(DyeColor color) + public BlockStainedGlassPane() { super(Material.TRANSLUCENT, false); - 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.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.setTab(CheatTab.BLOCKS); - PANES[color.ordinal()] = this; } - - public DyeColor getColor() { - return this.color; + + /** + * 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 < 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; } - protected Property[] getProperties() + /** + * Convert the given metadata into a BlockState for this Block + */ + public State getStateFromMeta(int meta) { - return new Property[] {NORTH, EAST, WEST, SOUTH}; + 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[] {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 this.color.getName() + "_glass"; + return state.getValue(COLOR).getName() + "_glass"; } protected String getPaneEdge(State state) { - return this.color.getName() + "_glass_pane"; + return state.getValue(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 a8cd4e11..337f7153 100755 --- a/common/src/main/java/common/block/artificial/BlockStairs.java +++ b/common/src/main/java/common/block/artificial/BlockStairs.java @@ -4,7 +4,6 @@ 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; @@ -16,7 +15,8 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -33,8 +33,9 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockStairs extends Block implements Rotatable +public class BlockStairs extends Block { + 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}}; @@ -804,9 +805,9 @@ public class BlockStairs extends Block implements Rotatable return state; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, HALF, SHAPE}; + return new IProperty[] {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 new file mode 100755 index 00000000..f0a7508f --- /dev/null +++ b/common/src/main/java/common/block/artificial/BlockStoneBrick.java @@ -0,0 +1,140 @@ +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 ba94d827..3f970d69 100755 --- a/common/src/main/java/common/block/artificial/BlockTrapDoor.java +++ b/common/src/main/java/common/block/artificial/BlockTrapDoor.java @@ -1,7 +1,6 @@ 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; @@ -12,8 +11,9 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.util.BlockPos; import common.util.BoundingBox; @@ -26,8 +26,9 @@ import common.world.IWorldAccess; import common.world.State; import common.world.World; -public class BlockTrapDoor extends Block implements Rotatable +public class BlockTrapDoor extends Block { + 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); @@ -249,7 +250,7 @@ public class BlockTrapDoor extends Block implements Rotatable private static boolean isValidSupportBlock(Block blockIn) { - return blockIn.getMaterial().isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn instanceof BlockStainedGlass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + return blockIn.getMaterial().isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; } public BlockLayer getBlockLayer() @@ -286,9 +287,9 @@ public class BlockTrapDoor extends Block implements Rotatable return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, OPEN, HALF}; + return new IProperty[] {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 40432a4a..703eed41 100755 --- a/common/src/main/java/common/block/artificial/BlockWall.java +++ b/common/src/main/java/common/block/artificial/BlockWall.java @@ -4,17 +4,20 @@ 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.Property; +import common.properties.IProperty; 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; @@ -27,26 +30,26 @@ 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 List WALLS = Lists.newArrayList(); - - private final String texture; + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockWall.EnumType.class); - public BlockWall(Block modelBlock, String texture) + public BlockWall(Block modelBlock) { super(modelBlock.getMaterial()); - 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.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.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() { return false; @@ -126,11 +129,47 @@ 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. @@ -140,17 +179,13 @@ 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()))); } - public int getMetaFromState(State state) { - return 0; - } - - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {UP, NORTH, EAST, WEST, SOUTH}; + return new IProperty[] {UP, NORTH, EAST, WEST, SOUTH, VARIANT}; } public Model getModel(ModelProvider provider, String name, State state) { - String wall = this.texture; + String wall = state.getValue(VARIANT).getName(); boolean n = state.getValue(NORTH); boolean s = state.getValue(SOUTH); boolean w = state.getValue(WEST); @@ -293,4 +328,59 @@ 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 deleted file mode 100755 index 10bad55f..00000000 --- a/common/src/main/java/common/block/artificial/BlockWool.java +++ /dev/null @@ -1,34 +0,0 @@ -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 new file mode 100755 index 00000000..413ec6eb --- /dev/null +++ b/common/src/main/java/common/block/foliage/BlockBaseFlower.java @@ -0,0 +1,9 @@ +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 7a496474..204599a5 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AGE}; + return new IProperty[] {AGE}; } public Model getModel(ModelProvider provider, String name, State state) { return cactus; } - public Property[] getIgnoredProperties() { - return new Property[] {AGE}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {AGE}; } } diff --git a/common/src/main/java/common/block/foliage/BlockCocoa.java b/common/src/main/java/common/block/foliage/BlockCocoa.java index d3296a1e..3f8e27c9 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.Rotatable; +import common.block.BlockDirectional; 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.Property; +import common.properties.IProperty; 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 Block implements Rotatable, IGrowable +public class BlockCocoa extends BlockDirectional implements IGrowable { public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 2); @@ -169,13 +169,21 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable for (int k = 0; k < j; ++k) { - spawnAsEntity(worldIn, pos, new ItemStack(Items.cocoa)); + spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, DyeColor.BROWN.getDyeDamage())); } } public Item getItem(World worldIn, BlockPos pos) { - return Items.cocoa; + 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(); } /** @@ -220,9 +228,9 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, AGE}; + return new IProperty[] {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 55749f46..db1806e4 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.Property; +import common.properties.IProperty; 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())); + spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); } } } @@ -217,9 +217,9 @@ public class BlockCrops extends BlockBush implements IGrowable return ((Integer)state.getValue(AGE)).intValue(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AGE}; + return new IProperty[] {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 8d1ca4c0..9e24f13c 100755 --- a/common/src/main/java/common/block/foliage/BlockDeadBush.java +++ b/common/src/main/java/common/block/foliage/BlockDeadBush.java @@ -2,7 +2,6 @@ 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; @@ -39,7 +38,7 @@ public class BlockDeadBush extends BlockBush */ protected boolean canPlaceBlockOn(Block ground) { - return ground == Blocks.sand || ground == Blocks.hardened_clay || ground instanceof BlockColoredClay || ground == Blocks.dirt; + return ground == Blocks.sand || ground == Blocks.hardened_clay || ground == Blocks.stained_hardened_clay || ground == Blocks.dirt; } /** @@ -63,7 +62,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)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); } else { diff --git a/common/src/main/java/common/block/foliage/BlockDoublePlant.java b/common/src/main/java/common/block/foliage/BlockDoublePlant.java index feed960a..34ef4246 100755 --- a/common/src/main/java/common/block/foliage/BlockDoublePlant.java +++ b/common/src/main/java/common/block/foliage/BlockDoublePlant.java @@ -3,10 +3,9 @@ package common.block.foliage; import java.util.List; import common.block.Block; -import common.block.Rotatable; +import common.block.BlockDirectional; 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; @@ -19,7 +18,7 @@ import common.item.ItemShears; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; @@ -33,29 +32,20 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable +public class BlockDoublePlant extends BlockBush implements 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 BlockDoublePlant[] PLANTS = new BlockDoublePlant[EnumPlantType.values().length]; + public static final PropertyEnum FACING = BlockDirectional.FACING; - private final EnumPlantType type; - - public static BlockDoublePlant getByType(EnumPlantType type) { - return PLANTS[type.ordinal()]; - } - - public BlockDoublePlant(EnumPlantType type) + public BlockDoublePlant() { super(Material.BUSH); - this.type = type; - this.setDefaultState(this.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, Facing.NORTH)); + this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockDoublePlant.EnumPlantType.SUNFLOWER).withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, Facing.NORTH)); this.setHardness(0.0F); this.setStepSound(SoundType.GRASS); - PLANTS[type.ordinal()] = this; - } - - public EnumPlantType getType() { - return this.type; +// this.setDisplay("doublePlant"); +// this.setTickRandomly(); } public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) @@ -69,8 +59,8 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable worldIn.setState(pos, Blocks.air.getState()); pos = pos.down(); if(!upper || worldIn.getState(pos).getBlock() == this) - worldIn.setState(pos, this.type == EnumPlantType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : - Blocks.dead_bush.getState()); + 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)); return; } super.updateTick(worldIn, pos, state, rand); @@ -81,6 +71,21 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, 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()); @@ -99,7 +104,8 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable } else { - return this.type == BlockDoublePlant.EnumPlantType.FERN || this.type == BlockDoublePlant.EnumPlantType.GRASS; + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)this.getActualState(iblockstate, worldIn, pos).getValue(VARIANT); + return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN || blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS; } } @@ -154,18 +160,29 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable } else { - return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat : null) : ItemRegistry.getItemFromBlock(this)); + 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)); } } + /** + * 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) { - return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(worldIn, pos); + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = this.getVariant(worldIn, pos); + return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(worldIn, pos); } - public void placeAt(World worldIn, BlockPos lowerPos, int flags) + public void placeAt(World worldIn, BlockPos lowerPos, BlockDoublePlant.EnumPlantType variant, int flags) { - worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER), flags); + worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT, variant), flags); worldIn.setState(lowerPos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags); } @@ -194,8 +211,9 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable // if (!player.creative) // { State iblockstate = worldIn.getState(pos.down()); + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)iblockstate.getValue(VARIANT); - if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS) + if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS) { worldIn.destroyBlock(pos.down(), true); } @@ -232,23 +250,47 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable private boolean onHarvest(World worldIn, BlockPos pos, State state, EntityNPC player) { - if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS) + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT); + + if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS) { return false; } else { - spawnAsEntity(worldIn, pos, new ItemStack(this.type == BlockDoublePlant.EnumPlantType.GRASS ? Blocks.tallgrass : Blocks.fern, 2)); +// 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)); 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) { - return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN; + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = this.getVariant(worldIn, pos); + return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN; } public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) @@ -258,7 +300,7 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) { - spawnAsEntity(worldIn, pos, new ItemStack(this)); + spawnAsEntity(worldIn, pos, new ItemStack(this, 1, this.getVariant(worldIn, pos).getMeta())); } /** @@ -266,7 +308,26 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable */ public State getStateFromMeta(int meta) { - return (meta & 8) > 0 ? this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER) : this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER); + 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; } /** @@ -274,16 +335,21 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable */ public int getMetaFromState(State state) { - return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 | ((Facing)state.getValue(FACING)).getHorizontalIndex() : 0; + return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 | ((Facing)state.getValue(FACING)).getHorizontalIndex() : ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT)).getMeta(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {HALF, FACING}; + return new IProperty[] {HALF, VARIANT, FACING}; } + +// public EnumOffsetType getOffsetType() +// { +// return EnumOffsetType.XZ; +// } public Model getModel(ModelProvider provider, String name, State state) { - if(this.type == EnumPlantType.SUNFLOWER && state.getValue(HALF) == EnumBlockHalf.UPPER) + if(state.getValue(VARIANT) == 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() @@ -291,16 +357,16 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, 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(this.type == EnumPlantType.FERN || this.type == EnumPlantType.GRASS) - return provider.getModel(this.type.getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER + else if(state.getValue(VARIANT) == EnumPlantType.FERN || state.getValue(VARIANT) == EnumPlantType.GRASS) + return provider.getModel(state.getValue(VARIANT).getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER ? "top" : "bottom")).crossTint(); else - return provider.getModel(this.type.getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER + return provider.getModel(state.getValue(VARIANT).getName() + "_" + (state.getValue(HALF) == EnumBlockHalf.UPPER ? "top" : "bottom")).cross(); } - public Property[] getIgnoredProperties() { - return new Property[] {FACING}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {FACING}; } public static enum EnumBlockHalf implements Identifyable @@ -323,9 +389,9 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable { SUNFLOWER(0, "sunflower", "Sonnenblume"), SYRINGA(1, "syringa", "Flieder"), - GRASS(2, "large_tallgrass", "Hohes Gras"), - FERN(3, "large_fern", "GroĂŸer Farn"), - ROSE(4, "rose_bush", "Rosenstrauch"), + GRASS(2, "double_grass", "Hohes Gras"), + FERN(3, "double_fern", "GroĂŸer Farn"), + ROSE(4, "double_rose", "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 1a442cca..d4ccd0ec 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.Property; +import common.properties.IProperty; 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(), rand, fortune); + return Blocks.dirt.getItemDropped(Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); } public Item getItem(World worldIn, BlockPos pos) { - return Items.dirt; + return ItemRegistry.getItemFromBlock(Blocks.dirt); } /** @@ -173,9 +173,9 @@ public class BlockFarmland extends Block return ((Integer)state.getValue(MOISTURE)).intValue(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {MOISTURE}; + return new IProperty[] {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 f69ba5e2..dabe90f2 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.Property; +import common.properties.IProperty; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -21,24 +21,14 @@ import common.vars.Vars; import common.world.State; import common.world.AWorldServer; -public class BlockFlower extends BlockBush +public abstract class BlockFlower extends BlockBush { - public static final BlockFlower[] FLOWERS = new BlockFlower[EnumFlowerType.values().length]; - - private final EnumFlowerType type; - - public static BlockFlower getByType(EnumFlowerType type) { - return FLOWERS[type.ordinal()]; - } + protected PropertyEnum type; - public BlockFlower(EnumFlowerType type) + public BlockFlower() { - this.type = type; - FLOWERS[type.ordinal()] = this; - } - - public EnumFlowerType getType() { - return this.type; + this.setDefaultState(this.getBaseState().withProperty(this.getTypeProperty(), /* this.getBlockType() == BlockFlower.EnumFlowerColor.RED ? BlockFlower.EnumFlowerType.ROSE : */ BlockFlower.EnumFlowerType.DANDELION)); +// this.setTickRandomly(); } public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) @@ -46,40 +36,154 @@ public class BlockFlower extends BlockBush if(Vars.flowerDry && worldIn.getTemperatureC(pos) >= 50.0f) { worldIn.setState(pos, worldIn.rand.chance(3) ? Blocks.air.getState() : - Blocks.dead_bush.getState()); + Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); 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(this.type.getName()).cross(); + return provider.getModel(state.getValue(this.type).getName()).cross(); } public static enum EnumFlowerType implements Identifyable { - 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"); + 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"); + 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(String name, 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) { + 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; @@ -94,5 +198,19 @@ public 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 dfe3d458..97804357 100755 --- a/common/src/main/java/common/block/foliage/BlockGrass.java +++ b/common/src/main/java/common/block/foliage/BlockGrass.java @@ -3,6 +3,7 @@ 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; @@ -10,7 +11,7 @@ import common.item.Item; import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -77,7 +78,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 && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) + if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) { worldIn.setState(blockpos, Blocks.grass.getState()); } @@ -86,7 +87,7 @@ public class BlockGrass extends Block implements IGrowable } else { if(Vars.grassDry) - worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.coarse_dirt.getState() : + worldIn.setState(pos, worldIn.rand.chance(20) ? Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT) : Blocks.dirt.getState()); } // } @@ -97,7 +98,7 @@ public class BlockGrass extends Block implements IGrowable */ public Item getItemDropped(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); + return Blocks.dirt.getItemDropped(Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); } /** @@ -131,9 +132,9 @@ public class BlockGrass extends Block implements IGrowable return 0; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {SNOWY}; + return new IProperty[] {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 ef8281ec..873240b4 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.Property; +import common.properties.IProperty; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -19,7 +19,6 @@ 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_) @@ -96,9 +95,9 @@ public class BlockHugeMushroom extends Block return ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)).getMetadata(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {VARIANT}; + return new IProperty[] {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 811f1a85..1d081508 100755 --- a/common/src/main/java/common/block/foliage/BlockLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockLeaves.java @@ -8,7 +8,6 @@ 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; @@ -19,8 +18,9 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ParticleType; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; import common.util.BlockPos; @@ -33,37 +33,41 @@ 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, LeavesType subType) + public BlockLeaves(WoodType type) { super(Material.LEAVES); this.type = type; - this.subType = subType; - this.setDefaultState(this.getBaseState().withProperty(DECAY, Boolean.valueOf(true))); + this.setDefaultState(this.getBaseState().withProperty(TYPE, LeavesType.SPRING).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 LeavesType getType() { - return this.subType; - } +// 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 void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) { @@ -96,8 +100,8 @@ public class BlockLeaves extends BlockLeavesBase public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - 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.seasonLeaves && state.getValue(TYPE) != worldIn.getLeavesGen(pos)) { + worldIn.setState(pos, state.withProperty(TYPE, worldIn.getLeavesGen(pos)), 2); } if(Vars.leafDry && worldIn.getTemperatureC(pos) >= 50.0f) { worldIn.setState(pos, worldIn.rand.chance(40) ? Blocks.air.getState() : Blocks.dry_leaves.getState()); @@ -266,7 +270,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)); + spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); } i = 200; @@ -282,29 +286,40 @@ 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()))); + spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.getRegisteredItem(this.type.getItem()), 1, 0)); } } public int getRenderColor(State state) { - return state.getBlock() != this || !this.subType.isTinted() ? 16777215 : + return state.getBlock() != this || !state.getValue(TYPE).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 || !this.subType.isTinted() ? 16777215 : (this.type.getTintType() + return state.getBlock() != this || !state.getValue(TYPE).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(DECAY, Boolean.valueOf((meta & 8) == 0)); + return this.getState().withProperty(TYPE, LeavesType.getById(meta & 7)).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; @@ -313,13 +328,22 @@ public class BlockLeaves extends BlockLeavesBase return i; } - protected Property[] getProperties() { - return new Property[] {DECAY}; +// public BlockPlanks.EnumType getWoodType() { +// return this.type; +// } + + protected IProperty[] getProperties() { + return new IProperty[] {TYPE, 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) { - spawnAsEntity(worldIn, pos, new ItemStack(this)); +// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.getItemFromBlock(this), 1, ((LeavesType)state.getValue(TYPE)).getIndex())); } else { super.harvestBlock(worldIn, player, pos, state, te); @@ -327,11 +351,16 @@ public class BlockLeaves extends BlockLeavesBase } public Model getModel(ModelProvider provider, String name, State state) { - return this.subType.isTinted() ? provider.getModel(name).add().all().tint() : - provider.getModel(name).add().all(); + return state.getValue(TYPE).isTinted() ? provider.getModel(name + "_" + state.getValue(TYPE).getName()).add().all().tint() : + provider.getModel(name + "_" + state.getValue(TYPE).getName()).add().all(); } - public Property[] getIgnoredProperties() { - return new Property[] {DECAY}; + 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); } } diff --git a/common/src/main/java/common/block/foliage/BlockLilyPad.java b/common/src/main/java/common/block/foliage/BlockLilyPad.java index 4187d83d..11024808 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.Rotatable; +import common.block.BlockDirectional; 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.Property; +import common.properties.IProperty; 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 implements Rotatable +public class BlockLilyPad extends BlockBush { 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(FACING, Facing.NORTH)); + this.setDefaultState(this.getBaseState().withProperty(BlockDirectional.FACING, Facing.NORTH)); this.setTab(CheatTab.PLANTS); } @@ -87,22 +87,22 @@ public class BlockLilyPad extends BlockBush implements Rotatable public State getStateFromMeta(int meta) { - return this.getState().withProperty(FACING, Facing.getHorizontal(meta)); + return this.getState().withProperty(BlockDirectional.FACING, Facing.getHorizontal(meta)); } public int getMetaFromState(State state) { - return ((Facing)state.getValue(FACING)).getHorizontalIndex(); + return ((Facing)state.getValue(BlockDirectional.FACING)).getHorizontalIndex(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {BlockDirectional.FACING}; } public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, int meta, EntityLiving placer) { - return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); + return this.getState().withProperty(BlockDirectional.FACING, placer.getHorizontalFacing().getOpposite()); } public Model getModel(ModelProvider provider, String name, State state) { @@ -110,6 +110,6 @@ public class BlockLilyPad extends BlockBush implements Rotatable .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(FACING))); + .rotate(ModelRotation.getNorthRot(state.getValue(BlockDirectional.FACING))); } } diff --git a/common/src/main/java/common/block/foliage/BlockLog.java b/common/src/main/java/common/block/foliage/BlockLog.java index 1cc80e82..8c9fbab7 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.Property; +import common.properties.IProperty; import common.properties.PropertyEnum; import common.util.BlockPos; import common.util.Facing; @@ -82,19 +82,19 @@ public class BlockLog extends BlockRotatedPillar switch (meta & 3) { - default: + case 0: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y); break; - case 1: + case 4: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X); break; - case 2: + case 8: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z); break; - case 3: + default: iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE); } @@ -109,6 +109,7 @@ 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)) { @@ -127,9 +128,9 @@ public class BlockLog extends BlockRotatedPillar return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {LOG_AXIS}; + return new IProperty[] {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 a770839c..24a8fb45 100755 --- a/common/src/main/java/common/block/foliage/BlockMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockMushroom.java @@ -2,6 +2,7 @@ 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; @@ -78,7 +79,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.podzol ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); + 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())); } else { diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index 49b79fdb..65e5ce34 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -2,13 +2,14 @@ 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -47,7 +48,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()); + worldIn.setState(pos, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); } else if(Vars.mycelSpread) { @@ -59,7 +60,7 @@ public class BlockMycelium extends Block State iblockstate = worldIn.getState(blockpos); Block block = worldIn.getState(blockpos.up()).getBlock(); - if (iblockstate.getBlock() == Blocks.dirt && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) + if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) { worldIn.setState(blockpos, this.getState()); } @@ -84,7 +85,7 @@ public class BlockMycelium extends Block */ public Item getItemDropped(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); + return Blocks.dirt.getItemDropped(Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); } /** @@ -95,9 +96,9 @@ public class BlockMycelium extends Block return 0; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {SNOWY}; + return new IProperty[] {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 806e9346..9b70bad9 100755 --- a/common/src/main/java/common/block/foliage/BlockPumpkin.java +++ b/common/src/main/java/common/block/foliage/BlockPumpkin.java @@ -1,20 +1,19 @@ package common.block.foliage; -import common.block.Block; -import common.block.Rotatable; +import common.block.BlockDirectional; 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.properties.IProperty; import common.util.BlockPos; import common.util.Facing; import common.world.State; import common.world.World; -public class BlockPumpkin extends Block implements Rotatable { +public class BlockPumpkin extends BlockDirectional { public BlockPumpkin() { super(Material.SOFT); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); @@ -37,8 +36,8 @@ public class BlockPumpkin extends Block implements Rotatable { return state.getValue(FACING).getHorizontalIndex(); } - protected Property[] getProperties() { - return new Property[] {FACING}; + protected IProperty[] getProperties() { + return new IProperty[] {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 d64b79cf..e581de92 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AGE}; + return new IProperty[] {AGE}; } public Model getModel(ModelProvider provider, String name, State state) { return provider.getModel("reeds").crossTint(); } - public Property[] getIgnoredProperties() { - return new Property[] {AGE}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {AGE}; } } diff --git a/common/src/main/java/common/block/foliage/BlockSapling.java b/common/src/main/java/common/block/foliage/BlockSapling.java index d359c91e..df3ca7d6 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.Property; +import common.properties.IProperty; 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.dead_bush.getState()); + Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); return; } // if (!worldIn.client) @@ -132,9 +132,9 @@ public class BlockSapling extends BlockBush implements IGrowable return state.getValue(STAGE); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {STAGE}; + return new IProperty[] {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 fce5dbae..e647e19b 100755 --- a/common/src/main/java/common/block/foliage/BlockStem.java +++ b/common/src/main/java/common/block/foliage/BlockStem.java @@ -1,7 +1,8 @@ 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; @@ -10,7 +11,8 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.properties.PropertyInteger; import common.rng.Random; import common.util.BlockPos; @@ -21,10 +23,16 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockStem extends BlockBush implements DirectionalUp, IGrowable +public class BlockStem extends BlockBush implements 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) @@ -226,9 +234,9 @@ public class BlockStem extends BlockBush implements DirectionalUp, IGrowable return ((Integer)state.getValue(AGE)).intValue(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AGE, FACING}; + return new IProperty[] {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 3001eea4..be708d50 100755 --- a/common/src/main/java/common/block/foliage/BlockTallGrass.java +++ b/common/src/main/java/common/block/foliage/BlockTallGrass.java @@ -3,7 +3,6 @@ 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; @@ -14,7 +13,7 @@ import common.item.ItemShears; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; @@ -28,38 +27,33 @@ import common.world.AWorldServer; public class BlockTallGrass extends BlockBush implements IGrowable { - 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 static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); - public BlockTallGrass(EnumType type) + public BlockTallGrass() { super(Material.BUSH); - this.type = type; + this.setDefaultState(this.getBaseState().withProperty(TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); float f = 0.4F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); - BUSHES[type.ordinal()] = this; - } - - public EnumType getType() { - return this.type; +// this.setTickRandomly(); } public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - if(Vars.tallgrassDry && worldIn.getTemperatureC(pos) >= 50.0f && this.type != EnumType.DEAD_BUSH) + if(Vars.tallgrassDry && worldIn.getTemperatureC(pos) >= 50.0f && state.getValue(TYPE) != EnumType.DEAD_BUSH) { - worldIn.setState(pos, this.type == EnumType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : - Blocks.dead_bush.getState()); + worldIn.setState(pos, state.getValue(TYPE) == EnumType.GRASS || worldIn.rand.chance(20) ? Blocks.air.getState() : + this.getState().withProperty(TYPE, EnumType.DEAD_BUSH)); 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()); @@ -81,7 +75,8 @@ public class BlockTallGrass extends BlockBush implements IGrowable } else { - return this.type == EnumType.DEAD_BUSH ? 16777215 : Colorizer.getGrassColor(0.5D, 1.0D); + BlockTallGrass.EnumType blocktallgrass$enumtype = (BlockTallGrass.EnumType)state.getValue(TYPE); + return blocktallgrass$enumtype == BlockTallGrass.EnumType.DEAD_BUSH ? 16777215 : Colorizer.getGrassColor(0.5D, 1.0D); } } @@ -110,7 +105,8 @@ public class BlockTallGrass extends BlockBush implements IGrowable { if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { - spawnAsEntity(worldIn, pos, new ItemStack(this)); +// player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); } else { @@ -118,12 +114,32 @@ 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 this.type != EnumType.DEAD_BUSH; + return state.getValue(TYPE) != BlockTallGrass.EnumType.DEAD_BUSH; } public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) @@ -133,42 +149,66 @@ public class BlockTallGrass extends BlockBush implements IGrowable public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) { - BlockDoublePlant block = Blocks.large_tallgrass; + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.GRASS; - if (this.type == BlockTallGrass.EnumType.FERN) + if (state.getValue(TYPE) == BlockTallGrass.EnumType.FERN) { - block = Blocks.large_fern; + blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.FERN; } - if (block.canPlaceBlockAt(worldIn, pos)) + if (Blocks.double_plant.canPlaceBlockAt(worldIn, pos)) { - block.placeAt(worldIn, pos, 2); + Blocks.double_plant.placeAt(worldIn, pos, blockdoubleplant$enumplanttype, 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(this.type != EnumType.DEAD_BUSH) - return provider.getModel(this.type.getName()).crossTint(); + if(state.getValue(TYPE) != EnumType.DEAD_BUSH) + return provider.getModel(state.getValue(TYPE).getName()).crossTint(); else return provider.getModel("deadbush").cross(); } public static enum EnumType implements Identifyable { - DEAD_BUSH(0, "dead_bush", "Busch"), - GRASS(1, "tallgrass", "Gras"), - FERN(2, "fern", "Farn"); + DEAD_BUSH(0, "dead_bush"), + GRASS(1, "tall_grass"), + FERN(2, "fern"); 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, String display) + private EnumType(int meta, String name) { this.meta = meta; this.name = name; - this.display = display; } public int getMeta() @@ -196,11 +236,6 @@ 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 dce3ab62..bf7aa447 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -41,9 +41,9 @@ public class BlockTianSoil extends Block return 0; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {SNOWY}; + return new IProperty[] {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 84447d4e..5e0b4e73 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.Property; +import common.properties.IProperty; 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)); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); } else { @@ -476,9 +476,9 @@ public class BlockVine extends Block return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {UP, NORTH, EAST, SOUTH, WEST}; + return new IProperty[] {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 d1649800..30771d89 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AGE}; + return new IProperty[] {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 ad1b4a4b..4643b574 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {LEVEL}; + return new IProperty[] {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 deleted file mode 100644 index 9f724109..00000000 --- a/common/src/main/java/common/block/natural/BlockColoredClay.java +++ /dev/null @@ -1,34 +0,0 @@ -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 new file mode 100755 index 00000000..f93a03c3 --- /dev/null +++ b/common/src/main/java/common/block/natural/BlockDirt.java @@ -0,0 +1,186 @@ +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 fd8ee8e2..40002fa0 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}; + return new IProperty[] {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 Property[] getIgnoredProperties() { - return new Property[] {AGE}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {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 f51001d0..93e8b749 100755 --- a/common/src/main/java/common/block/natural/BlockHardenedClay.java +++ b/common/src/main/java/common/block/natural/BlockHardenedClay.java @@ -11,4 +11,12 @@ 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 6d58d9ba..63c6b728 100755 --- a/common/src/main/java/common/block/natural/BlockHellRock.java +++ b/common/src/main/java/common/block/natural/BlockHellRock.java @@ -12,6 +12,14 @@ 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 83e830a5..bcf4df17 100755 --- a/common/src/main/java/common/block/natural/BlockOre.java +++ b/common/src/main/java/common/block/natural/BlockOre.java @@ -125,6 +125,16 @@ 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 deleted file mode 100644 index f812ce73..00000000 --- a/common/src/main/java/common/block/natural/BlockPodzol.java +++ /dev/null @@ -1,48 +0,0 @@ -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 new file mode 100755 index 00000000..92b0352b --- /dev/null +++ b/common/src/main/java/common/block/natural/BlockRock.java @@ -0,0 +1,49 @@ +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 new file mode 100755 index 00000000..ae5d6cb5 --- /dev/null +++ b/common/src/main/java/common/block/natural/BlockSand.java @@ -0,0 +1,135 @@ +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 282f464f..ca1bcac4 100755 --- a/common/src/main/java/common/block/natural/BlockSandStone.java +++ b/common/src/main/java/common/block/natural/BlockSandStone.java @@ -1,22 +1,144 @@ 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 { - private final String texture; +public class BlockSandStone extends Block +{ + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockSandStone.EnumType.class); - public BlockSandStone(String texture) { - super(Material.SOLID); - this.texture = texture; - this.setTab(CheatTab.NATURE); - } + public BlockSandStone() + { + super(Material.SOLID); + this.setDefaultState(this.getBaseState().withProperty(TYPE, BlockSandStone.EnumType.DEFAULT)); + this.setTab(CheatTab.NATURE); + } - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel("sandstone_" + this.texture).add().nswe().d("sandstone_bottom").u("sandstone_all"); - } + /** + * 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; + } + } + } } diff --git a/common/src/main/java/common/block/natural/BlockSnow.java b/common/src/main/java/common/block/natural/BlockSnow.java index f123225c..4a412400 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.Property; +import common.properties.IProperty; 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)); + spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {LAYERS}; + return new IProperty[] {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 e7d41f67..8a003522 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -1,6 +1,7 @@ package common.block.tech; -import common.block.Rotatable; +import java.util.List; + import common.block.BlockFalling; import common.block.Material; import common.entity.item.EntityFalling; @@ -10,41 +11,33 @@ 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.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; +import common.properties.PropertyInteger; 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 implements Rotatable +public class BlockAnvil extends BlockFalling { - 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 static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); + public static final PropertyInteger DAMAGE = PropertyInteger.create("damage", 0, 2); - public BlockAnvil(int damage) + public BlockAnvil() { super(Material.HEAVY); - this.damage = damage; - this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); + this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(DAMAGE, Integer.valueOf(0))); this.setLightOpacity(0); this.setTab(CheatTab.TECHNOLOGY); - ANVILS[damage] = this; - } - - public int getAnvilDamage() { - return this.damage; } public boolean isFullCube() @@ -60,10 +53,6 @@ public class BlockAnvil extends BlockFalling implements Rotatable 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 @@ -71,7 +60,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable 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); + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, enumfacing).withProperty(DAMAGE, Integer.valueOf(meta >> 2)); } public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) @@ -84,6 +73,15 @@ public class BlockAnvil extends BlockFalling implements Rotatable 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); @@ -98,6 +96,16 @@ public class BlockAnvil extends BlockFalling implements Rotatable } } + /** + * 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); @@ -126,7 +134,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable */ public State getStateFromMeta(int meta) { - return this.getState().withProperty(FACING, Facing.getHorizontal(meta & 3)); + return this.getState().withProperty(FACING, Facing.getHorizontal(meta & 3)).withProperty(DAMAGE, Integer.valueOf((meta & 12) == 12 ? 0 : ((meta & 12) >> 2))); } /** @@ -136,12 +144,13 @@ public class BlockAnvil extends BlockFalling implements Rotatable { int i = 0; i = i | ((Facing)state.getValue(FACING)).getHorizontalIndex(); + i = i | ((Integer)state.getValue(DAMAGE)).intValue() << 2; return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {FACING, DAMAGE}; } public Transforms getTransform() { @@ -156,7 +165,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable .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_" + this.damage) + .add(3, 10, 0, 13, 16, 16).d().uv(3, 0, 13, 16).rot(180).noCull().u("anvil_top_" + state.getValue(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 eb2280a3..bcde12f5 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.rng.Random; import common.tileentity.TileEntity; @@ -529,9 +529,9 @@ public class BlockBrewingStand extends BlockContainer return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]}; + return new IProperty[] {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 a170d068..956d0fe2 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -3,7 +3,6 @@ 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; @@ -16,8 +15,9 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.Transforms; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -27,8 +27,9 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockButton extends Block implements Directional +public class BlockButton extends Block { + public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool POWERED = PropertyBool.create("powered"); public static final List BUTTONS = Lists.newArrayList(); @@ -393,9 +394,9 @@ public class BlockButton extends Block implements Directional return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, POWERED}; + return new IProperty[] {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 4672cd56..087c8652 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -7,6 +7,8 @@ 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; @@ -14,7 +16,7 @@ import common.item.ItemBanner; import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyInteger; import common.rng.Random; import common.tileentity.TileEntityBanner; @@ -490,7 +492,7 @@ public class BlockCauldron extends Block int i = ((Integer)state.getValue(LEVEL)).intValue(); Item item = itemstack.getItem(); - if (item == Items.water_bucket) + if (item == Items.water_bucket && FluidRegistry.getStaticBlock(itemstack.getMetadata()) == Blocks.water) { if (i < 3) { @@ -511,7 +513,7 @@ public class BlockCauldron extends Block { // if (!playerIn.creative) // { - ItemStack itemstack2 = new ItemStack(Items.potion); + ItemStack itemstack2 = new ItemStack(Items.potion, 1, 0); if (!playerIn.inventory.addItemStackToInventory(itemstack2)) { @@ -657,9 +659,9 @@ public class BlockCauldron extends Block return ((Integer)state.getValue(LEVEL)).intValue(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {LEVEL}; + return new IProperty[] {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 03080280..75d977dc 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -2,7 +2,6 @@ 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; @@ -18,7 +17,8 @@ import common.inventory.InventoryLargeChest; import common.item.CheatTab; import common.item.ItemStack; import common.packet.SPacketSoundEffect; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.tileentity.ILockableContainer; import common.tileentity.Passcode; import common.tileentity.TileEntity; @@ -33,8 +33,11 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockChest extends BlockContainer implements Rotatable +public class BlockChest extends BlockContainer { + 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) @@ -625,9 +628,9 @@ public class BlockChest extends BlockContainer implements Rotatable return ((Facing)state.getValue(FACING)).getIndex(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {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 82ee1bcc..f35f5304 100755 --- a/common/src/main/java/common/block/tech/BlockDaylightDetector.java +++ b/common/src/main/java/common/block/tech/BlockDaylightDetector.java @@ -1,5 +1,7 @@ package common.block.tech; +import java.util.List; + import common.block.BlockContainer; import common.block.Material; import common.block.SoundType; @@ -8,10 +10,11 @@ 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.Property; +import common.properties.IProperty; import common.properties.PropertyInteger; import common.rng.Random; import common.tileentity.TileEntity; @@ -172,9 +175,20 @@ public class BlockDaylightDetector extends BlockContainer return ((Integer)state.getValue(POWER)).intValue(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {POWER}; + 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); + } } 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 0165aa94..4421fbb8 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -2,7 +2,6 @@ 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; @@ -21,8 +20,9 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityDispenser; @@ -33,8 +33,9 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockDispenser extends BlockContainer implements Directional +public class BlockDispenser extends BlockContainer { + 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(); @@ -300,9 +301,9 @@ public class BlockDispenser extends BlockContainer implements Directional return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, TRIGGERED}; + return new IProperty[] {FACING, TRIGGERED}; } public boolean isMagnetic() { @@ -318,7 +319,7 @@ public class BlockDispenser extends BlockContainer implements Directional .s("furnace_side").we("furnace_side").rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } - public Property[] getIgnoredProperties() { - return new Property[] {TRIGGERED}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {TRIGGERED}; } } diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index e4eaf1e1..4a3d9fae 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -2,7 +2,6 @@ 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; @@ -16,7 +15,8 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityFurnace; @@ -27,8 +27,9 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockFurnace extends BlockContainer implements Rotatable +public class BlockFurnace extends BlockContainer { + public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); private final boolean isBurning; private static boolean keepInventory; @@ -270,9 +271,9 @@ public class BlockFurnace extends BlockContainer implements Rotatable return ((Facing)state.getValue(FACING)).getIndex(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {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 fc9f09b8..524a7996 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -1,9 +1,10 @@ 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; @@ -16,8 +17,9 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.tileentity.TileEntity; import common.tileentity.TileEntityHopper; import common.util.BlockPos; @@ -28,7 +30,7 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockHopper extends BlockContainer implements DirectionalDown +public class BlockHopper extends BlockContainer { private static final Model hopper_down = ModelProvider.getModelProvider().getModel("hopper_outside") .add(0, 10, 0, 16, 11, 16) @@ -82,6 +84,13 @@ public class BlockHopper extends BlockContainer implements DirectionalDown .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() @@ -293,9 +302,9 @@ public class BlockHopper extends BlockContainer implements DirectionalDown return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, ENABLED}; + return new IProperty[] {FACING, ENABLED}; } public boolean isMagnetic() { @@ -356,7 +365,7 @@ public class BlockHopper extends BlockContainer implements DirectionalDown .rotate(ModelRotation.getNorthRot(state.getValue(FACING))); } - public Property[] getIgnoredProperties() { - return new Property[] {ENABLED}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {ENABLED}; } } diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index 91e80f11..6e5e2769 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.util.BlockPos; @@ -270,9 +270,9 @@ public class BlockLever extends Block return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, POWERED}; + return new IProperty[] {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 d8b85231..efdf9c30 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.Rotatable; +import common.block.BlockDirectional; 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.Property; +import common.properties.IProperty; 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 Block implements Rotatable, ITileEntityProvider { +public abstract class BlockMachine extends BlockDirectional implements ITileEntityProvider { public BlockMachine() { super(Material.SOLID); this.hasTile = true; @@ -94,8 +94,8 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti return ((Facing)state.getValue(FACING)).getHorizontalIndex(); } - protected Property[] getProperties() { - return new Property[] {FACING}; + protected IProperty[] getProperties() { + return new IProperty[] {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 64f7c830..cc6a0615 100755 --- a/common/src/main/java/common/block/tech/BlockPistonBase.java +++ b/common/src/main/java/common/block/tech/BlockPistonBase.java @@ -3,7 +3,6 @@ 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; @@ -17,8 +16,9 @@ import common.item.ItemStack; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; 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 implements Directional +public class BlockPistonBase extends Block { private static class BlockPistonStructureHelper { @@ -246,6 +246,7 @@ public class BlockPistonBase extends Block implements Directional } } + public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool EXTENDED = PropertyBool.create("extended"); /** This piston is the sticky one? */ @@ -702,9 +703,9 @@ public class BlockPistonBase extends Block implements Directional return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, EXTENDED}; + return new IProperty[] {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 0306e530..21aa5e21 100755 --- a/common/src/main/java/common/block/tech/BlockPistonHead.java +++ b/common/src/main/java/common/block/tech/BlockPistonHead.java @@ -3,7 +3,6 @@ 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; @@ -13,8 +12,9 @@ import common.item.Item; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.rng.Random; import common.util.BlockPos; @@ -26,8 +26,9 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockPistonHead extends Block implements Directional +public class BlockPistonHead extends Block { + 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"); @@ -254,9 +255,9 @@ public class BlockPistonHead extends Block implements Directional return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, TYPE, SHORT}; + return new IProperty[] {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 3b7b4ccf..666061d9 100755 --- a/common/src/main/java/common/block/tech/BlockPistonMoving.java +++ b/common/src/main/java/common/block/tech/BlockPistonMoving.java @@ -6,7 +6,8 @@ import common.block.Material; import common.entity.npc.EntityNPC; import common.init.Blocks; import common.item.Item; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; @@ -23,7 +24,7 @@ import common.world.AWorldServer; public class BlockPistonMoving extends BlockContainer { - public static final PropertyEnum FACING = BlockPistonHead.FACING; + public static final PropertyDirection FACING = BlockPistonHead.FACING; public static final PropertyEnum TYPE = BlockPistonHead.TYPE; public BlockPistonMoving() @@ -306,8 +307,8 @@ public class BlockPistonMoving extends BlockContainer return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, TYPE}; + return new IProperty[] {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 338cbbab..b17b4b07 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {POWERED}; + return new IProperty[] {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 375fd766..eeac2ec3 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {POWER}; + return new IProperty[] {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 bdfa0aae..de178aa1 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.Property; +import common.properties.IProperty; import common.properties.PropertyEnum; import common.util.BlockPos; import common.world.State; @@ -25,7 +25,7 @@ public class BlockRail extends BlockRailBase } } - public Property getShapeProperty() + public IProperty getShapeProperty() { return SHAPE; } @@ -46,8 +46,8 @@ public class BlockRail extends BlockRailBase return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {SHAPE}; + return new IProperty[] {SHAPE}; } } diff --git a/common/src/main/java/common/block/tech/BlockRailBase.java b/common/src/main/java/common/block/tech/BlockRailBase.java index 0cd20bd4..df3e43c7 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.Property; +import common.properties.IProperty; import common.util.BlockPos; import common.util.BoundingBox; import common.util.Facing; @@ -227,7 +227,7 @@ public abstract class BlockRailBase extends Block } } - public abstract Property getShapeProperty(); + public abstract IProperty 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 7a3a59d0..330cc6ce 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.rng.Random; @@ -23,13 +23,20 @@ import common.world.AWorldServer; public class BlockRailDetector extends BlockRailBase { - 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 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 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); } /** @@ -128,7 +135,7 @@ public class BlockRailDetector extends BlockRailBase this.updatePoweredState(worldIn, pos, state); } - public Property getShapeProperty() + public IProperty getShapeProperty() { return SHAPE; } @@ -200,9 +207,9 @@ public class BlockRailDetector extends BlockRailBase return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {SHAPE, POWERED}; + return new IProperty[] {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 72fa440d..727800b7 100755 --- a/common/src/main/java/common/block/tech/BlockRailPowered.java +++ b/common/src/main/java/common/block/tech/BlockRailPowered.java @@ -1,9 +1,11 @@ package common.block.tech; +import java.util.function.Predicate; + import common.block.Block; import common.model.Model; import common.model.ModelProvider; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.util.BlockPos; @@ -12,7 +14,13 @@ import common.world.World; public class BlockRailPowered extends BlockRailBase { - 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 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 PropertyBool POWERED = PropertyBool.create("powered"); public BlockRailPowered() @@ -158,7 +166,7 @@ public class BlockRailPowered extends BlockRailBase } } - public Property getShapeProperty() + public IProperty getShapeProperty() { return SHAPE; } @@ -187,9 +195,9 @@ public class BlockRailPowered extends BlockRailBase return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {SHAPE, POWERED}; + return new IProperty[] {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 3507eddf..635d9f47 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, MODE, POWERED}; + return new IProperty[] {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 a86e845c..5c61033d 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.Rotatable; +import common.block.BlockDirectional; 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 Block implements Rotatable +public abstract class BlockRedstoneDiode extends BlockDirectional { /** 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 b87d1a9d..07499f25 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.properties.PropertyInteger; import common.rng.Random; @@ -153,9 +153,9 @@ public class BlockRedstoneRepeater extends BlockRedstoneDiode return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, DELAY, LOCKED}; + return new IProperty[] {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 e29e5067..514b546a 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {NORTH, EAST, SOUTH, WEST, POWER}; + return new IProperty[] {NORTH, EAST, SOUTH, WEST, POWER}; } public boolean isMagnetic() { @@ -1023,8 +1023,8 @@ public class BlockRedstoneWire extends Block return redstone_none; } - public Property[] getIgnoredProperties() { - return new Property[] {POWER}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {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 eb771420..45c5fbf5 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -1,5 +1,7 @@ package common.block.tech; +import java.util.List; + import common.block.Block; import common.block.Material; import common.entity.Entity; @@ -11,12 +13,13 @@ 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.Property; +import common.properties.IProperty; 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; @@ -26,25 +29,13 @@ import common.world.AWorldServer; public class BlockTNT extends Block { public static final PropertyBool EXPLODE = PropertyBool.create("explode"); - 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 static final PropertyInteger POWER = PropertyInteger.create("power", 0, 7); - public BlockTNT(int power) + public BlockTNT() { 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) @@ -77,7 +68,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(), this.power); + 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()); entitytntprimed.fuse = worldIn.rand.zrange(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; worldIn.spawnEntityInWorld(entitytntprimed); } @@ -97,7 +88,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, this.power); + 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()); worldIn.spawnEntityInWorld(entitytntprimed); worldIn.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F); } @@ -147,6 +138,13 @@ 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. @@ -161,7 +159,7 @@ public class BlockTNT extends Block */ public State getStateFromMeta(int meta) { - return this.getState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0)); + return this.getState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0)).withProperty(POWER, Integer.valueOf(((meta >> 1) & 7))); } /** @@ -169,12 +167,17 @@ public class BlockTNT extends Block */ public int getMetaFromState(State state) { - return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0; + return (((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0) | (state.getValue(POWER).intValue() << 1); + } + + public int damageDropped(State state) + { + return ((Integer)state.getValue(POWER)).intValue(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {EXPLODE}; + return new IProperty[] {EXPLODE, POWER}; } public boolean isXrayVisible() @@ -183,12 +186,12 @@ public class BlockTNT extends Block } public Model getModel(ModelProvider provider, String name, State state) { - String power = this.power == 0 ? "" : ("_" + this.power); + String power = state.getValue(POWER) == 0 ? "" : ("_" + state.getValue(POWER)); return provider.getModel("tnt_side" + power).add().nswe().d("tnt_bottom" + power).u("tnt_top" + power); } - public Property[] getIgnoredProperties() { - return new Property[] {EXPLODE}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {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 a9d4150b..91d82e4b 100755 --- a/common/src/main/java/common/block/tech/BlockTorch.java +++ b/common/src/main/java/common/block/tech/BlockTorch.java @@ -1,10 +1,11 @@ package common.block.tech; +import java.util.function.Predicate; + import common.block.Block; -import common.block.DirectionalUp; +import common.block.BlockDirectional; 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; @@ -13,7 +14,8 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -25,8 +27,16 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockTorch extends Block implements DirectionalUp +public class BlockTorch extends Block { + 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; @@ -69,13 +79,13 @@ public class BlockTorch extends Block implements DirectionalUp else { Block block = worldIn.getState(pos).getBlock(); - return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block instanceof BlockStainedGlass; + return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; } } public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - for (Facing enumfacing : FACING.getStates()) + for (Facing enumfacing : FACING.getAllowedValues()) { if (this.canPlaceAt(worldIn, pos, enumfacing)) { @@ -310,9 +320,9 @@ public class BlockTorch extends Block implements DirectionalUp return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {FACING}; } public Model getModel(ModelProvider provider, String name, State state) { @@ -338,6 +348,6 @@ public class BlockTorch extends Block implements DirectionalUp .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(FACING), false)); + .rotate(ModelRotation.getEastRot(state.getValue(BlockDirectional.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 f3b0f707..8ed734df 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.Property; +import common.properties.IProperty; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -300,9 +300,9 @@ public class BlockTripWire extends Block return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH}; + return new IProperty[] {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 Property[] getIgnoredProperties() { - return new Property[] {DISARMED, POWERED}; + public IProperty[] getIgnoredProperties() { + return new IProperty[] {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 78214f4f..95cb387b 100755 --- a/common/src/main/java/common/block/tech/BlockTripWireHook.java +++ b/common/src/main/java/common/block/tech/BlockTripWireHook.java @@ -1,7 +1,6 @@ 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; @@ -12,8 +11,9 @@ import common.model.BlockLayer; import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; -import common.properties.Property; +import common.properties.IProperty; import common.properties.PropertyBool; +import common.properties.PropertyDirection; import common.rng.Random; import common.util.BlockPos; import common.util.BoundingBox; @@ -23,8 +23,9 @@ import common.world.State; import common.world.World; import common.world.AWorldServer; -public class BlockTripWireHook extends Block implements Rotatable +public class BlockTripWireHook extends Block { + 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"); @@ -369,9 +370,9 @@ public class BlockTripWireHook extends Block implements Rotatable return i; } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING, POWERED, ATTACHED, SUSPENDED}; + return new IProperty[] {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 06e75f30..e1cfa54b 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -1,7 +1,6 @@ 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; @@ -15,7 +14,8 @@ import common.model.Model; import common.model.ModelProvider; import common.model.ModelRotation; import common.model.ParticleType; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -23,8 +23,10 @@ import common.world.AWorldClient; import common.world.State; import common.world.World; -public class BlockWarpChest extends Block implements Rotatable +public class BlockWarpChest extends Block { + public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); + public BlockWarpChest() { super(Material.SOLID); @@ -155,9 +157,9 @@ public class BlockWarpChest extends Block implements Rotatable return ((Facing)state.getValue(FACING)).getIndex(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {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 328c226c..e34b8e8f 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,12 +15,14 @@ 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 implements Rotatable +public class BlockBanner extends BlockContainer { + public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15); public BlockBanner() @@ -30,6 +32,14 @@ public class BlockBanner extends BlockContainer implements Rotatable 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() { @@ -93,6 +103,14 @@ public class BlockBanner extends BlockContainer implements Rotatable { 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. @@ -103,7 +121,7 @@ public class BlockBanner extends BlockContainer implements Rotatable if (tileentity instanceof TileEntityBanner) { - ItemStack itemstack = new ItemStack(Items.banner); + ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); TagObject tag = new TagObject(); tileentity.writeTags(tag); tag.remove("x"); @@ -129,7 +147,7 @@ public class BlockBanner extends BlockContainer implements Rotatable if (te instanceof TileEntityBanner) { TileEntityBanner tileentitybanner = (TileEntityBanner)te; - ItemStack itemstack = new ItemStack(Items.banner); + ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor()); 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 4e380b7d..1d54303d 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {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 c19ea518..9a6e28c6 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {ROTATION}; + return new IProperty[] {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 d80ee07e..f6a616a2 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.Property; +import common.properties.IProperty; 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 Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {ROTATION}; + return new IProperty[] {ROTATION}; } } diff --git a/common/src/main/java/common/block/tile/BlockWallSign.java b/common/src/main/java/common/block/tile/BlockWallSign.java index 77dd5eb8..b390bd6b 100755 --- a/common/src/main/java/common/block/tile/BlockWallSign.java +++ b/common/src/main/java/common/block/tile/BlockWallSign.java @@ -1,16 +1,18 @@ package common.block.tile; import common.block.Block; -import common.block.Rotatable; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; 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 implements Rotatable +public class BlockWallSign extends BlockSign { + public static final PropertyDirection FACING = PropertyDirection.create("facing", Facing.Plane.HORIZONTAL); + public BlockWallSign() { this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); @@ -85,8 +87,8 @@ public class BlockWallSign extends BlockSign implements Rotatable return ((Facing)state.getValue(FACING)).getIndex(); } - protected Property[] getProperties() + protected IProperty[] getProperties() { - return new Property[] {FACING}; + return new IProperty[] {FACING}; } } diff --git a/common/src/main/java/common/color/DyeColor.java b/common/src/main/java/common/color/DyeColor.java index b691635c..b197b360 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", "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); + 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); private static final Map LOOKUP = Maps.newHashMap(); private static final DyeColor[] META_LOOKUP = new DyeColor[values().length]; @@ -36,12 +36,11 @@ 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, String dyeName, int colorIn, TextColor chatColor) + String fsubject, String dye, int colorIn, TextColor chatColor) { this.meta = meta; this.dyeDamage = dyeDamage; @@ -50,8 +49,7 @@ public enum DyeColor implements Identifyable this.subject = subject; this.msubject = msubject; this.fsubject = fsubject; - this.dye = dye == null ? name + "_dye" : dye; - this.dyeName = dyeName; + this.dye = dye; this.color = colorIn; this.chatColor = chatColor; } @@ -137,11 +135,6 @@ 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 a8490216..15a3e9d9 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), offsetY); + return this.entityDropItem(new ItemStack(itemIn, size, 0), offsetY); } /** diff --git a/common/src/main/java/common/entity/animal/EntityCow.java b/common/src/main/java/common/entity/animal/EntityCow.java index 62641f85..4e14119b 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), false); + player.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), 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 cffd3289..67483aeb 100755 --- a/common/src/main/java/common/entity/animal/EntityOcelot.java +++ b/common/src/main/java/common/entity/animal/EntityOcelot.java @@ -23,7 +23,6 @@ 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; @@ -47,7 +46,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, stack -> stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(), true)); + this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.fish, 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)); @@ -223,7 +222,7 @@ public class EntityOcelot extends EntityTameable this.aiSit.setSitting(!this.isSitting()); } } - else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() instanceof ItemFishFood fish && !fish.isCooked() && player.getDistanceSqToEntity(this) < 9.0D) + else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D) { // if (!player.creative) // { @@ -279,7 +278,7 @@ public class EntityOcelot extends EntityTameable */ public boolean isBreedingItem(ItemStack stack) { - return stack != null && stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(); + return stack != null && stack.getItem() == Items.fish; } /** diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index 0ee95740..4b34e121 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.BlockFlower; +import common.block.foliage.BlockTallGrass; import common.entity.DamageSource; import common.entity.Entity; import common.entity.npc.Alignment; @@ -25,6 +25,7 @@ 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; @@ -63,7 +64,9 @@ 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, stack -> stack.getItem() == Items.carrot || stack.getItem() == Items.golden_carrot || stack.getItem().getBlock() instanceof BlockFlower, false)); + 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(3, new EntityAIMate(this, 0.8D) { protected int getMatingCooldown() { return EntityRabbit.this.rand.excl(50, 200); @@ -265,7 +268,7 @@ public class EntityRabbit extends EntityAnimal { } private boolean isRabbitBreedingItem(Item itemIn) { - return itemIn == Items.carrot || itemIn == Items.golden_carrot || itemIn.getBlock() instanceof BlockFlower; + return itemIn == Items.carrot || itemIn == Items.golden_carrot || itemIn == ItemRegistry.getItemFromBlock(Blocks.flower); } public EntityRabbit createChild(EntityLiving ageable) { @@ -486,8 +489,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 instanceof BlockFlower || block == Blocks.blue_mushroom || - block == Blocks.tallgrass; + block == Blocks.flower || block == Blocks.blue_mushroom || + (block == Blocks.tallgrass && state.getValue(BlockTallGrass.TYPE) == BlockTallGrass.EnumType.GRASS); } } diff --git a/common/src/main/java/common/entity/animal/EntitySheep.java b/common/src/main/java/common/entity/animal/EntitySheep.java index ca5e04f7..a2250da5 100755 --- a/common/src/main/java/common/entity/animal/EntitySheep.java +++ b/common/src/main/java/common/entity/animal/EntitySheep.java @@ -12,7 +12,6 @@ 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; @@ -27,7 +26,6 @@ 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; @@ -77,6 +75,8 @@ 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.getRegisteredItem(this.getFleeceColor().getName() + "_wool")), 0.0F); + this.entityDropItem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 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(BlockWool.getByColor(this.getFleeceColor())); + return ItemRegistry.getItemFromBlock(Blocks.wool); } 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.getRegisteredItem(this.getFleeceColor().getName() + "_wool")), 1.0F); + EntityItem entityitem = this.entityDropItem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 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,25 +350,28 @@ 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) { - 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))); + int i = ((EntitySheep)father).getFleeceColor().getDyeDamage(); + int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage(); + this.inventoryCrafting.getStackInSlot(0).setItemDamage(i); + this.inventoryCrafting.getStackInSlot(1).setItemDamage(j); ItemStack itemstack = CraftingRegistry.getMatching(this.inventoryCrafting, ((EntitySheep)father).worldObj); - DyeColor k; + int k; - if (itemstack != null && itemstack.getItem() instanceof ItemDye dye) + if (itemstack != null && itemstack.getItem() == Items.dye) { - k = dye.getColor(); + k = itemstack.getMetadata(); } else { k = this.worldObj.rand.chance() ? i : j; } - return k; + return DyeColor.byDyeDamage(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 20969ed6..1650e154 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.ink_sack), 0.0F); + this.entityDropItem(new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), 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 8aa922b4..cf694c07 100755 --- a/common/src/main/java/common/entity/animal/EntityWolf.java +++ b/common/src/main/java/common/entity/animal/EntityWolf.java @@ -26,7 +26,6 @@ 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; @@ -381,9 +380,9 @@ public class EntityWolf extends EntityTameable return true; } } - else if (itemstack.getItem() instanceof ItemDye dye) + else if (itemstack.getItem() == Items.dye) { - DyeColor enumdyecolor = dye.getColor(); + DyeColor enumdyecolor = DyeColor.byDyeDamage(itemstack.getMetadata()); 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 8fe60389..75d3c6b0 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), 0.0F); + this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F); } } } @@ -149,7 +149,7 @@ public class EntityFalling extends Entity implements IObjectData { if (this.shouldDropItem && Vars.objectDrop) { - this.entityDropItem(new ItemStack(block), 0.0F); + this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 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 instanceof BlockAnvil; + boolean flag = block == Blocks.anvil; DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock; if(this.worldObj.client || (flag ? Vars.damageAcme : Vars.damageSquish)) { @@ -181,17 +181,16 @@ public class EntityFalling extends Entity implements IObjectData if (flag && (this.worldObj.client || Vars.anvilFallDecay) && (double)this.rand.floatv() < 0.05000000074505806D + (double)i * 0.05D) { - BlockAnvil anvil = (BlockAnvil)block; - int j = anvil.getAnvilDamage(); + int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue(); ++j; - if (j >= BlockAnvil.ANVILS.length) + if (j > 2) { this.canSetAsBlock = true; } else { - this.fallTile = BlockAnvil.getByDamage(j).getState().withProperty(BlockAnvil.FACING, this.fallTile.getValue(BlockAnvil.FACING)); + this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j)); } } } diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index dc0fcadb..00e1f5af 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())); + ItemRegistry.getIdFromItem(this.getEntityItem().getItem()), this.getEntityItem().getMetadata()); // } this.worldObj.playAuxSFX(1023, this.getPosition(), 0); this.setDead(); @@ -233,6 +233,10 @@ 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); @@ -461,7 +465,7 @@ public class EntityItem extends Entity return this.getCustomNameTag(); String comp = super.getTypeName(); comp += " (" + this.getEntityItem().size + " * " + - ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ")"; + ItemRegistry.getNameFromItem(this.getEntityItem().getItem()) + ":" + this.getEntityItem().getMetadata() + ")"; 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 64c03d4e..77a4d3df 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; + return stack.getItem() == Items.golden_apple && stack.getMetadata() == 0; } 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 fcfd1d0b..4811eb2e 100755 --- a/common/src/main/java/common/entity/npc/EntityMage.java +++ b/common/src/main/java/common/entity/npc/EntityMage.java @@ -5,7 +5,6 @@ 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; @@ -38,9 +37,9 @@ public class EntityMage extends EntityNPC ItemStack itemstack = this.getHeldItem(); this.setItem(0, null); - if (itemstack != null && itemstack.getItem() instanceof ItemPotion potion) + if (itemstack != null && itemstack.getItem() == Items.potion) { - List list = potion.getEffects(); + List list = Items.potion.getEffects(itemstack); if (list != null) { @@ -85,14 +84,14 @@ public class EntityMage extends EntityNPC if (i > -1) { - this.setItem(0, new ItemStack(ItemPotion.getPotionItem(i))); + this.setItem(0, new ItemStack(Items.potion, 1, 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.splash_potion) : null); + this.setItem(0, far || this.rand.chance() ? new ItemStack(Items.potion, 1, 16384) : null); } } } diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 39fa2f46..74452db8 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.getItemDamage() > old.getItemDamage() || stack.hasTagCompound() && !old.hasTagCompound(); + flag = stack.getMetadata() > old.getMetadata() || 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.getItemDamage() > old.getItemDamage() || stack.hasTagCompound() && !old.hasTagCompound(); + flag = stack.getMetadata() > old.getMetadata() || 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 dc484fbb..bc655a67 100755 --- a/common/src/main/java/common/entity/projectile/EntityDie.java +++ b/common/src/main/java/common/entity/projectile/EntityDie.java @@ -5,7 +5,6 @@ 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; @@ -117,8 +116,17 @@ 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(ItemDie.getBySides(this.sides)); + return new ItemStack(Items.die, 1, this.getStackMeta()); } public boolean interactFirst(EntityNPC player) @@ -152,6 +160,6 @@ public class EntityDie extends EntityThrowable implements IObjectData { if(this.getValue() == 0) return null; - return ItemDie.getBySides(this.sides).getDieColor() + "" + this.getValue(); + return ItemDie.DIE_COLORS[this.getStackMeta()] + "" + 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 9024243e..e33b81e5 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(ItemRegistry.getRegisteredItem("dynamite" + (this.explosionSize <= 0 || this.explosionSize >= 8 ? "" : "_" + this.explosionSize)))); + this.worldObj.spawnParticle(ParticleType.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ((double)this.rand.floatv() - 0.5D) * 0.08D, ItemRegistry.getIdFromItem(Items.dynamite), 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 f430b3d1..bcee5498 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -6,7 +6,6 @@ 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; @@ -18,6 +17,9 @@ 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) @@ -27,7 +29,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData public EntityPotion(World worldIn, EntityLiving throwerIn, int meta) { - this(worldIn, throwerIn, new ItemStack(ItemPotion.getPotionItem(meta))); + this(worldIn, throwerIn, new ItemStack(Items.potion, 1, meta)); } public EntityPotion(World worldIn, EntityLiving throwerIn, ItemStack potionDamageIn) @@ -38,7 +40,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(ItemPotion.getPotionItem(data))); + this(worldIn, x, y, z, new ItemStack(Items.potion, 1, data)); } public EntityPotion(World worldIn, double x, double y, double z, ItemStack potionDamageIn) @@ -70,7 +72,12 @@ public class EntityPotion extends EntityThrowable implements IObjectData */ public void setPotionDamage(int potionId) { - this.potionDamage = new ItemStack(ItemPotion.getPotionItem(potionId)); + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Items.potion, 1, 0); + } + + this.potionDamage.setItemDamage(potionId); } /** @@ -80,10 +87,10 @@ public class EntityPotion extends EntityThrowable implements IObjectData { if (this.potionDamage == null) { - this.potionDamage = new ItemStack(Items.potion); + this.potionDamage = new ItemStack(Items.potion, 1, 0); } - return this.potionDamage.getItem() instanceof ItemPotion potion ? potion.getPotionData() : 0; + return this.potionDamage.getMetadata(); } /** @@ -93,7 +100,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData { if (!this.worldObj.client) { - List list = this.potionDamage != null && this.potionDamage.getItem() instanceof ItemPotion potion ? potion.getEffects() : null; + List list = Items.potion.getEffects(this.potionDamage); BoundingBox axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D); List list1 = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb); @@ -164,7 +171,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData this.setPotionDamage(tagCompund.getInt("potionValue")); } - if (this.potionDamage == null || !(this.potionDamage.getItem() instanceof ItemPotion)) + if (this.potionDamage == null) { 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 eb7dfee1..890d8c77 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.ink_sack, 10), 1), + new RngFishable(new ItemStack(Items.dye, 10, DyeColor.BLACK.getDyeDamage()), 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.cod), 60), - new RngFishable(new ItemStack(Items.salmon), 25), - new RngFishable(new ItemStack(Items.clownfish), 2), - new RngFishable(new ItemStack(Items.pufferfish), 13)); + 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)); } diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index 46c5c85c..8ca2d012 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.artificial.BlockWool; +import common.block.foliage.BlockBaseFlower; import common.block.foliage.BlockBlackenedSoil; import common.block.foliage.BlockBlueShroom; import common.block.foliage.BlockCactus; @@ -38,7 +38,6 @@ 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; @@ -56,14 +55,13 @@ 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.BlockColoredClay; +import common.block.natural.BlockDirt; import common.block.natural.BlockFire; import common.block.natural.BlockGlowstone; import common.block.natural.BlockGravel; @@ -73,8 +71,9 @@ 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; @@ -131,7 +130,6 @@ 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 { @@ -237,8 +235,7 @@ 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 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("rock", (new BlockRock()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen")); 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)); @@ -247,25 +244,19 @@ 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); - 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("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"); 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")); - 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("stained_hardened_clay", (new BlockColored(Material.SOLID)).setHardness(1.25F).setResistance(7.0F) + .setStepSound(SoundType.STONE).setDisplay("gefärbter Ton").setTab(CheatTab.NATURE)); registerBlock("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) .setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE)); - 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("sand", (new BlockSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable()); 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()); @@ -324,10 +315,8 @@ public abstract class BlockRegistry { - registerBlock("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); + registerBlock("dirt", (new BlockDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable()); 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)); @@ -342,18 +331,11 @@ public abstract class BlockRegistry { - 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("tallgrass", (new BlockTallGrass()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShearsEfficiency(0)); registerBlock("deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Toter Busch")); - 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("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")); 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")); @@ -384,9 +366,7 @@ 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")); - for(LeavesType type : LeavesType.values()) { - registerBlock(wood.getName() + "_leaves_" + type.getName(), (new BlockLeaves(wood, type)).setDisplay(wood.getDisplay() + "laub (" + type.getDisplayName() + ")")); - } + registerBlock(wood.getName() + "_leaves", (new BlockLeaves(wood)).setDisplay(wood.getDisplay() + "laub")); registerBlock(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setStepSound(SoundType.GRASS) .setDisplay(wood.getDisplay() + "setzling")); } @@ -406,22 +386,15 @@ 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")); - 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("stained_glass", (new BlockStainedGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbtes Glas")); registerBlock("glass_pane", (new BlockPane(Material.TRANSLUCENT, false)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("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("stained_glass_pane", (new BlockStainedGlassPane()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("gefärbte Glasscheibe")); - for(DyeColor color : DyeColor.values()) { - registerBlock(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") + + registerBlock("wool", (new BlockColored(Material.BURNABLE)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay("Wolle") .setShearsEfficiency(1)); - } - 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)); - } + registerBlock("carpet", (new BlockCarpet()).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay("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")); } @@ -434,11 +407,7 @@ 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("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("flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf")); 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)); @@ -490,22 +459,19 @@ 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, "cobblestone")).setDisplay("Bruchsteinmauer")); - registerBlock("mossy_cobblestone_wall", (new BlockWall(mossyCobblestone, "mossy_cobblestone")).setDisplay("Bemooste Bruchsteinmauer")); + registerBlock("cobblestone_wall", (new BlockWall(cobblestone)).setDisplay("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(), + registerBlock("sandstone_stairs", (new BlockStairs(sandstone.getState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.DEFAULT), "sandstone_bottom", "sandstone_all")) // fix type .setDisplay("Sandsteintreppe")); - Block quartz = (new BlockQuartz(false, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzblock"); + Block quartz = (new BlockQuartz("")).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(), + registerBlock("quartz_stairs", (new BlockStairs(quartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT), "quartz_block_bottom", "quartz_top")) .setDisplay("Quarztreppe")); @@ -521,18 +487,12 @@ 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 Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) - .setDisplay("Steinziegel").setTab(CheatTab.BLOCKS); + Block stonebrick = (new BlockStoneBrick()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setDisplay("Steinziegel"); registerBlock("stonebrick", stonebrick); - 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")) + registerBlock("stonebrick_slab", (new BlockSlab(Material.SOLID, "stonebrick_default")) .setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinziegelstufe")); - registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState())) + registerBlock("stonebrick_stairs", (new BlockStairs(stonebrick.getState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT))) .setDisplay("Steinziegeltreppe")); @@ -555,13 +515,11 @@ 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(true, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer Quarzblock"); + Block bquartz = (new BlockQuartz("black_")).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(), + registerBlock("black_quartz_stairs", (new BlockStairs(bquartz.getState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT), "black_quartz_block_bottom", "black_quartz_top")) .setDisplay("Schwarze Quarztreppe")); @@ -599,9 +557,7 @@ 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)); - 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("anvil", (new BlockAnvil()).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay("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")); @@ -616,9 +572,7 @@ public abstract class BlockRegistry { registerBlock("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE) .setDisplay("Warptruhe").setLightLevel(0.5F)); - 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("tnt", (new BlockTNT()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT")); 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 7d397980..0b163e05 100755 --- a/common/src/main/java/common/init/Blocks.java +++ b/common/src/main/java/common/init/Blocks.java @@ -20,15 +20,10 @@ 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_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 BlockLeaves acacia_leaves = get("acacia_leaves"); 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"); @@ -36,14 +31,12 @@ 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 BlockFlower allium = get("allium"); + public static final BlockAir air = get("air"); 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"); @@ -56,11 +49,7 @@ 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_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 BlockLeaves birch_leaves = get("birch_leaves"); 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"); @@ -73,21 +62,13 @@ 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"); @@ -95,11 +76,7 @@ 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_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 BlockLeaves blackwood_leaves = get("blackwood_leaves"); 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"); @@ -110,42 +87,26 @@ 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_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 BlockLeaves cherry_leaves = get("cherry_leaves"); 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"); @@ -159,7 +120,6 @@ 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"); @@ -172,22 +132,10 @@ 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_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 BlockLeaves dark_oak_leaves = get("dark_oak_leaves"); 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"); @@ -195,13 +143,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 Block dirt = get("dirt"); + public static final BlockDirt 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"); @@ -209,27 +157,14 @@ 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 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 BlockBaseFlower flower = get("flower"); + public static final BlockFlowerPot flower_pot = get("flower_pot"); 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"); @@ -239,7 +174,6 @@ 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"); @@ -251,16 +185,6 @@ 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"); @@ -268,7 +192,6 @@ 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"); @@ -282,11 +205,7 @@ 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_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 BlockLeaves jungle_leaves = get("jungle_leaves"); 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"); @@ -296,34 +215,17 @@ 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"); @@ -332,11 +234,7 @@ 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_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 BlockLeaves maple_leaves = get("maple_leaves"); 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"); @@ -349,8 +247,6 @@ 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"); @@ -366,36 +262,19 @@ 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_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 BlockLeaves oak_leaves = get("oak_leaves"); 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"); @@ -403,8 +282,6 @@ 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"); @@ -417,15 +294,8 @@ 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"); @@ -433,15 +303,8 @@ 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"); @@ -449,12 +312,10 @@ 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 Block rock = get("rock"); - public static final BlockFlower rose = get("rose"); - public static final BlockDoublePlant rose_bush = get("rose_bush"); + public static final BlockRock rock = get("rock"); public static final Block ruby_block = get("ruby_block"); public static final BlockOre ruby_ore = get("ruby_ore"); - public static final BlockFalling sand = get("sand"); + public static final BlockSand 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"); @@ -464,17 +325,10 @@ 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"); @@ -483,34 +337,30 @@ 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_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 BlockLeaves spruce_leaves = get("spruce_leaves"); 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 Block stonebrick = get("stonebrick"); + public static final BlockStoneBrick 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"); @@ -518,11 +368,7 @@ 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_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 BlockLeaves tian_leaves = get("tian_leaves"); 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"); @@ -535,13 +381,6 @@ 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"); @@ -562,22 +401,14 @@ 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 cbe4afd6..d5d491f0 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -8,15 +8,13 @@ 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.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.BlockDoublePlant; import common.block.foliage.BlockFlower; -import common.block.natural.BlockColoredClay; +import common.block.natural.BlockDirt; +import common.block.natural.BlockSand; import common.block.natural.BlockSandStone; import common.collect.Lists; import common.collect.Maps; @@ -25,7 +23,6 @@ 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; @@ -43,9 +40,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.lapis_lazuli, 9)}, + {Blocks.lapis_block, new ItemStack(Items.dye, 9, DyeColor.BLUE.getDyeDamage())}, {Blocks.redstone_block, new ItemStack(Items.redstone, 9)}, - {Blocks.coal_block, new ItemStack(Items.coal, 9)}, + {Blocks.coal_block, new ItemStack(Items.coal, 9, 0)}, {Blocks.hay_block, new ItemStack(Items.wheats, 9)}, {Blocks.slime_block, new ItemStack(Items.slime_ball, 9)} }; @@ -146,7 +143,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', Items.cocoa, '#', Items.wheats); + add(new ItemStack(Items.cookie, 8), "#X#", 'X', new ItemStack(Items.dye, 1, DyeColor.BROWN.getDyeDamage()), '#', 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); @@ -158,72 +155,70 @@ 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), "##", "##", '#', 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.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.stonebrick, 4), "##", "##", '#', Blocks.stone); - addShapeless(new ItemStack(Blocks.mossy_stonebrick), Blocks.stonebrick, Blocks.vine); + addShapeless(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.MOSSY_META), 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.coarse_dirt, 4), "DG", "GD", 'D', Blocks.dirt, 'G', Blocks.gravel); + 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.lamp, 1), " R ", "RGR", " R ", 'R', Blocks.glass, 'G', Blocks.glowstone); - for (DyeColor color : DyeColor.values()) + for (int i = 0; i < 16; ++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(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)); } - 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); + 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())); - for (DyeColor color : DyeColor.values()) + for (int j = 0; j < 16; ++j) { - add(new ItemStack(BlockCarpet.getByColor(color), 3), "##", '#', BlockWool.getByColor(color)); + add(new ItemStack(Blocks.carpet, 3, j), "##", '#', new ItemStack(Blocks.wool, 1, j)); } recipes.add(new RecipesArmorDyes()); recipes.add(new RecipeFireworks()); recipes.add(new RecipeRepairItem()); - for (DyeColor color : DyeColor.values()) + for (DyeColor enumdyecolor : DyeColor.values()) { - add(ItemBanner.getColoredBanner(color), "###", "###", " | ", '#', BlockWool.getByColor(color), '|', Items.stick); + add(new ItemStack(Items.banner, 1, enumdyecolor.getDyeDamage()), "###", "###", " | ", '#', new ItemStack(Blocks.wool, 1, enumdyecolor.getMetadata()), '|', Items.stick); } recipes.add(new RecipeDuplicatePattern()); @@ -231,7 +226,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, Items.ink_sack, Items.feather); + addShapeless(new ItemStack(Items.writable_book, 1), Items.book, new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), 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); @@ -239,7 +234,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), "###", '#', planks); + add(new ItemStack(slab, 6, 0), "###", '#', 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); @@ -261,12 +256,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", '#', BlockWool.getByColor(color), 'X', planks); + add(new ItemStack(ItemRegistry.getRegisteredItem(color.getName() + "_bed"), 1), "###", "XXX", '#', new ItemStack(Blocks.wool, 1, color.getMetadata()), 'X', planks); } } - add(new ItemStack(Blocks.cobblestone_wall, 6), "###", "###", '#', Blocks.cobblestone); - add(new ItemStack(Blocks.mossy_cobblestone_wall, 6), "###", "###", '#', Blocks.mossy_cobblestone); + 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.blood_brick_fence, 6), "###", "###", '#', Blocks.blood_brick); add(new ItemStack(Items.lead, 2), "~~ ", "~O ", " ~", '~', Items.string, 'O', Items.slime_ball); @@ -276,17 +271,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.white_wool, 1), "##", "##", '#', Items.string); + add(new ItemStack(Blocks.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), "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.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.ladder, 3), "# #", "###", "# #", '#', Items.stick); @@ -296,7 +291,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', Items.charcoal, '#', Items.stick); + add(new ItemStack(Blocks.torch, 4), "X", "#", 'X', new ItemStack(Items.coal, 1, 1), '#', 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); @@ -307,10 +302,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', Blocks.tnt, '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.hopper_minecart, 1), "A", "B", 'A', Blocks.hopper, 'B', Items.minecart); add(new ItemStack(Items.bucket, 1), "# #", " # ", '#', Items.iron_ingot); - add(new ItemStack(Items.flowerpot, 1), "# #", " # ", '#', Items.brick); + add(new ItemStack(Items.flower_pot, 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); @@ -322,9 +317,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), "###", "#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.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.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); @@ -342,18 +337,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, Items.charcoal); + addShapeless(new ItemStack(Items.fire_charge, 3), Items.gunpowder, Items.blaze_powder, new ItemStack(Items.coal, 1, 1)); 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), "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.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.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); @@ -364,7 +359,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.splash_potion), Items.potion, Items.gunpowder); + addShapeless(new ItemStack(Items.potion, 1, 16384), new ItemStack(Items.potion, 1, 0), Items.gunpowder); add(new ItemStack(Blocks.construction_table), "---", "-#-", "---", '#', Blocks.workbench, '-', Items.iron_ingot); add(new ItemStack(Blocks.bedrock), "#####", "#####", "#####", "#####", "#####", '#', Blocks.obsidian); @@ -427,7 +422,7 @@ public abstract class CraftingRegistry } else if (recipeComponents[i + 1] instanceof Block) { - itemstack = new ItemStack((Block)recipeComponents[i + 1]); + itemstack = new ItemStack((Block)recipeComponents[i + 1], 1, 32767); } else if (recipeComponents[i + 1] instanceof ItemStack) { @@ -613,9 +608,9 @@ public abstract class CraftingRegistry { ItemStack itemstack2 = inv.getStackInSlot(j); - if (itemstack2 != null && itemstack2.getItem() instanceof ItemDye dye) + if (itemstack2 != null && itemstack2.getItem() == Items.dye) { - k = dye.getColor().getDyeDamage(); + k = itemstack2.getMetadata(); break; } } @@ -688,7 +683,7 @@ public abstract class CraftingRegistry if (itemstack != null && itemstack.getItem() != Items.banner) { - if (itemstack.getItem() instanceof ItemDye) + if (itemstack.getItem() == Items.dye) { if (flag2) { @@ -718,7 +713,7 @@ public abstract class CraftingRegistry } else if (p_179533_1_.getSizeInventory() == tileentitybanner$enumbannerpattern.getCraftingLayers().length * tileentitybanner$enumbannerpattern.getCraftingLayers()[0].length()) { - DyeColor j = null; + int j = -1; for (int k = 0; k < p_179533_1_.getSizeInventory() && flag; ++k) { @@ -728,13 +723,13 @@ public abstract class CraftingRegistry if (itemstack1 != null && itemstack1.getItem() != Items.banner) { - if (!(itemstack1.getItem() instanceof ItemDye dye)) + if (itemstack1.getItem() != Items.dye) { flag = false; break; } - if (j != null && j != dye.getColor()) + if (j != -1 && j != itemstack1.getMetadata()) { flag = false; break; @@ -746,7 +741,7 @@ public abstract class CraftingRegistry break; } - j = dye.getColor(); + j = itemstack1.getMetadata(); } else if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) != 32) { @@ -794,7 +789,7 @@ public abstract class CraftingRegistry return false; } - DyeColor j = TileEntityBanner.getBaseColor(itemstack2); + int j = TileEntityBanner.getBaseColor(itemstack2); boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0; if (itemstack != null) @@ -923,7 +918,7 @@ public abstract class CraftingRegistry { ++l; } - else if (itemstack.getItem() instanceof ItemDye) + else if (itemstack.getItem() == Items.dye) { ++k; } @@ -1009,9 +1004,9 @@ public abstract class CraftingRegistry if (itemstack2 != null) { - if (itemstack2.getItem() instanceof ItemDye dye) + if (itemstack2.getItem() == Items.dye) { - list.add(ItemDye.FIREWORK_COLORS[dye.getColor().getDyeDamage()]); + list.add(ItemDye.dyeColors[itemstack2.getMetadata() & 15]); } else if (itemstack2.getItem() == Items.glowstone_dust) { @@ -1063,9 +1058,9 @@ public abstract class CraftingRegistry if (itemstack1 != null) { - if (itemstack1.getItem() instanceof ItemDye dye) + if (itemstack1.getItem() == Items.dye) { - list1.add(ItemDye.FIREWORK_COLORS[dye.getColor().getDyeDamage()]); + list1.add(ItemDye.dyeColors[itemstack1.getMetadata() & 15]); } else if (itemstack1.getItem() == Items.firework_charge) { @@ -1228,9 +1223,7 @@ public abstract class CraftingRegistry i1 = 0; } - ItemStack stack = new ItemStack(itemstack2.getItem()); - stack.setItemDamage(i1); - return stack; + return new ItemStack(itemstack2.getItem(), 1, i1); } } @@ -1297,7 +1290,7 @@ public abstract class CraftingRegistry } else { - if (!(itemstack1.getItem() instanceof ItemDye)) + if (itemstack1.getItem() != Items.dye) { return false; } @@ -1354,12 +1347,12 @@ public abstract class CraftingRegistry } else { - if (!(itemstack1.getItem() instanceof ItemDye dye)) + if (itemstack1.getItem() != Items.dye) { return null; } - float[] afloat = EntitySheep.getDyeRgb(dye.getColor()); + float[] afloat = EntitySheep.getDyeRgb(DyeColor.byDyeDamage(itemstack1.getMetadata())); int l1 = (int)(afloat[0] * 255.0F); int i2 = (int)(afloat[1] * 255.0F); int j2 = (int)(afloat[2] * 255.0F); @@ -1531,6 +1524,11 @@ public abstract class CraftingRegistry { return false; } + + if (stack.getMetadata() != 32767 && stack.getMetadata() != ingredient.getMetadata()) + { + return false; + } } } } @@ -1623,7 +1621,7 @@ public abstract class CraftingRegistry for (ItemStack itemstack1 : list) { - if (itemstack.getItem() == itemstack1.getItem()) + if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata())) { 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 131e42a1..db74a2af 100755 --- a/common/src/main/java/common/init/DispenserRegistry.java +++ b/common/src/main/java/common/init/DispenserRegistry.java @@ -36,6 +36,7 @@ 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; @@ -61,33 +62,29 @@ public abstract class DispenserRegistry { return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ()); } }); - 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.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()); + } + }); REGISTRY.putObject(Items.snowball, new BehaviorProjectileDispense() { protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) @@ -110,13 +107,16 @@ public abstract class DispenserRegistry { return super.getVelocity() * 1.25F; } }); - for(ItemPotion potion : ItemPotion.getPotions()) { - if(potion.isSplashPotion()) - REGISTRY.putObject(potion, new BehaviorProjectileDispense() - { + 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() + { protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) { - return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), item.copy()); + return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), stack.copy()); } protected float getInaccuracy() { @@ -126,8 +126,9 @@ 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) @@ -306,7 +307,7 @@ public abstract class DispenserRegistry { } else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(new ItemStack(item)) < 0) { - this.field_150840_b.dispense(source, new ItemStack(item)); + this.field_150840_b.dispense(source, new ItemStack(item, 1, 0)); } return stack; @@ -314,7 +315,7 @@ public abstract class DispenserRegistry { }); REGISTRY.putObject(Items.flint_and_steel, new BehaviorDefaultDispenseItem() { - private boolean success = true; + private boolean field_150839_b = true; protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); @@ -328,24 +329,22 @@ 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.success = false; + this.field_150839_b = false; } return stack; } protected void playDispenseSound(IBlockSource source) { - if (this.success) + if (this.field_150839_b) { source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); } @@ -355,56 +354,59 @@ public abstract class DispenserRegistry { } } }); - REGISTRY.putObject(Items.bonemeal, new BehaviorDefaultDispenseItem() + 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() { - private boolean success = true; protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { 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); - } - this.success = true; - } - else - { - this.success = false; - } - + 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; 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 fd214fc6..0d0a632e 100755 --- a/common/src/main/java/common/init/FlammabilityRegistry.java +++ b/common/src/main/java/common/init/FlammabilityRegistry.java @@ -3,14 +3,6 @@ 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 { @@ -30,35 +22,21 @@ 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); - for(LeavesType type : LeavesType.values()) { - setFlammable(BlockLeaves.getLeavesBlock(wood, type), 30, 60); - } + setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_leaves"), 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 1aded2e9..83b991e9 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -2,22 +2,25 @@ 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.BlockStainedGlassPane; +import common.block.artificial.BlockStoneBrick; 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.foliage.BlockTallGrass; +import common.block.natural.BlockDirt; 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; @@ -28,6 +31,7 @@ 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; @@ -46,6 +50,8 @@ 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; @@ -75,6 +81,7 @@ 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; @@ -83,6 +90,7 @@ 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; @@ -109,14 +117,13 @@ 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 { @@ -149,10 +156,25 @@ public abstract class ItemRegistry { public static ItemStack getFromIdName(String name, ItemStack def) { if(name == null) return def; - Item item = REGISTRY.getObject(name); + String[] tok = name.split(":"); + if(tok.length < 1 || tok.length > 2) + return def; + Item item = REGISTRY.getObject(tok[0]); if(item == null) return def; - return new ItemStack(item); + 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); } private static ItemBlock registerFlat(Block block) { @@ -192,6 +214,7 @@ 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")); @@ -214,36 +237,131 @@ public abstract class ItemRegistry { } static void register() { - registerBlock(Blocks.grass, new ItemColored(Blocks.grass)); + 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.dispenser, new ItemDispenser(Blocks.dispenser)); - registerBlock(Blocks.dropper, new ItemDispenser(Blocks.dropper)); + 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.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)); - registerBlock(Blocks.vine, new ItemColored(Blocks.vine, "")); + registerFlat(Blocks.iron_bars); + registerFlat(Blocks.glass_pane, "glass"); + registerBlock(Blocks.vine, new ItemColored(Blocks.vine, false, "")); 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)); - - 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)); - } + 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(BlockWall wall : BlockWall.WALLS) { - registerBlock(wall, new ItemWall(wall)); - } for(BlockLeaves leaves : BlockLeaves.LEAVES) { - registerBlock(leaves, new ItemColored(leaves, 8)); + registerBlock(leaves, new ItemLeaves(leaves)); // .setDisplay(BlockRegistry.getNameFromBlock(leaves))); } for(BlockSlab slab : BlockSlab.SLABS) { registerBlock(slab, new ItemSlab(slab)); @@ -254,36 +372,9 @@ 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"); @@ -300,6 +391,8 @@ 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")); @@ -308,13 +401,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").setMaxAmount(ItemStack.MAX_SIZE)); + .setDisplay("Spawner").setMaxStackSize(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") - .setMaxAmount(ItemStack.MAX_SIZE)); + .setMaxStackSize(ItemStack.MAX_SIZE)); } } @@ -322,10 +415,8 @@ 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).setMaxAmount(128)); - for(Pair sides : ItemDie.DIE_SIDES) { - registerItem("die_" + sides.first(), (new ItemDie(sides.first(), sides.second())).setDisplay("WĂ¼rfel").setMaxAmount(128)); - } + registerItem("key", (new ItemKey()).setDisplay("SchlĂ¼ssel").setTab(CheatTab.TOOLS).setMaxStackSize(128)); + registerItem("die", (new ItemDie()).setDisplay("WĂ¼rfel").setMaxStackSize(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)); @@ -337,89 +428,79 @@ 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").setMaxAmount(128)); + registerItem("apple", (new ItemFood(4, false)).setDisplay("Apfel").setMaxStackSize(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).setMaxAmount(128)); - Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS); + registerItem("arrow", (new Item()).setDisplay("Pfeil").setTab(CheatTab.COMBAT).setMaxStackSize(128)); + Item coal = (new ItemCoal()).setDisplay("Kohle"); registerItem("coal", coal); - registerItem("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS)); - registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(256)); + registerItem("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxStackSize(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).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((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("bread", (new ItemFood(5, false)).setDisplay("Brot")); - registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxAmount(128)); + registerItem("flint", (new Item()).setDisplay("Feuerstein").setTab(CheatTab.MATERIALS).setMaxStackSize(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((new ItemRedstone()).setDisplay("Redstone").setPotionEffect(PotionHelper.redstoneEffect).setMaxAmount(256)); - registerItem("snowball", (new ItemSnowball()).setDisplay("Schneeball").setMaxAmount(128)); +// 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("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).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("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("book", (new ItemBook()).setDisplay("Buch").setTab(CheatTab.MISC)); - registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxAmount(128)); - registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxAmount(128)); + registerItem("slime_ball", (new Item()).setDisplay("Schleimball").setTab(CheatTab.MATERIALS).setMaxStackSize(128)); + registerItem("egg", (new ItemEgg()).setDisplay("Ei").setMaxStackSize(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).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)); + .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)); registerItem((new ItemSmallBlock(Blocks.repeater)).setDisplay("Redstone-Verstärker").setTab(CheatTab.TECHNOLOGY)); - registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(128)); + registerItem("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxStackSize(128)); registerItem("melon", (new ItemFood(2, false)).setDisplay("Melone")); - 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((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("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).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("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("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).setMaxAmount(128)); + .setPotionEffect(PotionHelper.spiderEyeEffect).setMaxStackSize(128)); registerItem("fermented_spider_eye", (new Item()).setDisplay("Fermentiertes Spinnenauge") - .setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxAmount(128)); + .setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setTab(CheatTab.MISC).setMaxStackSize(128)); registerItem("blaze_powder", (new Item()).setDisplay("Lohenstaub").setPotionEffect(PotionHelper.blazePowderEffect) - .setTab(CheatTab.MATERIALS).setMaxAmount(256)); - registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxAmount(128)); + .setTab(CheatTab.MATERIALS).setMaxStackSize(256)); + registerItem("magma_cream", (new Item()).setDisplay("Magmacreme").setPotionEffect(PotionHelper.magmaCreamEffect).setTab(CheatTab.MATERIALS).setMaxStackSize(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")); @@ -431,11 +512,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.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((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("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)); @@ -444,7 +525,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()).setMaxAmount(1).setDisplay("Verzaubertes Buch").setTab(CheatTab.MAGIC)); + registerItem("enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(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)); @@ -452,22 +533,38 @@ 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").setMaxAmount(128)); + registerItem("lead", (new ItemLead()).setDisplay("Leine").setMaxStackSize(128)); registerItem("name_tag", (new ItemNameTag()).setDisplay("Namensschild")); registerItem((new ItemBanner()).setDisplay("Banner")); - 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("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")); 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); @@ -491,10 +588,10 @@ public abstract class ItemRegistry { registerTools(tool.material, tool.name, tool.display); } for(BlockDoor door : BlockDoor.DOORS) { - registerItem(new ItemDoor(door)); + registerItem(new ItemDoor(door)); // .setDisplay(door.getDisplay())); } for(DyeColor color : BlockBed.COLORS) { - registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxAmount(1).setDisplay(color.getSubject(0) + " Bett")); + registerItem(new ItemBed((BlockBed)BlockRegistry.getRegisteredBlock(color.getName() + "_bed")).setMaxStackSize(1).setDisplay(color.getSubject(0) + " Bett")); } registerItem("record_13", (new ItemRecord()).setDisplay("Protokoll #1 - 13 Tage ohne Kaffee")); @@ -514,7 +611,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(lapis, 4), 4, 2); + ((BlockOre)BlockRegistry.getRegisteredBlock("lapis_ore")).setDropItem(new ItemStack(dye, 4, DyeColor.BLUE.getDyeDamage()), 4, 2); ((BlockOre)BlockRegistry.getRegisteredBlock("quartz_ore")).setDropItem(new ItemStack(quartz), 2); ((BlockOre)BlockRegistry.getRegisteredBlock("black_quartz_ore")).setDropItem(new ItemStack(bquartz), 3); @@ -523,21 +620,54 @@ 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 f4500027..ecd134e4 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -18,11 +18,7 @@ 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 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 ItemLeaves acacia_leaves = get("acacia_leaves"); 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"); @@ -31,16 +27,13 @@ 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 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 ItemAnvilBlock anvil = get("anvil"); 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"); @@ -64,11 +57,7 @@ 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 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 ItemLeaves birch_leaves = get("birch_leaves"); 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"); @@ -82,22 +71,14 @@ 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 ItemBlock black_quartz_block = get("black_quartz_block"); + public static final ItemMultiTexture 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"); @@ -106,11 +87,7 @@ 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 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 ItemLeaves blackwood_leaves = get("blackwood_leaves"); 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"); @@ -124,18 +101,11 @@ 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"); @@ -146,26 +116,19 @@ 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"); @@ -173,17 +136,12 @@ 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 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 ItemLeaves cherry_leaves = get("cherry_leaves"); 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"); @@ -205,10 +163,9 @@ 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 Item coal = get("coal"); + public static final ItemCoal 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"); @@ -216,42 +173,28 @@ 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 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 ItemLeaves dark_oak_leaves = get("dark_oak_leaves"); 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"); @@ -268,25 +211,15 @@ 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_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 ItemDie die = get("die"); + public static final ItemMultiTexture 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"); @@ -298,10 +231,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"); @@ -309,20 +242,8 @@ 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 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 ItemMultiTexture flower = get("flower"); + public static final ItemSmallBlock flower_pot = get("flower_pot"); 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"); @@ -347,23 +268,11 @@ 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"); @@ -377,11 +286,9 @@ 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"); @@ -406,11 +313,7 @@ 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 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 ItemLeaves jungle_leaves = get("jungle_leaves"); 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"); @@ -420,10 +323,7 @@ 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"); @@ -435,31 +335,13 @@ 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"); @@ -472,11 +354,7 @@ 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 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 ItemLeaves maple_leaves = get("maple_leaves"); 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"); @@ -492,8 +370,6 @@ 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"); @@ -525,27 +401,15 @@ 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 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 ItemLeaves oak_leaves = get("oak_leaves"); 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"); @@ -554,13 +418,6 @@ 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"); @@ -568,9 +425,7 @@ 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"); @@ -578,32 +433,6 @@ 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"); @@ -611,17 +440,9 @@ 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 ItemBlock quartz_block = get("quartz_block"); + public static final ItemMultiTexture 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"); @@ -652,20 +473,11 @@ 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"); @@ -673,16 +485,14 @@ 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 ItemBlock rock = get("rock"); - public static final ItemBlock rose = get("rose"); - public static final ItemDoublePlant rose_bush = get("rose_bush"); + public static final ItemMultiTexture rock = get("rock"); 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 ItemBlock sand = get("sand"); - public static final ItemBlock sandstone = get("sandstone"); + public static final ItemMultiTexture sand = get("sand"); + public static final ItemMultiTexture 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"); @@ -693,20 +503,12 @@ 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"); @@ -717,48 +519,19 @@ 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 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 ItemLeaves spruce_leaves = get("spruce_leaves"); 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"); @@ -771,7 +544,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 ItemBlock stonebrick = get("stonebrick"); + public static final ItemMultiTexture 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"); @@ -779,8 +552,6 @@ 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"); @@ -798,11 +569,7 @@ 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 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 ItemLeaves tian_leaves = get("tian_leaves"); 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"); @@ -816,14 +583,7 @@ 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 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 ItemTNT tnt = get("tnt"); public static final ItemMinecart tnt_minecart = get("tnt_minecart"); public static final ItemBlock torch = get("torch"); public static final ItemBlock trapdoor = get("trapdoor"); @@ -864,12 +624,6 @@ 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"); @@ -877,24 +631,15 @@ 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 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"); + public static final ItemBucket recursive_springwater_bucket = get("recursive_springwater_bucket"); + public static final ItemBucket springwater_bucket = get("springwater_bucket"); 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 7da3b400..4a316bc7 100755 --- a/common/src/main/java/common/init/SmeltingRegistry.java +++ b/common/src/main/java/common/init/SmeltingRegistry.java @@ -4,6 +4,7 @@ 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; @@ -19,35 +20,40 @@ public abstract class SmeltingRegistry private static boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { - return stack2.getItem() == stack1.getItem(); + return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata()); } 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(Blocks.stonebrick, new ItemStack(Blocks.cracked_stonebrick), 0.1F); + add(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 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.cactus_green), 0.2F); + add(Blocks.cactus, new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage()), 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 fish : ItemFishFood.FishType.values()) + for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) { - if (fish.canCook()) + if (itemfishfood$fishtype.canCook()) { - add(ItemRegistry.getRegisteredItem(fish.getName()), new ItemStack(ItemRegistry.getRegisteredItem("cooked_" + fish.getName())), 0.35F); + add(new ItemStack(Items.fish, 1, itemfishfood$fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, itemfishfood$fishtype.getMetadata()), 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.lapis_lazuli), 0.2F); + add(Blocks.lapis_ore, new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), 0.2F); add(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); add(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); @@ -60,7 +66,8 @@ 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.charcoal), 0.15F); + 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); } } @@ -71,7 +78,7 @@ public abstract class SmeltingRegistry private static void add(Item input, ItemStack stack, float experience) { - add(new ItemStack(input), stack, experience); + add(new ItemStack(input, 1, 32767), 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 9d1ffefa..c9d13561 100755 --- a/common/src/main/java/common/init/TradeRegistry.java +++ b/common/src/main/java/common/init/TradeRegistry.java @@ -28,15 +28,43 @@ 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.cod, new PriceInfo(6, 6), Items.cooked_cod, new PriceInfo(6, 6)), + new ItemForGemItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, + new PriceInfo(6, 6)), new EnchForGem(Items.fishing_rod, new PriceInfo(7, 8)), - new GemForItem(Items.white_wool, new PriceInfo(16, 22)), + new GemForItem(ItemRegistry.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)), new ItemForGem(Items.iron_shears, new PriceInfo(3, 4)), - 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 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 GemForItem(Items.string, new PriceInfo(15, 20)), new ItemForGem(Items.arrow, new PriceInfo(-12, -8)), new ItemForGem(Items.bow, new PriceInfo(2, 3)), @@ -49,6 +77,7 @@ 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(), @@ -57,9 +86,11 @@ 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(Items.ink_sack, new PriceInfo(-2, -1)), + new ItemForGem(new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), + new PriceInfo(-2, -1)), new ItemForGem(Items.charged_orb, new PriceInfo(7, 11)), - new ItemForGem(Items.glowstone, new PriceInfo(-3, -1)), + new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.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)), @@ -111,7 +142,7 @@ public abstract class TradeRegistry { i = this.price.getPrice(random); } - recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i), Items.emerald)); + recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i, 0), Items.emerald)); } } @@ -141,8 +172,8 @@ public abstract class TradeRegistry { j = this.field_179408_d.getPrice(random); } - recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i), - new ItemStack(Items.emerald), new ItemStack(this.sellingItemstack.getItem(), j))); + 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()))); } } @@ -177,8 +208,8 @@ public abstract class TradeRegistry { i = this.priceInfo.getPrice(random); } - ItemStack itemstack = new ItemStack(Items.emerald, i); - ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem()); + ItemStack itemstack = new ItemStack(Items.emerald, i, 0); + ItemStack itemstack1 = new ItemStack(this.enchantedItemStack.getItem(), 1, this.enchantedItemStack.getMetadata()); itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, random.range(5, 19)); recipeList.add(new MerchantRecipe(itemstack, itemstack1)); } @@ -209,12 +240,12 @@ public abstract class TradeRegistry { ItemStack itemstack1; if(i < 0) { - itemstack = new ItemStack(Items.emerald); - itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i); + itemstack = new ItemStack(Items.emerald, 1, 0); + itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i, this.itemToBuy.getMetadata()); } else { - itemstack = new ItemStack(Items.emerald, i); - itemstack1 = new ItemStack(this.itemToBuy.getItem()); + itemstack = new ItemStack(Items.emerald, i, 0); + itemstack1 = new ItemStack(this.itemToBuy.getItem(), 1, this.itemToBuy.getMetadata()); } 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 2d7cff48..3c894bea 100755 --- a/common/src/main/java/common/init/UniverseRegistry.java +++ b/common/src/main/java/common/init/UniverseRegistry.java @@ -5,8 +5,9 @@ import java.util.Map; import java.util.Map.Entry; import common.biome.Biome; -import common.block.artificial.BlockWool; +import common.block.BlockColored; import common.block.foliage.LeavesType; +import common.block.natural.BlockSand; import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; @@ -556,7 +557,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.red_sand.getState(), + .setPerlinGen(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND), 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"); @@ -614,7 +615,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.red_sand.getState()) + .setBiomeReplacer(Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND)) .setBiomeGen(Biome.MESA, true, 3, 1000, 100000, 100000) .enableCavesRavines(Blocks.lava.getState()).enableMobs() .addLake(Blocks.lava.getState(), null, null, 8, 8, 255, true) @@ -655,7 +656,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.green_clay.getState(), 2) + .setFlatGen(Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.GREEN), 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 c1c0cbe8..59197f1e 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() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) + if (itemstack9.getItem() == itemstack10.getItem() && itemstack9.getMetadata() == itemstack10.getMetadata() && 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 && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) + else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && (!itemstack9.getHasSubtypes() || itemstack9.getMetadata() == itemstack10.getMetadata()) && 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() && ItemStack.areItemStackTagsEqual(stack, itemstack)) + if (itemstack != null && itemstack.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getMetadata() == itemstack.getMetadata()) && 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 18d70ff4..32e26deb 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())); + ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata())); --itemstack1.size; } } diff --git a/common/src/main/java/common/inventory/ContainerRepair.java b/common/src/main/java/common/inventory/ContainerRepair.java index 06b6adf2..522df450 100755 --- a/common/src/main/java/common/inventory/ContainerRepair.java +++ b/common/src/main/java/common/inventory/ContainerRepair.java @@ -7,7 +7,6 @@ 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; @@ -101,19 +100,19 @@ public class ContainerRepair extends Container ContainerRepair.this.maximumCost = 0; State iblockstate = worldIn.getState(blockPosIn); - if (/* !playerIn.creative && */ !worldIn.client && Vars.anvilRepairDecay && iblockstate.getBlock() instanceof BlockAnvil anvil && playerIn.getRNG().floatv() < 0.12F) + if (/* !playerIn.creative && */ !worldIn.client && Vars.anvilRepairDecay && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().floatv() < 0.12F) { - int l = anvil.getAnvilDamage(); + int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); ++l; - if (l >= BlockAnvil.ANVILS.length) + if (l > 2) { worldIn.setBlockToAir(blockPosIn); worldIn.playAuxSFX(1020, blockPosIn, 0); } else { - worldIn.setState(blockPosIn, BlockAnvil.getByDamage(l).getState().withProperty(BlockAnvil.FACING, iblockstate.getValue(BlockAnvil.FACING)), 2); + worldIn.setState(blockPosIn, iblockstate.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(l)), 2); worldIn.playAuxSFX(1021, blockPosIn, 0); } } @@ -232,7 +231,7 @@ public class ContainerRepair extends Container damage = 0; } - if (damage < newStack.getItemDamage()) + if (damage < newStack.getMetadata()) { 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 8eb86cb0..97dbb15e 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)); + EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i, stack.getMetadata())); if (stack.hasTagCompound()) { diff --git a/common/src/main/java/common/inventory/InventoryPlayer.java b/common/src/main/java/common/inventory/InventoryPlayer.java index 1d8515a8..8802577e 100755 --- a/common/src/main/java/common/inventory/InventoryPlayer.java +++ b/common/src/main/java/common/inventory/InventoryPlayer.java @@ -65,6 +65,19 @@ 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 */ @@ -72,7 +85,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() && 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() && (!this.mainInventory[i].getHasSubtypes() || this.mainInventory[i].getMetadata() == itemStackIn.getMetadata()) && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn)) { return i; } @@ -97,10 +110,10 @@ public class InventoryPlayer implements IInventory return -1; } - public boolean setCurrentItem(Item itemIn) // , boolean p_146030_4_) + public boolean setCurrentItem(Item itemIn, int metadataIn, boolean isMetaSpecific) // , boolean p_146030_4_) { // ItemStack itemstack = this.getCurrentItem(); - int i = this.getInventorySlotContainItem(itemIn); + int i = isMetaSpecific ? this.getInventorySlotContainItemAndDamage(itemIn, metadataIn) : this.getInventorySlotContainItem(itemIn); if (i >= 0 && i < 9) { @@ -199,7 +212,7 @@ public class InventoryPlayer implements IInventory { if (this.mainInventory[j] == null) { - this.mainInventory[j] = new ItemStack(item, 0); + this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); if (itemStackIn.hasTagCompound()) { diff --git a/common/src/main/java/common/item/CheatTab.java b/common/src/main/java/common/item/CheatTab.java index b7be4c1a..b92c840b 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_spring); + return ItemRegistry.getItemFromBlock(Blocks.oak_leaves); } }, DECORATION("Dekoration") { diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index 9f82916b..daa6b611 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -15,6 +15,8 @@ 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; @@ -24,25 +26,35 @@ import common.world.World; public class Item { - private int maxAmount = 64; - private int maxDamage = 0; + protected static final Random itemRand = new Random(); + + protected int maxStackSize = 64; + private int maxDamage; + protected boolean hasSubtypes; private Item containerItem; private String potionEffect; private String display; - private CheatTab tab; + private CheatTab tabToDisplayOn; private TextColor color = null; - public final Item setMaxAmount(int max) + public Item setMaxStackSize(int maxStackSize) { - this.maxAmount = max; - this.maxDamage = 0; + this.maxStackSize = maxStackSize; return this; } - public final Item setMaxDamage(int max) + public Item setHasSubtypes(boolean hasSubtypes) { - this.maxAmount = 1; - this.maxDamage = max; + this.hasSubtypes = hasSubtypes; + return this; + } + + /** + * set max damage of an Item + */ + public Item setMaxDamage(int maxDamageIn) + { + this.maxDamage = maxDamageIn; return this; } @@ -52,21 +64,27 @@ public class Item return this; } - public final Item setContainerItem(Item containerItem) + public Item setContainerItem(Item containerItem) { this.containerItem = containerItem; return this; } - public final Item setPotionEffect(String potionEffect) + /** + * Sets the string representing this item's effect on a potion when used as an ingredient. + */ + public Item setPotionEffect(String potionEffect) { this.potionEffect = potionEffect; return this; } - public final Item setTab(CheatTab tab) + /** + * returns this; + */ + public Item setTab(CheatTab tab) { - this.tab = tab; + this.tabToDisplayOn = tab; return this; } @@ -75,22 +93,7 @@ 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() @@ -98,6 +101,17 @@ 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; @@ -112,41 +126,105 @@ 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; } - public int getMetadata() + /** + * 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) { 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; @@ -157,6 +235,9 @@ 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; @@ -167,6 +248,24 @@ 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; @@ -177,11 +276,17 @@ 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) { } @@ -196,10 +301,18 @@ 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(); @@ -210,6 +323,9 @@ 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(); @@ -234,21 +350,38 @@ 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)); + subItems.add(new ItemStack(itemIn, 1, 0)); } + /** + * gets the tab this item is displayed on + */ public CheatTab getTab() { - return this.tab; + return this.tabToDisplayOn; } +// public boolean canItemEditBlocks() +// { +// return false; +// } + + /** + * Return whether this item is repairable in an anvil. + */ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return false; @@ -262,13 +395,235 @@ 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; @@ -294,7 +649,7 @@ public class Item return Transforms.ITEM; } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { return provider.getModel(this.getTransform(), name); } @@ -303,6 +658,6 @@ public class Item } public void getRenderItems(Item itemIn, List subItems) { - subItems.add(new ItemStack(itemIn)); + this.getSubItems(itemIn, null, subItems); } } diff --git a/common/src/main/java/common/item/ItemAmmo.java b/common/src/main/java/common/item/ItemAmmo.java index c11cc9fc..e76602ab 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.setMaxAmount(stack); + this.maxStackSize = 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 new file mode 100755 index 00000000..8bf8549e --- /dev/null +++ b/common/src/main/java/common/item/ItemAnvilBlock.java @@ -0,0 +1,24 @@ +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 e2e4d597..a2b796a3 100755 --- a/common/src/main/java/common/item/ItemAppleGold.java +++ b/common/src/main/java/common/item/ItemAppleGold.java @@ -1,5 +1,7 @@ package common.item; +import java.util.List; + import common.color.TextColor; import common.entity.npc.EntityNPC; import common.potion.Potion; @@ -8,18 +10,24 @@ import common.world.World; public class ItemAppleGold extends ItemFood { - private final boolean powered; - - public ItemAppleGold(int amount, boolean powered) + public ItemAppleGold(int amount, boolean isWolfFood) { - super(amount, false); - this.powered = powered; - this.setColor(powered ? TextColor.MAGENTA : TextColor.NEON); + super(amount, isWolfFood); + this.setHasSubtypes(true); + this.setColor(TextColor.NEON); } public boolean hasEffect(ItemStack stack) { - return this.powered; + return stack.getMetadata() > 0; + } + + /** + * Return an item rarity from EnumRarity + */ + public TextColor getColor(ItemStack stack) + { + return stack.getMetadata() == 0 ? super.getColor(stack) : TextColor.MAGENTA; } protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player) @@ -29,7 +37,7 @@ public class ItemAppleGold extends ItemFood player.addEffect(new PotionEffect(Potion.ABSORPTION, 2400, 0)); } - if (this.powered) + if (stack.getMetadata() > 0) { if (!worldIn.client) { @@ -43,4 +51,13 @@ 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 4bbcc844..3c5722cd 100755 --- a/common/src/main/java/common/item/ItemArmor.java +++ b/common/src/main/java/common/item/ItemArmor.java @@ -91,6 +91,7 @@ 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); } @@ -271,11 +272,11 @@ public class ItemArmor extends Item super.getTransform()); } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { if(this.material.canBeDyed()) return provider.getModel(this.getTransform(), name, name + "_overlay"); else - return super.getModel(provider, name); + return super.getModel(provider, name, meta); } 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 1020ecfb..c5c76f61 100755 --- a/common/src/main/java/common/item/ItemBanner.java +++ b/common/src/main/java/common/item/ItemBanner.java @@ -7,7 +7,6 @@ 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; @@ -25,20 +24,8 @@ public class ItemBanner extends ItemBlock { super(Blocks.banner); this.setTab(CheatTab.DECORATION); - } - - 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; + this.setHasSubtypes(true); + this.setMaxDamage(0); } /** @@ -147,9 +134,15 @@ public class ItemBanner extends ItemBlock */ public void getSubItems(Item itemIn, CheatTab tab, List subItems) { - for (DyeColor color : DyeColor.values()) + for (DyeColor enumdyecolor : DyeColor.values()) { - subItems.add(this.getColored(color)); + 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); } } @@ -172,7 +165,7 @@ public class ItemBanner extends ItemBlock } else { - enumdyecolor = DyeColor.WHITE; + enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata()); } return enumdyecolor; @@ -211,12 +204,16 @@ public class ItemBanner extends ItemBlock { public String getModelLocation(ItemStack stack) { - return "item/banner" + '#' + "inventory"; + return "item/banner#0" + '#' + "inventory"; } }; } + + public void getRenderItems(Item itemIn, List subItems) { + subItems.add(new ItemStack(itemIn, 1, 0)); + } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 20d91680..8cdc5013 100755 --- a/common/src/main/java/common/item/ItemBlock.java +++ b/common/src/main/java/common/item/ItemBlock.java @@ -1,5 +1,7 @@ package common.item; +import java.util.List; + import common.block.Block; import common.color.TextColor; import common.entity.Entity; @@ -20,30 +22,21 @@ public class ItemBlock extends Item { protected final Block block; protected final String flatTexture; - protected final int fixedMeta; - - 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); + this.block = block; + this.flatTexture = flatTexture; } public ItemBlock(Block block) { - this(block, null, 0); + this(block, null); } + /** + * 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); @@ -79,7 +72,7 @@ public class ItemBlock extends Item } else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack)) { - int i = this.getMetadata(); + int i = this.getMetadata(stack.getMetadata()); State iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); if (worldIn.setState(pos, iblockstate1, 3)) @@ -188,15 +181,18 @@ 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"); @@ -219,11 +215,11 @@ public class ItemBlock extends Item return this.flatTexture != null ? super.getTransform() : this.block.getTransform(); } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { 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())).getPrimary() /* "blocks/" + name */) : + BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata(meta))).getPrimary() /* "blocks/" + name */) : provider.getModel(this.block.getModel(provider, - BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata())), this.getTransform()); + BlockRegistry.getNameFromBlock(this.block).toString(), this.block.getStateFromMeta(this.getMetadata(meta))), this.getTransform()); } } diff --git a/common/src/main/java/common/item/ItemBoat.java b/common/src/main/java/common/item/ItemBoat.java index e99e4cde..2d78fcf3 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.setMaxAmount(1); + this.maxStackSize = 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 86181393..4ee6e402 100755 --- a/common/src/main/java/common/item/ItemBow.java +++ b/common/src/main/java/common/item/ItemBow.java @@ -17,6 +17,7 @@ public class ItemBow extends Item { public ItemBow() { + this.maxStackSize = 1; this.setMaxDamage(384); this.setTab(CheatTab.COMBAT); } @@ -138,20 +139,19 @@ public class ItemBow extends Item } public void getRenderItems(Item itemIn, List subItems) { - super.getRenderItems(itemIn, subItems); + subItems.add(new ItemStack(itemIn, 1, 0)); for(int z = 0; z < 3; 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); - } - })); + subItems.add(new ItemStack(itemIn, 1, 1 + z)); } } 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 e1ab1e72..ad0b2dd1 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.setMaxAmount(liquid == null ? 16 : 1); + this.maxStackSize = 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"))); + "_bucket"), 1, 0)); } } } @@ -316,8 +316,8 @@ public class ItemBucket extends Item return true; } - public Model getModel(ModelProvider provider, String name) { - return this.recursive ? provider.getModel(this.getTransform(), name.substring("recursive_".length())) : super.getModel(provider, name); + 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 ItemMeshDefinition getMesher() { diff --git a/common/src/main/java/common/item/ItemBucketMilk.java b/common/src/main/java/common/item/ItemBucketMilk.java index 6485c168..90f2e490 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.setMaxAmount(1); + this.setMaxStackSize(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 607d8815..95b923b0 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 6682fc47..7a19ef90 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.setMaxAmount(1); + this.setMaxStackSize(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 580e908c..83d923ce 100755 --- a/common/src/main/java/common/item/ItemCarrotOnAStick.java +++ b/common/src/main/java/common/item/ItemCarrotOnAStick.java @@ -11,6 +11,7 @@ public class ItemCarrotOnAStick extends Item public ItemCarrotOnAStick() { this.setTab(CheatTab.TOOLS); + this.setMaxStackSize(1); this.setMaxDamage(25); } @@ -40,7 +41,7 @@ public class ItemCarrotOnAStick extends Item { EntityPig entitypig = (EntityPig)playerIn.vehicle; - if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getItemDamage() >= 7) + if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 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 3efa71b3..0b295150 100755 --- a/common/src/main/java/common/item/ItemChargedOrb.java +++ b/common/src/main/java/common/item/ItemChargedOrb.java @@ -17,6 +17,7 @@ public class ItemChargedOrb extends ItemFragile { public ItemChargedOrb() { + this.maxStackSize = 1; this.setTab(CheatTab.TOOLS); this.setMaxDamage(16); this.setColor(TextColor.DMAGENTA); @@ -60,9 +61,9 @@ public class ItemChargedOrb extends ItemFragile for (int i = 0; i < 16; ++i) { - double d0 = (double)((float)pos.getX() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F); + double d0 = (double)((float)pos.getX() + (5.0F + itemRand.floatv() * 6.0F) / 16.0F); double d1 = (double)((float)pos.getY() + 0.8125F); - double d2 = (double)((float)pos.getZ() + (5.0F + worldIn.rand.floatv() * 6.0F) / 16.0F); + double d2 = (double)((float)pos.getZ() + (5.0F + itemRand.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 93fd5e91..57e502cc 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 62e4bbf8..6c20acbf 100755 --- a/common/src/main/java/common/item/ItemCloth.java +++ b/common/src/main/java/common/item/ItemCloth.java @@ -7,21 +7,41 @@ import common.model.ModelProvider; public class ItemCloth extends ItemBlock { - private final DyeColor color; + private final Integer display; - public ItemCloth(Block block, String flatTexture, DyeColor color) + public ItemCloth(Block block, Integer display, String flatTexture) { super(block, flatTexture); - this.color = color; + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.display = display; } - public ItemCloth(Block block, DyeColor color) + public ItemCloth(Block block, Integer display) { - this(block, null, color); + this(block, display, null); } - 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); + /** + * 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); } } diff --git a/common/src/main/java/common/item/ItemCoal.java b/common/src/main/java/common/item/ItemCoal.java new file mode 100755 index 00000000..aa192aee --- /dev/null +++ b/common/src/main/java/common/item/ItemCoal.java @@ -0,0 +1,38 @@ +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 8c69cc88..97f58a3f 100755 --- a/common/src/main/java/common/item/ItemColored.java +++ b/common/src/main/java/common/item/ItemColored.java @@ -4,23 +4,60 @@ import common.block.Block; public class ItemColored extends ItemBlock { - public ItemColored(Block block, String flatTexture) + private final Block coloredBlock; + private String[] subtypeNames; + + public ItemColored(Block block, boolean hasSubtypes, String flatTexture) { super(block, flatTexture); + this.coloredBlock = block; + + if (hasSubtypes) + { + this.setMaxDamage(0); + this.setHasSubtypes(true); + } } - public ItemColored(Block block, int fixedMeta) + public ItemColored(Block block, boolean hasSubtypes) { - super(block, fixedMeta); - } - - public ItemColored(Block block) - { - super(block); + this(block, hasSubtypes, null); } public int getColorFromItemStack(ItemStack stack, int renderPass) { - return this.block.getRenderColor(this.block.getState()); + 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); + } } } diff --git a/common/src/main/java/common/item/ItemDie.java b/common/src/main/java/common/item/ItemDie.java index ee57801b..1afefd93 100755 --- a/common/src/main/java/common/item/ItemDie.java +++ b/common/src/main/java/common/item/ItemDie.java @@ -1,9 +1,7 @@ package common.item; -import java.util.Collection; -import java.util.Map; +import java.util.List; -import common.collect.Maps; import common.color.TextColor; import common.entity.npc.EntityNPC; import common.entity.projectile.EntityDie; @@ -11,47 +9,20 @@ import common.init.SoundEvent; import common.model.Model; import common.model.ModelProvider; import common.model.Transforms; -import common.util.Pair; +import common.util.ExtMath; import common.world.World; public class ItemDie extends Item { - 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 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}; - 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) + public ItemDie() { - this.sides = sides; - this.color = color; this.setTab(CheatTab.TOOLS); - DICE.put(sides, this); - } - - public int getSides() { - return this.sides; - } - - public TextColor getDieColor() { - return this.color; + this.setMaxDamage(0); + this.setHasSubtypes(true); } public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) @@ -65,24 +36,32 @@ public class ItemDie extends Item if (!worldIn.client) { - worldIn.spawnEntityInWorld(new EntityDie(worldIn, playerIn, this.sides, false)); // playerIn.creative)); + worldIn.spawnEntityInWorld(new EntityDie(worldIn, playerIn, DIE_SIDES[ExtMath.clampi(itemStackIn.getMetadata(), + 0, DIE_SIDES.length - 1)], 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" + this.sides; + return super.getDisplay(stack) + " W" + DIE_SIDES[ExtMath.clampi(stack.getMetadata(), 0, DIE_SIDES.length - 1)]; } public Transforms getTransform() { return Transforms.DICE; } - 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()); + 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()); } } diff --git a/common/src/main/java/common/item/ItemDispenser.java b/common/src/main/java/common/item/ItemDispenser.java index edc5df9e..1a90ccf6 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() { + public int getMetadata(int damage) { return 2; } } diff --git a/common/src/main/java/common/item/ItemDoublePlant.java b/common/src/main/java/common/item/ItemDoublePlant.java index 670e619f..2e1875e8 100755 --- a/common/src/main/java/common/item/ItemDoublePlant.java +++ b/common/src/main/java/common/item/ItemDoublePlant.java @@ -1,5 +1,7 @@ package common.item; +import java.util.function.Function; + import common.block.Block; import common.block.foliage.BlockDoublePlant; import common.block.foliage.BlockDoublePlant.EnumPlantType; @@ -7,24 +9,22 @@ import common.color.Colorizer; import common.model.Model; import common.model.ModelProvider; -public class ItemDoublePlant extends ItemBlock +public class ItemDoublePlant extends ItemMultiTexture { - private final BlockDoublePlant.EnumPlantType type; - - public ItemDoublePlant(Block block, BlockDoublePlant.EnumPlantType type) + public ItemDoublePlant(Block block, Block block2, Function nameFunction) { - super(block, ""); - this.type = type; + super(block, block2, true, nameFunction); } public int getColorFromItemStack(ItemStack stack, int renderPass) { - return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D); + 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); } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { return provider.getModel(this.getTransform(), "blocks/" + ( - this.type == EnumPlantType.SUNFLOWER ? "sunflower_front" : - this.type.getName() + "_top")); + BlockDoublePlant.EnumPlantType.byMetadata(meta) == EnumPlantType.SUNFLOWER ? "sunflower_front" : + BlockDoublePlant.EnumPlantType.byMetadata(meta).getName() + "_top")); } } diff --git a/common/src/main/java/common/item/ItemDye.java b/common/src/main/java/common/item/ItemDye.java index fe11e9e8..af0b10b9 100755 --- a/common/src/main/java/common/item/ItemDye.java +++ b/common/src/main/java/common/item/ItemDye.java @@ -1,5 +1,7 @@ package common.item; +import java.util.List; + import common.block.Block; import common.block.artificial.BlockBed; import common.block.foliage.IGrowable; @@ -22,24 +24,23 @@ import common.world.AWorldServer; public class ItemDye extends Item { - 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()]; + 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 ItemDye(DyeColor color) + /** + * 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) { - this.color = color; - this.setTab(CheatTab.MATERIALS); - DIES[this.color.getMetadata()] = this; - } - - public DyeColor getColor() { - return this.color; + int i = stack.getMetadata(); + return DyeColor.byDyeDamage(i).getDye(); } /** @@ -53,7 +54,9 @@ public class ItemDye extends Item } else { - if (this.color == DyeColor.WHITE) + DyeColor enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata()); + + if (enumdyecolor == DyeColor.WHITE) { if (applyBonemeal(stack, worldIn, pos)) { @@ -65,7 +68,7 @@ public class ItemDye extends Item return true; } } - else if (this.color == DyeColor.BROWN) + else if (enumdyecolor == DyeColor.BROWN) { State iblockstate = worldIn.getState(pos); Block block = iblockstate.getBlock(); @@ -100,7 +103,7 @@ public class ItemDye extends Item } State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() instanceof BlockBed) { - Block bedBlock = BlockRegistry.getRegisteredBlock(this.color.getName() + "_bed"); + Block bedBlock = BlockRegistry.getRegisteredBlock(enumdyecolor.getName() + "_bed"); if(bedBlock != Blocks.air) { if (iblockstate.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT) { @@ -131,7 +134,7 @@ public class ItemDye extends Item else if(iblockstate.getBlock() == Blocks.beacon) { TileEntity te = worldIn.getTileEntity(pos); if(te instanceof TileEntityBeacon) { - ((TileEntityBeacon)te).setBeamColor(this.color); + ((TileEntityBeacon)te).setBeamColor(enumdyecolor); // if(!playerIn.creative) --stack.size; } @@ -183,10 +186,10 @@ public class ItemDye extends Item for (int i = 0; i < amount; ++i) { - 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); + 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); } } } @@ -199,10 +202,11 @@ public class ItemDye extends Item if (target instanceof EntitySheep) { EntitySheep entitysheep = (EntitySheep)target; + DyeColor enumdyecolor = DyeColor.byDyeDamage(stack.getMetadata()); - if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != this.color) + if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor) { - entitysheep.setFleeceColor(this.color); + entitysheep.setFleeceColor(enumdyecolor); --stack.size; } @@ -214,7 +218,18 @@ public class ItemDye extends Item } } - public Model getModel(ModelProvider provider, String name) { - return provider.getModel(this.getTransform(), "dye_" + this.color.getName()); + /** + * 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()); } } diff --git a/common/src/main/java/common/item/ItemDynamite.java b/common/src/main/java/common/item/ItemDynamite.java index 85380ddf..d3433506 100755 --- a/common/src/main/java/common/item/ItemDynamite.java +++ b/common/src/main/java/common/item/ItemDynamite.java @@ -1,36 +1,61 @@ package common.item; +import java.util.List; + import common.entity.npc.EntityNPC; import common.entity.projectile.EntityDynamite; import common.init.SoundEvent; -import common.util.ExtMath; +import common.model.Model; +import common.model.ModelProvider; import common.world.World; -public class ItemDynamite extends Item { - public static final ItemDynamite[] DYNAMITE = new ItemDynamite[8]; +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); + } - private final int power; + /** + * 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; +// } - public static ItemDynamite getByPower(int power) { - return DYNAMITE[ExtMath.clampi(power, 0, DYNAMITE.length - 1)]; - } + worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F); - public ItemDynamite(int power) { - this.power = power; - this.setMaxAmount(32); - this.setTab(CheatTab.TOOLS); - DYNAMITE[power] = this; - } + if (!worldIn.client) + { + worldIn.spawnEntityInWorld(new EntityDynamite(worldIn, playerIn, itemStackIn.getMetadata())); + } - public int getExplosionPower() { - return this.power; - } +// 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 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; - } + public Model getModel(ModelProvider provider, String name, int meta) { + return provider.getModel(this.getTransform(), "dynamite" + (meta == 0 ? "" : ("_" + meta))); + } } diff --git a/common/src/main/java/common/item/ItemEditWand.java b/common/src/main/java/common/item/ItemEditWand.java index ccceb58d..6d1baa92 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.setMaxAmount(1); + this.maxStackSize = 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 b857cde1..37a1079e 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); + ItemStack itemstack = new ItemStack(Items.book, 1, 0); EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30); return new RngLoot(itemstack, minChance, maxChance, weight); } @@ -196,8 +196,12 @@ public class ItemEnchantedBook extends Item { public String getModelLocation(ItemStack stack) { - return "item/enchanted_book" + '#' + "inventory"; + return "item/enchanted_book#0" + '#' + "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 3abe8633..cd5287d0 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.setMaxAmount(1); + this.setMaxStackSize(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 a3691e3d..cd6c5c01 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 2c902d0d..14e9ba12 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.FIREWORK_COLORS.length; ++j) + for (int j = 0; j < ItemDye.dyeColors.length; ++j) { - if (i == ItemDye.FIREWORK_COLORS[j]) + if (i == ItemDye.dyeColors[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.FIREWORK_COLORS[k]) + if (l == ItemDye.dyeColors[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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 3a785a37..2a0f9b4d 100755 --- a/common/src/main/java/common/item/ItemFishFood.java +++ b/common/src/main/java/common/item/ItemFishFood.java @@ -1,5 +1,9 @@ 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; @@ -10,37 +14,31 @@ 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, FishType type) + public ItemFishFood(boolean cooked) { 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) { - return this.cooked && this.type.canCook() ? this.type.getCookedHealAmount() : this.type.getUncookedHealAmount(); + ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); + return this.cooked && itemfishfood$fishtype.canCook() ? itemfishfood$fishtype.getCookedHealAmount() : itemfishfood$fishtype.getUncookedHealAmount(); } public String getPotionEffect(ItemStack stack) { - return this.type == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null; + return ItemFishFood.FishType.byItemStack(stack) == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null; } protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player) { - if (this.type == ItemFishFood.FishType.PUFFERFISH) + ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); + + if (itemfishfood$fishtype == ItemFishFood.FishType.PUFFERFISH) { player.addEffect(new PotionEffect(Potion.POISON, 1200, 3)); player.addEffect(new PotionEffect(Potion.NAUSEA, 300, 1)); @@ -49,13 +47,32 @@ public class ItemFishFood extends ItemFood super.onFoodEaten(stack, worldIn, player); } - public String getDisplay(ItemStack 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) { - return (this.type.canCook() ? (this.cooked ? "Gebratener " : "Roher ") : "") + this.type.getDisplay(); + for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) + { + if (!this.cooked || itemfishfood$fishtype.canCook()) + { + subItems.add(new ItemStack(this, 1, itemfishfood$fishtype.getMetadata())); + } + } } - public Model getModel(ModelProvider provider, String name) { - return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + this.type.getName()); + /** + * 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(); + } + + public Model getModel(ModelProvider provider, String name, int meta) { + return provider.getModel(this.getTransform(), (this.cooked ? "cooked_" : "") + FishType.byMetadata(meta).getTexture()); } public static enum FishType @@ -65,28 +82,29 @@ 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 name, int meta, String display, int uncookedHeal, int cookedHeal) + private FishType(String texture, int meta, String name, int uncookedHeal, int cookedHeal) { - this.name = name; + this.texture = texture; this.meta = meta; - this.display = display; + this.name = name; this.uncookedHealAmount = uncookedHeal; this.cookedHealAmount = cookedHeal; this.cookable = true; } - private FishType(String name, int meta, String display, int uncookedHeal) + private FishType(String texture, int meta, String name, int uncookedHeal) { - this.name = name; + this.texture = texture; this.meta = meta; - this.display = display; + this.name = name; this.uncookedHealAmount = uncookedHeal; this.cookedHealAmount = 0; this.cookable = false; @@ -97,16 +115,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; @@ -121,5 +139,23 @@ 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 601c30ba..f7278f83 100755 --- a/common/src/main/java/common/item/ItemFishingRod.java +++ b/common/src/main/java/common/item/ItemFishingRod.java @@ -15,6 +15,7 @@ public class ItemFishingRod extends Item public ItemFishingRod() { this.setMaxDamage(64); + this.setMaxStackSize(1); this.setTab(CheatTab.TOOLS); } @@ -79,15 +80,15 @@ public class ItemFishingRod extends Item } public void getRenderItems(Item itemIn, List subItems) { - 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"); - } - })); + subItems.add(new ItemStack(itemIn, 1, 0)); + subItems.add(new ItemStack(itemIn, 1, 1)); } 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 a32f0139..55ff3be0 100755 --- a/common/src/main/java/common/item/ItemFlintAndSteel.java +++ b/common/src/main/java/common/item/ItemFlintAndSteel.java @@ -15,6 +15,7 @@ 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 3b2811cf..d4b046a7 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), false); + playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potion, 1, 0), false); } } } @@ -64,7 +64,7 @@ public class ItemGlassBottle extends Item } } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 4ae5041d..73f56abe 100755 --- a/common/src/main/java/common/item/ItemGunBase.java +++ b/common/src/main/java/common/item/ItemGunBase.java @@ -15,6 +15,7 @@ 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 2b630181..9e7b7b76 100755 --- a/common/src/main/java/common/item/ItemHoe.java +++ b/common/src/main/java/common/item/ItemHoe.java @@ -1,6 +1,7 @@ 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; @@ -17,6 +18,7 @@ public class ItemHoe extends Item public ItemHoe(ToolMaterial material) { this.theToolMaterial = material; + this.maxStackSize = 1; this.setMaxDamage(material.getDurability()); this.setTab(CheatTab.TOOLS); } @@ -46,12 +48,14 @@ public class ItemHoe extends Item if (block == Blocks.dirt) { - return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getState()); - } + switch ((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT)) + { + case DIRT: + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getState()); - if (block == Blocks.coarse_dirt) - { - return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getState()); + case COARSE_DIRT: + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } } } diff --git a/common/src/main/java/common/item/ItemHorseArmor.java b/common/src/main/java/common/item/ItemHorseArmor.java index 86d14c20..3b60d1f2 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.setMaxAmount(1); + this.setMaxStackSize(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 eb1c35d5..9ed68418 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() { + public int getMetadata(int damage) { return 14; } } diff --git a/common/src/main/java/common/item/ItemLeaves.java b/common/src/main/java/common/item/ItemLeaves.java new file mode 100755 index 00000000..efe717c4 --- /dev/null +++ b/common/src/main/java/common/item/ItemLeaves.java @@ -0,0 +1,45 @@ +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 1650934e..efe834d0 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.foliage.BlockLilyPad; +import common.block.BlockDirectional; 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, ""); + super(block, false, ""); } 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(BlockLilyPad.FACING, playerIn.getHorizontalFacing().getOpposite())); + worldIn.setState(blockpos1, Blocks.waterlily.getState().withProperty(BlockDirectional.FACING, playerIn.getHorizontalFacing().getOpposite())); // if (!playerIn.creative) // { @@ -60,4 +60,9 @@ 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 53aca673..f2b85279 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.setMaxAmount(1); + this.setMaxStackSize(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 7ed0e155..ccc8a414 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.setMaxAmount(1); + this.maxStackSize = 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 ee1209c8..c7faf25f 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 new file mode 100755 index 00000000..4a85c9f0 --- /dev/null +++ b/common/src/main/java/common/item/ItemMultiTexture.java @@ -0,0 +1,61 @@ +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 eddd7f21..edc04b25 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 7e758130..1b83d880 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() + public int getMetadata(int damage) { return 7; } @@ -25,7 +25,7 @@ public class ItemPiston extends ItemBlock return true; } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 8aba65f0..29a9c7bd 100755 --- a/common/src/main/java/common/item/ItemPotion.java +++ b/common/src/main/java/common/item/ItemPotion.java @@ -1,6 +1,5 @@ package common.item; -import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -21,41 +20,60 @@ import common.world.World; public class ItemPotion extends Item { - private static final Map POTIONS = Maps.newTreeMap(); + private Map> effectCache = Maps.>newHashMap(); 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(int data) + public ItemPotion() { - this.data = data; - this.setMaxAmount(1); + this.setMaxStackSize(1); + this.setHasSubtypes(true); + this.setMaxDamage(0); this.setTab(CheatTab.MAGIC); this.setColor(TextColor.ORK); - POTIONS.put(data, this); - } - - public int getPotionData() { - return this.data; } - public List getEffects() + public List getEffects(ItemStack stack) { - List list = this.effectCache; +// 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())); if (list == null) { - list = this.effectCache = PotionHelper.getPotionEffects(this.data); + 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); } return list; @@ -74,7 +92,7 @@ public class ItemPotion extends Item if (!worldIn.client) { - List list = this.getEffects(); + List list = this.getEffects(stack); if (list != null) { @@ -124,7 +142,7 @@ public class ItemPotion extends Item */ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) { - if (this.isSplashPotion()) + if (isSplash(itemStackIn.getMetadata())) { // if (!playerIn.creative) // { @@ -147,24 +165,28 @@ public class ItemPotion extends Item return itemStackIn; } } - - public boolean isSplashPotion() { - return (this.data & 16384) != 0; + + /** + * 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 int getColorFromDamage() + public int getColorFromDamage(int meta) { - return PotionHelper.getLiquidColor(this.data); + return PotionHelper.getLiquidColor(meta); } public int getColorFromItemStack(ItemStack stack, int renderPass) { - return renderPass > 0 ? 16777215 : this.getColorFromDamage(); + return renderPass > 0 ? 16777215 : this.getColorFromDamage(stack.getMetadata()); } - public boolean isEffectInstant() + public boolean isEffectInstant(int meta) { - List list = this.getEffects(); + List list = this.getEffects(meta); if (list != null && !list.isEmpty()) { @@ -186,20 +208,20 @@ public class ItemPotion extends Item public String getDisplay(ItemStack stack) { - if ((this.data & 16383) == 0) + if ((stack.getMetadata() & 16383) == 0) { - return (this.isSplashPotion() ? "Werfbare " : "") + "Wasserflasche"; + return (isSplash(stack.getMetadata()) ? "Werfbare " : "") + "Wasserflasche"; } else { String s = ""; - if (this.isSplashPotion()) + if (isSplash(stack.getMetadata())) { s = "Werfbarer "; } - List list = this.getEffects(); + List list = Items.potion.getEffects(stack); if (list != null && !list.isEmpty()) { @@ -209,7 +231,7 @@ public class ItemPotion extends Item } else { - String s1 = PotionHelper.getPotionPrefix(this.data); + String s1 = PotionHelper.getPotionPrefix(stack.getMetadata()); return s1.trim() + " " + super.getDisplay(stack); } } @@ -220,9 +242,9 @@ public class ItemPotion extends Item */ public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { - if ((this.data & 16383) != 0) + if ((stack.getMetadata() & 16383) != 0) { - List list = this.getEffects(); + List list = Items.potion.getEffects(stack); List implications = Lists.newArrayList(); if (list != null && !list.isEmpty()) @@ -267,25 +289,17 @@ public class ItemPotion extends Item public boolean hasEffect(ItemStack stack) { - List list = this.getEffects(); + List list = this.getEffects(stack); 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()); - } - public static List getValidDataValues() + /** + * 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) { - List data = Lists.newArrayList(); - data.add(0); - data.add(16384); + super.getSubItems(itemIn, tab, subItems); + subItems.add(new ItemStack(itemIn, 1, 16384)); if (SUB_ITEMS_CACHE.isEmpty()) { @@ -336,28 +350,47 @@ public class ItemPotion extends Item while (iterator.hasNext()) { int j1 = ((Integer)iterator.next()).intValue(); - data.add(j1); + subItems.add(new ItemStack(itemIn, 1, 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.this.isSplashPotion() ? ("item/splash_potion" + '#' + "inventory") : ("item/potion" + '#' + "inventory"); + return ItemPotion.isSplash(stack.getMetadata()) ? ("item/potion#16384" + '#' + "inventory") : ("item/potion#0" + '#' + "inventory"); } }; } public void getRenderItems(Item itemIn, List subItems) { - if(this.data == 0 || this.data == 16384) - super.getRenderItems(itemIn, subItems); + subItems.add(new ItemStack(itemIn, 1, 0)); + subItems.add(new ItemStack(itemIn, 1, 16384)); } - public Model getModel(ModelProvider provider, String name) { - return provider.getModel(this.getTransform(), "potion_overlay", this.isSplashPotion() ? "potion_bottle_splash" : "potion_bottle_drinkable"); + public Model getModel(ModelProvider provider, String name, int meta) { + return provider.getModel(this.getTransform(), "potion_overlay", + isSplash(meta) ? "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 3338435c..e644b4b5 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 5f5f032f..d43a90ef 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) { + public Model getModel(ModelProvider provider, String name, int meta) { 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 b25254d5..be30a91d 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.setMaxAmount(1); + this.maxStackSize = 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 d82b517e..b3e3556b 100755 --- a/common/src/main/java/common/item/ItemShears.java +++ b/common/src/main/java/common/item/ItemShears.java @@ -14,6 +14,7 @@ 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 043a0cc3..e30370b7 100755 --- a/common/src/main/java/common/item/ItemSlab.java +++ b/common/src/main/java/common/item/ItemSlab.java @@ -16,6 +16,8 @@ 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 a1bb1954..f19ba090 100755 --- a/common/src/main/java/common/item/ItemSnow.java +++ b/common/src/main/java/common/item/ItemSnow.java @@ -14,8 +14,13 @@ 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) @@ -60,4 +65,13 @@ 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 39d7c223..daf6ebaa 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.setMaxAmount(1); + this.setMaxStackSize(1); } /** diff --git a/common/src/main/java/common/item/ItemSpaceNavigator.java b/common/src/main/java/common/item/ItemSpaceNavigator.java index 14633f63..eb3841f6 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.setMaxAmount(1); + this.setMaxStackSize(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 6baa83f1..abe7cbb5 100755 --- a/common/src/main/java/common/item/ItemStack.java +++ b/common/src/main/java/common/item/ItemStack.java @@ -15,6 +15,7 @@ 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; @@ -25,11 +26,12 @@ import common.world.World; public final class ItemStack { public static final int MAX_SIZE = 67108864; - private static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); + public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); public int size; private Item item; private TagObject tag; + private int meta; public ItemStack(Block block) { @@ -38,7 +40,12 @@ public final class ItemStack public ItemStack(Block block, int amount) { - this(ItemRegistry.getItemFromBlock(block), amount); + this(block, amount, 0); + } + + public ItemStack(Block block, int amount, int meta) + { + this(ItemRegistry.getItemFromBlock(block), amount, meta); } public ItemStack(Item item) @@ -48,8 +55,23 @@ 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) { @@ -78,6 +100,10 @@ public final class ItemStack private ItemStack() { +// this.canDestroyCacheBlock = null; +// this.canDestroyCacheResult = false; +// this.canPlaceOnCacheBlock = null; +// this.canPlaceOnCacheResult = false; } /** @@ -85,7 +111,7 @@ public final class ItemStack */ public ItemStack splitStack(int amount) { - ItemStack itemstack = new ItemStack(this.item, amount); + ItemStack itemstack = new ItemStack(this.item, amount, this.meta); if (this.tag != null) { @@ -142,70 +168,136 @@ 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) { - if(this.tag != null) - tag.merge(this.tag); - tag.setString("id", this.item == null ? "air" : ItemRegistry.getNameFromItem(this.item)); - tag.setInt("size", this.size); + 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); + } + return tag; } - private void readTags(TagObject tag) + /** + * Read the stack fields from a object. + */ + public void readTags(TagObject 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; + 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); + } + } } + /** + * 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.getItemDamage() > 0; + return this.isItemStackDamageable() && this.meta > 0; } public int getItemDamage() { - return this.isItemStackDamageable() && this.tag != null && this.tag.hasInt("dmg") ? this.tag.getInt("dmg") : 0; + return this.meta; } - public void setItemDamage(int damage) + public int getMetadata() { - 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); - } + return this.meta; } + 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(); @@ -246,14 +338,18 @@ public final class ItemStack } } - int damage = this.getItemDamage() + amount; - this.setItemDamage(damage); - return damage > this.getMaxDamage(); + this.meta += amount; + return this.meta > 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())) @@ -264,6 +360,7 @@ 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) { @@ -276,9 +373,10 @@ public final class ItemStack this.size = 0; } - this.setItemDamage(0); + this.meta = 0; } } +// } } /** @@ -320,9 +418,12 @@ 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); + ItemStack itemstack = new ItemStack(this.item, this.size, this.meta); if (this.tag != null) { @@ -350,7 +451,7 @@ public final class ItemStack */ private boolean isItemStackEqual(ItemStack other) { - 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))); + 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)))); } /** @@ -367,7 +468,7 @@ public final class ItemStack */ public boolean isItemEqual(ItemStack other) { - return other != null && this.item == other.item; + return other != null && this.item == other.item && this.meta == other.meta; } // public String getUnlocalizedName() @@ -478,18 +579,29 @@ 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; @@ -510,26 +622,131 @@ 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"); @@ -539,14 +756,59 @@ 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) @@ -562,6 +824,37 @@ 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(); @@ -597,6 +890,58 @@ 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" : ""), @@ -612,6 +957,7 @@ public final class ItemStack { list.add(TextColor.GRAY + String.format("NBT-Tags: %d", this.getTagCompound().keySet().size())); } +// } return list; } @@ -739,11 +1085,46 @@ 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) { @@ -778,4 +1159,74 @@ 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 ea1610a3..2a741fa3 100755 --- a/common/src/main/java/common/item/ItemSword.java +++ b/common/src/main/java/common/item/ItemSword.java @@ -18,6 +18,7 @@ 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 new file mode 100755 index 00000000..6aa1b7de --- /dev/null +++ b/common/src/main/java/common/item/ItemTNT.java @@ -0,0 +1,28 @@ +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 b287c04c..28e0768f 100755 --- a/common/src/main/java/common/item/ItemTool.java +++ b/common/src/main/java/common/item/ItemTool.java @@ -14,6 +14,7 @@ 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 50b9893c..9e138fdc 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 ItemBlock { - private final BlockWall wallBlock; - - public ItemWall(BlockWall block) { - super(block); - this.wallBlock = block; +public class ItemWall extends ItemMultiTexture { + public ItemWall(Block block, Block block2, Function nameFunction) { + super(block, block2, nameFunction); } - public Model getModel(ModelProvider provider, String name) { + public Model getModel(ModelProvider provider, String name, int meta) { return provider.getModel( - provider.getModel(this.wallBlock.getTexture()) + provider.getModel(this.block.getStateFromMeta(this.getMetadata(meta)).getValue(BlockWall.VARIANT).getName()) .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 c5a2017a..f0a494d0 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.setMaxAmount(1); + this.maxStackSize = 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 a0937dd2..bff9568e 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.setMaxAmount(1); + this.setMaxStackSize(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 1a61cd2e..b8c9c4e2 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 min, int max, int weight) + public RngLoot(Item item, int amount, int min, int max, int weight) { super(weight); - this.item = new ItemStack(item); + this.item = new ItemStack(item, 1, amount); 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 9adf71bd..5de7b2f3 100755 --- a/common/src/main/java/common/network/PacketBuffer.java +++ b/common/src/main/java/common/network/PacketBuffer.java @@ -119,6 +119,7 @@ public class PacketBuffer { } this.writeShort(ItemRegistry.getIdFromItem(stack.getItem())); this.writeVarInt(stack.size); + this.writeShort(stack.getMetadata()); this.writeTag(stack.getTagCompound()); } @@ -127,7 +128,8 @@ public class PacketBuffer { if(id < 0) return null; int amt = this.readVarInt(); - ItemStack stack = new ItemStack(ItemRegistry.getItemById(id), amt); + int meta = this.readShort(); + ItemStack stack = new ItemStack(ItemRegistry.getItemById(id), amt, meta); 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 new file mode 100755 index 00000000..af1e3889 --- /dev/null +++ b/common/src/main/java/common/properties/IProperty.java @@ -0,0 +1,17 @@ +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 deleted file mode 100755 index 3331a098..00000000 --- a/common/src/main/java/common/properties/Property.java +++ /dev/null @@ -1,38 +0,0 @@ -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 66c7599b..2db7c379 100755 --- a/common/src/main/java/common/properties/PropertyBool.java +++ b/common/src/main/java/common/properties/PropertyBool.java @@ -4,22 +4,30 @@ import java.util.Collection; import common.collect.ImmutableSet; -public class PropertyBool extends Property { - private final ImmutableSet bools = ImmutableSet.of(true, false); +public class PropertyBool extends PropertyHelper +{ + private final ImmutableSet allowedValues = ImmutableSet.of(Boolean.valueOf(true), Boolean.valueOf(false)); - public static PropertyBool create(String name) { - return new PropertyBool(name); - } + protected PropertyBool(String name) + { + super(name, Boolean.class); + } - private PropertyBool(String name) { - super(name, Boolean.class); - } + public Collection getAllowedValues() + { + return this.allowedValues; + } - public Collection getStates() { - return this.bools; - } + public static PropertyBool create(String name) + { + return new PropertyBool(name); + } - public String getName(Boolean value) { - return value.toString(); - } + /** + * Get the name for the given value. + */ + 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 new file mode 100755 index 00000000..88ba891f --- /dev/null +++ b/common/src/main/java/common/properties/PropertyDirection.java @@ -0,0 +1,41 @@ +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 76fe6e8a..eccbeeb6 100755 --- a/common/src/main/java/common/properties/PropertyEnum.java +++ b/common/src/main/java/common/properties/PropertyEnum.java @@ -1,59 +1,69 @@ package common.properties; import java.util.Collection; -import java.util.Set; +import java.util.Map; +import java.util.function.Predicate; +import common.collect.Filter; import common.collect.ImmutableSet; -import common.collect.Sets; +import common.collect.Lists; +import common.collect.Maps; import common.util.Identifyable; +import common.util.Predicates; -public class PropertyEnum & Identifyable> extends Property { - private final ImmutableSet states; +public class PropertyEnum & Identifyable> extends PropertyHelper +{ + private final ImmutableSet allowedValues; + private final Map nameToValue = Maps.newHashMap(); - public static & Identifyable> PropertyEnum create(String name, Class clazz) { - return new PropertyEnum(name, clazz, clazz.getEnumConstants()); - } + 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, T... values) { - return new PropertyEnum(name, clazz, values); - } + for (T t : allowedValues) + { + String s = ((Identifyable)t).getName(); - 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); - } + if (this.nameToValue.containsKey(s)) + { + throw new IllegalArgumentException("Multiple values have the same name \'" + s + "\'"); + } - public Collection getStates() { - return this.states; - } + this.nameToValue.put(s, t); + } + } - public String getName(T value) { - return value.getName(); - } + 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; - PropertyEnum other = (PropertyEnum)obj; - return this.states.equals(other.states); - } - return false; - } + /** + * Get the name for the given value. + */ + public String getName(T value) + { + return ((Identifyable)value).getName(); + } - public int hashCode() { - int i = super.hashCode(); - i = 31 * i + this.states.hashCode(); - return i; - } + 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); + } } diff --git a/common/src/main/java/common/properties/PropertyHelper.java b/common/src/main/java/common/properties/PropertyHelper.java new file mode 100755 index 00000000..671ff281 --- /dev/null +++ b/common/src/main/java/common/properties/PropertyHelper.java @@ -0,0 +1,50 @@ +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 638c9396..c6bd59b0 100755 --- a/common/src/main/java/common/properties/PropertyInteger.java +++ b/common/src/main/java/common/properties/PropertyInteger.java @@ -6,49 +6,81 @@ import java.util.Set; import common.collect.ImmutableSet; import common.collect.Sets; -public class PropertyInteger extends Property { - private final ImmutableSet values; +public class PropertyInteger extends PropertyHelper +{ + private final ImmutableSet allowedValues; - public static PropertyInteger create(String name, int min, int max) { - return new PropertyInteger(name, min, max); - } + protected PropertyInteger(String name, int min, int max) + { + super(name, Integer.class); - 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); - } + 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(); - public Collection getStates() { - return this.values; - } + for (int i = min; i <= max; ++i) + { + set.add(Integer.valueOf(i)); + } - public String getName(Integer value) { - return value.toString(); - } + this.allowedValues = ImmutableSet.copyOf(set); + } + } - 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 Collection getAllowedValues() + { + return this.allowedValues; + } - public int hashCode() { - int i = super.hashCode(); - i = 31 * i + this.values.hashCode(); - return i; - } + 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(); + } } diff --git a/common/src/main/java/common/tileentity/TileEntityBanner.java b/common/src/main/java/common/tileentity/TileEntityBanner.java index be5d13b0..6f09ac23 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 = DyeColor.WHITE.getDyeDamage(); + this.baseColor = stack.getMetadata() & 15; } } else { - this.baseColor = DyeColor.WHITE.getDyeDamage(); + this.baseColor = stack.getMetadata() & 15; } this.patternList = null; @@ -104,10 +104,10 @@ public class TileEntityBanner extends TileEntity return this.baseColor; } - public static DyeColor getBaseColor(ItemStack stack) + public static int getBaseColor(ItemStack stack) { TagObject nbttagcompound = stack.getSubCompound("BlockEntityTag", false); - return nbttagcompound != null && nbttagcompound.hasInt("Base") ? DyeColor.byDyeDamage(nbttagcompound.getInt("Base")) : DyeColor.WHITE; + return nbttagcompound != null && nbttagcompound.hasInt("Base") ? nbttagcompound.getInt("Base") : stack.getMetadata(); } /** @@ -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)), + RUNE("rune", "run", "%s Rune", -1, false, new ItemStack(Items.golden_apple, 1, 0)), 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)), - FLOWER("flower", "flo", "%s Blume", -1, false, new ItemStack(Items.daisy)), - THING("thing", "thi", "%s ", 0, false, new ItemStack(Items.charged_apple)); + 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)); 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 aec178d7..da2d009b 100755 --- a/common/src/main/java/common/tileentity/TileEntityBeacon.java +++ b/common/src/main/java/common/tileentity/TileEntityBeacon.java @@ -3,8 +3,6 @@ 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; @@ -156,7 +154,7 @@ public class TileEntityBeacon extends TileEntity implements ITickable { State iblockstate = this.worldObj.getState(blockpos$mutableblockpos.set(j, i1, l)); - if (!(iblockstate.getBlock() instanceof BlockStainedGlass) && !(iblockstate.getBlock() instanceof BlockStainedGlassPane) + if (iblockstate.getBlock() != Blocks.stained_glass && iblockstate.getBlock() != Blocks.stained_glass_pane && 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 4d8950ef..f883e9b8 100755 --- a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java +++ b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java @@ -143,20 +143,21 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka for (int i = 0; i < 3; ++i) { - if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion) + if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potion) { - ItemPotion result = this.getPotionResult(potion, itemstack); + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); - if (!potion.isSplashPotion() && result.isSplashPotion()) + if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) { flag = true; break; } - List list = potion.getEffects(); - List list1 = result.getEffects(); + List list = Items.potion.getEffects(j); + List list1 = Items.potion.getEffects(k); - if ((potion.getPotionData() <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && potion != result) + if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) { flag = true; break; @@ -181,22 +182,23 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka for (int i = 0; i < 3; ++i) { - if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion) + if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potion) { - ItemPotion result = this.getPotionResult(potion, itemstack); - List list = potion.getEffects(); - List list1 = result.getEffects(); + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); + List list = Items.potion.getEffects(j); + List list1 = Items.potion.getEffects(k); - if (potion.getPotionData() > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null)) + if (j > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null)) { - if (!potion.isSplashPotion() && result.isSplashPotion()) + if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) { - this.brewingItemStacks[i] = new ItemStack(result); + this.brewingItemStacks[i].setItemDamage(k); } } - else if (potion != result) + else if (j != k) { - this.brewingItemStacks[i] = new ItemStack(result); + this.brewingItemStacks[i].setItemDamage(k); } } } @@ -217,9 +219,12 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka } } - private ItemPotion getPotionResult(ItemPotion potion, ItemStack stack) + /** + * The result of brewing a potion of the specified damage value with an ingredient itemstack. + */ + private int getPotionResult(int meta, ItemStack stack) { - return stack == null ? potion : (stack.getItem().isPotionIngredient(stack) ? ItemPotion.getPotionItem(PotionHelper.applyIngredient(potion.getPotionData(), stack.getItem().getPotionEffect(stack))) : potion); + return stack == null ? meta : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta); } 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 cd25eea3..519647cb 100755 --- a/common/src/main/java/common/tileentity/TileEntityFurnace.java +++ b/common/src/main/java/common/tileentity/TileEntityFurnace.java @@ -398,11 +398,10 @@ 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 b866b247..5da8f318 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.size > stack1.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(stack1, stack2)); + return stack1.getItem() != stack2.getItem() ? false : (stack1.getMetadata() != stack2.getMetadata() ? 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 4daca142..2fc26058 100644 --- a/common/src/main/java/common/util/Util.java +++ b/common/src/main/java/common/util/Util.java @@ -33,8 +33,6 @@ 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) { @@ -534,8 +532,4 @@ 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 e21b785c..76772ffd 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.Property; +import common.properties.IProperty; 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 { - Property prop = entry.getKey(); + IProperty 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(Property property) { - Collection values = property.getStates(); + public > State cycleProperty(IProperty property) { + Collection values = property.getAllowedValues(); 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(Property property) { + public > T getValue(IProperty 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.getType().cast(this.properties.get(property))); + return (T)((Comparable)property.getValueClass().cast(this.properties.get(property))); } } - public , V extends T> State withProperty(Property property, V value) { + public , V extends T> State withProperty(IProperty 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.getStates().contains(value)) { + else if(!property.getAllowedValues().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(Property prop : this.properties.keySet()) { - for(Comparable value : prop.getStates()) { + Table table = new StandardTable(); + for(IProperty prop : this.properties.keySet()) { + for(Comparable value : prop.getAllowedValues()) { 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 653d486e..04383c2d 100644 --- a/server/src/main/java/server/biome/BiomeBlackened.java +++ b/server/src/main/java/server/biome/BiomeBlackened.java @@ -4,7 +4,6 @@ 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; @@ -12,7 +11,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(), WoodType.BLACKWOOD); + protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), Blocks.blackwood_leaves.getState()); 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 af373827..23709f92 100755 --- a/server/src/main/java/server/biome/BiomeForest.java +++ b/server/src/main/java/server/biome/BiomeForest.java @@ -8,7 +8,6 @@ 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; @@ -22,8 +21,8 @@ import server.worldgen.tree.WorldGenTree; public class BiomeForest extends GenBiome { - private static final BlockDoublePlant[] FLOWER_TYPES = new BlockDoublePlant[] { - Blocks.syringa, Blocks.rose_bush, Blocks.paeonia + private static final BlockDoublePlant.EnumPlantType[] FLOWER_TYPES = new BlockDoublePlant.EnumPlantType[] { + BlockDoublePlant.EnumPlantType.SYRINGA, BlockDoublePlant.EnumPlantType.ROSE, BlockDoublePlant.EnumPlantType.PAEONIA }; protected static final WorldGenBirch tallBirch = new WorldGenBirch(false, true); protected static final WorldGenBirch normalBirch = new WorldGenBirch(false, false); @@ -36,13 +35,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), - WoodType.CHERRY); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBaseTree maple = new WorldGenBaseTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE), - WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBigTree cherryBig = new WorldGenBigTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY), - WoodType.CHERRY); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBigTree mapleBig = new WorldGenBigTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE), - WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + Blocks.maple_leaves.getState()); // .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 8ee66a47..34faff3d 100755 --- a/server/src/main/java/server/biome/BiomeJungle.java +++ b/server/src/main/java/server/biome/BiomeJungle.java @@ -5,7 +5,6 @@ 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; @@ -22,8 +21,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 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 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 final boolean edge; @@ -62,7 +61,7 @@ public class BiomeJungle extends GenBiome */ public FeatureGenerator getRandomWorldGenForGrass(Random rand) { - return rand.chance(4) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass); + return rand.chance(4) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); } 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 bb6426ed..19251d30 100755 --- a/server/src/main/java/server/biome/BiomeMesa.java +++ b/server/src/main/java/server/biome/BiomeMesa.java @@ -4,8 +4,9 @@ import java.util.Arrays; import common.biome.Biome; import common.block.Block; -import common.block.artificial.BlockWool; -import common.block.natural.BlockColoredClay; +import common.block.BlockColored; +import common.block.natural.BlockDirt; +import common.block.natural.BlockSand; import common.color.DyeColor; import common.init.Blocks; import common.rng.PerlinGen; @@ -36,8 +37,8 @@ public class BiomeMesa extends GenBiome // this.setDisableRain(); // this.setTemperatureLegacy(2.0F).setHumidity(0.0F); // this.mobs.clear(); - this.topBlock = Blocks.red_sand.getState(); - this.fillerBlock = Blocks.white_clay.getState(); + this.topBlock = Blocks.sand.getState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND); + this.fillerBlock = Blocks.stained_hardened_clay.getState(); this.treesPerChunk = -999; this.deadBushPerChunk = 20; this.reedsPerChunk = 3; @@ -106,7 +107,7 @@ public class BiomeMesa extends GenBiome int j1 = x & 15; int k1 = z & 15; int l1 = worldIn.getSeaLevel(); - State iblockstate = Blocks.white_clay.getState(); + State iblockstate = Blocks.stained_hardened_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; @@ -150,7 +151,7 @@ public class BiomeMesa extends GenBiome } else if (i1 >= l1 - 4 && i1 <= l1 + 1) { - iblockstate = Blocks.white_clay.getState(); + iblockstate = Blocks.stained_hardened_clay.getState(); iblockstate3 = this.fillerBlock; } @@ -165,16 +166,16 @@ public class BiomeMesa extends GenBiome { chunkPrimerIn.set(k1, i1, j1, iblockstate3); - if (iblockstate3.getBlock() instanceof BlockColoredClay) + if (iblockstate3.getBlock() == Blocks.stained_hardened_clay) { - chunkPrimerIn.set(k1, i1, j1, Blocks.orange_clay.getState()); + chunkPrimerIn.set(k1, i1, j1, iblockstate3.getBlock().getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE)); } } else if (this.soil && i1 > 86 + k * 2) { if (flag) { - chunkPrimerIn.set(k1, i1, j1, Blocks.coarse_dirt.getState()); + chunkPrimerIn.set(k1, i1, j1, Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT)); } else { @@ -203,7 +204,7 @@ public class BiomeMesa extends GenBiome } else { - iblockstate4 = Blocks.orange_clay.getState(); + iblockstate4 = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE); } chunkPrimerIn.set(k1, i1, j1, iblockstate4); @@ -215,7 +216,7 @@ public class BiomeMesa extends GenBiome if (flag1) { - chunkPrimerIn.set(k1, i1, j1, Blocks.orange_clay.getState()); + chunkPrimerIn.set(k1, i1, j1, Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE)); } else { @@ -241,7 +242,7 @@ public class BiomeMesa extends GenBiome if (l1 < 64) { - this.layers[l1] = Blocks.orange_clay.getState(); + this.layers[l1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE); } } @@ -254,7 +255,7 @@ public class BiomeMesa extends GenBiome for (int l = 0; k + l < 64 && l < j; ++l) { - this.layers[k + l] = Blocks.yellow_clay.getState(); + this.layers[k + l] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.YELLOW); } } @@ -267,7 +268,7 @@ public class BiomeMesa extends GenBiome for (int i1 = 0; l3 + i1 < 64 && i1 < i3; ++i1) { - this.layers[l3 + i1] = Blocks.brown_clay.getState(); + this.layers[l3 + i1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.BROWN); } } @@ -280,7 +281,7 @@ public class BiomeMesa extends GenBiome for (int j1 = 0; k4 + j1 < 64 && j1 < i4; ++j1) { - this.layers[k4 + j1] = Blocks.red_clay.getState(); + this.layers[k4 + j1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.RED); } } @@ -294,16 +295,16 @@ public class BiomeMesa extends GenBiome for (int k1 = 0; j4 + k1 < 64 && k1 < i5; ++k1) { - this.layers[j4 + k1] = Blocks.white_clay.getState(); + this.layers[j4 + k1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.WHITE); if (j4 + k1 > 1 && random.chance()) { - this.layers[j4 + k1 - 1] = Blocks.silver_clay.getState(); + this.layers[j4 + k1 - 1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.SILVER); } if (j4 + k1 < 63 && random.chance()) { - this.layers[j4 + k1 + 1] = Blocks.silver_clay.getState(); + this.layers[j4 + k1 + 1] = Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.SILVER); } } } diff --git a/server/src/main/java/server/biome/BiomePlains.java b/server/src/main/java/server/biome/BiomePlains.java index 8b4c1c70..15a969aa 100755 --- a/server/src/main/java/server/biome/BiomePlains.java +++ b/server/src/main/java/server/biome/BiomePlains.java @@ -4,7 +4,6 @@ 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; @@ -82,7 +81,7 @@ public class BiomePlains extends GenBiome { this.flowersPerChunk = 4; this.grassPerChunk = 10; - DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass); + DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); for (int i = 0; i < 7; ++i) { @@ -96,7 +95,7 @@ public class BiomePlains extends GenBiome // int n = rand.range(0, 2); if (rand.chance()) { - DOUBLE_PLANT_GEN.setPlantType(Blocks.sunflower); + DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.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 c54f905e..f2124ae1 100755 --- a/server/src/main/java/server/biome/BiomeSavanna.java +++ b/server/src/main/java/server/biome/BiomeSavanna.java @@ -2,6 +2,7 @@ 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; @@ -39,7 +40,7 @@ public class BiomeSavanna extends GenBiome public void decorate(WorldServer worldIn, Random rand, BlockPos pos) { - DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass); + DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); for (int i = 0; i < 7; ++i) { @@ -74,7 +75,7 @@ public class BiomeSavanna extends GenBiome } else if (noiseVal > -0.5D) { - this.topBlock = Blocks.coarse_dirt.getState(); + this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT); } 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 75c8f3bb..b83c9de8 100755 --- a/server/src/main/java/server/biome/BiomeSpace.java +++ b/server/src/main/java/server/biome/BiomeSpace.java @@ -1,6 +1,7 @@ package server.biome; import common.biome.Biome; +import common.block.natural.BlockDirt; import common.init.Blocks; import common.rng.Random; import common.rng.WeightedList; @@ -14,7 +15,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.coarse_dirt.getState()); + Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT)); public BiomeSpace() { diff --git a/server/src/main/java/server/biome/BiomeSwamp.java b/server/src/main/java/server/biome/BiomeSwamp.java index 157ec583..9c3854d8 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(BlockLilyPad.FACING, Facing.randHorizontal(rand))); + chunkPrimerIn.set(j, k + 1, i, Blocks.waterlily.getState().withProperty(BlockDirectional.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 6d138fbb..97812ff5 100755 --- a/server/src/main/java/server/biome/BiomeTaiga.java +++ b/server/src/main/java/server/biome/BiomeTaiga.java @@ -3,6 +3,7 @@ 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; @@ -56,7 +57,7 @@ public class BiomeTaiga extends GenBiome */ public FeatureGenerator getRandomWorldGenForGrass(Random rand) { - return rand.rarity(5) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass); + return rand.rarity(5) ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); } public void decorate(WorldServer worldIn, Random rand, BlockPos pos) @@ -74,7 +75,7 @@ public class BiomeTaiga extends GenBiome } } - DOUBLE_PLANT_GEN.setPlantType(Blocks.large_fern); + DOUBLE_PLANT_GEN.setPlantType(BlockDoublePlant.EnumPlantType.FERN); for (int i1 = 0; i1 < 7; ++i1) { @@ -96,11 +97,11 @@ public class BiomeTaiga extends GenBiome if (noiseVal > 1.75D) { - this.topBlock = Blocks.coarse_dirt.getState(); + this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT); } else if (noiseVal > -0.95D) { - this.topBlock = Blocks.podzol.getState(); + this.topBlock = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL); } } diff --git a/server/src/main/java/server/biome/BiomeTian.java b/server/src/main/java/server/biome/BiomeTian.java index 0bd9f78e..021a9728 100755 --- a/server/src/main/java/server/biome/BiomeTian.java +++ b/server/src/main/java/server/biome/BiomeTian.java @@ -7,7 +7,6 @@ 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; @@ -23,12 +22,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(), WoodType.TIAN) + protected WorldGenTree treeGen1 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) .setHeightLimit(6, 8); - protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) + protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) .setHeightLimit(14, 20); - protected WorldGenTree treeGen3 = new WorldGenBaseTree(false, Blocks.tian_log.getState(), WoodType.TIAN); - protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) + 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()) .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 b940ae0f..cc3c27d4 100755 --- a/server/src/main/java/server/biome/GenBiome.java +++ b/server/src/main/java/server/biome/GenBiome.java @@ -3,11 +3,12 @@ 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; @@ -132,7 +133,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.dandelion); + private final WorldGenFlowers yellowFlowerGen = new WorldGenFlowers(Blocks.flower, BlockFlower.EnumFlowerType.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(); @@ -258,7 +259,7 @@ public abstract class GenBiome implements IBiome { public FeatureGenerator getRandomWorldGenForGrass(Random rand) { - return new WorldGenTallGrass(Blocks.tallgrass); + return new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); } public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) @@ -365,8 +366,9 @@ 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.getByType(blockflower$enumflowertype)); + this.yellowFlowerGen.setGeneratedBlock(blockflower, blockflower$enumflowertype); this.yellowFlowerGen.generate(world, rand, blockpos1); } } @@ -618,12 +620,7 @@ public abstract class GenBiome implements IBiome { if (j == 0 && iblockstate1.getBlock() == Blocks.sand) { j = rand.zrange(4) + Math.max(0, j1 - 63); - 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! + iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.ORANGE) : Blocks.sandstone.getState(); //TODO: check! } } } @@ -671,7 +668,8 @@ 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()); - WoodType leaves = type == WoodType.CHERRY || type == WoodType.MAPLE ? type : WoodType.OAK; + State leaves = type == WoodType.CHERRY ? Blocks.cherry_leaves.getState() : + (type == WoodType.MAPLE ? Blocks.maple_leaves.getState() : Blocks.oak_leaves.getState()); FeatureGenerator worldgenerator = (FeatureGenerator)(rand.chance(10) ? new WorldGenBigTree(true, log, leaves) : new WorldGenBaseTree(true, log, leaves)); int i = 0; int j = 0; @@ -709,13 +707,13 @@ public abstract class GenBiome implements IBiome { break; case TIAN: - worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), WoodType.TIAN) + worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) .setHeightLimit(6, 20); break; case JUNGLE: State iblockstate = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - WoodType iblockstate1 = WoodType.JUNGLE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + State iblockstate1 = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); label269: for (i = 0; i >= -1; --i) @@ -817,8 +815,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.getByType(blockflower$enumflowertype); - State iblockstate = blockflower.getState(); + BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock(); + State iblockstate = blockflower.getState().withProperty(blockflower.getTypeProperty(), blockflower$enumflowertype); if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate)) { @@ -827,7 +825,7 @@ public abstract class GenBiome implements IBiome { } else { - State iblockstate1 = Blocks.tallgrass.getState(); + State iblockstate1 = Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS); 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 f2d2e356..3040b082 100755 --- a/server/src/main/java/server/clipboard/ReorderRegistry.java +++ b/server/src/main/java/server/clipboard/ReorderRegistry.java @@ -7,11 +7,7 @@ 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; @@ -53,9 +49,7 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.tallgrass); PLACE_LAST.add(Blocks.deadbush); PLACE_LAST.add(Blocks.piston_head); - for(BlockFlower block : BlockFlower.FLOWERS) { - PLACE_LAST.add(block); - } + PLACE_LAST.add(Blocks.flower); PLACE_LAST.add(Blocks.brown_mushroom); PLACE_LAST.add(Blocks.red_mushroom_block); PLACE_LAST.add(Blocks.torch); @@ -87,9 +81,7 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.cocoa); PLACE_LAST.add(Blocks.tripwire_hook); PLACE_LAST.add(Blocks.string); - for(BlockFlowerPot block : BlockFlowerPot.POTS) { - PLACE_LAST.add(block); - } + PLACE_LAST.add(Blocks.flower_pot); PLACE_LAST.add(Blocks.carrot); PLACE_LAST.add(Blocks.potato); PLACE_LAST.add(Blocks.wooden_button); @@ -100,12 +92,8 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.powered_comparator); PLACE_LAST.add(Blocks.activator_rail); PLACE_LAST.add(Blocks.iron_trapdoor); - for(BlockCarpet block : BlockCarpet.CARPETS) { - PLACE_LAST.add(block); - } - for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { - PLACE_LAST.add(block); - } + PLACE_LAST.add(Blocks.carpet); + PLACE_LAST.add(Blocks.double_plant); PLACE_LAST.add(Blocks.daylight_detector_inverted); // shouldPlaceLast.add(Blocks.daylight_detector); PLACE_LAST.add(Blocks.blue_mushroom); @@ -150,9 +138,7 @@ 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); } - for(BlockFlower block : BlockFlower.FLOWERS) { - addAttach(block, Facing.DOWN); - } + addAttach(Blocks.flower, 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 }) { @@ -209,9 +195,7 @@ public abstract class ReorderRegistry { addCardinals(Blocks.tripwire_hook, offset + 2, offset + 3, offset + 0, offset + 1); } addAttach(Blocks.string, Facing.DOWN); - for(BlockFlowerPot block : BlockFlowerPot.POTS) { - addAttach(block, Facing.DOWN); - } + addAttach(Blocks.flower_pot, Facing.DOWN); addAttach(Blocks.carrot, Facing.DOWN); addAttach(Blocks.potato, Facing.DOWN); addAttach(Blocks.anvil, Facing.DOWN); @@ -219,12 +203,8 @@ public abstract class ReorderRegistry { addAttach(Blocks.heavy_weighted_pressure_plate, Facing.DOWN); addAttach(Blocks.comparator, Facing.DOWN); addAttach(Blocks.powered_comparator, Facing.DOWN); - for(BlockCarpet block : BlockCarpet.CARPETS) { - addAttach(block, Facing.DOWN); - } - for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { - addAttach(block, Facing.DOWN); - } + addAttach(Blocks.carpet, Facing.DOWN); + addAttach(Blocks.double_plant, 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 693b16d0..6716e849 100755 --- a/server/src/main/java/server/clipboard/RotationRegistry.java +++ b/server/src/main/java/server/clipboard/RotationRegistry.java @@ -9,6 +9,7 @@ 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; @@ -17,7 +18,8 @@ import common.block.tech.BlockRailDetector; import common.block.tech.BlockRailPowered; import common.collect.Lists; import common.collect.Maps; -import common.properties.Property; +import common.properties.IProperty; +import common.properties.PropertyDirection; import common.util.Facing; import common.util.Vec3i; import common.world.State; @@ -27,7 +29,7 @@ public abstract class RotationRegistry { public static void register() { for(Block block : common.init.BlockRegistry.REGISTRY) { - for(Property prop : block.getPropertyMap()) { + for(IProperty prop : block.getPropertyMap()) { Predicate predicate = null; if(prop == BlockDoor.FACING) { predicate = new Predicate() { @@ -47,7 +49,7 @@ public abstract class RotationRegistry { } byte mask = 0; - for(Object v : prop.getStates()) { + for(Object v : prop.getAllowedValues()) { if(map.get(v) == null) { continue; } @@ -56,14 +58,14 @@ public abstract class RotationRegistry { if(mask == 0) { continue; } - for(Object v : prop.getStates()) { + for(Object v : prop.getAllowedValues()) { if(map.get(v) == null) { continue; } Vec3i dv = null; Facing.Axis axis = null; - if(v instanceof Facing face) { - dv = face.getDirectionVec(); + if(prop instanceof PropertyDirection) { + dv = ((Facing)v).getDirectionVec(); } else if(prop == BlockRotatedPillar.AXIS) { axis = ((Facing.Axis)v); @@ -74,6 +76,9 @@ 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 8b9a84a3..52995821 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); + ItemStack stack = new ItemStack(Items.skull, 1, 0); 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.getItemDamage(); + int j = stack.getMetadata(); ItemStack itemstack = stack.useItemRightClick(this.entity.worldObj, this.entity); - if (itemstack != stack || itemstack != null && (itemstack.size != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getItemDamage() != j)) + if (itemstack != stack || itemstack != null && (itemstack.size != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getMetadata() != 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.size <= itemstack.getMaxStackSize() && itemstack.size > 0; // TODO: max + boolean validData = itemstack.getMetadata() >= 0 && 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 37eb8fc5..8e2efbff 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -19,14 +19,15 @@ 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; @@ -34,7 +35,10 @@ 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; @@ -346,7 +350,6 @@ 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); @@ -480,7 +483,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(BlockWool.COLOR, DyeColor.byMetadata(data)); + return Blocks.wool.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); } }, 35); mapBlock(Blocks.stone, 36); // mapBlockData(Blocks.piston_extension, 36); @@ -735,7 +738,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(BlockWool.COLOR, DyeColor.byMetadata(data)); + return Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); } }, 159); mapBlock(new BlockFunction() { @@ -840,23 +843,22 @@ public abstract class Converter { mapBlock(Blocks.glass, 217); mapBlockData(Blocks.dropper, 218); for(int id = 219; id <= 234; id++) { - mapBlock(Blocks.wool.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(id - 219)), id); + mapBlock(Blocks.wool.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(id - 219)), id); } for(int id = 235; id <= 250; id++) { - mapBlock(Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(id - 235)), id); + mapBlock(Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(id - 235)), id); } mapBlock(new BlockFunction() { public State getState(int id, int data) { - return Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(data)); + return Blocks.stained_hardened_clay.getState().withProperty(BlockColored.COLOR, DyeColor.byMetadata(data)); } }, 251); mapBlock(new BlockFunction() { public State getState(int id, int data) { - return Blocks.stained_hardened_clay.getState().withProperty(BlockWool.COLOR, DyeColor.byMetadata(data)); + return Blocks.stained_hardened_clay.getState().withProperty(BlockColored.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 6f33ace8..3a005257 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.Property; +import common.properties.IProperty; 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(Property prop : map.keySet()) { + Map smap = sub.getProperties(); + for(IProperty 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,11 +74,6 @@ 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(); @@ -86,7 +81,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); @@ -107,7 +102,7 @@ public class Region { } mapping.put(id, bid); taken.add(bid); - removed.remove(id); + tag.remove(id); Log.IO.debug("Bestehende Block-ID %d = %s", (int)bid, id); } else { @@ -134,11 +129,11 @@ public class Region { ENCODE_MAP[id] = bid; } } - for(String id : removed) { - tag.remove(id); - Log.IO.debug("Entfernte Block-ID %d = %s", (int)tag.getChar(id), id); + for(String id : tag.keySet()) { + if(tag.hasChar(id)) + Log.IO.debug("Entfernte Block-ID %d = %s", (int)tag.getChar(id), id); } - return !missing.isEmpty() || !removed.isEmpty(); + return !missing.isEmpty() || !tag.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 4d392b22..a26738fd 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, 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)); + 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)); } diff --git a/server/src/main/java/server/worldgen/caves/MapGenCaves.java b/server/src/main/java/server/worldgen/caves/MapGenCaves.java index e8684b27..c3c67d49 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.artificial.BlockWool; -import common.block.natural.BlockColoredClay; +import common.block.BlockColored; +import common.block.natural.BlockSand; import common.color.DyeColor; import common.init.Blocks; import common.rng.Random; @@ -212,11 +212,7 @@ public class MapGenCaves extends MapGenBase if (iblockstate2.getBlock() == Blocks.sand) { - 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! + 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! } if (flag1 && p_180702_5_.get(j3, j2 - 1, i2).getBlock() == this.top) @@ -244,7 +240,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() 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()))))))); // ); + 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()))))))); // ); } /** diff --git a/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java b/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java index 9f8b9e41..90b06369 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java @@ -1,6 +1,7 @@ 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; @@ -23,7 +24,7 @@ public class WorldGenDesertWells extends FeatureGenerator } State state = worldIn.getState(position); - if (state.getBlock() != Blocks.sand) + if (state.getBlock() != Blocks.sand || state.getValue(BlockSand.VARIANT) != BlockSand.EnumType.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 5c3243e4..548e5845 100755 --- a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java +++ b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java @@ -1,15 +1,16 @@ 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 type; + private BlockDoublePlant.EnumPlantType type; - public void setPlantType(BlockDoublePlant type) + public void setPlantType(BlockDoublePlant.EnumPlantType type) { this.type = type; } @@ -22,9 +23,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) && this.type.canPlaceBlockAt(worldIn, blockpos)) + if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 254) && Blocks.double_plant.canPlaceBlockAt(worldIn, blockpos)) { - this.type.placeAt(worldIn, blockpos, 2); + Blocks.double_plant.placeAt(worldIn, blockpos, this.type, 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 d3990ecd..4bc978c3 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 state; + private State field_175915_b; - public WorldGenFlowers(BlockFlower block) + public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_) { - this.setGeneratedBlock(block); + this.setGeneratedBlock(p_i45632_1_, p_i45632_2_); } - public void setGeneratedBlock(BlockFlower block) + public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_) { - this.flower = block; - this.state = block.getState(); + this.flower = p_175914_1_; + this.field_175915_b = p_175914_1_.getState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_); } 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.state)) + if (worldIn.isAirBlock(blockpos) && (!worldIn.dimension.hasNoLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b)) { - worldIn.setState(blockpos, this.state, 2); + worldIn.setState(blockpos, this.field_175915_b, 2); } } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java index 5d1566a2..65d93768 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java @@ -4,7 +4,6 @@ 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,14 +12,14 @@ import server.worldgen.tree.WorldGenBaseTree; public class WorldGenShrub extends WorldGenBaseTree { - private final WoodType leavesMetadata; + private final State leavesMetadata; private final State woodMetadata; - public WorldGenShrub(State log, WoodType leaves) + public WorldGenShrub(State log, State leaves) { super(false); this.woodMetadata = log; - this.leavesMetadata = leaves; + this.leavesMetadata = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); } public boolean generate(WorldServer worldIn, Random rand, BlockPos position) @@ -58,7 +57,7 @@ public class WorldGenShrub extends WorldGenBaseTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java b/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java index e0257bd3..81a1d757 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java @@ -12,13 +12,11 @@ import server.worldgen.FeatureGenerator; public class WorldGenTallGrass extends FeatureGenerator { - private final BlockTallGrass tallGrass; private final State tallGrassState; - public WorldGenTallGrass(BlockTallGrass block) + public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_) { - this.tallGrass = block; - this.tallGrassState = block.getState(); + this.tallGrassState = Blocks.tallgrass.getState().withProperty(BlockTallGrass.TYPE, p_i45629_1_); } public boolean generate(WorldServer worldIn, Random rand, BlockPos position) @@ -34,7 +32,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) && this.tallGrass.canBlockStay(worldIn, blockpos, this.tallGrassState)) + if (worldIn.isAirBlock(blockpos) && Blocks.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 9cb72a80..c5a78585 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.foliage.BlockLilyPad; +import common.block.BlockDirectional; 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(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2); + worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockDirectional.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 ab5ab6c8..bbc96a98 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.Rotatable; +import common.block.BlockDirectional; 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 Rotatable)) + else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof BlockDirectional)) { 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 c6a1fc03..5d2705a2 100755 --- a/server/src/main/java/server/worldgen/structure/StructureScattered.java +++ b/server/src/main/java/server/worldgen/structure/StructureScattered.java @@ -1,6 +1,7 @@ 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; @@ -81,6 +82,8 @@ 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); @@ -95,29 +98,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.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.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.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.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, 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, 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.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.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.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); @@ -145,105 +148,105 @@ public class StructureScattered for (int k1 = 5; k1 <= 17; k1 += 2) { - 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.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.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); + 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); for (int j3 = 0; j3 <= this.scatteredFeatureSizeX - 1; j3 += this.scatteredFeatureSizeX - 1) { - 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); + 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); } for (int k3 = 2; k3 <= this.scatteredFeatureSizeX - 3; k3 += this.scatteredFeatureSizeX - 3 - 2) { - 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.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.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 4, 0, 12, 6, 0, Blocks.smooth_sandstone.getState(), Blocks.smooth_sandstone.getState(), false); + 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.setBlockState(worldIn, Blocks.air.getState(), 8, 6, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 12, 6, 0, structureBoundingBoxIn); - 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.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.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.carved_sandstone.getState(), 7, -10, 10, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 7, -11, 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.air.getState(), 12, -11, 10, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 12, -10, 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.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.air.getState(), 10, -11, 8, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 10, -10, 8, 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.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.air.getState(), 10, -11, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.air.getState(), 10, -10, 12, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.carved_sandstone.getState(), 10, -10, 13, structureBoundingBoxIn); - this.setBlockState(worldIn, Blocks.smooth_sandstone.getState(), 10, -11, 13, 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); for (Facing enumfacing : Facing.Plane.HORIZONTAL) { @@ -551,9 +554,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.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.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.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); @@ -646,7 +649,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.flowerpot_black_lotus.getState(), 1, 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.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 49d68447..b96c6c4b 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStronghold.java +++ b/server/src/main/java/server/worldgen/structure/StructureStronghold.java @@ -4,6 +4,7 @@ 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; @@ -1348,11 +1349,11 @@ public class StructureStronghold if (f < 0.2F) { - this.blockstate = Blocks.cracked_stonebrick.getState(); + this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CRACKED_META); } else if (f < 0.5F) { - this.blockstate = Blocks.mossy_stonebrick.getState(); + this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.MOSSY_META); } // 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 0c7f121b..d88fb768 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.white_wool.getState(), 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(DyeColor.WHITE.getDyeDamage()), 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.getState(); + return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.DEFAULT.getMetadata()); } if (p_175847_1_.getBlock() == Blocks.oak_planks) { - return Blocks.smooth_sandstone.getState(); + return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()); } 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 cd5cf3ba..58583165 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java @@ -6,7 +6,6 @@ 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; @@ -17,29 +16,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 WoodType defLeaves = WoodType.OAK; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); + private static final State defLeaves = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); private final int minTreeHeight; private final boolean vinesGrow; private final State metaWood; - private final WoodType metaLeaves; + private final State metaLeaves; public WorldGenBaseTree(boolean notify) { this(notify, 4, defLog, defLeaves, false); } - public WorldGenBaseTree(boolean notify, State log, WoodType leaves) + public WorldGenBaseTree(boolean notify, State log, State leaves) { this(notify, 4, log, leaves, false); } - public WorldGenBaseTree(boolean notify, int minHeight, State log, WoodType leaves, boolean vines) + public WorldGenBaseTree(boolean notify, int minHeight, State log, State leaves, boolean vines) { super(notify); this.minTreeHeight = minHeight; this.metaWood = log; - this.metaLeaves = leaves; + this.metaLeaves = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); this.vinesGrow = vines; } @@ -119,7 +118,7 @@ public class WorldGenBaseTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.metaLeaves, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java index 712dcb0a..4daf686b 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java @@ -8,7 +8,6 @@ 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; @@ -17,7 +16,7 @@ import server.world.WorldServer; public class WorldGenBigTree extends WorldGenTree { - private final WoodType leavesBase; + private final State leavesBase; private final State logBase; private Random rand; @@ -35,7 +34,7 @@ public class WorldGenBigTree extends WorldGenTree private int leafDistanceLimit = 4; List field_175948_j; - public WorldGenBigTree(boolean notify, State logBase, WoodType leavesBase) + public WorldGenBigTree(boolean notify, State logBase, State leavesBase) { super(notify); this.leavesBase = leavesBase; @@ -44,7 +43,7 @@ public class WorldGenBigTree extends WorldGenTree public WorldGenBigTree(boolean notify) { - this(notify, Blocks.oak_log.getState(), WoodType.OAK); + this(notify, Blocks.oak_log.getState(), Blocks.oak_leaves.getState()); } public WorldGenBigTree setHeightLimit(int lower, int limit) { @@ -177,7 +176,8 @@ public class WorldGenBigTree extends WorldGenTree { for (int i = 0; i < this.leafDistanceLimit; ++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))); + 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)))); } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java index 54378827..58bdda10 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java @@ -4,7 +4,6 @@ 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,8 +12,9 @@ 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 WoodType leavesBlock = WoodType.BIRCH; -// .withProperty(BlockOldLeaf.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 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, BlockLeaves.getLeavesBlock(leavesBlock, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java index e8b95ac4..65286b20 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java @@ -4,7 +4,6 @@ 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,8 +13,9 @@ 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 WoodType leavesBlock = WoodType.DARK_OAK; -// .withProperty(BlockNewLeaf.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)); public WorldGenDarkOak(boolean notify) { @@ -212,7 +212,7 @@ public class WorldGenDarkOak extends WorldGenTree if (block == Blocks.air) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(leavesBlock, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java index 5f661fc6..05ddd76b 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java @@ -4,7 +4,6 @@ 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; @@ -19,16 +18,16 @@ public abstract class WorldGenHugeTree extends WorldGenTree protected final State woodMetadata; /** Sets the metadata for the leaves used in huge trees */ - protected final WoodType leavesMetadata; + protected final State leavesMetadata; protected int extraRandomHeight; - public WorldGenHugeTree(boolean notify, int base, int extra, State log, WoodType leaves) + public WorldGenHugeTree(boolean notify, int base, int extra, State log, State leaves) { super(notify); this.baseHeight = base; this.extraRandomHeight = extra; this.woodMetadata = log; - this.leavesMetadata = leaves; + this.leavesMetadata = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); } protected int func_150533_a(Random p_150533_1_) @@ -124,7 +123,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } @@ -146,7 +145,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java index 03e15476..ba30cdb2 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java @@ -2,7 +2,6 @@ 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; @@ -12,7 +11,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_, WoodType p_i46448_5_) + public WorldGenJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, State p_i46448_4_, State 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 c48176c7..26b98200 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,9 +13,8 @@ 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 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 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 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 757f98d4..dfd389b5 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java @@ -4,7 +4,6 @@ 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; @@ -15,8 +14,9 @@ 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 WoodType field_181644_b = WoodType.ACACIA; -// .withProperty(BlockNewLeaf.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)); 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_, BlockLeaves.getLeavesBlock(field_181644_b, worldIn.getLeavesGen(p_175924_2_)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(p_175924_2_))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java index ceaf681b..276ed3cb 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java @@ -5,7 +5,6 @@ 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; @@ -16,8 +15,9 @@ 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 WoodType field_181649_b = WoodType.OAK; -// .withProperty(BlockOldLeaf.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)); public WorldGenSwamp() { @@ -112,7 +112,7 @@ public class WorldGenSwamp extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181649_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java index efb87ba1..2ae38594 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java @@ -4,7 +4,6 @@ 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; @@ -14,8 +13,9 @@ 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 WoodType field_181637_b = WoodType.SPRUCE; -// .withProperty(BlockOldLeaf.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)); public WorldGenTaiga1() { @@ -95,7 +95,7 @@ public class WorldGenTaiga1 extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181637_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java index 78f01240..ba017a36 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java @@ -4,7 +4,6 @@ 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; @@ -14,8 +13,9 @@ 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 WoodType field_181646_b = WoodType.SPRUCE; -// .withProperty(BlockOldLeaf.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)); 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, BlockLeaves.getLeavesBlock(field_181646_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); } } }