From 7b25e6181ee39fee5ca0b40b74d3cd04d52a358f Mon Sep 17 00:00:00 2001 From: Sen Date: Sat, 21 Jun 2025 14:04:15 +0200 Subject: [PATCH] block cleanup #6 --- .../java/common/ai/EntityAITakePlace.java | 4 +- .../common/block/artificial/BlockCarpet.java | 15 +- .../block/artificial/BlockFlowerPot.java | 6 + .../block/artificial/BlockStainedGlass.java | 7 + .../artificial/BlockStainedGlassPane.java | 7 + .../common/block/artificial/BlockWool.java | 7 + .../block/foliage/BlockDoublePlant.java | 3 + .../common/block/foliage/BlockFlower.java | 2 +- .../common/block/foliage/BlockTallGrass.java | 4 + .../block/natural/BlockColoredClay.java | 7 + .../main/java/common/block/tech/BlockTNT.java | 2 + .../common/entity/animal/EntityOcelot.java | 7 +- .../common/entity/animal/EntityRabbit.java | 7 +- common/src/main/java/common/init/Blocks.java | 3 +- .../java/common/init/CraftingRegistry.java | 146 +++++++++--------- .../java/common/init/DispenserRegistry.java | 21 +-- .../common/init/FlammabilityRegistry.java | 36 ++++- .../main/java/common/init/ItemRegistry.java | 2 +- common/src/main/java/common/init/Items.java | 18 +-- .../java/common/init/SmeltingRegistry.java | 16 +- .../main/java/common/init/TradeRegistry.java | 47 +----- .../src/main/java/common/item/ItemBanner.java | 25 ++- .../main/java/common/item/ItemFishFood.java | 12 +- .../src/main/java/common/item/ItemPotion.java | 27 ++-- .../tileentity/TileEntityBrewingStand.java | 27 ++-- .../server/clipboard/ReorderRegistry.java | 17 +- .../src/main/java/server/world/Converter.java | 2 + 27 files changed, 263 insertions(+), 214 deletions(-) diff --git a/common/src/main/java/common/ai/EntityAITakePlace.java b/common/src/main/java/common/ai/EntityAITakePlace.java index d352a563..a5b138d4 100755 --- a/common/src/main/java/common/ai/EntityAITakePlace.java +++ b/common/src/main/java/common/ai/EntityAITakePlace.java @@ -31,8 +31,8 @@ public class EntityAITakePlace extends EntityAIBase } static { - for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { - addPlaceable(BlockFlower.getByType(type)); + for(BlockFlower block : BlockFlower.FLOWERS) { + addPlaceable(block); } addPlaceable(Blocks.brown_mushroom); addPlaceable(Blocks.red_mushroom); diff --git a/common/src/main/java/common/block/artificial/BlockCarpet.java b/common/src/main/java/common/block/artificial/BlockCarpet.java index 332f4b1e..a3764475 100755 --- a/common/src/main/java/common/block/artificial/BlockCarpet.java +++ b/common/src/main/java/common/block/artificial/BlockCarpet.java @@ -15,7 +15,13 @@ 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 BlockCarpet(DyeColor color) { @@ -23,7 +29,8 @@ public class BlockCarpet extends Block this.color = color; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); this.setTab(CheatTab.DECORATION); - this.setBlockBoundsFromMeta(0); + this.setBlockBoundsFromMeta(); + CARPETS[color.ordinal()] = this; } public DyeColor getColor() { @@ -48,15 +55,15 @@ public class BlockCarpet extends Block */ public void setBlockBoundsForItemRender() { - this.setBlockBoundsFromMeta(0); + this.setBlockBoundsFromMeta(); } public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { - this.setBlockBoundsFromMeta(0); + this.setBlockBoundsFromMeta(); } - protected void setBlockBoundsFromMeta(int meta) + private void setBlockBoundsFromMeta() { int i = 0; float f = (float)(1 * (1 + i)) / 16.0F; diff --git a/common/src/main/java/common/block/artificial/BlockFlowerPot.java b/common/src/main/java/common/block/artificial/BlockFlowerPot.java index 69c5de58..b614f322 100755 --- a/common/src/main/java/common/block/artificial/BlockFlowerPot.java +++ b/common/src/main/java/common/block/artificial/BlockFlowerPot.java @@ -1,8 +1,11 @@ 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; @@ -98,6 +101,8 @@ 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 BlockFlowerPot(Block content) @@ -105,6 +110,7 @@ public class BlockFlowerPot extends Block super(Material.SMALL); this.content = content; this.setBlockBoundsForItemRender(); + POTS.add(this); } /** diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlass.java b/common/src/main/java/common/block/artificial/BlockStainedGlass.java index c6b1ccd4..84121a8b 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlass.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlass.java @@ -7,10 +7,17 @@ import common.model.ModelProvider; 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 BlockStainedGlass(DyeColor color) { this.color = color; + GLASS[color.ordinal()] = this; } public DyeColor getColor() { diff --git a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java index 270ddef9..2b103321 100755 --- a/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java +++ b/common/src/main/java/common/block/artificial/BlockStainedGlassPane.java @@ -9,7 +9,13 @@ 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 BlockStainedGlassPane(DyeColor color) { @@ -17,6 +23,7 @@ public class BlockStainedGlassPane extends BlockPane this.color = color; this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); this.setTab(CheatTab.BLOCKS); + PANES[color.ordinal()] = this; } public DyeColor getColor() { diff --git a/common/src/main/java/common/block/artificial/BlockWool.java b/common/src/main/java/common/block/artificial/BlockWool.java index d9970e67..10bad55f 100755 --- a/common/src/main/java/common/block/artificial/BlockWool.java +++ b/common/src/main/java/common/block/artificial/BlockWool.java @@ -9,12 +9,19 @@ 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() { diff --git a/common/src/main/java/common/block/foliage/BlockDoublePlant.java b/common/src/main/java/common/block/foliage/BlockDoublePlant.java index ef46eefd..49d357de 100755 --- a/common/src/main/java/common/block/foliage/BlockDoublePlant.java +++ b/common/src/main/java/common/block/foliage/BlockDoublePlant.java @@ -6,6 +6,7 @@ import common.block.Block; import common.block.Rotatable; import common.block.Material; import common.block.SoundType; +import common.collect.Lists; import common.color.Colorizer; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; @@ -35,6 +36,7 @@ import common.world.AWorldServer; public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable { public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); + public static final BlockDoublePlant[] PLANTS = new BlockDoublePlant[EnumPlantType.values().length]; private final EnumPlantType type; @@ -45,6 +47,7 @@ public class BlockDoublePlant extends BlockBush implements Rotatable, IGrowable this.setDefaultState(this.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(FACING, Facing.NORTH)); this.setHardness(0.0F); this.setStepSound(SoundType.GRASS); + PLANTS[type.ordinal()] = this; } public EnumPlantType getType() { diff --git a/common/src/main/java/common/block/foliage/BlockFlower.java b/common/src/main/java/common/block/foliage/BlockFlower.java index 3836c79f..3a100841 100755 --- a/common/src/main/java/common/block/foliage/BlockFlower.java +++ b/common/src/main/java/common/block/foliage/BlockFlower.java @@ -23,7 +23,7 @@ import common.world.AWorldServer; public abstract class BlockFlower extends BlockBush { - private static final BlockFlower[] FLOWERS = new BlockFlower[EnumFlowerType.values().length]; + public static final BlockFlower[] FLOWERS = new BlockFlower[EnumFlowerType.values().length]; private final EnumFlowerType type; diff --git a/common/src/main/java/common/block/foliage/BlockTallGrass.java b/common/src/main/java/common/block/foliage/BlockTallGrass.java index 418fa747..ba787fc4 100755 --- a/common/src/main/java/common/block/foliage/BlockTallGrass.java +++ b/common/src/main/java/common/block/foliage/BlockTallGrass.java @@ -3,6 +3,7 @@ package common.block.foliage; import java.util.List; import common.block.Material; +import common.collect.Lists; import common.color.Colorizer; import common.entity.npc.EntityNPC; import common.init.Blocks; @@ -27,6 +28,8 @@ 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 BlockTallGrass(EnumType type) @@ -35,6 +38,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable this.type = type; float f = 0.4F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); + BUSHES[type.ordinal()] = this; } public EnumType getType() { diff --git a/common/src/main/java/common/block/natural/BlockColoredClay.java b/common/src/main/java/common/block/natural/BlockColoredClay.java index 7ab1a5e5..9f724109 100644 --- a/common/src/main/java/common/block/natural/BlockColoredClay.java +++ b/common/src/main/java/common/block/natural/BlockColoredClay.java @@ -9,12 +9,19 @@ 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() { diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index 6cbe58f9..8d347638 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -25,6 +25,7 @@ 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; @@ -34,6 +35,7 @@ public class BlockTNT extends Block this.power = power; this.setDefaultState(this.getBaseState().withProperty(EXPLODE, Boolean.valueOf(false))); this.setTab(CheatTab.TECHNOLOGY); + TNTS[power] = this; } public int getExplosionPower() { diff --git a/common/src/main/java/common/entity/animal/EntityOcelot.java b/common/src/main/java/common/entity/animal/EntityOcelot.java index 67483aeb..cffd3289 100755 --- a/common/src/main/java/common/entity/animal/EntityOcelot.java +++ b/common/src/main/java/common/entity/animal/EntityOcelot.java @@ -23,6 +23,7 @@ import common.entity.types.EntityTameable; import common.init.Items; import common.init.SoundEvent; import common.item.Item; +import common.item.ItemFishFood; import common.item.ItemStack; import common.pathfinding.PathNavigateGround; import common.tags.TagObject; @@ -46,7 +47,7 @@ public class EntityOcelot extends EntityTameable ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); - this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.fish, true)); + this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, stack -> stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(), true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F)); this.tasks.addTask(6, new EntityAIOcelotSit(this, 0.8D)); this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.3F)); @@ -222,7 +223,7 @@ public class EntityOcelot extends EntityTameable this.aiSit.setSitting(!this.isSitting()); } } - else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D) + else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() instanceof ItemFishFood fish && !fish.isCooked() && player.getDistanceSqToEntity(this) < 9.0D) { // if (!player.creative) // { @@ -278,7 +279,7 @@ public class EntityOcelot extends EntityTameable */ public boolean isBreedingItem(ItemStack stack) { - return stack != null && stack.getItem() == Items.fish; + return stack != null && stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(); } /** diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index 0c97ead1..0ee95740 100755 --- a/common/src/main/java/common/entity/animal/EntityRabbit.java +++ b/common/src/main/java/common/entity/animal/EntityRabbit.java @@ -63,12 +63,7 @@ public class EntityRabbit extends EntityAnimal { this.navigator.setHeightRequirement(2.5F); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityRabbit.AIPanic(this, 1.33D)); - this.tasks.addTask(2, new EntityAITempt(this, 1.0D, new Predicate() { - public boolean test(ItemStack stack) { - Item item = stack.getItem(); - return item == Items.carrot || item == Items.golden_carrot || item.getBlock() instanceof BlockFlower; - } - }, false)); + this.tasks.addTask(2, new EntityAITempt(this, 1.0D, stack -> stack.getItem() == Items.carrot || stack.getItem() == Items.golden_carrot || stack.getItem().getBlock() instanceof BlockFlower, false)); this.tasks.addTask(3, new EntityAIMate(this, 0.8D) { protected int getMatingCooldown() { return EntityRabbit.this.rand.excl(50, 200); diff --git a/common/src/main/java/common/init/Blocks.java b/common/src/main/java/common/init/Blocks.java index 838a6771..0ad61715 100755 --- a/common/src/main/java/common/init/Blocks.java +++ b/common/src/main/java/common/init/Blocks.java @@ -163,8 +163,7 @@ public abstract class Blocks { public static final Block floor_tiles_black = get("floor_tiles_black"); public static final Block floor_tiles_red = get("floor_tiles_red"); public static final Block floor_tiles_white = get("floor_tiles_white"); - public static final BlockBaseFlower flower = get("flower"); - public static final BlockFlowerPot flower_pot = get("flower_pot"); + public static final BlockFlowerPot flowerpot = get("flowerpot"); public static final BlockDynamicLiquid flowing_acid = get("flowing_acid"); public static final BlockDynamicLiquid flowing_blood = get("flowing_blood"); public static final BlockDynamicLiquid flowing_goo = get("flowing_goo"); diff --git a/common/src/main/java/common/init/CraftingRegistry.java b/common/src/main/java/common/init/CraftingRegistry.java index f75a1dc5..c51ed102 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -8,11 +8,16 @@ 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; @@ -23,6 +28,7 @@ import common.entity.animal.EntitySheep; import common.inventory.InventoryCrafting; import common.item.Item; import common.item.ItemArmor; +import common.item.ItemBanner; import common.item.ItemDye; import common.item.ItemStack; import common.tags.TagObject; @@ -42,7 +48,7 @@ public abstract class CraftingRegistry {Blocks.emerald_block, new ItemStack(Items.emerald, 9)}, {Blocks.lapis_block, new ItemStack(Items.lapis_lazuli, 9)}, {Blocks.redstone_block, new ItemStack(Items.redstone, 9)}, - {Blocks.coal_block, new ItemStack(Items.coal, 9, 0)}, + {Blocks.coal_block, new ItemStack(Items.coal, 9)}, {Blocks.hay_block, new ItemStack(Items.wheats, 9)}, {Blocks.slime_block, new ItemStack(Items.slime_ball, 9)} }; @@ -143,7 +149,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.gold_nugget, 9), "#", '#', Items.gold_ingot); addShapeless(new ItemStack(Items.mushroom_stew), Blocks.brown_mushroom, Blocks.red_mushroom, Items.bowl); - add(new ItemStack(Items.cookie, 8), "#X#", 'X', new ItemStack(Items.dye, 1, DyeColor.BROWN.getDyeDamage()), '#', Items.wheats); + add(new ItemStack(Items.cookie, 8), "#X#", 'X', Items.cocoa, '#', Items.wheats); add(new ItemStack(Blocks.melon_block), "MMM", "MMM", "MMM", 'M', Items.melon); add(new ItemStack(Items.melon_stem), "M", 'M', Items.melon); add(new ItemStack(Items.pumpkin_stem, 4), "M", 'M', Blocks.pumpkin); @@ -155,70 +161,72 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.trapped_chest), "#-", '#', Blocks.chest, '-', Blocks.tripwire_hook); add(new ItemStack(Blocks.warp_chest), "###", "#E#", "###", '#', Blocks.obsidian, 'E', Items.charged_orb); add(new ItemStack(Blocks.furnace), "###", "# #", "###", '#', Blocks.cobblestone); - add(new ItemStack(Blocks.sandstone), "##", "##", '#', new ItemStack(Blocks.sand, 1, BlockSand.EnumType.SAND.getMetadata())); - add(new ItemStack(Blocks.sandstone, 4, BlockSandStone.EnumType.SMOOTH.getMetadata()), "##", "##", '#', new ItemStack(Blocks.sandstone, 1, BlockSandStone.EnumType.DEFAULT.getMetadata())); - add(new ItemStack(Blocks.quartz_block, 2, BlockQuartz.EnumType.LINES_Y.getMetadata()), "#", "#", '#', new ItemStack(Blocks.quartz_block, 1, BlockQuartz.EnumType.DEFAULT.getMetadata())); + add(new ItemStack(Blocks.sandstone), "##", "##", '#', Blocks.sand); + add(new ItemStack(Blocks.sandstone_smooth, 4), "##", "##", '#', Blocks.sandstone); + add(new ItemStack(Blocks.quartz_block_y, 2), "#", "#", '#', Blocks.quartz_block); add(new ItemStack(Blocks.stonebrick, 4), "##", "##", '#', Blocks.stone); - addShapeless(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.MOSSY_META), Blocks.stonebrick, Blocks.vine); + addShapeless(new ItemStack(Blocks.stonebrick_mossy), Blocks.stonebrick, Blocks.vine); addShapeless(new ItemStack(Blocks.mossy_cobblestone, 1), Blocks.cobblestone, Blocks.vine); add(new ItemStack(Blocks.iron_bars, 16), "###", "###", '#', Items.iron_ingot); add(new ItemStack(Blocks.glass_pane, 16), "###", "###", '#', Blocks.glass); add(new ItemStack(Blocks.redstone_lamp, 1), " R ", "RGR", " R ", 'R', Items.redstone, 'G', Blocks.glowstone); add(new ItemStack(Blocks.beacon, 1), "GGG", "GSG", "OOO", 'G', Blocks.glass, 'S', Items.charge_crystal, 'O', Blocks.obsidian); add(new ItemStack(Blocks.blood_brick, 1), "NN", "NN", 'N', Items.bloodbrick); - add(new ItemStack(Blocks.dirt, 4, BlockDirt.DirtType.COARSE_DIRT.getMetadata()), "DG", "GD", 'D', new ItemStack(Blocks.dirt, 1, BlockDirt.DirtType.DIRT.getMetadata()), 'G', Blocks.gravel); + add(new ItemStack(Blocks.coarse_dirt, 4), "DG", "GD", 'D', Blocks.dirt, 'G', Blocks.gravel); add(new ItemStack(Blocks.lamp, 1), " R ", "RGR", " R ", 'R', Blocks.glass, 'G', Blocks.glowstone); - for (int i = 0; i < 16; ++i) + for (DyeColor color : DyeColor.values()) { - addShapeless(new ItemStack(Blocks.wool, 1, i), new ItemStack(Items.dye, 1, 15 - i), new ItemStack(Blocks.wool, 1, 0)); - add(new ItemStack(Blocks.stained_hardened_clay, 8, 15 - i), "###", "#X#", "###", '#', new ItemStack(Blocks.hardened_clay), 'X', new ItemStack(Items.dye, 1, i)); - add(new ItemStack(Blocks.stained_glass, 8, 15 - i), "###", "#X#", "###", '#', new ItemStack(Blocks.glass), 'X', new ItemStack(Items.dye, 1, i)); - add(new ItemStack(Blocks.stained_glass_pane, 16, i), "###", "###", '#', new ItemStack(Blocks.stained_glass, 1, i)); + ItemDye dye = ItemDye.getByColor(color); + if(color != DyeColor.WHITE) + addShapeless(new ItemStack(BlockWool.getByColor(color)), dye, Blocks.white_wool); + add(new ItemStack(BlockColoredClay.getByColor(color), 8), "###", "#X#", "###", '#', Blocks.hardened_clay, 'X', dye); + add(new ItemStack(BlockStainedGlass.getByColor(color), 8), "###", "#X#", "###", '#', Blocks.glass, 'X', dye); + add(new ItemStack(BlockStainedGlassPane.getByColor(color), 16), "###", "###", '#', BlockStainedGlass.getByColor(color)); } - addShapeless(new ItemStack(Items.dye, 1, DyeColor.YELLOW.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.DANDELION.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.ROSE.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.POPPY.getMeta())); - addShapeless(new ItemStack(Items.dye, 3, DyeColor.WHITE.getDyeDamage()), Items.bone); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.PINK.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.ORANGE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.YELLOW.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.LIME.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.GRAY.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.SILVER.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.GRAY.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 3, DyeColor.SILVER.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.LIGHT_BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.CYAN.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.GREEN.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.PURPLE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.PURPLE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.PINK.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 3, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.PINK.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 4, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, DyeColor.WHITE.getDyeDamage())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.LIGHT_BLUE.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.BLUE_ORCHID.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.ALLIUM.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.SILVER.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.HOUSTONIA.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.RED_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.ORANGE.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.ORANGE_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.SILVER.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.WHITE_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.PINK.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.PINK_TULIP.getMeta())); - addShapeless(new ItemStack(Items.dye, 1, DyeColor.SILVER.getDyeDamage()), new ItemStack(Blocks.flower, 1, BlockFlower.EnumFlowerType.OXEYE_DAISY.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.YELLOW.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.SUNFLOWER.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.MAGENTA.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.SYRINGA.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.RED.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.ROSE.getMeta())); - addShapeless(new ItemStack(Items.dye, 2, DyeColor.PINK.getDyeDamage()), new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.PAEONIA.getMeta())); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.YELLOW)), Blocks.dandelion); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED)), Blocks.rose); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED)), Blocks.poppy); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.WHITE), 3), Items.bone); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PINK), 2), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.ORANGE), 2), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.YELLOW))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.LIME), 2), new ItemStack(ItemDye.getByColor(DyeColor.GREEN)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.GRAY), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLACK)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER), 2), new ItemStack(ItemDye.getByColor(DyeColor.GRAY)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER), 3), new ItemStack(ItemDye.getByColor(DyeColor.BLACK)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.LIGHT_BLUE), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.CYAN), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.GREEN))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PURPLE), 2), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.RED))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 2), new ItemStack(ItemDye.getByColor(DyeColor.PURPLE)), new ItemStack(ItemDye.getByColor(DyeColor.PINK))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 3), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.PINK))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 4), new ItemStack(ItemDye.getByColor(DyeColor.BLUE)), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.RED)), new ItemStack(ItemDye.getByColor(DyeColor.WHITE))); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.LIGHT_BLUE)), Blocks.blue_orchid); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA)), Blocks.allium); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER)), Blocks.houstonia); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED)), Blocks.red_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.ORANGE)), Blocks.orange_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER)), Blocks.white_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PINK)), Blocks.pink_tulip); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.SILVER)), Blocks.daisy); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.YELLOW), 2), Blocks.sunflower); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.MAGENTA), 2), Blocks.syringa); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.RED), 2), Blocks.rose_bush); + addShapeless(new ItemStack(ItemDye.getByColor(DyeColor.PINK), 2), Blocks.paeonia); - for (int j = 0; j < 16; ++j) + for (DyeColor color : DyeColor.values()) { - add(new ItemStack(Blocks.carpet, 3, j), "##", '#', new ItemStack(Blocks.wool, 1, j)); + add(new ItemStack(BlockCarpet.getByColor(color), 3), "##", '#', BlockWool.getByColor(color)); } recipes.add(new RecipesArmorDyes()); recipes.add(new RecipeFireworks()); recipes.add(new RecipeRepairItem()); - for (DyeColor enumdyecolor : DyeColor.values()) + for (DyeColor color : DyeColor.values()) { - add(new ItemStack(Items.banner, 1, enumdyecolor.getDyeDamage()), "###", "###", " | ", '#', new ItemStack(Blocks.wool, 1, enumdyecolor.getMetadata()), '|', Items.stick); + add(ItemBanner.getColoredBanner(color), "###", "###", " | ", '#', BlockWool.getByColor(color), '|', Items.stick); } recipes.add(new RecipeDuplicatePattern()); @@ -226,7 +234,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.paper, 3), "###", '#', Items.reeds); addShapeless(new ItemStack(Items.book, 1), Items.paper, Items.paper, Items.paper, Items.leather); - addShapeless(new ItemStack(Items.writable_book, 1), Items.book, new ItemStack(Items.dye, 1, DyeColor.BLACK.getDyeDamage()), Items.feather); + addShapeless(new ItemStack(Items.writable_book, 1), Items.book, Items.ink_sack, Items.feather); for(WoodType wood : WoodType.values()) { Item planks = ItemRegistry.getRegisteredItem(wood.getName() + "_planks"); add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_fence"), 3), "W#W", "W#W", '#', Items.stick, 'W', planks); @@ -234,7 +242,7 @@ public abstract class CraftingRegistry add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_door"), 3), "##", "##", "##", '#', planks); addBasic(new ItemStack(planks, 4), "#", '#', ItemRegistry.getRegisteredItem(wood.getName() + "_log")); Item slab = ItemRegistry.getRegisteredItem(wood.getName() + "_slab"); - add(new ItemStack(slab, 6, 0), "###", '#', planks); + add(new ItemStack(slab, 6), "###", '#', planks); add(new ItemStack(ItemRegistry.getRegisteredItem(wood.getName() + "_stairs"), 4), "# ", "## ", "###", '#', planks); add(new ItemStack(Blocks.daylight_detector), "GGG", "QQQ", "WWW", 'G', Blocks.glass, 'Q', Items.quartz, 'W', slab); @@ -256,12 +264,12 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.wooden_pressure_plate, 1), "##", '#', planks); add(new ItemStack(Blocks.piston, 1), "TTT", "#X#", "#R#", '#', Blocks.cobblestone, 'X', Items.iron_ingot, 'R', Items.redstone, 'T', planks); for(DyeColor color : BlockBed.COLORS) { - add(new ItemStack(ItemRegistry.getRegisteredItem(color.getName() + "_bed"), 1), "###", "XXX", '#', new ItemStack(Blocks.wool, 1, color.getMetadata()), 'X', planks); + add(new ItemStack(ItemRegistry.getRegisteredItem(color.getName() + "_bed"), 1), "###", "XXX", '#', BlockWool.getByColor(color), 'X', planks); } } - add(new ItemStack(Blocks.cobblestone_wall, 6, BlockWall.EnumType.NORMAL.getMetadata()), "###", "###", '#', Blocks.cobblestone); - add(new ItemStack(Blocks.cobblestone_wall, 6, BlockWall.EnumType.MOSSY.getMetadata()), "###", "###", '#', Blocks.mossy_cobblestone); + add(new ItemStack(Blocks.cobblestone_wall, 6), "###", "###", '#', Blocks.cobblestone); + add(new ItemStack(Blocks.mossy_cobblestone_wall, 6), "###", "###", '#', Blocks.mossy_cobblestone); add(new ItemStack(Blocks.blood_brick_fence, 6), "###", "###", '#', Blocks.blood_brick); add(new ItemStack(Items.lead, 2), "~~ ", "~O ", " ~", '~', Items.string, 'O', Items.slime_ball); @@ -274,14 +282,14 @@ public abstract class CraftingRegistry 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, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', new ItemStack(Blocks.tnt, 1, 0)); - add(new ItemStack(Blocks.tnt, 1, 2), "##", "##", '#', new ItemStack(Blocks.tnt, 1, 1)); - addShapeless(new ItemStack(Blocks.tnt, 1, 3), new ItemStack(Blocks.tnt, 1, 2), new ItemStack(Blocks.tnt, 1, 2)); - addShapeless(new ItemStack(Blocks.tnt, 1, 4), new ItemStack(Blocks.tnt, 1, 3), new ItemStack(Blocks.tnt, 1, 3)); - addShapeless(new ItemStack(Blocks.tnt, 1, 5), new ItemStack(Blocks.tnt, 1, 4), new ItemStack(Blocks.tnt, 1, 4)); - addShapeless(new ItemStack(Blocks.tnt, 1, 6), new ItemStack(Blocks.tnt, 1, 5), new ItemStack(Blocks.tnt, 1, 5)); - addShapeless(new ItemStack(Blocks.tnt, 1, 7), new ItemStack(Blocks.tnt, 1, 6), new ItemStack(Blocks.tnt, 1, 6)); - add(new ItemStack(Blocks.nuke, 1), "###", "###", "###", '#', new ItemStack(Blocks.tnt, 1, 7)); + add(new ItemStack(Blocks.tnt_1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Blocks.tnt); + add(new ItemStack(Blocks.tnt_2), "##", "##", '#', Blocks.tnt_1); + addShapeless(new ItemStack(Blocks.tnt_3), Blocks.tnt_2, Blocks.tnt_2); + addShapeless(new ItemStack(Blocks.tnt_4), Blocks.tnt_3, Blocks.tnt_3); + addShapeless(new ItemStack(Blocks.tnt_5), Blocks.tnt_4, Blocks.tnt_4); + addShapeless(new ItemStack(Blocks.tnt_6), Blocks.tnt_5, Blocks.tnt_5); + addShapeless(new ItemStack(Blocks.tnt_7), Blocks.tnt_6, Blocks.tnt_6); + add(new ItemStack(Blocks.nuke, 1), "###", "###", "###", '#', Blocks.tnt_7); add(new ItemStack(Blocks.ladder, 3), "# #", "###", "# #", '#', Items.stick); @@ -302,7 +310,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.brewing_stand, 1), " B ", "###", '#', Blocks.cobblestone, 'B', Items.blaze_rod); add(new ItemStack(Blocks.lit_pumpkin, 1), "A", "B", 'A', Blocks.pumpkin, 'B', Blocks.torch); add(new ItemStack(Items.chest_minecart, 1), "A", "B", 'A', Blocks.chest, 'B', Items.minecart); - add(new ItemStack(Items.tnt_minecart, 1), "A", "B", 'A', new ItemStack(Blocks.tnt, 1, 0), 'B', Items.minecart); + add(new ItemStack(Items.tnt_minecart, 1), "A", "B", 'A', Blocks.tnt, 'B', Items.minecart); add(new ItemStack(Items.hopper_minecart, 1), "A", "B", 'A', Blocks.hopper, 'B', Items.minecart); add(new ItemStack(Items.bucket, 1), "# #", " # ", '#', Items.iron_ingot); add(new ItemStack(Items.flower_pot, 1), "# #", " # ", '#', Items.brick); @@ -317,9 +325,9 @@ public abstract class CraftingRegistry add(new ItemStack(Blocks.blood_brick_stairs, 4), "# ", "## ", "###", '#', Blocks.blood_brick); add(new ItemStack(Blocks.sandstone_stairs, 4), "# ", "## ", "###", '#', Blocks.sandstone); add(new ItemStack(Blocks.quartz_stairs, 4), "# ", "## ", "###", '#', Blocks.quartz_block); - add(new ItemStack(Items.golden_apple, 1, 0), "###", "#X#", "###", '#', Items.gold_ingot, 'X', Items.apple); - add(new ItemStack(Items.golden_apple, 1, 1), "###", "#X#", "###", '#', Blocks.gold_block, 'X', Items.apple); - add(new ItemStack(Items.golden_carrot, 1, 0), "###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.carrot); + add(new ItemStack(Items.golden_apple, 1), "###", "#X#", "###", '#', Items.gold_ingot, 'X', Items.apple); + add(new ItemStack(Items.golden_apple_powered, 1), "###", "#X#", "###", '#', Blocks.gold_block, 'X', Items.apple); + add(new ItemStack(Items.golden_carrot, 1), "###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.carrot); add(new ItemStack(Items.speckled_melon, 1), "###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.melon); add(new ItemStack(Blocks.lever, 1), "X", "#", '#', Blocks.cobblestone, 'X', Items.stick); add(new ItemStack(Blocks.redstone_torch, 1), "X", "#", '#', Items.stick, 'X', Items.redstone); @@ -342,13 +350,13 @@ public abstract class CraftingRegistry add(new ItemStack(Items.dynamite, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Items.clay_ball); - add(new ItemStack(Items.dynamite, 1, 1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', new ItemStack(Items.dynamite, 1, 0)); - add(new ItemStack(Items.dynamite, 1, 2), "##", "##", '#', new ItemStack(Items.dynamite, 1, 1)); - addShapeless(new ItemStack(Items.dynamite, 1, 3), new ItemStack(Items.dynamite, 1, 2), new ItemStack(Items.dynamite, 1, 2)); - addShapeless(new ItemStack(Items.dynamite, 1, 4), new ItemStack(Items.dynamite, 1, 3), new ItemStack(Items.dynamite, 1, 3)); - addShapeless(new ItemStack(Items.dynamite, 1, 5), new ItemStack(Items.dynamite, 1, 4), new ItemStack(Items.dynamite, 1, 4)); - addShapeless(new ItemStack(Items.dynamite, 1, 6), new ItemStack(Items.dynamite, 1, 5), new ItemStack(Items.dynamite, 1, 5)); - addShapeless(new ItemStack(Items.dynamite, 1, 7), new ItemStack(Items.dynamite, 1, 6), new ItemStack(Items.dynamite, 1, 6)); + add(new ItemStack(Items.dynamite_1), "X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Items.dynamite); + add(new ItemStack(Items.dynamite_2), "##", "##", '#', Items.dynamite_1); + addShapeless(new ItemStack(Items.dynamite_3), Items.dynamite_2, Items.dynamite_2); + addShapeless(new ItemStack(Items.dynamite_4), Items.dynamite_3, Items.dynamite_3); + addShapeless(new ItemStack(Items.dynamite_5), Items.dynamite_4, Items.dynamite_4); + addShapeless(new ItemStack(Items.dynamite_6), Items.dynamite_5, Items.dynamite_5); + addShapeless(new ItemStack(Items.dynamite_7), Items.dynamite_6, Items.dynamite_6); add(new ItemStack(Items.portal_frame, 1), "XYX", "X#X", "XXX", 'X', Blocks.obsidian, 'Y', Items.orb, '#', Items.charged_orb); add(new ItemStack(Items.experience_bottle, 1), "YXY", "X#X", "YXY", 'X', Blocks.glass_pane, 'Y', Blocks.glowstone, '#', Items.emerald); @@ -359,7 +367,7 @@ public abstract class CraftingRegistry add(new ItemStack(Items.chick_magnet, 1), "A A", "N N", " C ", 'A', Items.aluminium_ingot, 'N', Items.nickel_ingot, 'C', Items.cobalt_ingot); add(new ItemStack(Items.magnet, 1), "I I", "N N", " R ", 'I', Items.iron_ingot, 'N', Items.neodymium_ingot, 'R', Items.redstone); - addShapeless(new ItemStack(Items.potion, 1, 16384), new ItemStack(Items.potion, 1, 0), Items.gunpowder); + addShapeless(new ItemStack(Items.splash_potion), Items.potion, Items.gunpowder); add(new ItemStack(Blocks.construction_table), "---", "-#-", "---", '#', Blocks.workbench, '-', Items.iron_ingot); add(new ItemStack(Blocks.bedrock), "#####", "#####", "#####", "#####", "#####", '#', Blocks.obsidian); diff --git a/common/src/main/java/common/init/DispenserRegistry.java b/common/src/main/java/common/init/DispenserRegistry.java index a1b588ba..b579cbf1 100755 --- a/common/src/main/java/common/init/DispenserRegistry.java +++ b/common/src/main/java/common/init/DispenserRegistry.java @@ -36,7 +36,6 @@ import common.item.ItemStack; import common.rng.Random; import common.tileentity.TileEntityDispenser; import common.util.BlockPos; -import common.util.ExtMath; import common.util.Facing; import common.util.RegistryDefaulted; import common.world.State; @@ -111,16 +110,13 @@ public abstract class DispenserRegistry { return super.getVelocity() * 1.25F; } }); - REGISTRY.putObject(Items.potion, new IBehaviorDispenseItem() - { - private final BehaviorDefaultDispenseItem field_150843_b = new BehaviorDefaultDispenseItem(); - public ItemStack dispense(IBlockSource source, final ItemStack stack) - { - return ItemPotion.isSplash(stack.getMetadata()) ? (new BehaviorProjectileDispense() - { + for(ItemPotion potion : ItemPotion.getPotions()) { + if(potion.isSplashPotion()) + REGISTRY.putObject(potion, new BehaviorProjectileDispense() + { protected IProjectile getProjectileEntity(World worldIn, IPosition position, ItemStack item) { - return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), stack.copy()); + return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), item.copy()); } protected float getInaccuracy() { @@ -130,9 +126,8 @@ public abstract class DispenserRegistry { { return super.getVelocity() * 1.25F; } - }).dispense(source, stack): this.field_150843_b.dispense(source, stack); - } - }); + }); + } IBehaviorDispenseItem disp = new BehaviorDefaultDispenseItem() { public ItemStack dispenseStack(IBlockSource source, ItemStack stack) @@ -360,7 +355,7 @@ public abstract class DispenserRegistry { } } }); - REGISTRY.putObject(ItemDye.getByColor(DyeColor.WHITE), new BehaviorDefaultDispenseItem() + REGISTRY.putObject(Items.bonemeal, new BehaviorDefaultDispenseItem() { private boolean success = true; protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) diff --git a/common/src/main/java/common/init/FlammabilityRegistry.java b/common/src/main/java/common/init/FlammabilityRegistry.java index 0d0a632e..fd214fc6 100755 --- a/common/src/main/java/common/init/FlammabilityRegistry.java +++ b/common/src/main/java/common/init/FlammabilityRegistry.java @@ -3,6 +3,14 @@ package common.init; import java.util.Map; import common.block.Block; +import common.block.artificial.BlockCarpet; +import common.block.artificial.BlockWool; +import common.block.foliage.BlockDoublePlant; +import common.block.foliage.BlockFlower; +import common.block.foliage.BlockLeaves; +import common.block.foliage.BlockTallGrass; +import common.block.foliage.LeavesType; +import common.block.tech.BlockTNT; import common.collect.Maps; public abstract class FlammabilityRegistry { @@ -22,21 +30,35 @@ public abstract class FlammabilityRegistry { setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence"), 5, 20); setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_fence_gate"), 5, 20); setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), 5, 5); - setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_leaves"), 30, 60); + for(LeavesType type : LeavesType.values()) { + setFlammable(BlockLeaves.getLeavesBlock(wood, type), 30, 60); + } setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_sapling"), 15, 100); } + for(BlockTNT block : BlockTNT.TNTS) { + setFlammable(block, 15, 100); + } + for(BlockTallGrass block : BlockTallGrass.BUSHES) { + setFlammable(block, 60, 100); + } + for(BlockDoublePlant block : BlockDoublePlant.PLANTS) { + setFlammable(block, 60, 100); + } + for(BlockFlower block : BlockFlower.FLOWERS) { + setFlammable(block, 60, 100); + } + for(BlockWool block : BlockWool.WOOLS) { + setFlammable(block, 30, 60); + } + for(BlockCarpet block : BlockCarpet.CARPETS) { + setFlammable(block, 60, 20); + } setFlammable(Blocks.bookshelf, 30, 20); - setFlammable(Blocks.tnt, 15, 100); - setFlammable(Blocks.tallgrass, 60, 100); - setFlammable(Blocks.double_plant, 60, 100); - setFlammable(Blocks.flower, 60, 100); setFlammable(Blocks.deadbush, 60, 100); setFlammable(Blocks.dry_leaves, 60, 100); - setFlammable(Blocks.wool, 30, 60); setFlammable(Blocks.vine, 15, 100); setFlammable(Blocks.coal_block, 5, 5); setFlammable(Blocks.hay_block, 60, 20); - setFlammable(Blocks.carpet, 60, 20); } public static int getFlammability(Block block) { diff --git a/common/src/main/java/common/init/ItemRegistry.java b/common/src/main/java/common/init/ItemRegistry.java index 1b41b450..d2732c1b 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -497,7 +497,7 @@ public abstract class ItemRegistry { registerItem("written_book", (new Item()).setDisplay("Beschriebenes Buch").setTab(CheatTab.MISC)); Item emerald = (new Item()).setDisplay("Smaragd").setTab(CheatTab.METALS); registerItem("emerald", emerald); - registerItem((new ItemSmallBlock(Blocks.flower_pot)).setDisplay("Blumentopf").setTab(CheatTab.DECORATION)); + registerItem((new 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)); diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index 50054de8..4bc5ee9f 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -75,7 +75,7 @@ public abstract class Items { public static final ItemMetal black_metal_ingot = get("black_metal_ingot"); public static final ItemMetalBlock black_metal_ore = get("black_metal_ore"); public static final Item black_quartz = get("black_quartz"); - public static final ItemMultiTexture black_quartz_block = get("black_quartz_block"); + public static final ItemBlock black_quartz_block = get("black_quartz_block"); public static final ItemBlock black_quartz_ore = get("black_quartz_ore"); public static final ItemSlab black_quartz_slab = get("black_quartz_slab"); public static final ItemBlock black_quartz_stairs = get("black_quartz_stairs"); @@ -178,7 +178,6 @@ public abstract class Items { 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"); @@ -213,7 +212,7 @@ public abstract class Items { public static final ItemShovel diamond_shovel = get("diamond_shovel"); public static final ItemSword diamond_sword = get("diamond_sword"); public static final ItemDie die = get("die"); - public static final ItemMultiTexture dirt = get("dirt"); + public static final ItemBlock dirt = get("dirt"); public static final ItemDispenser dispenser = get("dispenser"); public static final ItemDoublePlant double_plant = get("double_plant"); public static final ItemBlock dragon_egg = get("dragon_egg"); @@ -235,7 +234,6 @@ public abstract class Items { 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"); @@ -243,7 +241,7 @@ public abstract class Items { public static final ItemBlock floor_tiles_black = get("floor_tiles_black"); public static final ItemBlock floor_tiles_red = get("floor_tiles_red"); public static final ItemBlock floor_tiles_white = get("floor_tiles_white"); - public static final ItemMultiTexture flower = get("flower"); + public static final ItemBlock 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"); @@ -442,7 +440,7 @@ public abstract class Items { public static final ItemSeeds pumpkin_stem = get("pumpkin_stem"); public static final ItemBed purple_bed = get("purple_bed"); public static final Item quartz = get("quartz"); - public static final ItemMultiTexture quartz_block = get("quartz_block"); + public static final ItemBlock quartz_block = get("quartz_block"); public static final ItemBlock quartz_ore = get("quartz_ore"); public static final ItemSlab quartz_slab = get("quartz_slab"); public static final ItemBlock quartz_stairs = get("quartz_stairs"); @@ -486,14 +484,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 ItemMultiTexture rock = get("rock"); + public static final ItemBlock 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 ItemMultiTexture sand = get("sand"); - public static final ItemMultiTexture sandstone = get("sandstone"); + public static final ItemBlock sand = get("sand"); + public static final ItemBlock sandstone = get("sandstone"); public static final ItemSlab sandstone_slab = get("sandstone_slab"); public static final ItemBlock sandstone_stairs = get("sandstone_stairs"); public static final ItemMetalBlock selenium_block = get("selenium_block"); @@ -545,7 +543,7 @@ public abstract class Items { public static final ItemSlab stone_slab = get("stone_slab"); public static final ItemBlock stone_stairs = get("stone_stairs"); public static final ItemSword stone_sword = get("stone_sword"); - public static final ItemMultiTexture stonebrick = get("stonebrick"); + public static final ItemBlock stonebrick = get("stonebrick"); public static final ItemSlab stonebrick_slab = get("stonebrick_slab"); public static final ItemBlock stonebrick_stairs = get("stonebrick_stairs"); public static final ItemSmallBlock string = get("string"); diff --git a/common/src/main/java/common/init/SmeltingRegistry.java b/common/src/main/java/common/init/SmeltingRegistry.java index 295815f5..8624457f 100755 --- a/common/src/main/java/common/init/SmeltingRegistry.java +++ b/common/src/main/java/common/init/SmeltingRegistry.java @@ -25,29 +25,24 @@ public abstract class SmeltingRegistry static void register() { -// add(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); -// add(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); -// add(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); add(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); + add(Blocks.red_sand, new ItemStack(Blocks.glass), 0.1F); add(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); add(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); add(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); -// addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F); -// addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F); add(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); - add(new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stonebrick_cracked), 0.1F); + add(Blocks.stonebrick, new ItemStack(Blocks.stonebrick_cracked), 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(Items.potato, new ItemStack(Items.baked_potato), 0.35F); add(Blocks.hellrock, new ItemStack(Items.bloodbrick), 0.1F); -// add(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F); - for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) + for (ItemFishFood.FishType fish : ItemFishFood.FishType.values()) { - if (itemfishfood$fishtype.canCook()) + if (fish.canCook()) { - add(new ItemStack(Items.fish, 1, itemfishfood$fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, itemfishfood$fishtype.getMetadata()), 0.35F); + add(ItemRegistry.getRegisteredItem(fish.getName()), new ItemStack(ItemRegistry.getRegisteredItem("cooked_" + fish.getName())), 0.35F); } } @@ -67,7 +62,6 @@ public abstract class SmeltingRegistry } for(WoodType wood : WoodType.values()) { add(BlockRegistry.getRegisteredBlock(wood.getName() + "_log"), new ItemStack(Items.charcoal), 0.15F); -// add(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); } } diff --git a/common/src/main/java/common/init/TradeRegistry.java b/common/src/main/java/common/init/TradeRegistry.java index 40b76fd9..f8f513f7 100755 --- a/common/src/main/java/common/init/TradeRegistry.java +++ b/common/src/main/java/common/init/TradeRegistry.java @@ -28,43 +28,15 @@ public abstract class TradeRegistry { new ItemForGem(Items.cake, new PriceInfo(1, 1)), new GemForItem(Items.string, new PriceInfo(15, 20)), new GemForItem(Items.coal, new PriceInfo(16, 24)), - new ItemForGemItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, - new PriceInfo(6, 6)), + new ItemForGemItem(Items.cod, new PriceInfo(6, 6), Items.cooked_cod, new PriceInfo(6, 6)), new EnchForGem(Items.fishing_rod, new PriceInfo(7, 8)), new GemForItem(ItemRegistry.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)), new ItemForGem(Items.iron_shears, new PriceInfo(3, 4)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 0), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 1), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 2), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 3), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 4), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 5), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 6), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 7), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 8), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 9), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 10), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 11), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 12), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 13), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 14), - new PriceInfo(1, 2)), - new ItemForGem(new ItemStack(ItemRegistry.getItemFromBlock(Blocks.wool), 1, 15), - new PriceInfo(1, 2)), + new ItemForGem(Items.white_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.black_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.brown_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.gray_wool, new PriceInfo(1, 2)), + new ItemForGem(Items.silver_wool, new PriceInfo(1, 2)), new GemForItem(Items.string, new PriceInfo(15, 20)), new ItemForGem(Items.arrow, new PriceInfo(-12, -8)), new ItemForGem(Items.bow, new PriceInfo(2, 3)), @@ -77,7 +49,6 @@ public abstract class TradeRegistry { new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4)), new GemForItem(Items.written_book, new PriceInfo(2, 2)), -// new ItemForGem(Items.clock, new PriceInfo(10, 12)), new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3)), new BookForGem(), @@ -86,11 +57,9 @@ public abstract class TradeRegistry { new GemForItem(Items.rotten_flesh, new PriceInfo(36, 40)), new GemForItem(Items.gold_ingot, new PriceInfo(8, 10)), new ItemForGem(Items.redstone, new PriceInfo(-4, -1)), - new ItemForGem(new ItemStack(Items.dye, 1, DyeColor.BLUE.getDyeDamage()), - new PriceInfo(-2, -1)), + new ItemForGem(Items.ink_sack, new PriceInfo(-2, -1)), new ItemForGem(Items.charged_orb, new PriceInfo(7, 11)), - new ItemForGem(ItemRegistry.getItemFromBlock(Blocks.glowstone), - new PriceInfo(-3, -1)), + new ItemForGem(Items.glowstone, new PriceInfo(-3, -1)), new ItemForGem(Items.experience_bottle, new PriceInfo(3, 11)), new GemForItem(Items.coal, new PriceInfo(16, 24)), new ItemForGem(Items.iron_helmet, new PriceInfo(4, 6)), diff --git a/common/src/main/java/common/item/ItemBanner.java b/common/src/main/java/common/item/ItemBanner.java index 996c22d4..1020ecfb 100755 --- a/common/src/main/java/common/item/ItemBanner.java +++ b/common/src/main/java/common/item/ItemBanner.java @@ -7,6 +7,7 @@ import common.block.tile.BlockWallSign; import common.color.DyeColor; import common.entity.npc.EntityNPC; import common.init.Blocks; +import common.init.Items; import common.model.ItemMeshDefinition; import common.model.Model; import common.model.ModelProvider; @@ -25,6 +26,20 @@ 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; + } /** * Called when a Block is right-clicked with this Item @@ -132,15 +147,9 @@ public class ItemBanner extends ItemBlock */ public void getSubItems(Item itemIn, CheatTab tab, List subItems) { - for (DyeColor enumdyecolor : DyeColor.values()) + for (DyeColor color : DyeColor.values()) { - TagObject nbttagcompound = new TagObject(); - TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), null); - TagObject nbttagcompound1 = new TagObject(); - nbttagcompound1.setObject("BlockEntityTag", nbttagcompound); - ItemStack itemstack = new ItemStack(itemIn); - itemstack.setTagCompound(nbttagcompound1); - subItems.add(itemstack); + subItems.add(this.getColored(color)); } } diff --git a/common/src/main/java/common/item/ItemFishFood.java b/common/src/main/java/common/item/ItemFishFood.java index 1f8474df..2729e701 100755 --- a/common/src/main/java/common/item/ItemFishFood.java +++ b/common/src/main/java/common/item/ItemFishFood.java @@ -1,9 +1,5 @@ package common.item; -import java.util.List; -import java.util.Map; - -import common.collect.Maps; import common.entity.npc.EntityNPC; import common.model.Model; import common.model.ModelProvider; @@ -23,6 +19,14 @@ public class ItemFishFood extends ItemFood this.cooked = cooked; this.type = type; } + + public FishType getType() { + return this.type; + } + + public boolean isCooked() { + return this.cooked; + } public int getHealAmount(ItemStack stack) { diff --git a/common/src/main/java/common/item/ItemPotion.java b/common/src/main/java/common/item/ItemPotion.java index 70556d79..de539b91 100755 --- a/common/src/main/java/common/item/ItemPotion.java +++ b/common/src/main/java/common/item/ItemPotion.java @@ -1,5 +1,6 @@ package common.item; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -20,7 +21,7 @@ import common.world.World; public class ItemPotion extends Item { - private static final Map POTIONS = Maps.newHashMap(); + private static final Map POTIONS = Maps.newTreeMap(); private static final Map, Integer> SUB_ITEMS_CACHE = Maps., Integer>newLinkedHashMap(); private final int data; @@ -28,7 +29,11 @@ public class ItemPotion extends Item private List effectCache; public static ItemPotion getPotionItem(int data) { - return POTIONS.getOrDefault(data, isSplash(data) ? Items.splash_potion : Items.potion); + return POTIONS.getOrDefault(data, (data & 16384) != 0 ? Items.splash_potion : Items.potion); + } + + public static Collection getPotions() { + return POTIONS.values(); } public ItemPotion(int data) @@ -119,7 +124,7 @@ public class ItemPotion extends Item */ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) { - if (isSplash(this.data)) + if (this.isSplashPotion()) { // if (!playerIn.creative) // { @@ -142,13 +147,9 @@ public class ItemPotion extends Item return itemStackIn; } } - - /** - * returns wether or not a potion is a throwable splash potion based on damage value - */ - public static boolean isSplash(int meta) - { - return (meta & 16384) != 0; + + public boolean isSplashPotion() { + return (this.data & 16384) != 0; } public int getColorFromDamage() @@ -187,13 +188,13 @@ public class ItemPotion extends Item { if ((this.data & 16383) == 0) { - return (isSplash(this.data) ? "Werfbare " : "") + "Wasserflasche"; + return (this.isSplashPotion() ? "Werfbare " : "") + "Wasserflasche"; } else { String s = ""; - if (isSplash(this.data)) + if (this.isSplashPotion()) { s = "Werfbarer "; } @@ -336,7 +337,7 @@ public class ItemPotion extends Item { public String getModelLocation(ItemStack stack) { - return ItemPotion.isSplash(ItemPotion.this.data) ? ("item/splash_potion" + '#' + "inventory") : ("item/potion" + '#' + "inventory"); + return ItemPotion.this.isSplashPotion() ? ("item/splash_potion" + '#' + "inventory") : ("item/potion" + '#' + "inventory"); } }; } diff --git a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java index 73cc1836..4d8950ef 100755 --- a/common/src/main/java/common/tileentity/TileEntityBrewingStand.java +++ b/common/src/main/java/common/tileentity/TileEntityBrewingStand.java @@ -145,18 +145,18 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka { if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion) { - int k = this.getPotionResult(potion.getPotionData(), itemstack); + ItemPotion result = this.getPotionResult(potion, itemstack); - if (!ItemPotion.isSplash(potion.getPotionData()) && ItemPotion.isSplash(k)) + if (!potion.isSplashPotion() && result.isSplashPotion()) { flag = true; break; } List list = potion.getEffects(); - List list1 = ItemPotion.getPotionItem(k).getEffects(); + List list1 = result.getEffects(); - if ((potion.getPotionData() <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && potion.getPotionData() != k) + if ((potion.getPotionData() <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && potion != result) { flag = true; break; @@ -183,20 +183,20 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka { if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() instanceof ItemPotion potion) { - int k = this.getPotionResult(potion.getPotionData(), itemstack); + ItemPotion result = this.getPotionResult(potion, itemstack); List list = potion.getEffects(); - List list1 = ItemPotion.getPotionItem(k).getEffects(); + List list1 = result.getEffects(); if (potion.getPotionData() > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null)) { - if (!ItemPotion.isSplash(potion.getPotionData()) && ItemPotion.isSplash(k)) + if (!potion.isSplashPotion() && result.isSplashPotion()) { - this.brewingItemStacks[i] = new ItemStack(ItemPotion.getPotionItem(k)); + this.brewingItemStacks[i] = new ItemStack(result); } } - else if (potion.getPotionData() != k) + else if (potion != result) { - this.brewingItemStacks[i] = new ItemStack(ItemPotion.getPotionItem(k)); + this.brewingItemStacks[i] = new ItemStack(result); } } } @@ -217,12 +217,9 @@ public class TileEntityBrewingStand extends TileEntityLockable implements ITicka } } - /** - * The result of brewing a potion of the specified damage value with an ingredient itemstack. - */ - private int getPotionResult(int meta, ItemStack stack) + private ItemPotion getPotionResult(ItemPotion potion, ItemStack stack) { - return stack == null ? meta : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta); + return stack == null ? potion : (stack.getItem().isPotionIngredient(stack) ? ItemPotion.getPotionItem(PotionHelper.applyIngredient(potion.getPotionData(), stack.getItem().getPotionEffect(stack))) : potion); } public void readTags(TagObject compound) diff --git a/server/src/main/java/server/clipboard/ReorderRegistry.java b/server/src/main/java/server/clipboard/ReorderRegistry.java index 1a21def8..31c17171 100755 --- a/server/src/main/java/server/clipboard/ReorderRegistry.java +++ b/server/src/main/java/server/clipboard/ReorderRegistry.java @@ -8,6 +8,7 @@ import java.util.Set; import common.block.Block; import common.block.artificial.BlockBed; import common.block.artificial.BlockDoor; +import common.block.artificial.BlockFlowerPot; import common.block.foliage.BlockFlower; import common.color.DyeColor; import common.init.BlockRegistry; @@ -50,8 +51,8 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.tallgrass); PLACE_LAST.add(Blocks.deadbush); PLACE_LAST.add(Blocks.piston_head); - for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { - PLACE_LAST.add(BlockFlower.getByType(type)); + for(BlockFlower block : BlockFlower.FLOWERS) { + PLACE_LAST.add(block); } PLACE_LAST.add(Blocks.brown_mushroom); PLACE_LAST.add(Blocks.red_mushroom_block); @@ -84,7 +85,9 @@ public abstract class ReorderRegistry { PLACE_LAST.add(Blocks.cocoa); PLACE_LAST.add(Blocks.tripwire_hook); PLACE_LAST.add(Blocks.string); - PLACE_LAST.add(Blocks.flower_pot); + for(BlockFlowerPot block : BlockFlowerPot.POTS) { + PLACE_LAST.add(block); + } PLACE_LAST.add(Blocks.carrot); PLACE_LAST.add(Blocks.potato); PLACE_LAST.add(Blocks.wooden_button); @@ -141,8 +144,8 @@ 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.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { - addAttach(BlockFlower.getByType(type), Facing.DOWN); + for(BlockFlower block : BlockFlower.FLOWERS) { + addAttach(block, Facing.DOWN); } addAttach(Blocks.brown_mushroom, Facing.DOWN); addAttach(Blocks.red_mushroom, Facing.DOWN); @@ -200,7 +203,9 @@ public abstract class ReorderRegistry { addCardinals(Blocks.tripwire_hook, offset + 2, offset + 3, offset + 0, offset + 1); } addAttach(Blocks.string, Facing.DOWN); - addAttach(Blocks.flower_pot, Facing.DOWN); + for(BlockFlowerPot block : BlockFlowerPot.POTS) { + addAttach(block, Facing.DOWN); + } addAttach(Blocks.carrot, Facing.DOWN); addAttach(Blocks.potato, Facing.DOWN); addAttach(Blocks.anvil, Facing.DOWN); diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index 61ba91e2..ecb7e105 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -350,6 +350,7 @@ public abstract class Converter { mapTile(TileEntityComparator.class, "Comparator", "comparator"); mapTile(TileEntityBanner.class, "Banner", "banner"); + /* mapBlock(Blocks.stone.getState(), 1); mapBlock(Blocks.rock.getState().withProperty(BlockRock.SMOOTH, false), 1, 1); mapBlock(Blocks.rock.getState().withProperty(BlockRock.SMOOTH, true), 1, 2); @@ -859,6 +860,7 @@ public abstract class Converter { } }, 252); mapBlock(Blocks.obsidian, 255); + */ } private static Object read(DataInput input, byte id) throws IOException {