diff --git a/gradle.properties b/gradle.properties index d2a293769..772422345 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ mcversion=1.9 -forgeversion=12.16.0.1868-1.9 +forgeversion=12.16.1.1887 mcp_mappings=snapshot_20160430 jei_version=3.3.3.+ diff --git a/src/main/java/forestry/api/apiculture/hives/IHiveGen.java b/src/main/java/forestry/api/apiculture/hives/IHiveGen.java index 5bbb13b20..112868603 100644 --- a/src/main/java/forestry/api/apiculture/hives/IHiveGen.java +++ b/src/main/java/forestry/api/apiculture/hives/IHiveGen.java @@ -5,6 +5,7 @@ ******************************************************************************/ package forestry.api.apiculture.hives; +import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -25,6 +26,6 @@ public interface IHiveGen { /** * returns true if the hive can safely replace the block at this location. */ - boolean canReplace(World world, BlockPos pos); + boolean canReplace(IBlockState blockState, World world, BlockPos pos); } diff --git a/src/main/java/forestry/api/core/EnumTemperature.java b/src/main/java/forestry/api/core/EnumTemperature.java index 37008b9ae..32f570b5d 100644 --- a/src/main/java/forestry/api/core/EnumTemperature.java +++ b/src/main/java/forestry/api/core/EnumTemperature.java @@ -64,7 +64,7 @@ public enum EnumTemperature { if (BiomeHelper.isBiomeHellish(biomeGenBase)) { return HELLISH; } - return getFromValue(biomeGenBase.temperature); + return getFromValue(biomeGenBase.getTemperature()); } public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase, World world, BlockPos pos) { diff --git a/src/main/java/forestry/apiculture/MaterialBeehive.java b/src/main/java/forestry/apiculture/MaterialBeehive.java index 4db15559b..8744224ff 100755 --- a/src/main/java/forestry/apiculture/MaterialBeehive.java +++ b/src/main/java/forestry/apiculture/MaterialBeehive.java @@ -16,7 +16,7 @@ import net.minecraft.block.material.Material; public class MaterialBeehive extends Material { public MaterialBeehive(boolean noHarvest) { - super(MapColor.stoneColor); + super(MapColor.STONE); if (noHarvest) { this.setRequiresTool(); } diff --git a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java index d77a12109..74015f0cc 100755 --- a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java +++ b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java @@ -29,7 +29,7 @@ public class VillageHandlerApiculture /*implements IVillageCreationHandler, IVil recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.emerald, 1))); ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false); - recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), randomComb)); + recipeList.add(new MerchantRecipe(new ItemStack(Items.WHEAT, 2), randomComb)); ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockTypeApiculture.APIARY); recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), apiary)); diff --git a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java index ae2516089..a03b56925 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java @@ -67,14 +67,14 @@ public class CommandBeeGive extends SubCommand { @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws SpeciesNotFoundException, TemplateNotFoundException, PlayerNotFoundException { if (args.length < 2) { - printHelp(, sender); + printHelp(sender); return; } IBeeGenome beeGenome = getBeeGenome(args[0]); EnumBeeType beeType = getBeeType(args[1]); if (beeType == null) { - printHelp(, sender); + printHelp(sender); return; } @@ -85,7 +85,7 @@ public class CommandBeeGive extends SubCommand { player = CommandBase.getPlayer(server, sender, sender.getName()); } if (player == null) { - printHelp(, sender); + printHelp(sender); return; } diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java index 33f2e7ca9..742b106f6 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java @@ -27,7 +27,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule { } Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock(); - if (ground != Blocks.dirt && ground != Blocks.grass) { + if (ground != Blocks.DIRT && ground != Blocks.GRASS) { return false; } diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java index e397f43b9..0340506e0 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java @@ -27,7 +27,7 @@ public class GrowthRuleMycelium implements IFlowerGrowthRule { } Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock(); - if (ground != Blocks.mycelium) { + if (ground != Blocks.MYCELIUM) { return false; } diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java index 5ed756ac5..6a634f3f1 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java @@ -22,12 +22,12 @@ public class GrowthRuleSnow implements IFlowerGrowthRule { @Override public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) { - if (world.getBlockState(pos).getBlock() != Blocks.snow) { + if (world.getBlockState(pos).getBlock() != Blocks.SNOW) { return false; } Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock(); - if (ground != Blocks.dirt && ground != Blocks.grass) { + if (ground != Blocks.DIRT && ground != Blocks.GRASS) { return false; } diff --git a/src/main/java/forestry/apiculture/genetics/BeeDefinition.java b/src/main/java/forestry/apiculture/genetics/BeeDefinition.java index 3bb23fed7..ce6e12c90 100644 --- a/src/main/java/forestry/apiculture/genetics/BeeDefinition.java +++ b/src/main/java/forestry/apiculture/genetics/BeeDefinition.java @@ -259,7 +259,7 @@ public enum BeeDefinition implements IBeeDefinition { @Override protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) { beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.COCOA, 1), 0.30f) - .addSpecialty(new ItemStack(Items.sugar), 0.15f); + .addSpecialty(new ItemStack(Items.SUGAR), 0.15f); } @Override @@ -350,7 +350,7 @@ public enum BeeDefinition implements IBeeDefinition { @Override protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) { beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.45f) - .addProduct(new ItemStack(Items.glowstone_dust), 0.15f) + .addProduct(new ItemStack(Items.GLOWSTONE_DUST), 0.15f) .setHasEffect() .setTemperature(EnumTemperature.HELLISH) .setHumidity(EnumHumidity.ARID); @@ -684,7 +684,7 @@ public enum BeeDefinition implements IBeeDefinition { @Override protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) { beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SILKY, 1), 0.30f) - .addProduct(new ItemStack(Items.egg), 0.10f) + .addProduct(new ItemStack(Items.EGG), 0.10f) .setHasEffect() .setIsNotCounted(); } @@ -770,11 +770,11 @@ public enum BeeDefinition implements IBeeDefinition { @Override protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) { beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.40f) - .addProduct(new ItemStack(Items.cookie), 0.15f) - .addSpecialty(new ItemStack(Items.skull, 1, 0), 0.02f) - .addSpecialty(new ItemStack(Items.skull, 1, 2), 0.02f) - .addSpecialty(new ItemStack(Items.skull, 1, 3), 0.02f) - .addSpecialty(new ItemStack(Items.skull, 1, 4), 0.02f) + .addProduct(new ItemStack(Items.COOKIE), 0.15f) + .addSpecialty(new ItemStack(Items.SKULL, 1, 0), 0.02f) + .addSpecialty(new ItemStack(Items.SKULL, 1, 2), 0.02f) + .addSpecialty(new ItemStack(Items.SKULL, 1, 3), 0.02f) + .addSpecialty(new ItemStack(Items.SKULL, 1, 4), 0.02f) .setHasEffect() .setIsNotCounted(); } diff --git a/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java b/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java index 4c6795fa3..477030dc6 100644 --- a/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java +++ b/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java @@ -35,7 +35,7 @@ public class JubilanceRequiresResource implements IJubilanceProvider { World world = housing.getWorld(); BlockPos housingCoords = housing.getCoordinates(); - IBlockState state = world.getBlockState(housingCoords.add(0, -1, 0)); + IBlockState state = world.getBlockState(housingCoords.down()); return ItemStackUtil.equals(state, blockRequired); } diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectResurrection.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectResurrection.java index a0521e947..b3feac440 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectResurrection.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectResurrection.java @@ -49,23 +49,23 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled { public static List getReanimationList() { ArrayList list = new ArrayList<>(); - list.add(new Resurrectable(new ItemStack(Items.bone), EntitySkeleton.class)); - list.add(new Resurrectable(new ItemStack(Items.arrow), EntitySkeleton.class)); - list.add(new Resurrectable(new ItemStack(Items.rotten_flesh), EntityZombie.class)); - list.add(new Resurrectable(new ItemStack(Items.blaze_rod), EntityBlaze.class)); + list.add(new Resurrectable(new ItemStack(Items.BONE), EntitySkeleton.class)); + list.add(new Resurrectable(new ItemStack(Items.ARROW), EntitySkeleton.class)); + list.add(new Resurrectable(new ItemStack(Items.ROTTEN_FLESH), EntityZombie.class)); + list.add(new Resurrectable(new ItemStack(Items.BLAZE_ROD), EntityBlaze.class)); return list; } public static List getResurrectionList() { ArrayList list = new ArrayList<>(); - list.add(new Resurrectable(new ItemStack(Items.gunpowder), EntityCreeper.class)); - list.add(new Resurrectable(new ItemStack(Items.ender_pearl), EntityEnderman.class)); - list.add(new Resurrectable(new ItemStack(Items.string), EntitySpider.class)); - list.add(new Resurrectable(new ItemStack(Items.spider_eye), EntitySpider.class)); - list.add(new Resurrectable(new ItemStack(Items.string), EntityCaveSpider.class)); - list.add(new Resurrectable(new ItemStack(Items.spider_eye), EntityCaveSpider.class)); - list.add(new Resurrectable(new ItemStack(Items.ghast_tear), EntityGhast.class)); - list.add(new Resurrectable(new ItemStack(Blocks.dragon_egg), EntityDragon.class)); + list.add(new Resurrectable(new ItemStack(Items.GUNPOWDER), EntityCreeper.class)); + list.add(new Resurrectable(new ItemStack(Items.ENDER_PEARL), EntityEnderman.class)); + list.add(new Resurrectable(new ItemStack(Items.STRING), EntitySpider.class)); + list.add(new Resurrectable(new ItemStack(Items.SPIDER_EYE), EntitySpider.class)); + list.add(new Resurrectable(new ItemStack(Items.STRING), EntityCaveSpider.class)); + list.add(new Resurrectable(new ItemStack(Items.SPIDER_EYE), EntityCaveSpider.class)); + list.add(new Resurrectable(new ItemStack(Items.GHAST_TEAR), EntityGhast.class)); + list.add(new Resurrectable(new ItemStack(Blocks.DRAGON_EGG), EntityDragon.class)); return list; } diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java index 9dc8013f2..82b3ea194 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java @@ -64,13 +64,13 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled { IBlockState state = world.getBlockState(posBlock); Block block = state.getBlock(); - if (block == Blocks.snow_layer) { + if (block == Blocks.SNOW_LAYER) { int meta = block.getMetaFromState(state); if (meta < 7) { world.setBlockState(posBlock, block.getStateFromMeta(meta + 1), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } } else if (block.isReplaceable(world, posBlock)) { - world.setBlockState(posBlock, Blocks.snow_layer.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); + world.setBlockState(posBlock, Blocks.SNOW_LAYER.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } } diff --git a/src/main/java/forestry/apiculture/gui/ContainerAlveary.java b/src/main/java/forestry/apiculture/gui/ContainerAlveary.java index e505a9f41..a41d43827 100755 --- a/src/main/java/forestry/apiculture/gui/ContainerAlveary.java +++ b/src/main/java/forestry/apiculture/gui/ContainerAlveary.java @@ -27,6 +27,6 @@ public class ContainerAlveary extends ContainerTile { public void detectAndSendChanges() { super.detectAndSendChanges(); PacketGuiUpdate packet = new PacketGuiUpdate(tile); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } } diff --git a/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java b/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java index 9235477b5..c1032a5b4 100644 --- a/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java +++ b/src/main/java/forestry/apiculture/gui/ContainerBeeHousing.java @@ -34,7 +34,7 @@ public class ContainerBeeHousing extends ContainerTile imple if (this.beeProgress != beeProgress) { this.beeProgress = beeProgress; IForestryPacketClient packet = new PacketGuiUpdate(tile); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } } diff --git a/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java b/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java index d3a171e81..233742665 100644 --- a/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java +++ b/src/main/java/forestry/apiculture/gui/ContainerMinecartBeehouse.java @@ -33,7 +33,7 @@ public class ContainerMinecartBeehouse extends ContainerEntity itemList) { for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) { diff --git a/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java b/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java index 9f76ec889..268cf5b19 100644 --- a/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java +++ b/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java @@ -21,8 +21,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemMinecart; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -48,33 +50,33 @@ public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegi super(null); setMaxDamage(0); setHasSubtypes(true); - BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior); + BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, dispenserMinecartBehavior); } @Override - public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { - if (!BlockRailBase.isRailBlock(world.getBlockState(pos))) { - return false; + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + if (!BlockRailBase.isRailBlock(worldIn.getBlockState(pos))) { + return EnumActionResult.PASS; } - if (!world.isRemote) { + if (!worldIn.isRemote) { EntityMinecartBeeHousingBase entityMinecart; - if (itemStack.getItemDamage() == 0) { - entityMinecart = new EntityMinecartBeehouse(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F); + if (stack.getItemDamage() == 0) { + entityMinecart = new EntityMinecartBeehouse(worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F); } else { - entityMinecart = new EntityMinecartApiary(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F); + entityMinecart = new EntityMinecartApiary(worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F); } - entityMinecart.setOwner(player.getGameProfile()); + entityMinecart.setOwner(playerIn.getGameProfile()); - if (itemStack.hasDisplayName()) { - entityMinecart.setCustomNameTag(itemStack.getDisplayName()); + if (stack.hasDisplayName()) { + entityMinecart.setCustomNameTag(stack.getDisplayName()); } - world.spawnEntityInWorld(entityMinecart); + worldIn.spawnEntityInWorld(entityMinecart); } - --itemStack.stackSize; - return true; + --stack.stackSize; + return EnumActionResult.SUCCESS; } @Override diff --git a/src/main/java/forestry/apiculture/items/ItemRegistryApiculture.java b/src/main/java/forestry/apiculture/items/ItemRegistryApiculture.java index 8a697abc8..8f494bf0d 100644 --- a/src/main/java/forestry/apiculture/items/ItemRegistryApiculture.java +++ b/src/main/java/forestry/apiculture/items/ItemRegistryApiculture.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.apiculture.items; +import net.minecraft.inventory.EntityEquipmentSlot; + import net.minecraftforge.oredict.OreDictionary; import forestry.api.apiculture.EnumBeeType; @@ -91,10 +93,10 @@ public class ItemRegistryApiculture extends ItemRegistry { OreDictionary.registerOre("beeComb", beeComb.getWildcard()); // / APIARIST'S CLOTHES - apiaristHat = registerItem(new ItemArmorApiarist(0), "apiaristHelmet"); - apiaristChest = registerItem(new ItemArmorApiarist(1), "apiaristChest"); - apiaristLegs = registerItem(new ItemArmorApiarist(2), "apiaristLegs"); - apiaristBoots = registerItem(new ItemArmorApiarist(3), "apiaristBoots"); + apiaristHat = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.HEAD), "apiaristHelmet"); + apiaristChest = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.CHEST), "apiaristChest"); + apiaristLegs = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.LEGS), "apiaristLegs"); + apiaristBoots = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.FEET), "apiaristBoots"); // TOOLS scoop = registerItem(new ItemScoop(), "scoop"); diff --git a/src/main/java/forestry/apiculture/items/ItemSmoker.java b/src/main/java/forestry/apiculture/items/ItemSmoker.java index cdfe6dc43..6197de096 100644 --- a/src/main/java/forestry/apiculture/items/ItemSmoker.java +++ b/src/main/java/forestry/apiculture/items/ItemSmoker.java @@ -7,6 +7,9 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.Vec3d; @@ -36,7 +39,7 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist { } @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { + public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) { super.onUsingTick(stack, player, count); World worldObj = player.worldObj; addSmoke(worldObj, player, count % RANGE); @@ -57,19 +60,19 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist { } @Override - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) { - playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); - return itemStackIn; + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + playerIn.setActiveHand(hand); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof IHiveTile) { IHiveTile hive = (IHiveTile) tileEntity; hive.calmBees(); } - return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ); + return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand); } @Override diff --git a/src/main/java/forestry/apiculture/proxy/ProxyApicultureClient.java b/src/main/java/forestry/apiculture/proxy/ProxyApicultureClient.java index 61570b6b4..1f0596724 100644 --- a/src/main/java/forestry/apiculture/proxy/ProxyApicultureClient.java +++ b/src/main/java/forestry/apiculture/proxy/ProxyApicultureClient.java @@ -22,7 +22,10 @@ import net.minecraft.world.IBlockAccess; import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.apiculture.PluginApiculture; +import forestry.apiculture.blocks.BlockRegistryApiculture; import forestry.apiculture.genetics.BeeGenome; +import forestry.apiculture.items.EnumHoneyComb; +import forestry.apiculture.items.ItemRegistryApiculture; import forestry.apiculture.tiles.TileCandle; import forestry.core.tiles.TileUtil; @@ -30,30 +33,42 @@ public class ProxyApicultureClient extends ProxyApiculture { @Override public void initializeRendering() { - /*if (PluginApiculture.fancyRenderedBees) { - RenderingRegistry.registerEntityRenderingHandler(EntityBee.class, new RenderBeeEntity()); - - MinecraftForgeClient.registerItemRenderer(PluginApiculture.items.beeDroneGE, new RenderBeeItem()); - MinecraftForgeClient.registerItemRenderer(PluginApiculture.items.beePrincessGE, new RenderBeeItem()); - MinecraftForgeClient.registerItemRenderer(PluginApiculture.items.beeQueenGE, new RenderBeeItem()); - }*/ - Minecraft minecraft = Minecraft.getMinecraft(); + ItemColors itemColors = minecraft.getItemColors(); + BlockColors blockColors = minecraft.getBlockColors(); + + ItemRegistryApiculture items = PluginApiculture.items; + BlockRegistryApiculture blocks = PluginApiculture.blocks; + itemColors.registerItemColorHandler(new BeeItemColor(), - PluginApiculture.items.beeQueenGE, - PluginApiculture.items.beeDroneGE, - PluginApiculture.items.beeLarvaeGE, - PluginApiculture.items.beePrincessGE + items.beeQueenGE, + items.beeDroneGE, + items.beeLarvaeGE, + items.beePrincessGE + ); + itemColors.registerItemColorHandler(new HoneyCombItemColor(), + items.beeComb ); - BlockColors blockColors = minecraft.getBlockColors(); blockColors.registerBlockColorHandler(new CandleBlockColor(), - PluginApiculture.blocks.candle, - PluginApiculture.blocks.stump + blocks.candle, + blocks.stump ); } + private static class HoneyCombItemColor implements IItemColor { + @Override + public int getColorFromItemstack(ItemStack itemstack, int tintIndex) { + EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[itemstack.getItemDamage()]; + if (tintIndex == 1) { + return honeyComb.primaryColor; + } else { + return honeyComb.secondaryColor; + } + } + } + private static class BeeItemColor implements IItemColor { @Override public int getColorFromItemstack(ItemStack itemstack, int tintIndex) { diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index c8722bff0..01c006060 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -302,7 +302,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } IBlockState blockState = world.getBlockState(posNew); - if (PluginApiculture.blocks.apiculture == blockState.getBlock() || !world.isBlockLoaded(posNew.add(0, -1, 0))) { + if (PluginApiculture.blocks.apiculture == blockState.getBlock() || !world.isBlockLoaded(posNew.down())) { return; } diff --git a/src/main/java/forestry/apiculture/worldgen/Hive.java b/src/main/java/forestry/apiculture/worldgen/Hive.java index c2ccd0a2a..63e713fad 100644 --- a/src/main/java/forestry/apiculture/worldgen/Hive.java +++ b/src/main/java/forestry/apiculture/worldgen/Hive.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -76,7 +77,8 @@ public final class Hive { } public boolean canReplace(World world, BlockPos pos) { - return hiveDescription.getHiveGen().canReplace(world, pos); + IBlockState blockState = world.getBlockState(pos); + return hiveDescription.getHiveGen().canReplace(blockState, world, pos); } public int getYForHive(World world, int x, int z) { diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDescription.java b/src/main/java/forestry/apiculture/worldgen/HiveDescription.java index ebdf65780..ea3b77aca 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveDescription.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDescription.java @@ -46,14 +46,14 @@ public enum HiveDescription implements IHiveDescription { postGenFlowers(world, pos, flowerStates); } }, - MEADOWS(1, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)) { + MEADOWS(1, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) { @Override public void postGen(World world, BlockPos pos) { super.postGen(world, pos); postGenFlowers(world, pos, flowerStates); } }, - DESERT(2, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.sand, Blocks.sandstone)) { + DESERT(2, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) { @Override public void postGen(World world, BlockPos pos) { super.postGen(world, pos); @@ -61,23 +61,23 @@ public enum HiveDescription implements IHiveDescription { } }, JUNGLE(3, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()), - END(4, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.end_stone)) { + END(4, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) { @Override public boolean isGoodBiome(BiomeGenBase biome) { return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END); } }, - SNOW(5, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow)) { + SNOW(5, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) { @Override public void postGen(World world, BlockPos pos) { if (world.isAirBlock(pos.add(0, 1, 0))) { - world.setBlockState(pos.add(0, 1, 0), Blocks.snow_layer.getDefaultState(), 0); + world.setBlockState(pos.add(0, 1, 0), Blocks.SNOW_LAYER.getDefaultState(), 0); } postGenFlowers(world, pos, flowerStates); } }, - SWAMP(6, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)) { + SWAMP(6, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) { @Override public void postGen(World world, BlockPos pos) { super.postGen(world, pos); @@ -86,16 +86,16 @@ public enum HiveDescription implements IHiveDescription { } }; - private static final IHiveGen groundGen = HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow, Blocks.sand, Blocks.sandstone); + private static final IHiveGen groundGen = HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW, Blocks.SAND, Blocks.SANDSTONE); private static final List flowerStates = new ArrayList<>(); private static final List mushroomStates = new ArrayList<>(); - private static final List cactusStates = Collections.singletonList(Blocks.cactus.getDefaultState()); + private static final List cactusStates = Collections.singletonList(Blocks.CACTUS.getDefaultState()); static { - flowerStates.addAll(Blocks.red_flower.getBlockState().getValidStates()); - flowerStates.addAll(Blocks.yellow_flower.getBlockState().getValidStates()); - mushroomStates.add(Blocks.red_mushroom.getDefaultState()); - mushroomStates.add(Blocks.brown_mushroom.getDefaultState()); + flowerStates.addAll(Blocks.RED_FLOWER.getBlockState().getValidStates()); + flowerStates.addAll(Blocks.YELLOW_FLOWER.getBlockState().getValidStates()); + mushroomStates.add(Blocks.RED_MUSHROOM.getDefaultState()); + mushroomStates.add(Blocks.BROWN_MUSHROOM.getDefaultState()); } private final int meta; @@ -183,8 +183,9 @@ public enum HiveDescription implements IHiveDescription { IPlantable plantable = (IPlantable) block; BlockPos groundPos = blockPos.down(); - Block ground = world.getBlockState(groundPos).getBlock(); - if (!ground.canSustainPlant(world, groundPos, EnumFacing.UP, plantable)) { + IBlockState blockState = world.getBlockState(groundPos); + Block ground = blockState.getBlock(); + if (!ground.canSustainPlant(blockState, world, groundPos, EnumFacing.UP, plantable)) { world.setBlockToAir(blockPos); plantedCount--; } diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java b/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java index 7d759ea5c..12620feb8 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java @@ -38,7 +38,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription { @Override public IHiveGen getHiveGen() { - return new HiveGenGround(Blocks.dirt, Blocks.grass); + return new HiveGenGround(Blocks.DIRT, Blocks.GRASS); } @Override diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGen.java b/src/main/java/forestry/apiculture/worldgen/HiveGen.java index 435011dac..f935c90f0 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGen.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGen.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.apiculture.worldgen; +import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -19,7 +20,7 @@ import forestry.core.utils.BlockUtil; public abstract class HiveGen implements IHiveGen { @Override - public boolean canReplace(World world, BlockPos pos) { - return BlockUtil.canReplace(world, pos); + public boolean canReplace(IBlockState blockState, World world, BlockPos pos) { + return BlockUtil.canReplace(blockState, world, pos); } } diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java b/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java index 1f577cd94..5cb59e543 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java @@ -15,25 +15,28 @@ import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import forestry.core.utils.BlockUtil; - public class HiveGenGround extends HiveGen { private final Set groundMaterials = new HashSet<>(); public HiveGenGround(Block... groundBlocks) { for (Block block : groundBlocks) { - groundMaterials.add(block.getMaterial()); + IBlockState blockState = block.getDefaultState(); + Material blockMaterial = block.getMaterial(blockState); + groundMaterials.add(blockMaterial); } } @Override public boolean isValidLocation(World world, BlockPos pos) { - Block ground = BlockUtil.getBlock(world, pos.add(0, -1, 0)); - return groundMaterials.contains(ground.getMaterial()); + IBlockState groundBlockState = world.getBlockState(pos.down()); + Block groundBlock = groundBlockState.getBlock(); + Material groundBlockMaterial = groundBlock.getMaterial(groundBlockState); + return groundMaterials.contains(groundBlockMaterial); } @Override @@ -41,8 +44,12 @@ public class HiveGenGround extends HiveGen { // get to the ground BlockPos pos = world.getHeight(new BlockPos(x, 0, z)); - while (pos.getY() >= 0 && (world.getBlockState(pos.down()).getBlock().isLeaves(world, pos.down()) || canReplace(world, pos.down()))) { - pos = pos.add(0, -1, 0); + IBlockState blockState = world.getBlockState(pos.down()); + Block block = blockState.getBlock(); + while (pos.getY() >= 0 && (block.isLeaves(blockState, world, pos.down()) || canReplace(blockState, world, pos.down()))) { + pos = pos.down(); + blockState = world.getBlockState(pos); + block = blockState.getBlock(); } return pos.getY(); diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java b/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java index 808355c8a..cd1a2e91c 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java @@ -11,6 +11,7 @@ package forestry.apiculture.worldgen; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -18,27 +19,31 @@ public class HiveGenTree extends HiveGen { @Override public boolean isValidLocation(World world, BlockPos pos) { - Block blockAbove = world.getBlockState(pos.add(0, 1, 0)).getBlock(); - if (!blockAbove.isLeaves(world, pos.add(0, 1, 0))) { + IBlockState blockState = world.getBlockState(pos.up()); + Block blockAbove = blockState.getBlock(); + if (!blockAbove.isLeaves(blockState, world, pos.up())) { return false; } // not a good location if right on top of something - return canReplace(world, pos.add(0, -1, 0)); + return canReplace(blockState, world, pos.down()); } @Override public int getYForHive(World world, int x, int z) { // get top leaf block int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1; - if (!world.getBlockState(new BlockPos(x, y, z)).getBlock().isLeaves(world, new BlockPos(x, y, z))) { + BlockPos pos = new BlockPos(x, y, z); + IBlockState blockState = world.getBlockState(pos); + if (!blockState.getBlock().isLeaves(blockState, world, pos)) { return -1; } // get to the bottom of the leaves do { - y--; - } while (world.getBlockState(new BlockPos(x, y, z)).getBlock().isLeaves(world, new BlockPos(x, y, z))); + pos = pos.down(); + blockState = world.getBlockState(pos); + } while (blockState.getBlock().isLeaves(blockState, world, pos)); return y; } diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java b/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java index c38cfdc4d..2cd6de8e3 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java @@ -28,6 +28,7 @@ import forestry.arboriculture.WoodHelper.WoodMeshDefinition; import forestry.core.proxy.Proxies; import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockPlanks.EnumType; +import net.minecraft.block.SoundType; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java b/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java index e070b9d2b..390f188e9 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java @@ -65,7 +65,7 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I } @Override - public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileFruitPod tile = TileUtil.getTile(world, pos, TileFruitPod.class); if (tile == null) { return null; @@ -88,9 +88,9 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I tile.onBlockTick(); } - + @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (!world.isRemote) { TileFruitPod tile = TileUtil.getTile(world, pos, TileFruitPod.class); if (tile != null) { @@ -100,7 +100,7 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I } } - return super.removedByPlayer(world, pos, player, willHarvest); + return super.removedByPlayer(state, world, pos, player, willHarvest); } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/property/PropertyTree.java b/src/main/java/forestry/arboriculture/blocks/property/PropertyTree.java index 831a9c633..9a791eba6 100644 --- a/src/main/java/forestry/arboriculture/blocks/property/PropertyTree.java +++ b/src/main/java/forestry/arboriculture/blocks/property/PropertyTree.java @@ -11,6 +11,7 @@ package forestry.arboriculture.blocks.property; import com.google.common.base.Objects; +import com.google.common.base.Optional; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java b/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java index 10428444e..919d08ee5 100644 --- a/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java +++ b/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java @@ -41,7 +41,7 @@ public final class TreeGenHelper { public static void generateTree(WorldGenerator gen, EntityPlayer player, BlockPos pos) { World world = player.worldObj; - if(world.isAirBlock(pos.add(0, -1, 0))){ + if(world.isAirBlock(pos.down())){ pos = BlockUtil.getNextSolidDownPos(world, pos); }else{ pos = BlockUtil.getNextReplaceableUpPos(world, pos); diff --git a/src/main/java/forestry/arboriculture/genetics/Tree.java b/src/main/java/forestry/arboriculture/genetics/Tree.java index d44c5238b..bb882cef0 100755 --- a/src/main/java/forestry/arboriculture/genetics/Tree.java +++ b/src/main/java/forestry/arboriculture/genetics/Tree.java @@ -156,7 +156,7 @@ public class Tree extends Individual implements ITree, IPlantable { @Override public boolean canStay(IBlockAccess world, BlockPos pos) { - BlockPos blockPos = pos.add(0, -1, 0); + BlockPos blockPos = pos.down(); IBlockState blockState = world.getBlockState(blockPos); if (blockState == null) { return false; diff --git a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java index d6fe560b2..6b720a437 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java @@ -93,7 +93,7 @@ import forestry.core.tiles.TileUtil; import forestry.core.utils.BlockUtil; public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSerializable { - Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 0, new ItemStack(Blocks.log, 1, 0)) { + Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 0, new ItemStack(Blocks.LOG, 1, 0)) { @Override public WorldGenerator getWorldGenerator(ITreeGenData tree) { return new WorldGenOak(tree); @@ -116,7 +116,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe // vanilla } }, - DarkOak(TreeBranchDefinition.QUERCUS, "darkOak", "velutina", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 5, new ItemStack(Blocks.log2, 1, 1)) { + DarkOak(TreeBranchDefinition.QUERCUS, "darkOak", "velutina", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 5, new ItemStack(Blocks.LOG2, 1, 1)) { @Override public WorldGenerator getWorldGenerator(ITreeGenData tree) { return new WorldGenDarkOak(tree); @@ -139,7 +139,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe // vanilla } }, - Birch(TreeBranchDefinition.BETULA, "silverBirch", "pendula", false, EnumLeafType.DECIDUOUS, new Color(8431445), new Color(0xb0c648), 2, new ItemStack(Blocks.log, 1, 2)) { + Birch(TreeBranchDefinition.BETULA, "silverBirch", "pendula", false, EnumLeafType.DECIDUOUS, new Color(8431445), new Color(0xb0c648), 2, new ItemStack(Blocks.LOG, 1, 2)) { @Override public WorldGenerator getWorldGenerator(ITreeGenData tree) { return new WorldGenBirch(tree); @@ -344,7 +344,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe registerMutation(Spruce, Larch, 5); } }, - Spruce(TreeBranchDefinition.PICEA, "redSpruce", "abies", false, EnumLeafType.CONIFERS, new Color(6396257), new Color(0x539d12), 1, new ItemStack(Blocks.log, 1, 1)) { + Spruce(TreeBranchDefinition.PICEA, "redSpruce", "abies", false, EnumLeafType.CONIFERS, new Color(6396257), new Color(0x539d12), 1, new ItemStack(Blocks.LOG, 1, 1)) { @Override public WorldGenerator getWorldGenerator(ITreeGenData tree) { return new WorldGenSpruce(tree); @@ -464,7 +464,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe // only available by rare villager trade } }, - Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.log, 1, 3)) { + Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.LOG, 1, 3)) { @Override public WorldGenerator getWorldGenerator(ITreeGenData tree) { return new WorldGenJungle(tree); @@ -626,7 +626,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe registerMutation(Kapok, Ebony, 10); } }, - AcaciaVanilla(TreeBranchDefinition.ACACIA, "acacia", "aneura", true, EnumLeafType.DECIDUOUS, new Color(0x616101), new Color(0xb3b302), 4, new ItemStack(Blocks.log2, 1, 0)) { + AcaciaVanilla(TreeBranchDefinition.ACACIA, "acacia", "aneura", true, EnumLeafType.DECIDUOUS, new Color(0x616101), new Color(0xb3b302), 4, new ItemStack(Blocks.LOG2, 1, 0)) { @Override public WorldGenerator getWorldGenerator(ITreeGenData tree) { return new WorldGenAcaciaVanilla(tree); @@ -1056,7 +1056,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe tileLeaves.setOwner(owner); tileLeaves.setTree(new Tree(genome)); - world.markBlockForUpdate(pos); + world.markBlockRangeForRenderUpdate(pos, pos); } public static void initTrees() { diff --git a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java index ac8f3d7c0..883e0d05b 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java @@ -73,7 +73,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { private final ArrayList treekeepingModes = new ArrayList<>(); public TreeRoot() { - setResearchSuitability(new ItemStack(Blocks.sapling, 1, OreDictionary.WILDCARD_VALUE), 1.0f); + setResearchSuitability(new ItemStack(Blocks.SAPLING, 1, OreDictionary.WILDCARD_VALUE), 1.0f); } @Override @@ -260,7 +260,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { return false; } pod.setProperties(allele, sappiness); - world.markBlockForUpdate(pos); + world.markBlockRangeForRenderUpdate(pos, pos); return true; } diff --git a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java index 4d28b979d..8e5a38ea1 100644 --- a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java +++ b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java @@ -55,10 +55,10 @@ public class AlleleFruit extends AlleleCategorized implements IAlleleFruit { public static void createAlleles() { List fruitAlleles = Arrays.asList( fruitNone = new AlleleFruit("none", new FruitProviderNone("for.fruits.none", null)), - fruitApple = new AlleleFruit("apple", new FruitProviderRandom("for.fruits.apple", EnumFruitFamily.POMES, new ItemStack(Items.apple), 1.0f) + fruitApple = new AlleleFruit("apple", new FruitProviderRandom("for.fruits.apple", EnumFruitFamily.POMES, new ItemStack(Items.APPLE), 1.0f) .setColour(new Color(0xff2e2e)) .setOverlay("pomes")), - fruitCocoa = new AlleleFruit("cocoa", new FruitProviderPod("for.fruits.cocoa", EnumFruitFamily.JUNGLE, FruitProviderPod.EnumPodType.COCOA, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage()))), + fruitCocoa = new AlleleFruit("cocoa", new FruitProviderPod("for.fruits.cocoa", EnumFruitFamily.JUNGLE, FruitProviderPod.EnumPodType.COCOA, new ItemStack(Items.DYE, 1, EnumDyeColor.BROWN.getDyeDamage()))), // .setColours(0xecdca5, 0xc4d24a), true); fruitChestnut = new AlleleFruit("chestnut", new FruitProviderRipening("for.fruits.chestnut", EnumFruitFamily.NUX, ItemFruit.EnumFruit.CHESTNUT.getStack(), 1.0f) .setRipeningPeriod(6) diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java b/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java index b1f9643c5..1620ea252 100644 --- a/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java @@ -1,12 +1,16 @@ package forestry.arboriculture.items; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.arboriculture.blocks.BlockArbDoor; @@ -17,26 +21,31 @@ public class ItemBlockWoodDoor extends ItemBlockWood { super(block); } + /** Copy of {@link ItemDoor#onItemUse} */ @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { - if (side != EnumFacing.UP) { - return false; + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + if (facing != EnumFacing.UP) { + return EnumActionResult.FAIL; } else { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); if (!block.isReplaceable(worldIn, pos)) { - pos = pos.offset(side); + pos = pos.offset(facing); } - if (!playerIn.canPlayerEdit(pos, side, stack)) { - return false; - } else if (!this.block.canPlaceBlockAt(worldIn, pos)) { - return false; - } else { - ItemDoor.placeDoor(worldIn, pos, EnumFacing.fromAngle(playerIn.rotationYaw), this.block); + if (playerIn.canPlayerEdit(pos, facing, stack) && this.block.canPlaceBlockAt(worldIn, pos)) { + EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw); + int x = enumfacing.getFrontOffsetX(); + int z = enumfacing.getFrontOffsetZ(); + boolean isRightHinge = x < 0 && hitZ < 0.5F || x > 0 && hitZ > 0.5F || z < 0 && hitX > 0.5F || z > 0 && hitX < 0.5F; + ItemDoor.placeDoor(worldIn, pos, enumfacing, this.block, isRightHinge); + SoundType soundtype = this.block.getSoundType(); + worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); --stack.stackSize; - return true; + return EnumActionResult.SUCCESS; + } else { + return EnumActionResult.FAIL; } } } diff --git a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java index e87d3a01a..f33686bad 100755 --- a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java +++ b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java @@ -12,14 +12,21 @@ package forestry.arboriculture.items; import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -109,7 +116,6 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable { } @SideOnly(Side.CLIENT) - @Override public int getColorFromItemStack(ItemStack itemstack, int renderPass) { return getSpeciesOrDefault(itemstack).getGermlingColour(type, renderPass); } @@ -138,68 +144,65 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable { } } - + @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ITree tree = TreeManager.treeRoot.getMember(stack); if (tree == null) { - return false; + return EnumActionResult.PASS; } if (type == EnumGermlingType.SAPLING) { // x, y, z are the coordinates of the block "hit", can thus either be the soil or tall grass, etc. - int yShift; - if (!BlockUtil.isReplaceableBlock(world, pos)) { - if (!world.isAirBlock(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))) { - return false; + IBlockState hitBlock = worldIn.getBlockState(pos); + if (!BlockUtil.isReplaceableBlock(hitBlock, hitBlock.getBlock())) { + if (!worldIn.isAirBlock(pos.up())) { + return EnumActionResult.FAIL; } - yShift = 1; - } else { - yShift = 0; - } - BlockPos posS = pos.add(0, yShift, 0); - - if (!tree.canStay(world, posS)) { - return false; + pos = pos.up(); } - if (TreeManager.treeRoot.plantSapling(world, tree, player.getGameProfile(), posS)) { - Proxies.common.addBlockPlaceEffects(world, pos, world.getBlockState(posS)); - if (!player.capabilities.isCreativeMode) { + if (!tree.canStay(worldIn, pos)) { + return EnumActionResult.FAIL; + } + + if (TreeManager.treeRoot.plantSapling(worldIn, tree, playerIn.getGameProfile(), pos)) { + Proxies.common.addBlockPlaceEffects(worldIn, pos, worldIn.getBlockState(pos)); + if (!playerIn.capabilities.isCreativeMode) { stack.stackSize--; } - return true; + return EnumActionResult.SUCCESS; } else { - return false; + return EnumActionResult.FAIL; } } else if (type == EnumGermlingType.POLLEN) { - ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(world, pos); + ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(worldIn, pos); if (checkPollinatable == null) { - return false; + return EnumActionResult.PASS; } if (!checkPollinatable.canMateWith(tree)) { - return false; + return EnumActionResult.FAIL; } - IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(player.getGameProfile(), world, pos); + IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(playerIn.getGameProfile(), worldIn, pos); if (!pollinatable.canMateWith(tree)) { - return false; + return EnumActionResult.FAIL; } pollinatable.mateWith(tree); - Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, world, pos, - world.getBlockState(pos)); - if (!player.capabilities.isCreativeMode) { + Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, worldIn, pos, + worldIn.getBlockState(pos)); + if (!playerIn.capabilities.isCreativeMode) { stack.stackSize--; } - return true; + return EnumActionResult.SUCCESS; } else { - return false; + return EnumActionResult.PASS; } } diff --git a/src/main/java/forestry/arboriculture/items/ItemGrafter.java b/src/main/java/forestry/arboriculture/items/ItemGrafter.java index 2b2766c1d..a3c317404 100755 --- a/src/main/java/forestry/arboriculture/items/ItemGrafter.java +++ b/src/main/java/forestry/arboriculture/items/ItemGrafter.java @@ -13,6 +13,7 @@ package forestry.arboriculture.items; import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -34,15 +35,16 @@ public class ItemGrafter extends ItemForestryTool implements IToolGrafter { } @Override - public boolean canHarvestBlock(Block block, ItemStack itemStack) { - if (block instanceof BlockLeaves || block.getMaterial() == Material.leaves) { + public boolean canHarvestBlock(IBlockState state, ItemStack stack) { + Block block = state.getBlock(); + if (block instanceof BlockLeaves || block.getMaterial(state) == Material.LEAVES) { return true; } - return super.canHarvestBlock(block, itemStack); + return super.canHarvestBlock(state, stack); } - + @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase player) { + public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { return true; } diff --git a/src/main/java/forestry/arboriculture/proxy/ProxyArboricultureClient.java b/src/main/java/forestry/arboriculture/proxy/ProxyArboricultureClient.java index 7f3b33534..a0c8eea7e 100644 --- a/src/main/java/forestry/arboriculture/proxy/ProxyArboricultureClient.java +++ b/src/main/java/forestry/arboriculture/proxy/ProxyArboricultureClient.java @@ -16,6 +16,10 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.color.IBlockColor; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.client.renderer.color.ItemColors; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.IBlockAccess; @@ -26,6 +30,7 @@ import forestry.arboriculture.PluginArboriculture; import forestry.arboriculture.blocks.BlockDecorativeLeaves; import forestry.arboriculture.blocks.property.PropertyTreeType; import forestry.arboriculture.genetics.TreeDefinition; +import forestry.arboriculture.items.ItemGermlingGE; import forestry.arboriculture.models.ModelDecorativeLeaves; import forestry.arboriculture.models.ModelLeaves; import forestry.arboriculture.tiles.TileLeaves; @@ -54,6 +59,9 @@ public class ProxyArboricultureClient extends ProxyArboriculture { Minecraft minecraft = Minecraft.getMinecraft(); BlockColors blockColors = minecraft.getBlockColors(); + ItemColors itemColors = minecraft.getItemColors(); + + itemColors.registerItemColorHandler(new SaplingItemColor(), PluginArboriculture.items.sapling); blockColors.registerBlockColorHandler(new LeavesBlockColor(), PluginArboriculture.blocks.leaves); @@ -118,4 +126,15 @@ public class ProxyArboricultureClient extends ProxyArboriculture { } } } + + private static class SaplingItemColor implements IItemColor { + @Override + public int getColorFromItemstack(ItemStack stack, int tintIndex) { + Item item = stack.getItem(); + if (item instanceof ItemGermlingGE) { + return ((ItemGermlingGE) item).getColorFromItemStack(stack, tintIndex); + } + return 0xffffff; + } + } } diff --git a/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java b/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java index de80fb984..777cd10e2 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java +++ b/src/main/java/forestry/arboriculture/tiles/TileTreeContainer.java @@ -107,7 +107,7 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl public void setTree(ITree tree) { this.containedTree = tree; if (worldObj != null && worldObj.isRemote) { - worldObj.markBlockForUpdate(getPos()); + worldObj.markBlockRangeForRenderUpdate(getPos(), getPos()); } } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java index 9b04bd743..eb356e2df 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenArboriculture.java @@ -15,6 +15,7 @@ import java.util.EnumSet; import java.util.List; import java.util.Random; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; @@ -56,10 +57,10 @@ public abstract class WorldGenArboriculture extends WorldGenBase { } } - private static final ITreeBlockType vineNorth = new TreeBlockType(Blocks.vine, 1); - private static final ITreeBlockType vineSouth = new TreeBlockType(Blocks.vine, 4); - private static final ITreeBlockType vineWest = new TreeBlockType(Blocks.vine, 8); - private static final ITreeBlockType vineEast = new TreeBlockType(Blocks.vine, 2); + private static final ITreeBlockType vineNorth = new TreeBlockType(Blocks.VINE, 1); + private static final ITreeBlockType vineSouth = new TreeBlockType(Blocks.VINE, 4); + private static final ITreeBlockType vineWest = new TreeBlockType(Blocks.VINE, 8); + private static final ITreeBlockType vineEast = new TreeBlockType(Blocks.VINE, 2); private static final int minPodHeight = 3; private static final BlockType air = new BlockTypeVoid(); @@ -198,8 +199,10 @@ public abstract class WorldGenArboriculture extends WorldGenBase { } private void trySpawnFruitBlock(World world, BlockPos pos) { - if (BlockUtil.isReplaceableBlock(world, pos.add(startPos)) || world.isAirBlock(pos.add(startPos))) { - tree.trySpawnFruitBlock(world, pos.add(startPos)); + pos = pos.add(startPos); + IBlockState blockState = world.getBlockState(pos); + if (BlockUtil.isReplaceableBlock(blockState, world, pos) || world.isAirBlock(pos)) { + tree.trySpawnFruitBlock(world, pos); } } @@ -308,10 +311,12 @@ public abstract class WorldGenArboriculture extends WorldGenBase { @Override protected boolean addBlock(World world, BlockPos pos, ITreeBlockType type, EnumReplaceMode replace) { + pos = pos.add(startPos); + IBlockState blockState = world.getBlockState(pos); if (replace == EnumReplaceMode.ALL - || replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startPos.add(pos)) - || world.isAirBlock(startPos.add(pos))) { - type.setBlock(world, tree, startPos.add(pos)); + || replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(blockState, world, pos) + || world.isAirBlock(pos)) { + type.setBlock(world, tree, pos); return true; } return false; diff --git a/src/main/java/forestry/core/PluginCore.java b/src/main/java/forestry/core/PluginCore.java index 64e63c322..afcab7007 100644 --- a/src/main/java/forestry/core/PluginCore.java +++ b/src/main/java/forestry/core/PluginCore.java @@ -58,6 +58,7 @@ import forestry.core.models.ModelManager; import forestry.core.multiblock.MultiblockLogicFactory; import forestry.core.network.IPacketRegistry; import forestry.core.network.PacketRegistryCore; +import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; import forestry.core.render.TextureManager; import forestry.core.utils.ClimateUtil; @@ -127,6 +128,8 @@ public class PluginCore extends BlankForestryPlugin { ForestryModEnvWarningCallable.register(); AlleleHelper.instance.init(); + + Proxies.render.initRendering(); } @Override @@ -154,55 +157,55 @@ public class PluginCore extends BlankForestryPlugin { crateRegistry.registerCrate(blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, 1)); // vanilla items - crateRegistry.registerCrate(Items.wheat); - crateRegistry.registerCrate(Items.cookie); - crateRegistry.registerCrate(Items.redstone); - crateRegistry.registerCrate(new ItemStack(Items.dye, 1, 4)); - crateRegistry.registerCrate(Items.reeds); - crateRegistry.registerCrate(Items.clay_ball); - crateRegistry.registerCrate(Items.glowstone_dust); - crateRegistry.registerCrate(Items.apple); - crateRegistry.registerCrate(new ItemStack(Items.nether_wart)); - crateRegistry.registerCrate(new ItemStack(Items.coal, 1, 1)); - crateRegistry.registerCrate(new ItemStack(Items.coal, 1, 0)); - crateRegistry.registerCrate(Items.wheat_seeds); - crateRegistry.registerCrate(Items.potato); - crateRegistry.registerCrate(Items.carrot); + crateRegistry.registerCrate(Items.WHEAT); + crateRegistry.registerCrate(Items.COOKIE); + crateRegistry.registerCrate(Items.REDSTONE); + crateRegistry.registerCrate(new ItemStack(Items.DYE, 1, 4)); + crateRegistry.registerCrate(Items.REEDS); + crateRegistry.registerCrate(Items.CLAY_BALL); + crateRegistry.registerCrate(Items.GLOWSTONE_DUST); + crateRegistry.registerCrate(Items.APPLE); + crateRegistry.registerCrate(new ItemStack(Items.NETHER_WART)); + crateRegistry.registerCrate(new ItemStack(Items.COAL, 1, 1)); + crateRegistry.registerCrate(new ItemStack(Items.COAL, 1, 0)); + crateRegistry.registerCrate(Items.WHEAT_SEEDS); + crateRegistry.registerCrate(Items.POTATO); + crateRegistry.registerCrate(Items.CARROT); // vanilla blocks - crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 1)); - crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 2)); - crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 3)); - crateRegistry.registerCrate(new ItemStack(Blocks.log2, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.log2, 1, 1)); - crateRegistry.registerCrate(Blocks.cobblestone); - crateRegistry.registerCrate(new ItemStack(Blocks.dirt, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.dirt, 1, 2)); - crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 1)); - crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 3)); - crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 5)); - crateRegistry.registerCrate(new ItemStack(Blocks.prismarine, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.prismarine, 1, 1)); - crateRegistry.registerCrate(new ItemStack(Blocks.prismarine, 1, 2)); - crateRegistry.registerCrate(Blocks.brick_block); - crateRegistry.registerCrate(Blocks.cactus); - crateRegistry.registerCrate(new ItemStack(Blocks.sand, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.sand, 1, 1)); - crateRegistry.registerCrate(Blocks.obsidian); - crateRegistry.registerCrate(Blocks.netherrack); - crateRegistry.registerCrate(Blocks.soul_sand); - crateRegistry.registerCrate(Blocks.sandstone); - crateRegistry.registerCrate(Blocks.nether_brick); - crateRegistry.registerCrate(Blocks.mycelium); - crateRegistry.registerCrate(Blocks.gravel); - crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 0)); - crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 1)); - crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 2)); - crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 3)); - crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 4)); - crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 5)); + crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 1)); + crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 2)); + crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 3)); + crateRegistry.registerCrate(new ItemStack(Blocks.LOG2, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.LOG2, 1, 1)); + crateRegistry.registerCrate(Blocks.COBBLESTONE); + crateRegistry.registerCrate(new ItemStack(Blocks.DIRT, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.DIRT, 1, 2)); + crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 1)); + crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 3)); + crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 5)); + crateRegistry.registerCrate(new ItemStack(Blocks.PRISMARINE, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.PRISMARINE, 1, 1)); + crateRegistry.registerCrate(new ItemStack(Blocks.PRISMARINE, 1, 2)); + crateRegistry.registerCrate(Blocks.BRICK_BLOCK); + crateRegistry.registerCrate(Blocks.CACTUS); + crateRegistry.registerCrate(new ItemStack(Blocks.SAND, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.SAND, 1, 1)); + crateRegistry.registerCrate(Blocks.OBSIDIAN); + crateRegistry.registerCrate(Blocks.NETHERRACK); + crateRegistry.registerCrate(Blocks.SOUL_SAND); + crateRegistry.registerCrate(Blocks.SANDSTONE); + crateRegistry.registerCrate(Blocks.NETHER_BRICK); + crateRegistry.registerCrate(Blocks.MYCELIUM); + crateRegistry.registerCrate(Blocks.GRAVEL); + crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 0)); + crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 1)); + crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 2)); + crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 3)); + crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 4)); + crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 5)); } @Override @@ -255,13 +258,13 @@ public class PluginCore extends BlankForestryPlugin { int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat"); if (compostWheatAmount > 0) { ItemStack compost = items.fertilizerBio.getItemStack(compostWheatAmount); - RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.dirt, 'X', "cropWheat"); + RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', "cropWheat"); } int compostAshAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.ash"); if (compostAshAmount > 0) { ItemStack compost = items.fertilizerBio.getItemStack(compostAshAmount); - RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.dirt, 'X', "dustAsh"); + RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', "dustAsh"); } int fertilizerApatiteAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.fertilizer.apatite"); @@ -280,20 +283,20 @@ public class PluginCore extends BlankForestryPlugin { int humusCompostAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.humus.compost"); if (humusCompostAmount > 0) { ItemStack humus = blocks.soil.get(BlockSoil.SoilType.HUMUS, humusCompostAmount); - RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.dirt, 'X', items.fertilizerBio); + RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerBio); } int humusFertilizerAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.humus.fertilizer"); if (humusFertilizerAmount > 0) { ItemStack humus = blocks.soil.get(BlockSoil.SoilType.HUMUS, humusFertilizerAmount); - RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.dirt, 'X', items.fertilizerCompound); + RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerCompound); } // Bog earth int bogEarthOutputBucket = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.bucket"); if (bogEarthOutputBucket > 0) { ItemStack bogEarth = blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, bogEarthOutputBucket); - RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', Items.water_bucket, 'Y', "sand"); + RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', Items.WATER_BUCKET, 'Y', "sand"); } int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can"); @@ -302,16 +305,16 @@ public class PluginCore extends BlankForestryPlugin { ItemStack canWater = PluginFluids.items.getContainer(EnumContainerType.CAN, Fluids.WATER).getItemStack(); ItemStack waxCapsuleWater = PluginFluids.items.getContainer(EnumContainerType.CAPSULE, Fluids.WATER).getItemStack(); ItemStack refractoryWater = PluginFluids.items.getContainer(EnumContainerType.REFRACTORY, Fluids.WATER).getItemStack(); - RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', canWater, 'Y', "sand"); - RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waxCapsuleWater, 'Y', "sand"); - RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', refractoryWater, 'Y', "sand"); + RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', canWater, 'Y', "sand"); + RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waxCapsuleWater, 'Y', "sand"); + RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', refractoryWater, 'Y', "sand"); } // Crafting Material - RecipeUtil.addRecipe(new ItemStack(Items.string), "#", "#", "#", '#', items.craftingMaterial.getSilkWisp()); + RecipeUtil.addRecipe(new ItemStack(Items.STRING), "#", "#", "#", '#', items.craftingMaterial.getSilkWisp()); // / Pipette - RecipeUtil.addRecipe(items.pipette, " #", " X ", "X ", 'X', "paneGlass", '#', new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE)); + RecipeUtil.addRecipe(items.pipette, " #", " X ", "X ", 'X', "paneGlass", '#', new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE)); // Storage Blocks RecipeUtil.addRecipe(blocks.resourceStorage.get(EnumResourceType.APATITE), "###", "###", "###", '#', "gemApatite"); @@ -328,7 +331,7 @@ public class PluginCore extends BlankForestryPlugin { // alternate recipes if (!ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) { - RecipeManagers.centrifugeManager.addRecipe(5, new ItemStack(Items.string), ImmutableMap.of( + RecipeManagers.centrifugeManager.addRecipe(5, new ItemStack(Items.STRING), ImmutableMap.of( items.craftingMaterial.getSilkWisp(), 0.15f )); } diff --git a/src/main/java/forestry/core/blocks/BlockBase.java b/src/main/java/forestry/core/blocks/BlockBase.java index efbb75552..67fb52e74 100644 --- a/src/main/java/forestry/core/blocks/BlockBase.java +++ b/src/main/java/forestry/core/blocks/BlockBase.java @@ -341,7 +341,7 @@ public class BlockBase

& IBlockType & IStringSerializable> ext public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) { P property = state.getValue(TYPE); if(property.getMachineProperties() instanceof IMachinePropertiesTesr){ - return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback); + return ParticleHelper.addBlockHitEffects(worldObj, target.getBlockPos(), target.sideHit, effectRenderer, particleCallback); } return false; } diff --git a/src/main/java/forestry/core/blocks/BlockForestry.java b/src/main/java/forestry/core/blocks/BlockForestry.java index fb0a41f4a..e55224a28 100644 --- a/src/main/java/forestry/core/blocks/BlockForestry.java +++ b/src/main/java/forestry/core/blocks/BlockForestry.java @@ -39,7 +39,7 @@ public abstract class BlockForestry extends Block implements IItemModelRegister, } @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof IRestrictedAccess) { @@ -49,7 +49,7 @@ public abstract class BlockForestry extends Block implements IItemModelRegister, } } - return super.removedByPlayer(world, pos, player, willHarvest); + return super.removedByPlayer(state, world, pos, player, willHarvest); } @Override diff --git a/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java b/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java index 1131681ef..3317d1cf1 100644 --- a/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java +++ b/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java @@ -10,14 +10,18 @@ ******************************************************************************/ package forestry.core.blocks.propertys; +import com.google.common.base.Optional; + import net.minecraft.block.properties.IProperty; import java.util.List; +import forestry.api.arboriculture.IAlleleTreeSpecies; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleProperty; public abstract class PropertyAllele> implements IProperty { - protected final String name; public PropertyAllele(String name) { @@ -29,6 +33,17 @@ public abstract class PropertyAllele> implements IP return this.name; } + @Override + public Optional parseValue(String value) { + IAllele allele = AlleleManager.alleleRegistry.getAllele(value); + Class valueClass = getValueClass(); + if (valueClass.isInstance(allele)) { + A alleleValue = valueClass.cast(allele); + return Optional.of(alleleValue); + } + return Optional.absent(); + } + @Override public boolean equals(Object object) { if (this == object) { diff --git a/src/main/java/forestry/core/commands/CommandHelpers.java b/src/main/java/forestry/core/commands/CommandHelpers.java index 09f38e015..0fa5741b0 100644 --- a/src/main/java/forestry/core/commands/CommandHelpers.java +++ b/src/main/java/forestry/core/commands/CommandHelpers.java @@ -102,7 +102,7 @@ public class CommandHelpers { public static boolean processStandardCommands(MinecraftServer server, ICommandSender sender, IForestryCommand command, String[] args) throws CommandException { if (args.length >= 1) { if (args[0].equals("help")) { - command.printHelp(, sender); + command.printHelp(sender); return true; } for (SubCommand child : command.getChildren()) { diff --git a/src/main/java/forestry/core/commands/CommandModeInfo.java b/src/main/java/forestry/core/commands/CommandModeInfo.java index d52c67873..3351395be 100644 --- a/src/main/java/forestry/core/commands/CommandModeInfo.java +++ b/src/main/java/forestry/core/commands/CommandModeInfo.java @@ -38,7 +38,7 @@ public class CommandModeInfo extends SubCommand { @Override public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length <= 0) { - printHelp(, sender); + printHelp(sender); return; } @@ -46,7 +46,7 @@ public class CommandModeInfo extends SubCommand { if (modeName == null) { CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.error", args[0]); - printHelp(, sender); + printHelp(sender); return; } diff --git a/src/main/java/forestry/core/commands/CommandModeSet.java b/src/main/java/forestry/core/commands/CommandModeSet.java index 7c5ea09a3..c5bfb5534 100644 --- a/src/main/java/forestry/core/commands/CommandModeSet.java +++ b/src/main/java/forestry/core/commands/CommandModeSet.java @@ -34,7 +34,7 @@ public final class CommandModeSet extends SubCommand { @Override public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException { if (args.length == 0 || args.length > 2) { - printHelp(, sender); + printHelp(sender); return; } @@ -45,7 +45,7 @@ public final class CommandModeSet extends SubCommand { String modeName = modeSetter.getModeNameMatching(desired); if (modeName == null) { CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.set.error", desired); - printHelp(, sender); + printHelp(sender); return; } diff --git a/src/main/java/forestry/core/commands/RootCommand.java b/src/main/java/forestry/core/commands/RootCommand.java index 5d00dd657..98291a588 100644 --- a/src/main/java/forestry/core/commands/RootCommand.java +++ b/src/main/java/forestry/core/commands/RootCommand.java @@ -18,6 +18,7 @@ import java.util.TreeSet; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import forestry.core.config.Constants; @@ -50,8 +51,8 @@ public class RootCommand extends CommandBase implements IForestryCommand { } @Override - public void processCommand(ICommandSender sender, String[] args) throws CommandException { - if (!CommandHelpers.processStandardCommands(sender, this, args)) { + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + if (!CommandHelpers.processStandardCommands(server, sender, this, args)) { CommandHelpers.throwWrongUsage(sender, this); } } @@ -73,8 +74,8 @@ public class RootCommand extends CommandBase implements IForestryCommand { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) { - return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete, pos); + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + return CommandHelpers.addStandardTabCompletionOptions(server, this, sender, args, pos); } /* IForestryCommand */ @@ -95,7 +96,7 @@ public class RootCommand extends CommandBase implements IForestryCommand { } @Override - public void printHelp(MinecraftServer server, ICommandSender sender) { + public void printHelp(ICommandSender sender) { CommandHelpers.printHelp(sender, this); } diff --git a/src/main/java/forestry/core/commands/SubCommand.java b/src/main/java/forestry/core/commands/SubCommand.java index 044467428..1bcd74395 100644 --- a/src/main/java/forestry/core/commands/SubCommand.java +++ b/src/main/java/forestry/core/commands/SubCommand.java @@ -91,7 +91,7 @@ public abstract class SubCommand implements IForestryCommand { } public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException, CommandException { - printHelp(, sender); + printHelp(sender); } public SubCommand setPermLevel(PermLevel permLevel) { diff --git a/src/main/java/forestry/core/config/LocalizedConfiguration.java b/src/main/java/forestry/core/config/LocalizedConfiguration.java index 7aa57fc11..00a255f8e 100644 --- a/src/main/java/forestry/core/config/LocalizedConfiguration.java +++ b/src/main/java/forestry/core/config/LocalizedConfiguration.java @@ -32,7 +32,7 @@ public class LocalizedConfiguration extends Configuration { @Override public boolean getBoolean(String category, String name, boolean defaultValue, String comment) { Property prop = this.get(category, name, defaultValue); - prop.comment = comment + " [default: " + defaultValue + "]"; + prop.setComment(comment + " [default: " + defaultValue + "]"); return prop.getBoolean(defaultValue); } @@ -67,7 +67,7 @@ public class LocalizedConfiguration extends Configuration { Property prop = this.get(category, name, defaultValue); prop.setValidValues(validValues); prop.setLanguageKey(langKey); - prop.comment = comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]"; + prop.setComment(comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]"); return prop.getString(); } @@ -89,7 +89,7 @@ public class LocalizedConfiguration extends Configuration { prop.setValidValues(validValues); prop.setLanguageKey(langKey); - prop.comment = comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]"; + prop.setComment(comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]"); String stringValue = prop.getString(); T enumValue = defaultValue; @@ -123,7 +123,7 @@ public class LocalizedConfiguration extends Configuration { Property prop = this.get(category, name, defaultValue); prop.setLanguageKey(langKey); prop.setValidValues(validValues); - prop.comment = comment + " [default: " + Arrays.toString(defaultValue) + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]"; + prop.setComment(comment + " [default: " + Arrays.toString(defaultValue) + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]"); return prop.getStringList(); } diff --git a/src/main/java/forestry/core/fluids/FluidHelper.java b/src/main/java/forestry/core/fluids/FluidHelper.java index 4948584c9..8ba619c77 100644 --- a/src/main/java/forestry/core/fluids/FluidHelper.java +++ b/src/main/java/forestry/core/fluids/FluidHelper.java @@ -65,7 +65,7 @@ public final class FluidHelper { if (current.stackSize > 1) { player.inventory.decrStackSize(player.inventory.currentItem, 1); if (drainedContainer != null && !player.inventory.addItemStackToInventory(drainedContainer)) { - player.dropPlayerItemWithRandomChoice(drainedContainer, false); + player.dropItem(drainedContainer, false); } } else { player.inventory.setInventorySlotContents(player.inventory.currentItem, drainedContainer); diff --git a/src/main/java/forestry/core/fluids/Fluids.java b/src/main/java/forestry/core/fluids/Fluids.java index 414210ee1..4efb9fc8f 100644 --- a/src/main/java/forestry/core/fluids/Fluids.java +++ b/src/main/java/forestry/core/fluids/Fluids.java @@ -155,7 +155,7 @@ public enum Fluids { @Override public List getOtherContainers() { return Collections.singletonList( - new ItemStack(Items.milk_bucket) + new ItemStack(Items.MILK_BUCKET) ); } }, diff --git a/src/main/java/forestry/core/genetics/ItemResearchNote.java b/src/main/java/forestry/core/genetics/ItemResearchNote.java index dd19e0db5..475a7d93e 100755 --- a/src/main/java/forestry/core/genetics/ItemResearchNote.java +++ b/src/main/java/forestry/core/genetics/ItemResearchNote.java @@ -18,6 +18,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; @@ -278,24 +281,23 @@ public class ItemResearchNote extends ItemForestry { } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { - - if (world.isRemote) { - return itemstack; + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + if (worldIn.isRemote) { + return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); } - ResearchNote note = new ResearchNote(itemstack.getTagCompound()); - if (note.registerResults(world, entityplayer)) { - entityplayer.inventory.decrStackSize(entityplayer.inventory.currentItem, 1); + ResearchNote note = new ResearchNote(itemStackIn.getTagCompound()); + if (note.registerResults(worldIn, playerIn)) { + playerIn.inventory.decrStackSize(playerIn.inventory.currentItem, 1); // Notify player that his inventory has changed. - Proxies.net.inventoryChangeNotify(entityplayer); + Proxies.net.inventoryChangeNotify(playerIn); } - return itemstack; + return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } - @Override - public int getColorFromItemStack(ItemStack itemstack, int j) { - return 0xffe8a5; - } +// @Override +// public int getColorFromItemStack(ItemStack itemstack, int j) { +// return 0xffe8a5; +// } } diff --git a/src/main/java/forestry/core/gui/ContainerEntity.java b/src/main/java/forestry/core/gui/ContainerEntity.java index 389c09583..3ea60b4c9 100644 --- a/src/main/java/forestry/core/gui/ContainerEntity.java +++ b/src/main/java/forestry/core/gui/ContainerEntity.java @@ -69,7 +69,7 @@ public class ContainerEntity extends ContainerFor if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) { PacketErrorUpdateEntity packet = new PacketErrorUpdateEntity(entity, errorLogicSource); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } previousErrorStates = errorStates; @@ -81,7 +81,7 @@ public class ContainerEntity extends ContainerFor EnumAccess access = accessHandler.getAccess(); if (access != previousAccess) { IForestryPacketClient packet = new PacketAccessUpdateEntity(restrictedAccess, entity); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); previousAccess = access; } diff --git a/src/main/java/forestry/core/gui/ContainerForestry.java b/src/main/java/forestry/core/gui/ContainerForestry.java index d9918ea6d..22f0e93b7 100644 --- a/src/main/java/forestry/core/gui/ContainerForestry.java +++ b/src/main/java/forestry/core/gui/ContainerForestry.java @@ -18,7 +18,9 @@ import java.util.Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -57,29 +59,29 @@ public abstract class ContainerForestry extends Container { } @Override - public ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) { + public ItemStack slotClick(int slotId, int dragType_or_button, ClickType clickTypeIn, EntityPlayer player) { if (!canAccess(player)) { return null; } - if (modifier == 2 && button >= 0 && button < 9) { + if (clickTypeIn == ClickType.QUICK_MOVE && dragType_or_button >= 0 && dragType_or_button < 9) { // hotkey used to move item from slot to hotbar - int hotbarSlotIndex = 27 + button; + int hotbarSlotIndex = 27 + dragType_or_button; Slot hotbarSlot = getSlot(hotbarSlotIndex); if (hotbarSlot instanceof SlotLocked) { return null; } } - Slot slot = slotIndex < 0 ? null : getSlot(slotIndex); + Slot slot = slotId < 0 ? null : getSlot(slotId); if (slot instanceof SlotForestry) { SlotForestry slotForestry = (SlotForestry) slot; if (slotForestry.isPhantom()) { - return SlotUtil.slotClickPhantom(slotForestry, button, modifier, player); + return SlotUtil.slotClickPhantom(slotForestry, dragType_or_button, clickTypeIn, player); } } - return super.slotClick(slotIndex, button, modifier, player); + return super.slotClick(slotId, dragType_or_button, clickTypeIn, player); } @Override @@ -93,10 +95,10 @@ public abstract class ContainerForestry extends Container { protected abstract boolean canAccess(EntityPlayer player); - protected final void sendPacketToCrafters(IForestryPacketClient packet) { - for (Object crafter : crafters) { - if (crafter instanceof EntityPlayer) { - Proxies.net.sendToPlayer(packet, (EntityPlayer) crafter); + protected final void sendPacketToListeners(IForestryPacketClient packet) { + for (ICrafting listener : listeners) { + if (listener instanceof EntityPlayer) { + Proxies.net.sendToPlayer(packet, (EntityPlayer) listener); } } } diff --git a/src/main/java/forestry/core/gui/ContainerItemInventory.java b/src/main/java/forestry/core/gui/ContainerItemInventory.java index 4da8d8732..68e2c579d 100755 --- a/src/main/java/forestry/core/gui/ContainerItemInventory.java +++ b/src/main/java/forestry/core/gui/ContainerItemInventory.java @@ -12,6 +12,7 @@ package forestry.core.gui; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -50,8 +51,8 @@ public abstract class ContainerItemInventory extends Co } @Override - public final ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) { - ItemStack result = super.slotClick(slotIndex, button, modifier, player); + public ItemStack slotClick(int slotId, int dragType_or_button, ClickType clickTypeIn, EntityPlayer player) { + ItemStack result = super.slotClick(slotId, dragType_or_button, clickTypeIn, player); inventory.onSlotClick(player); return result; } diff --git a/src/main/java/forestry/core/gui/ContainerLiquidTanks.java b/src/main/java/forestry/core/gui/ContainerLiquidTanks.java index 8eb985277..8d2767e34 100755 --- a/src/main/java/forestry/core/gui/ContainerLiquidTanks.java +++ b/src/main/java/forestry/core/gui/ContainerLiquidTanks.java @@ -42,7 +42,7 @@ public abstract class ContainerLiquidTanks extends ContainerFores if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) { PacketErrorUpdate packet = new PacketErrorUpdate(tile, errorLogicSource); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } previousErrorStates = errorStates; @@ -90,7 +90,7 @@ public abstract class ContainerTile extends ContainerFores int energyManagerData = energyManager.toGuiInt(); if (energyManagerData != previousEnergyManagerData) { PacketGuiEnergy packet = new PacketGuiEnergy(windowId, energyManagerData); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); previousEnergyManagerData = energyManagerData; } @@ -102,7 +102,7 @@ public abstract class ContainerTile extends ContainerFores EnumAccess access = accessHandler.getAccess(); if (access != previousAccess) { IForestryPacketClient packet = new PacketAccessUpdate(restrictedAccess, tile); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); previousAccess = access; } @@ -127,7 +127,7 @@ public abstract class ContainerTile extends ContainerFores if (guiNeedsUpdate) { PacketGuiUpdate packet = new PacketGuiUpdate(tilePowered); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } } } diff --git a/src/main/java/forestry/core/gui/GuiEscritoire.java b/src/main/java/forestry/core/gui/GuiEscritoire.java index 6f8cebf74..cf56a5a7a 100755 --- a/src/main/java/forestry/core/gui/GuiEscritoire.java +++ b/src/main/java/forestry/core/gui/GuiEscritoire.java @@ -26,7 +26,7 @@ import forestry.core.tiles.TileEscritoire; import forestry.core.utils.Translator; public class GuiEscritoire extends GuiForestry { - private final ItemStack LEVEL_ITEM = new ItemStack(Items.paper); + private final ItemStack LEVEL_ITEM = new ItemStack(Items.PAPER); private final EscritoireTextSource textSource = new EscritoireTextSource(); public GuiEscritoire(EntityPlayer player, TileEscritoire tile) { diff --git a/src/main/java/forestry/core/gui/GuiHandler.java b/src/main/java/forestry/core/gui/GuiHandler.java index b4c87174e..fa9857582 100644 --- a/src/main/java/forestry/core/gui/GuiHandler.java +++ b/src/main/java/forestry/core/gui/GuiHandler.java @@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -76,11 +77,13 @@ public class GuiHandler implements IGuiHandler { switch (guiId.getGuiType()) { case Item: { - ItemStack heldItem = player.getCurrentEquippedItem(); - if (heldItem != null) { - Item item = heldItem.getItem(); - if (guiId.getGuiHandlerClass().isInstance(item)) { - return ((IGuiHandlerItem) item).getGui(player, heldItem, data); + for (EnumHand hand : EnumHand.values()) { + ItemStack heldItem = player.getHeldItem(hand); + if (heldItem != null) { + Item item = heldItem.getItem(); + if (guiId.getGuiHandlerClass().isInstance(item)) { + return ((IGuiHandlerItem) item).getGui(player, heldItem, data); + } } } break; @@ -114,11 +117,13 @@ public class GuiHandler implements IGuiHandler { switch (guiId.getGuiType()) { case Item: { - ItemStack heldItem = player.getCurrentEquippedItem(); - if (heldItem != null) { - Item item = heldItem.getItem(); - if (guiId.getGuiHandlerClass().isInstance(item)) { - return ((IGuiHandlerItem) item).getContainer(player, heldItem, data); + for (EnumHand hand : EnumHand.values()) { + ItemStack heldItem = player.getHeldItem(hand); + if (heldItem != null) { + Item item = heldItem.getItem(); + if (guiId.getGuiHandlerClass().isInstance(item)) { + return ((IGuiHandlerItem) item).getContainer(player, heldItem, data); + } } } break; diff --git a/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java b/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java index 468312c99..8ffa325b8 100644 --- a/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java +++ b/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java @@ -25,7 +25,7 @@ import forestry.core.tiles.EscritoireGame; import forestry.core.tiles.EscritoireGameToken; public class GameTokenWidget extends Widget { - private final ItemStack HIDDEN_TOKEN = new ItemStack(Items.book); + private final ItemStack HIDDEN_TOKEN = new ItemStack(Items.BOOK); private final EscritoireGame game; private final int index; diff --git a/src/main/java/forestry/core/inventory/filters/StandardStackFilters.java b/src/main/java/forestry/core/inventory/filters/StandardStackFilters.java index a046eaacf..f4d397f64 100644 --- a/src/main/java/forestry/core/inventory/filters/StandardStackFilters.java +++ b/src/main/java/forestry/core/inventory/filters/StandardStackFilters.java @@ -45,7 +45,7 @@ public enum StandardStackFilters implements IStackFilter { FEED { @Override public boolean apply(ItemStack stack) { - return stack.getItem() instanceof ItemFood || stack.getItem() == Items.wheat || stack.getItem() instanceof ItemSeeds; + return stack.getItem() instanceof ItemFood || stack.getItem() == Items.WHEAT || stack.getItem() instanceof ItemSeeds; } }; diff --git a/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java b/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java index e3d2c6883..8cc463908 100755 --- a/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java +++ b/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; /** * @author CovertJaguar diff --git a/src/main/java/forestry/core/items/ItemArmorNaturalist.java b/src/main/java/forestry/core/items/ItemArmorNaturalist.java index c730b02fb..1aa623a2b 100755 --- a/src/main/java/forestry/core/items/ItemArmorNaturalist.java +++ b/src/main/java/forestry/core/items/ItemArmorNaturalist.java @@ -12,6 +12,7 @@ package forestry.core.items; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -28,13 +29,13 @@ import forestry.core.config.Constants; public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist, IItemModelRegister { public ItemArmorNaturalist() { - super(ArmorMaterial.LEATHER, 0, 0); + super(ArmorMaterial.LEATHER, 0, EntityEquipmentSlot.HEAD); this.setMaxDamage(100); setCreativeTab(CreativeTabForestry.tabForestry); } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { return Constants.RESOURCE_ID + ":" + Constants.TEXTURE_NATURALIST_ARMOR_PRIMARY; } @@ -44,11 +45,6 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist, manager.registerItemModel(item, 0); } - @Override - public int getColorFromItemStack(ItemStack itemstack, int renderPass) { - return 0xffffff; - } - @Override public boolean hasColor(ItemStack itemstack) { return false; @@ -56,7 +52,7 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist, @Override public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) { - return armorType == 0; + return armorType == EntityEquipmentSlot.HEAD; } } diff --git a/src/main/java/forestry/core/items/ItemForestryTool.java b/src/main/java/forestry/core/items/ItemForestryTool.java index 901f11937..96f54a412 100755 --- a/src/main/java/forestry/core/items/ItemForestryTool.java +++ b/src/main/java/forestry/core/items/ItemForestryTool.java @@ -43,22 +43,22 @@ public class ItemForestryTool extends ItemForestry { } @Override - public float getDigSpeed(ItemStack itemstack, IBlockState state) { + public float getStrVsBlock(ItemStack itemstack, IBlockState state) { for (String type : getToolClasses(itemstack)) { if (state.getBlock().isToolEffective(type, state)) { return efficiencyOnProperMaterial; } } - return super.getDigSpeed(itemstack, state); + return super.getStrVsBlock(itemstack, state); } @SubscribeEvent public void onDestroyCurrentItem(PlayerDestroyItemEvent event) { - if (event.original == null || event.original.getItem() != this) { + if (event.getOriginal() == null || event.getOriginal().getItem() != this) { return; } - EntityPlayer player = event.entityPlayer; + EntityPlayer player = event.getEntityPlayer(); World world = player.worldObj; if (!world.isRemote && remnants != null) { @@ -67,9 +67,10 @@ public class ItemForestryTool extends ItemForestry { } @Override - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase player) { - if (block.getBlockHardness(world, pos) != 0) { - stack.damageItem(1, player); + public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { + Block block = state.getBlock(); + if (block.getBlockHardness(state, worldIn, pos) != 0) { + stack.damageItem(1, entityLiving); } return true; } diff --git a/src/main/java/forestry/core/items/ItemOverlay.java b/src/main/java/forestry/core/items/ItemOverlay.java index 39bff47dc..fc89dc75d 100755 --- a/src/main/java/forestry/core/items/ItemOverlay.java +++ b/src/main/java/forestry/core/items/ItemOverlay.java @@ -80,7 +80,6 @@ public class ItemOverlay extends ItemForestry { return super.getUnlocalizedName(stack) + "." + overlays[stack.getItemDamage()].getUid(); } - @Override public int getColorFromItemStack(ItemStack itemstack, int j) { IOverlayInfo overlayInfo = overlays[itemstack.getItemDamage()]; if (j == 0 || overlayInfo.getSecondaryColor() == 0) { diff --git a/src/main/java/forestry/core/items/ItemWithGui.java b/src/main/java/forestry/core/items/ItemWithGui.java index 2ceadba53..ba22dd57a 100644 --- a/src/main/java/forestry/core/items/ItemWithGui.java +++ b/src/main/java/forestry/core/items/ItemWithGui.java @@ -13,6 +13,9 @@ package forestry.core.items; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import forestry.core.gui.ContainerItemInventory; @@ -25,12 +28,12 @@ public abstract class ItemWithGui extends ItemForestry implements IGuiHandlerIte } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { - if (!world.isRemote) { - openGui(entityplayer); + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + if (!worldIn.isRemote) { + openGui(playerIn); } - return itemstack; + return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } protected void openGui(EntityPlayer entityplayer) { diff --git a/src/main/java/forestry/core/models/TRSRBakedModel.java b/src/main/java/forestry/core/models/TRSRBakedModel.java index 6b2352054..68d984bad 100644 --- a/src/main/java/forestry/core/models/TRSRBakedModel.java +++ b/src/main/java/forestry/core/models/TRSRBakedModel.java @@ -23,41 +23,43 @@ import javax.vecmath.Vector4f; import java.util.EnumMap; import java.util.List; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.IFlexibleBakedModel; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.client.model.pipeline.VertexTransformer; +import net.minecraftforge.common.model.TRSRTransformation; // for those wondering TRSR stands for Translation Rotation Scale Rotation -public class TRSRBakedModel implements IFlexibleBakedModel { +public class TRSRBakedModel implements IBakedModel { protected final ImmutableList general; protected final ImmutableMap> faces; - protected final IFlexibleBakedModel original; + protected final IBakedModel original; - public TRSRBakedModel(IFlexibleBakedModel original, float x, float y, float z, float scale) { + public TRSRBakedModel(IBakedModel original, float x, float y, float z, float scale) { this(original, x, y, z, 0, 0, 0, scale, scale, scale); } - public TRSRBakedModel(IFlexibleBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scale) { + public TRSRBakedModel(IBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scale) { this(original, x, y, z, rotX, rotY, rotZ, scale, scale, scale); } - public TRSRBakedModel(IFlexibleBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ) { + public TRSRBakedModel(IBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ) { this(original, new TRSRTransformation(new Vector3f(x, y, z), null, new Vector3f(scaleX, scaleY, scaleZ), TRSRTransformation.quatFromYXZ(rotY, rotX, rotZ))); } - public TRSRBakedModel(IFlexibleBakedModel original, TRSRTransformation transform) { + public TRSRBakedModel(IBakedModel original, TRSRTransformation transform) { this.original = original; ImmutableList.Builder builder; @@ -69,8 +71,8 @@ public class TRSRBakedModel implements IFlexibleBakedModel { EnumMap> faces = Maps.newEnumMap(EnumFacing.class); for (EnumFacing face : EnumFacing.values()) { if (!original.isBuiltInRenderer()) { - for (BakedQuad quad : original.getFaceQuads(face)) { - Transformer transformer = new Transformer(transform, original.getFormat()); + for (BakedQuad quad : original.getQuads(null, face, 0)) { + Transformer transformer = new Transformer(transform, quad.getFormat()); quad.pipe(transformer); builder.add(transformer.build()); } @@ -82,8 +84,8 @@ public class TRSRBakedModel implements IFlexibleBakedModel { // general quads //builder = ImmutableList.builder(); if (!original.isBuiltInRenderer()) { - for (BakedQuad quad : original.getGeneralQuads()) { - Transformer transformer = new Transformer(transform, original.getFormat()); + for (BakedQuad quad : original.getQuads(null, null, 0)) { + Transformer transformer = new Transformer(transform, quad.getFormat()); quad.pipe(transformer); builder.add(transformer.build()); } @@ -94,12 +96,10 @@ public class TRSRBakedModel implements IFlexibleBakedModel { } @Override - public List getFaceQuads(EnumFacing side) { - return faces.get(side); - } - - @Override - public List getGeneralQuads() { + public List getQuads(IBlockState state, EnumFacing side, long rand) { + if (side != null) { + return faces.get(side); + } return general; } @@ -129,8 +129,8 @@ public class TRSRBakedModel implements IFlexibleBakedModel { } @Override - public VertexFormat getFormat() { - return original.getFormat(); + public ItemOverrideList getOverrides() { + return null; } public static class Transformer extends VertexTransformer { diff --git a/src/main/java/forestry/core/multiblock/MultiblockEventHandler.java b/src/main/java/forestry/core/multiblock/MultiblockEventHandler.java index 9a7795606..b9a9a10e1 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockEventHandler.java +++ b/src/main/java/forestry/core/multiblock/MultiblockEventHandler.java @@ -18,13 +18,13 @@ public class MultiblockEventHandler { @SubscribeEvent(priority = EventPriority.NORMAL) public void onChunkLoad(ChunkEvent.Load loadEvent) { Chunk chunk = loadEvent.getChunk(); - World world = loadEvent.world; + World world = loadEvent.getWorld(); MultiblockRegistry.onChunkLoaded(world, chunk.xPosition, chunk.zPosition); } // Cleanup, for nice memory usageness @SubscribeEvent(priority = EventPriority.NORMAL) public void onWorldUnload(WorldEvent.Unload unloadWorldEvent) { - MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.world); + MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.getWorld()); } } diff --git a/src/main/java/forestry/core/proxy/ProxyNetwork.java b/src/main/java/forestry/core/proxy/ProxyNetwork.java index 5704863ef..861c1c02f 100755 --- a/src/main/java/forestry/core/proxy/ProxyNetwork.java +++ b/src/main/java/forestry/core/proxy/ProxyNetwork.java @@ -31,7 +31,7 @@ public class ProxyNetwork { } WorldServer worldServer = (WorldServer) world; - PlayerManager playerManager = worldServer.getPlayerManager(); + PlayerManager playerManager = worldServer.getPlayerChunkMap(); int chunkX = packet.getPos().getX() >> 4; int chunkZ = packet.getPos().getZ() >> 4; diff --git a/src/main/java/forestry/core/proxy/ProxyRender.java b/src/main/java/forestry/core/proxy/ProxyRender.java index 364a983d6..1dbd7e82a 100644 --- a/src/main/java/forestry/core/proxy/ProxyRender.java +++ b/src/main/java/forestry/core/proxy/ProxyRender.java @@ -45,6 +45,10 @@ public class ProxyRender { return false; } + public void initRendering() { + + } + @Nullable public TileEntitySpecialRenderer getRenderDefaultMachine(String gfxBase) { return null; @@ -103,9 +107,9 @@ public class ProxyRender { public void registerModels() { } - public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap parameters){ - return null; - } +// public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap parameters){ +// return null; +// } /* FX */ diff --git a/src/main/java/forestry/core/proxy/ProxyRenderClient.java b/src/main/java/forestry/core/proxy/ProxyRenderClient.java index 2cf35259c..4c1e60efa 100644 --- a/src/main/java/forestry/core/proxy/ProxyRenderClient.java +++ b/src/main/java/forestry/core/proxy/ProxyRenderClient.java @@ -25,6 +25,8 @@ import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.block.statemap.StateMapperBase; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -44,6 +46,7 @@ import net.minecraftforge.common.model.animation.IAnimationStateMachine; import forestry.apiculture.entities.EntityFXBee; import forestry.apiculture.render.ParticleRenderer; import forestry.apiculture.render.TextureHabitatLocator; +import forestry.core.PluginCore; import forestry.core.config.Config; import forestry.core.config.Constants; import forestry.core.entities.EntityFXHoneydust; @@ -52,6 +55,7 @@ import forestry.core.entities.EntityFXSmoke; import forestry.core.entities.EntityFXSnow; import forestry.core.fluids.Fluids; import forestry.core.items.ItemCrated; +import forestry.core.items.ItemOverlay; import forestry.core.models.BlockModelIndex; import forestry.core.models.ModelIndex; import forestry.core.models.ModelManager; @@ -147,6 +151,28 @@ public class ProxyRenderClient extends ProxyRender { // registerModel(new ModelIndex(modelLocation, new ModelCrate())); } + @Override + public void initRendering() { + Minecraft minecraft = Minecraft.getMinecraft(); + + ItemColors itemColors = minecraft.getItemColors(); + +// itemColors.registerItemColorHandler(new ItemOverlayColor(), +// PluginCore.items. +// ); + } + + private static class ItemOverlayColor implements IItemColor { + @Override + public int getColorFromItemstack(ItemStack stack, int tintIndex) { + Item item = stack.getItem(); + if (item instanceof ItemOverlay) { + return ((ItemOverlay) item).getColorFromItemStack(stack, tintIndex); + } + return 0xffffff; + } + } + @Override public void registerFluidStateMapper(Block block, final Fluids forestryFluid) { final ModelResourceLocation fluidLocation = new ModelResourceLocation("forestry:blockforestryfluid", @@ -167,10 +193,10 @@ public class ProxyRenderClient extends ProxyRender { ModelManager.registerModels(); } - @Override - public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap parameters){ - return Animation.INSTANCE.load(location, parameters); - } +// @Override +// public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap parameters){ +// return Animation.INSTANCE.load(location, parameters); +// } private static boolean shouldSpawnParticle(World world) { if (!Config.enableParticleFX) { diff --git a/src/main/java/forestry/core/render/MachineParticleCallback.java b/src/main/java/forestry/core/render/MachineParticleCallback.java index d63c49f70..43053fc3b 100644 --- a/src/main/java/forestry/core/render/MachineParticleCallback.java +++ b/src/main/java/forestry/core/render/MachineParticleCallback.java @@ -12,12 +12,16 @@ package forestry.core.render; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityDiggingFX; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.math.BlockPos; import net.minecraft.util.IStringSerializable; import forestry.core.blocks.BlockBase; import forestry.core.blocks.IBlockType; +import forestry.core.blocks.IMachineProperties; import forestry.core.blocks.IMachinePropertiesTesr; import forestry.core.proxy.Proxies; @@ -32,9 +36,15 @@ public class MachineParticleCallback

& IBlockType & IStringSer @Override protected void setTexture(EntityDiggingFX fx, BlockPos pos, IBlockState state) { - P protety = state.getValue(TYPE); - if(protety.getMachineProperties() instanceof IMachinePropertiesTesr){ - fx.setParticleIcon(Proxies.common.getClientInstance().getTextureMapBlocks().getAtlasSprite(((IMachinePropertiesTesr)protety.getMachineProperties()).getParticleTextureLocation())); + P property = state.getValue(TYPE); + IMachineProperties machineProperties = property.getMachineProperties(); + if(machineProperties instanceof IMachinePropertiesTesr){ + Minecraft minecraft = Proxies.common.getClientInstance(); + TextureMap textureMapBlocks = minecraft.getTextureMapBlocks(); + IMachinePropertiesTesr machinePropertiesTesr = (IMachinePropertiesTesr) machineProperties; + String particleTextureLocation = machinePropertiesTesr.getParticleTextureLocation(); + TextureAtlasSprite particleTexture = textureMapBlocks.getAtlasSprite(particleTextureLocation); + fx.setParticleTexture(particleTexture); } } diff --git a/src/main/java/forestry/core/render/ParticleHelper.java b/src/main/java/forestry/core/render/ParticleHelper.java index b5c520cb3..ab2929ed5 100644 --- a/src/main/java/forestry/core/render/ParticleHelper.java +++ b/src/main/java/forestry/core/render/ParticleHelper.java @@ -14,8 +14,14 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityDiggingFX; +import net.minecraft.client.renderer.BlockModelShapes; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; @@ -35,42 +41,45 @@ public class ParticleHelper { private static final Random rand = new Random(); @SideOnly(Side.CLIENT) - public static boolean addHitEffects(World world, Block block, RayTraceResult target, EffectRenderer effectRenderer, Callback callback) { - int x = target.getBlockPos().getX(); - int y = target.getBlockPos().getY(); - int z = target.getBlockPos().getZ(); + public static boolean addBlockHitEffects(World world, BlockPos pos, EnumFacing side, EffectRenderer effectRenderer, Callback callback) { + IBlockState iblockstate = world.getBlockState(pos); + if(iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) { + int x = pos.getX(); + int y = pos.getY(); + int z = pos.getZ(); + float f = 0.1F; + AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(world, pos); + double px = (double)x + world.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - (double)(f * 2.0F)) + (double)f + axisalignedbb.minX; + double py = (double)y + world.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - (double)(f * 2.0F)) + (double)f + axisalignedbb.minY; + double pz = (double)z + world.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - (double)(f * 2.0F)) + (double)f + axisalignedbb.minZ; + if(side == EnumFacing.DOWN) { + py = (double)y + axisalignedbb.minY - (double)f; + } - EnumFacing sideHit = target.sideHit; - - IBlockState state = world.getBlockState(target.getBlockPos()); + if(side == EnumFacing.UP) { + py = (double)y + axisalignedbb.maxY + (double)f; + } - if (block != state.getBlock()) { - return true; + if(side == EnumFacing.NORTH) { + pz = (double)z + axisalignedbb.minZ - (double)f; + } + + if(side == EnumFacing.SOUTH) { + pz = (double)z + axisalignedbb.maxZ + (double)f; + } + + if(side == EnumFacing.WEST) { + px = (double)x + axisalignedbb.minX - (double)f; + } + + if(side == EnumFacing.EAST) { + px = (double)x + axisalignedbb.maxX + (double)f; + } + + EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(iblockstate)); + callback.addHitEffects(fx, pos, iblockstate); + effectRenderer.addEffect(fx.setBlockPos(new BlockPos(x, y, z)).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); } - - float b = 0.1F; - double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - b * 2.0F) + b + block.getBlockBoundsMinX(); - double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - b * 2.0F) + b + block.getBlockBoundsMinY(); - double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - b * 2.0F) + b + block.getBlockBoundsMinZ(); - - if (sideHit == EnumFacing.DOWN) { - py = y + block.getBlockBoundsMinY() - b; - } else if (sideHit == EnumFacing.UP) { - py = y + block.getBlockBoundsMaxY() + b; - } else if (sideHit == EnumFacing.NORTH) { - pz = z + block.getBlockBoundsMinZ() - b; - } else if (sideHit == EnumFacing.SOUTH) { - pz = z + block.getBlockBoundsMaxZ() + b; - } else if (sideHit == EnumFacing.WEST) { - px = x + block.getBlockBoundsMinX() - b; - } else if (sideHit == EnumFacing.EAST) { - px = x + block.getBlockBoundsMaxX() + b; - } - - EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(state)); - callback.addHitEffects(fx, target.getBlockPos(), state); - effectRenderer.addEffect(fx.setBlockPos(new BlockPos(x, y, z)).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); - return true; } @@ -138,7 +147,11 @@ public class ParticleHelper { @SideOnly(Side.CLIENT) protected void setTexture(EntityDiggingFX fx, BlockPos pos, IBlockState state) { - fx.setParticleIcon(Proxies.common.getClientInstance().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state)); + Minecraft minecraft = Proxies.common.getClientInstance(); + BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher(); + BlockModelShapes blockModelShapes = blockRendererDispatcher.getBlockModelShapes(); + TextureAtlasSprite texture = blockModelShapes.getTexture(state); + fx.setParticleTexture(texture); } } } diff --git a/src/main/java/forestry/core/tiles/TileAnalyzer.java b/src/main/java/forestry/core/tiles/TileAnalyzer.java index ce39dd4e5..3cfde76fe 100644 --- a/src/main/java/forestry/core/tiles/TileAnalyzer.java +++ b/src/main/java/forestry/core/tiles/TileAnalyzer.java @@ -162,7 +162,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui public void handleItemStackForDisplay(ItemStack itemStack) { if (!ItemStack.areItemStacksEqual(itemStack, individualOnDisplayClient)) { individualOnDisplayClient = itemStack; - worldObj.markBlockForUpdate(getPos()); + worldObj.markBlockRangeForRenderUpdate(getPos(), getPos()); } } diff --git a/src/main/java/forestry/core/tiles/TileEngine.java b/src/main/java/forestry/core/tiles/TileEngine.java index b8c86c141..96105ba4f 100644 --- a/src/main/java/forestry/core/tiles/TileEngine.java +++ b/src/main/java/forestry/core/tiles/TileEngine.java @@ -307,8 +307,10 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection, } /* SMP GUI */ + @Deprecated //use packets public abstract void getGUINetworkData(int i, int j); + @Deprecated //use packets public abstract void sendGUINetworkData(Container containerEngine, ICrafting iCrafting); @Override diff --git a/src/main/java/forestry/core/tiles/TileForestry.java b/src/main/java/forestry/core/tiles/TileForestry.java index f7d426c79..95d0e7636 100644 --- a/src/main/java/forestry/core/tiles/TileForestry.java +++ b/src/main/java/forestry/core/tiles/TileForestry.java @@ -397,9 +397,9 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE @Override public T getCapability(Capability capability, EnumFacing facing) { - if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && inventory != null){ - //noinspection unchecked - return (T) new SidedInvWrapper(inventory, facing); + if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && inventory != null){ + SidedInvWrapper sidedInvWrapper = new SidedInvWrapper(inventory, facing); + return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(sidedInvWrapper); } return super.getCapability(capability, facing); } diff --git a/src/main/java/forestry/core/tiles/TileNaturalistChest.java b/src/main/java/forestry/core/tiles/TileNaturalistChest.java index f6c119020..3005c423c 100644 --- a/src/main/java/forestry/core/tiles/TileNaturalistChest.java +++ b/src/main/java/forestry/core/tiles/TileNaturalistChest.java @@ -13,6 +13,8 @@ package forestry.core.tiles; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import forestry.api.genetics.ISpeciesRoot; @@ -87,7 +89,7 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve } private void playLidSound(String sound) { - worldObj.playSoundEffect(getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, sound, 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F); + this.worldObj.playSound((EntityPlayer)null, getPos(), SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } @Override diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index ea8d188cf..c0b86c2a3 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -297,7 +297,7 @@ public abstract class BlockUtil { } public static boolean canReplace(IBlockState blockState, World world, BlockPos pos) { - Block block = getBlock(world, pos); + Block block = blockState.getBlock(); Material material = block.getMaterial(blockState); return material.isReplaceable() && block.isReplaceable(world, pos) && !material.isLiquid() || block.isAir(blockState, world, pos) || material == Material.PLANTS; } diff --git a/src/main/java/forestry/core/utils/GeneticsUtil.java b/src/main/java/forestry/core/utils/GeneticsUtil.java index a86576cf5..29f569eda 100644 --- a/src/main/java/forestry/core/utils/GeneticsUtil.java +++ b/src/main/java/forestry/core/utils/GeneticsUtil.java @@ -150,7 +150,7 @@ public class GeneticsUtil { if (block == Blocks.leaves2) { meta = meta + 4; //Dark Oak and Acacia are their own leaf block, but added on the end of sapling } - block = Blocks.sapling; + block = Blocks.SAPLING; } ItemStack itemStack = new ItemStack(block, 1, meta); IIndividual tree = getGeneticEquivalent(itemStack); diff --git a/src/main/java/forestry/core/utils/SlotUtil.java b/src/main/java/forestry/core/utils/SlotUtil.java index 9c1239374..be2311e66 100644 --- a/src/main/java/forestry/core/utils/SlotUtil.java +++ b/src/main/java/forestry/core/utils/SlotUtil.java @@ -14,6 +14,7 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; @@ -26,7 +27,7 @@ public abstract class SlotUtil { return slotIndex >= start && slotIndex < start + count; } - public static ItemStack slotClickPhantom(SlotForestry slot, int mouseButton, int modifier, EntityPlayer player) { + public static ItemStack slotClickPhantom(SlotForestry slot, int mouseButton, ClickType clickTypeIn, EntityPlayer player) { ItemStack stack = null; ItemStack stackSlot = slot.getStack(); @@ -46,10 +47,10 @@ public abstract class SlotUtil { fillPhantomSlot(slot, stackHeld, mouseButton); } } else if (stackHeld == null) { - adjustPhantomSlot(slot, mouseButton, modifier); + adjustPhantomSlot(slot, mouseButton, clickTypeIn); } else if (slot.isItemValid(stackHeld)) { if (ItemStackUtil.isIdenticalItem(stackSlot, stackHeld)) { - adjustPhantomSlot(slot, mouseButton, modifier); + adjustPhantomSlot(slot, mouseButton, clickTypeIn); } else { fillPhantomSlot(slot, stackHeld, mouseButton); } @@ -116,13 +117,13 @@ public abstract class SlotUtil { } } - private static void adjustPhantomSlot(SlotForestry slot, int mouseButton, int modifier) { + private static void adjustPhantomSlot(SlotForestry slot, int mouseButton, ClickType clickTypeIn) { if (!slot.canAdjustPhantom()) { return; } ItemStack stackSlot = slot.getStack(); int stackSize; - if (modifier == 1) { + if (clickTypeIn == ClickType.QUICK_MOVE) { stackSize = mouseButton == 0 ? (stackSlot.stackSize + 1) / 2 : stackSlot.stackSize * 2; } else { stackSize = mouseButton == 0 ? stackSlot.stackSize - 1 : stackSlot.stackSize + 1; diff --git a/src/main/java/forestry/core/utils/vect/VectUtil.java b/src/main/java/forestry/core/utils/vect/VectUtil.java index 8247dfcdb..bdccc1255 100644 --- a/src/main/java/forestry/core/utils/vect/VectUtil.java +++ b/src/main/java/forestry/core/utils/vect/VectUtil.java @@ -14,43 +14,44 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @Deprecated public final class VectUtil { @Deprecated - public static boolean isAirBlock(World world, IVect position) { + public static boolean isAirBlock(World world, BlockPos position) { return world.isAirBlock(position); } @Deprecated - public static boolean isWoodBlock(World world, IVect position) { + public static boolean isWoodBlock(World world, BlockPos position) { Block block = getBlock(world, position); return block.isWood(world, position); } @Deprecated - public static TileEntity getTile(World world, IVect position) { + public static TileEntity getTile(World world, BlockPos position) { return world.getTileEntity(position); } @Deprecated - public static IBlockState getBlockState(World world, IVect position) { + public static IBlockState getBlockState(World world, BlockPos position) { return world.getBlockState(position); } @Deprecated - public static Block getBlock(World world, IVect position) { + public static Block getBlock(World world, BlockPos position) { return getBlockState(world, position).getBlock(); } @Deprecated - public static int getBlockMeta(World world, IVect position) { + public static int getBlockMeta(World world, BlockPos position) { return getBlock(world, position).getMetaFromState(getBlockState(world, position)); } @Deprecated - public static ItemStack getAsItemStack(World world, IVect position) { + public static ItemStack getAsItemStack(World world, BlockPos position) { return new ItemStack(getBlock(world, position), 1, getBlockMeta(world, position)); } } diff --git a/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java b/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java index 7fa756d32..e8f615167 100644 --- a/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java +++ b/src/main/java/forestry/energy/gui/ContainerEngineBiogas.java @@ -37,7 +37,7 @@ public class ContainerEngineBiogas extends ContainerLiquidTanks { public void detectAndSendChanges() { super.detectAndSendChanges(); - for (ICrafting crafter : crafters) { + for (ICrafting crafter : listeners) { tile.sendGUINetworkData(this, crafter); } } diff --git a/src/main/java/forestry/factory/PluginFactory.java b/src/main/java/forestry/factory/PluginFactory.java index 408c8ca5f..c0a804b03 100644 --- a/src/main/java/forestry/factory/PluginFactory.java +++ b/src/main/java/forestry/factory/PluginFactory.java @@ -135,7 +135,7 @@ public class PluginFactory extends BlankForestryPlugin { FuelManager.fermenterFuel.put(mulch, new FermenterFuel(mulch, valueCompost, cyclesCompost)); // Add moistener resources - ItemStack wheat = new ItemStack(Items.wheat); + ItemStack wheat = new ItemStack(Items.WHEAT); ItemStack mouldyWheat = coreItems.mouldyWheat.getItemStack(); ItemStack decayingWheat = coreItems.decayingWheat.getItemStack(); FuelManager.moistenerResource.put(wheat, new MoistenerFuel(wheat, mouldyWheat, 0, 300)); @@ -221,17 +221,17 @@ public class PluginFactory extends BlankForestryPlugin { RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.DIAMOND, 4), new Object[]{ " X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemDiamond"}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.OBSIDIAN, 4), new Object[]{ - " X ", "#X#", "XXX", '#', "dustRedstone", 'X', Blocks.obsidian}); + " X ", "#X#", "XXX", '#', "dustRedstone", 'X', Blocks.OBSIDIAN}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.BLAZE, 4), new Object[]{ - " X ", "#X#", "XXX", '#', "dustRedstone", 'X', Items.blaze_powder}); + " X ", "#X#", "XXX", '#', "dustRedstone", 'X', Items.BLAZE_POWDER}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.EMERALD, 4), new Object[]{ " X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemEmerald"}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.APATITE, 4), new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemApatite"}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.LAPIS, 4), - new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', new ItemStack(Items.dye, 1, 4)}); + new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', new ItemStack(Items.DYE, 1, 4)}); RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.ENDER, 4), - new Object[]{" X ", "#X#", "XXX", '#', new ItemStack(Items.ender_eye, 1, 0), 'X', new ItemStack(Blocks.end_stone, 1, 0)}); + new Object[]{" X ", "#X#", "XXX", '#', new ItemStack(Items.ENDER_EYE, 1, 0), 'X', new ItemStack(Blocks.END_STONE, 1, 0)}); String[] dyes = {"dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite"}; @@ -241,12 +241,12 @@ public class PluginFactory extends BlankForestryPlugin { FluidStack liquidGlass = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME); FluidStack liquidGlassX4 = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME * 4); for (int i = 0; i < 16; i++) { - RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlass, new ItemStack(Blocks.stained_glass, 4, 15 - i), new Object[]{ + RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlass, new ItemStack(Blocks.STAINED_GLASS, 4, 15 - i), new Object[]{ "#", "X", '#', dyes[i], 'X', beeItems.propolis.getWildcard()}); } - RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.glass, 1, 0), new Object[]{ + RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.GLASS, 1, 0), new Object[]{ "#", "X", 'X', beeItems.propolis.getWildcard()}); } @@ -254,52 +254,52 @@ public class PluginFactory extends BlankForestryPlugin { // / SQUEEZER int appleMulchAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple"); int appleJuiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple"); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.apple)}, Fluids.JUICE.getFluid(appleJuiceAmount), + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.APPLE)}, Fluids.JUICE.getFluid(appleJuiceAmount), PluginCore.items.mulch.getItemStack(), appleMulchAmount); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.carrot)}, Fluids.JUICE.getFluid(appleJuiceAmount), + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.CARROT)}, Fluids.JUICE.getFluid(appleJuiceAmount), PluginCore.items.mulch.getItemStack(), appleMulchAmount); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.carrot)}, Fluids.JUICE.getFluid(appleJuiceAmount), + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.CARROT)}, Fluids.JUICE.getFluid(appleJuiceAmount), PluginCore.items.mulch.getItemStack(), appleMulchAmount); int seedOilAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed"); FluidStack seedOil = Fluids.SEED_OIL.getFluid(seedOilAmount); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.wheat_seeds)}, seedOil); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.pumpkin_seeds)}, seedOil); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.melon_seeds)}, seedOil); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{PluginCore.items.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone)}, Fluids.LAVA.getFluid(1600)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.cactus)}, Fluids.WATER.getFluid(500)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.snowball), PluginCore.items.craftingMaterial.getIceShard(4)}, Fluids.ICE.getFluid(4000)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.WHEAT_SEEDS)}, seedOil); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.PUMPKIN_SEEDS)}, seedOil); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.MELON_SEEDS)}, seedOil); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{PluginCore.items.phosphor.getItemStack(2), new ItemStack(Blocks.COBBLESTONE)}, Fluids.LAVA.getFluid(1600)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.CACTUS)}, Fluids.WATER.getFluid(500)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.SNOWBALL), PluginCore.items.craftingMaterial.getIceShard(4)}, Fluids.ICE.getFluid(4000)); // STILL RecipeManagers.stillManager.addRecipe(Constants.STILL_DESTILLATION_DURATION, Fluids.BIOMASS.getFluid(Constants.STILL_DESTILLATION_INPUT), Fluids.BIO_ETHANOL.getFluid(Constants.STILL_DESTILLATION_OUTPUT)); // MOISTENER - RecipeManagers.moistenerManager.addRecipe(new ItemStack(Items.wheat_seeds), new ItemStack(Blocks.mycelium), 5000); - RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone), 20000); - RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stonebrick, 1, 1), 20000); + RecipeManagers.moistenerManager.addRecipe(new ItemStack(Items.WHEAT_SEEDS), new ItemStack(Blocks.MYCELIUM), 5000); + RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.MOSSY_COBBLESTONE), 20000); + RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.STONEBRICK), new ItemStack(Blocks.STONEBRICK, 1, 1), 20000); // FERMENTER for (int i = 0; i < 6; i++) { - RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.sapling, 1, i), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.SAPLING, 1, i), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS); } - RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.cactus), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS); - RecipeUtil.addFermenterRecipes(new ItemStack(Items.wheat), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); - RecipeUtil.addFermenterRecipes(new ItemStack(Items.potato), 2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); - RecipeUtil.addFermenterRecipes(new ItemStack(Items.reeds), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS); - RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.brown_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS); - RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.red_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.CACTUS), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Items.WHEAT), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Items.POTATO), 2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Items.REEDS), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.BROWN_MUSHROOM), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS); + RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.RED_MUSHROOM), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS); // FABRICATOR - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.glass), Fluids.GLASS.getFluid(1000), 1000); - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.glass_pane), Fluids.GLASS.getFluid(375), 1000); - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sand), Fluids.GLASS.getFluid(1000), 3000); - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sand, 1, 1), Fluids.GLASS.getFluid(1000), 3000); - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone), Fluids.GLASS.getFluid(4000), 4800); - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone, 1, 1), Fluids.GLASS.getFluid(4000), 4800); - RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone, 1, 2), Fluids.GLASS.getFluid(4000), 4800); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.GLASS), Fluids.GLASS.getFluid(1000), 1000); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.GLASS_PANE), Fluids.GLASS.getFluid(375), 1000); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SAND), Fluids.GLASS.getFluid(1000), 3000); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SAND, 1, 1), Fluids.GLASS.getFluid(1000), 3000); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SANDSTONE), Fluids.GLASS.getFluid(4000), 4800); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SANDSTONE, 1, 1), Fluids.GLASS.getFluid(4000), 4800); + RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SANDSTONE, 1, 2), Fluids.GLASS.getFluid(4000), 4800); // / CARPENTER RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEED_OIL.getFluid(250), null, PluginCore.items.impregnatedCasing.getItemStack(), @@ -325,7 +325,7 @@ public class PluginFactory extends BlankForestryPlugin { "#", '#', "logWood"); RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(250), null, - new ItemStack(Items.paper, 1), + new ItemStack(Items.PAPER, 1), "#", "#", '#', "pulpWood"); @@ -334,13 +334,13 @@ public class PluginFactory extends BlankForestryPlugin { "###", "#X#", "###", - '#', Blocks.dirt, + '#', Blocks.DIRT, 'X', PluginCore.items.mulch); RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, 8), "#X#", "XYX", "#X#", - '#', Blocks.dirt, + '#', Blocks.DIRT, 'X', "sand", 'Y', PluginCore.items.mulch); RecipeManagers.carpenterManager.addRecipe(75, Fluids.WATER.getFluid(5000), null, PluginCore.items.hardenedCasing.getItemStack(), @@ -371,7 +371,7 @@ public class PluginFactory extends BlankForestryPlugin { "#Y#", "X#X", '#', beeItems.pollenCluster.getWildcard(), - 'X', Items.gunpowder, + 'X', Items.GUNPOWDER, 'Y', PluginFluids.items.canEmpty, 'Z', beeItems.honeyDrop); RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.items.craftingMaterial.getDissipationCharge(), @@ -379,13 +379,13 @@ public class PluginFactory extends BlankForestryPlugin { "#Y#", "X#X", '#', beeItems.royalJelly, - 'X', Items.gunpowder, + 'X', Items.GUNPOWDER, 'Y', PluginFluids.items.canEmpty, 'Z', beeItems.honeydew); } // Ender pearl - RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), " # ", "###", " # ", '#', + RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ENDER_PEARL, 1), " # ", "###", " # ", '#', PluginCore.items.craftingMaterial.getPulsatingMesh()); // Woven Silk @@ -511,7 +511,7 @@ public class PluginFactory extends BlankForestryPlugin { "B", "W", "C", - 'B', Items.book, + 'B', Items.BOOK, 'W', "craftingTableWood", 'C', "chestWood"); } diff --git a/src/main/java/forestry/factory/gui/ContainerCarpenter.java b/src/main/java/forestry/factory/gui/ContainerCarpenter.java index 3ab09b7b1..c9791ab4d 100755 --- a/src/main/java/forestry/factory/gui/ContainerCarpenter.java +++ b/src/main/java/forestry/factory/gui/ContainerCarpenter.java @@ -73,7 +73,7 @@ public class ContainerCarpenter extends ContainerLiquidTanks impl oldCraftPreview = newCraftPreview; PacketItemStackDisplay packet = new PacketItemStackDisplay(tile, newCraftPreview); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } } diff --git a/src/main/java/forestry/factory/gui/ContainerWorktable.java b/src/main/java/forestry/factory/gui/ContainerWorktable.java index 1d326d777..285d8b792 100755 --- a/src/main/java/forestry/factory/gui/ContainerWorktable.java +++ b/src/main/java/forestry/factory/gui/ContainerWorktable.java @@ -72,14 +72,14 @@ public class ContainerWorktable extends ContainerTile implements if (craftMatrixChanged) { craftMatrixChanged = false; tile.setCurrentRecipe(craftMatrix); - sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile)); + sendPacketToListeners(new PacketWorktableRecipeUpdate(tile)); } super.detectAndSendChanges(); if (lastMemoryUpdate != tile.getMemory().getLastUpdate()) { lastMemoryUpdate = tile.getMemory().getLastUpdate(); - sendPacketToCrafters(new PacketWorktableMemoryUpdate(tile)); + sendPacketToListeners(new PacketWorktableMemoryUpdate(tile)); } } @@ -130,13 +130,13 @@ public class ContainerWorktable extends ContainerTile implements case -1: { // clicked clear button tile.clearCraftMatrix(); updateCraftMatrix(); - sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile)); + sendPacketToListeners(new PacketWorktableRecipeUpdate(tile)); break; } case 0: { // clicked a memorized recipe tile.chooseRecipeMemory(secondary); updateCraftMatrix(); - sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile)); + sendPacketToListeners(new PacketWorktableRecipeUpdate(tile)); break; } case 1: { // right clicked a memorized recipe @@ -147,12 +147,12 @@ public class ContainerWorktable extends ContainerTile implements } case 100: { // clicked previous recipe conflict button tile.choosePreviousConflictRecipe(); - sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile)); + sendPacketToListeners(new PacketWorktableRecipeUpdate(tile)); break; } case 101: { // clicked next recipe conflict button tile.chooseNextConflictRecipe(); - sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile)); + sendPacketToListeners(new PacketWorktableRecipeUpdate(tile)); break; } } diff --git a/src/main/java/forestry/factory/tiles/TileMillRainmaker.java b/src/main/java/forestry/factory/tiles/TileMillRainmaker.java index c593cd7e8..685bbbac5 100644 --- a/src/main/java/forestry/factory/tiles/TileMillRainmaker.java +++ b/src/main/java/forestry/factory/tiles/TileMillRainmaker.java @@ -11,7 +11,10 @@ package forestry.factory.tiles; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.SoundCategory; import forestry.api.fuels.FuelManager; import forestry.api.fuels.RainSubstrate; @@ -30,21 +33,21 @@ public class TileMillRainmaker extends TileMill { } @Override - public void openGui(EntityPlayer player) { + public void openGui(EntityPlayer player, ItemStack heldItem) { if (player.worldObj.isRemote) { return; } - if (player.inventory.getCurrentItem() == null) { + if (heldItem == null) { return; } // We don't have a gui, but we can be activated - if (FuelManager.rainSubstrate.containsKey(player.inventory.getCurrentItem()) && charge == 0) { - RainSubstrate substrate = FuelManager.rainSubstrate.get(player.inventory.getCurrentItem()); - if (substrate.getItem().isItemEqual(player.inventory.getCurrentItem())) { + if (FuelManager.rainSubstrate.containsKey(heldItem) && charge == 0) { + RainSubstrate substrate = FuelManager.rainSubstrate.get(heldItem); + if (substrate.getItem().isItemEqual(heldItem)) { addCharge(substrate); - player.inventory.getCurrentItem().stackSize--; + heldItem.stackSize--; } } sendNetworkUpdate(); @@ -83,8 +86,7 @@ public class TileMillRainmaker extends TileMill { @Override public void activate() { if (Proxies.render.hasRendering()) { - worldObj.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "ambient.weather.thunder", 4F, - (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + worldObj.playSound((EntityPlayer)null, getPos(), SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + worldObj.rand.nextFloat() * 0.2F); float f = getPos().getX() + 0.5F; float f1 = getPos().getY() + 0.0F + worldObj.rand.nextFloat() * 6F / 16F; diff --git a/src/main/java/forestry/factory/tiles/TileWorktable.java b/src/main/java/forestry/factory/tiles/TileWorktable.java index 1e2dc62b7..cd88f15ae 100644 --- a/src/main/java/forestry/factory/tiles/TileWorktable.java +++ b/src/main/java/forestry/factory/tiles/TileWorktable.java @@ -18,6 +18,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; @@ -165,7 +166,7 @@ public class TileWorktable extends TileBase implements ICrafterWorktable { ItemStack container = null; if (itemStack.getItem().hasContainerItem(itemStack)) { - container = itemStack.getItem().getContainerItem(itemStack); + container = ForgeHooks.getContainerItem(itemStack); } else if (itemStack.stackSize > 1) { // TerraFirmaCraft's crafting event handler does some tricky stuff with its tools. // It sets the tool's stack size to 2 instead of using a container. @@ -177,13 +178,8 @@ public class TileWorktable extends TileBase implements ICrafterWorktable { continue; } - if (container != null && container.isItemStackDamageable() && container.getItemDamage() > container.getMaxDamage()) { - MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, container)); - continue; - } - if (!InventoryUtil.tryAddStack(this, container, true)) { - player.dropPlayerItemWithRandomChoice(container, false); + player.dropItem(container, false); } } diff --git a/src/main/java/forestry/farming/FarmHelper.java b/src/main/java/forestry/farming/FarmHelper.java index 66ed57ab7..89bfc5c5d 100755 --- a/src/main/java/forestry/farming/FarmHelper.java +++ b/src/main/java/forestry/farming/FarmHelper.java @@ -26,11 +26,11 @@ import forestry.core.utils.vect.VectUtil; public class FarmHelper { public static final ImmutableSet bricks = ImmutableSet.of( - Blocks.brick_block, - Blocks.stonebrick, - Blocks.sandstone, - Blocks.nether_brick, - Blocks.quartz_block + Blocks.BRICK_BLOCK, + Blocks.STONEBRICK, + Blocks.SANDSTONE, + Blocks.NETHER_BRICK, + Blocks.QUARTZ_BLOCK ); private static FarmDirection getOpposite(FarmDirection farmDirection) { diff --git a/src/main/java/forestry/farming/PluginFarming.java b/src/main/java/forestry/farming/PluginFarming.java index 4811d719e..b757d46a0 100644 --- a/src/main/java/forestry/farming/PluginFarming.java +++ b/src/main/java/forestry/farming/PluginFarming.java @@ -113,16 +113,16 @@ public class PluginFarming extends BlankForestryPlugin { Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.carrots, 7)); Farmables.farmables.put("farmShroom", new ArrayList<>()); - Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.brown_mushroom, 0)); - Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.red_mushroom, 0)); + Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.BROWN_MUSHROOM, 0)); + Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.RED_MUSHROOM, 0)); Farmables.farmables.put("farmWheat", new ArrayList<>()); - Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7)); + Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.wheat, 7)); Farmables.farmables.put("farmGourd", new ArrayList<>()); Farmables.farmables.get("farmGourd").add( - new FarmableGourd(new ItemStack(Items.pumpkin_seeds), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin))); - Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.melon_seeds), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block))); + new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin))); + Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.MELON_SEEDS), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block))); Farmables.farmables.put("farmInfernal", new ArrayList<>()); Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3)); @@ -131,11 +131,11 @@ public class PluginFarming extends BlankForestryPlugin { Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3, 0)); Farmables.farmables.put("farmSucculentes", new ArrayList<>()); - Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3, 0)); + Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.CACTUS, 3, 0)); Farmables.farmables.put("farmVegetables", new ArrayList<>()); - Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7)); - Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7)); + Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.POTATO), Blocks.potatoes, 7)); + Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.CARROT), Blocks.carrots, 7)); proxy.initializeModels(); diff --git a/src/main/java/forestry/farming/blocks/BlockFarm.java b/src/main/java/forestry/farming/blocks/BlockFarm.java index 5557a1728..6c4b2b4a0 100644 --- a/src/main/java/forestry/farming/blocks/BlockFarm.java +++ b/src/main/java/forestry/farming/blocks/BlockFarm.java @@ -128,9 +128,9 @@ public class BlockFarm extends BlockStructure { TileFarm tile = (TileFarm) world.getTileEntity(pos); tile.setFarmBlockTexture(EnumFarmBlockTexture.getFromCompound(stack.getTagCompound())); } - + @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (!world.isRemote && canHarvestBlock(world, pos, player)) { List drops = getDrops(world, pos, BlockUtil.getBlockState(world, pos), 0); for (ItemStack drop : drops) { diff --git a/src/main/java/forestry/farming/gui/ContainerFarm.java b/src/main/java/forestry/farming/gui/ContainerFarm.java index fcdd49851..13d34e3a9 100755 --- a/src/main/java/forestry/farming/gui/ContainerFarm.java +++ b/src/main/java/forestry/farming/gui/ContainerFarm.java @@ -64,7 +64,7 @@ public class ContainerFarm extends ContainerSocketed { public void detectAndSendChanges() { super.detectAndSendChanges(); PacketGuiUpdate packet = new PacketGuiUpdate(tile); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } public IFluidTank getTank(int slot) { diff --git a/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java b/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java index 51c68a134..04a640782 100644 --- a/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java +++ b/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java @@ -56,7 +56,7 @@ public class CropBasicGrowthCraft extends Crop { } if (isRice) { - world.setBlockState(pos.add(0, -1, 0), block.getStateFromMeta(7), Constants.FLAG_BLOCK_SYNCH); + world.setBlockState(pos.down(), block.getStateFromMeta(7), Constants.FLAG_BLOCK_SYNCH); } return harvest; diff --git a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java index bcd083b58..42177c9b4 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java @@ -46,7 +46,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous { } public FarmLogicArboreal(IFarmHousing housing) { - super(housing, new ItemStack(Blocks.dirt), PluginCore.blocks.soil.get(BlockSoil.SoilType.HUMUS, 1), Farmables.farmables.get("farmArboreal")); + super(housing, new ItemStack(Blocks.DIRT), PluginCore.blocks.soil.get(BlockSoil.SoilType.HUMUS, 1), Farmables.farmables.get("farmArboreal")); } @Override @@ -71,7 +71,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous { @SideOnly(Side.CLIENT) @Override public Item getItem() { - return Item.getItemFromBlock(Blocks.sapling); + return Item.getItemFromBlock(Blocks.SAPLING); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicCereal.java b/src/main/java/forestry/farming/logic/FarmLogicCereal.java index fc63cc1cb..d1cebd5e2 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCereal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCereal.java @@ -37,7 +37,7 @@ public class FarmLogicCereal extends FarmLogicCrops { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Items.wheat; + return Items.WHEAT; } } diff --git a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java index 194d1a4d8..276c5f013 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java @@ -49,7 +49,7 @@ public class FarmLogicCocoa extends FarmLogic { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Items.dye; + return Items.DYE; } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicCrops.java b/src/main/java/forestry/farming/logic/FarmLogicCrops.java index 25295fae2..b6cc798ab 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCrops.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCrops.java @@ -35,7 +35,7 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { private final Iterable seeds; protected FarmLogicCrops(IFarmHousing housing, Iterable seeds) { - super(housing, new ItemStack(Blocks.dirt), new ItemStack(Blocks.farmland)); + super(housing, new ItemStack(Blocks.DIRT), new ItemStack(Blocks.farmland)); this.seeds = seeds; } @@ -83,7 +83,7 @@ public abstract class FarmLogicCrops extends FarmLogicWatered { continue; } - ItemStack below = VectUtil.getAsItemStack(world, position.add(0, -1, 0)); + ItemStack below = VectUtil.getAsItemStack(world, position.down()); if (ground.getItem() != below.getItem()) { continue; } diff --git a/src/main/java/forestry/farming/logic/FarmLogicEnder.java b/src/main/java/forestry/farming/logic/FarmLogicEnder.java index f97fe64f3..a870ea17f 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicEnder.java +++ b/src/main/java/forestry/farming/logic/FarmLogicEnder.java @@ -35,7 +35,7 @@ import forestry.core.utils.vect.VectUtil; public class FarmLogicEnder extends FarmLogicHomogeneous { public FarmLogicEnder(IFarmHousing housing) { - super(housing, new ItemStack(Blocks.end_stone), new ItemStack(Blocks.end_stone), Farmables.farmables.get("farmEnder")); + super(housing, new ItemStack(Blocks.END_STONE), new ItemStack(Blocks.END_STONE), Farmables.farmables.get("farmEnder")); } @Override @@ -46,7 +46,7 @@ public class FarmLogicEnder extends FarmLogicHomogeneous { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Items.ender_eye; + return Items.ENDER_EYE; } @Override @@ -93,7 +93,7 @@ public class FarmLogicEnder extends FarmLogicHomogeneous { continue; } - ItemStack below = VectUtil.getAsItemStack(world, position.add(0, -1, 0)); + ItemStack below = VectUtil.getAsItemStack(world, position.down()); if (!isAcceptedSoil(below)) { continue; } diff --git a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java index 6d65d7c43..9322c1b5d 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java +++ b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java @@ -105,7 +105,7 @@ public abstract class FarmLogicHomogeneous extends FarmLogic { continue; } - Vect platformPosition = position.add(0, -1, 0); + BlockPos platformPosition = position.down(); Block platformBlock = VectUtil.getBlock(world, platformPosition); if (!FarmHelper.bricks.contains(platformBlock)) { diff --git a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java index 1753c4726..07577720f 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java @@ -93,7 +93,7 @@ public class FarmLogicInfernal extends FarmLogicHomogeneous { continue; } - ItemStack below = VectUtil.getAsItemStack(world, position.add(0, -1, 0)); + ItemStack below = VectUtil.getAsItemStack(world, position.down()); if (!isAcceptedSoil(below)) { continue; } diff --git a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java index dab4f7eb9..b6953d3a3 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java +++ b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java @@ -55,7 +55,7 @@ public class FarmLogicOrchard extends FarmLogic { // traversalBlocksBuilder.add(Blocks.farmland); // } // if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) { - // traversalBlocksBuilder.add(Blocks.dirt); + // traversalBlocksBuilder.add(Blocks.DIRT); // } // if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.PLANTMEGAPACK)) { // traversalBlocksBuilder.add(Blocks.WATER); diff --git a/src/main/java/forestry/farming/logic/FarmLogicReeds.java b/src/main/java/forestry/farming/logic/FarmLogicReeds.java index a284f787c..4acd36568 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicReeds.java +++ b/src/main/java/forestry/farming/logic/FarmLogicReeds.java @@ -44,7 +44,7 @@ public class FarmLogicReeds extends FarmLogic { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Items.reeds; + return Items.REEDS; } @Override @@ -72,7 +72,7 @@ public class FarmLogicReeds extends FarmLogic { return false; } - return ItemStackUtil.equals(Blocks.sand, itemstack) || ItemStackUtil.equals(Blocks.dirt, itemstack); + return ItemStackUtil.equals(Blocks.SAND, itemstack) || ItemStackUtil.equals(Blocks.DIRT, itemstack); } @Override @@ -81,7 +81,7 @@ public class FarmLogicReeds extends FarmLogic { return false; } - return itemstack.getItem() == Items.reeds; + return itemstack.getItem() == Items.REEDS; } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicRubber.java b/src/main/java/forestry/farming/logic/FarmLogicRubber.java index a822d43e2..7cbdab2eb 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicRubber.java +++ b/src/main/java/forestry/farming/logic/FarmLogicRubber.java @@ -54,7 +54,7 @@ public class FarmLogicRubber extends FarmLogic { if (!inActive) { return PluginIC2.resin.getItem(); } else { - return Items.gunpowder; + return Items.GUNPOWDER; } } diff --git a/src/main/java/forestry/farming/logic/FarmLogicShroom.java b/src/main/java/forestry/farming/logic/FarmLogicShroom.java index 1e5b286db..4a512fb8d 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicShroom.java +++ b/src/main/java/forestry/farming/logic/FarmLogicShroom.java @@ -26,7 +26,7 @@ import forestry.api.farming.IFarmHousing; public class FarmLogicShroom extends FarmLogicArboreal { public FarmLogicShroom(IFarmHousing housing) { - super(housing, new ItemStack(Blocks.mycelium), new ItemStack(Blocks.mycelium), Farmables.farmables.get("farmShroom")); + super(housing, new ItemStack(Blocks.MYCELIUM), new ItemStack(Blocks.MYCELIUM), Farmables.farmables.get("farmShroom")); } @Override @@ -41,7 +41,7 @@ public class FarmLogicShroom extends FarmLogicArboreal { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Item.getItemFromBlock(Blocks.red_mushroom); + return Item.getItemFromBlock(Blocks.RED_MUSHROOM); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java index ec55a989f..f24174aa9 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java +++ b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java @@ -44,7 +44,7 @@ public class FarmLogicSucculent extends FarmLogic { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Items.dye; + return Items.DYE; } @Override @@ -78,7 +78,7 @@ public class FarmLogicSucculent extends FarmLogic { return false; } - return ItemStackUtil.equals(Blocks.sand, itemstack); + return ItemStackUtil.equals(Blocks.SAND, itemstack); } @Override @@ -87,7 +87,7 @@ public class FarmLogicSucculent extends FarmLogic { return false; } - return ItemStackUtil.equals(Blocks.cactus, itemstack); + return ItemStackUtil.equals(Blocks.CACTUS, itemstack); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicVegetable.java b/src/main/java/forestry/farming/logic/FarmLogicVegetable.java index c4a3d708a..c197b7b03 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicVegetable.java +++ b/src/main/java/forestry/farming/logic/FarmLogicVegetable.java @@ -28,7 +28,7 @@ public class FarmLogicVegetable extends FarmLogicCrops { @Override @SideOnly(Side.CLIENT) public Item getItem() { - return Items.carrot; + return Items.CARROT; } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicWatered.java b/src/main/java/forestry/farming/logic/FarmLogicWatered.java index ca1c72031..961837894 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicWatered.java +++ b/src/main/java/forestry/farming/logic/FarmLogicWatered.java @@ -106,7 +106,7 @@ public abstract class FarmLogicWatered extends FarmLogic { continue; } - Vect platformPosition = position.add(0, -1, 0); + BlockPos platformPosition = position.down(); Block platformBlock = VectUtil.getBlock(world, platformPosition); if (!FarmHelper.bricks.contains(platformBlock)) { break; @@ -138,7 +138,7 @@ public abstract class FarmLogicWatered extends FarmLogic { for (int i = 0; i < extent; i++) { Vect position = translateWithOffset(pos, direction, i); - Vect platformPosition = position.add(0, -1, 0); + BlockPos platformPosition = position.down(); Block platformBlock = VectUtil.getBlock(world, platformPosition); if (!FarmHelper.bricks.contains(platformBlock)) { break; diff --git a/src/main/java/forestry/farming/logic/FarmableCocoa.java b/src/main/java/forestry/farming/logic/FarmableCocoa.java index 23086b3f8..f4e355651 100755 --- a/src/main/java/forestry/farming/logic/FarmableCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmableCocoa.java @@ -27,8 +27,8 @@ import forestry.core.utils.vect.Vect; public class FarmableCocoa implements IFarmable { - private static final Block COCOA_PLANT = Blocks.cocoa; - public static final Item COCOA_SEED = Items.dye; + private static final Block COCOA_PLANT = Blocks.COCOA; + public static final Item COCOA_SEED = Items.DYE; public static final int COCOA_META = 3; @Override diff --git a/src/main/java/forestry/farming/logic/FarmableGE.java b/src/main/java/forestry/farming/logic/FarmableGE.java index 9a8d4a046..4b78f09e3 100755 --- a/src/main/java/forestry/farming/logic/FarmableGE.java +++ b/src/main/java/forestry/farming/logic/FarmableGE.java @@ -51,7 +51,7 @@ public class FarmableGE implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return germling.copy().onItemUse(player, world, pos.add(0, -1, 0), EnumFacing.UP, 0, 0, 0); + return germling.copy().onItemUse(player, world, pos.down(), EnumFacing.UP, 0, 0, 0); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmableGenericCrop.java b/src/main/java/forestry/farming/logic/FarmableGenericCrop.java index 0b784254a..594229d69 100755 --- a/src/main/java/forestry/farming/logic/FarmableGenericCrop.java +++ b/src/main/java/forestry/farming/logic/FarmableGenericCrop.java @@ -68,7 +68,7 @@ public class FarmableGenericCrop implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return germling.copy().onItemUse(player, world, pos.add(0, -1, 0), EnumFacing.UP, 0, 0, 0); + return germling.copy().onItemUse(player, world, pos.down(), EnumFacing.UP, 0, 0, 0); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmableGenericSapling.java b/src/main/java/forestry/farming/logic/FarmableGenericSapling.java index a83247ca0..153846482 100755 --- a/src/main/java/forestry/farming/logic/FarmableGenericSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableGenericSapling.java @@ -90,7 +90,7 @@ public class FarmableGenericSapling implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return germling.copy().onItemUse(player, world, pos.add(0, -1, 0), EnumFacing.UP, 0, 0, 0); + return germling.copy().onItemUse(player, world, pos.down(), EnumFacing.UP, 0, 0, 0); } } diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java b/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java index 7289571e3..2e699a77f 100644 --- a/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java @@ -35,7 +35,7 @@ public class FarmableVanillaMushroom extends FarmableGenericSapling { public ICrop getCropAt(World world, BlockPos pos) { Block block = BlockUtil.getBlock(world, pos); - if (block != Blocks.brown_mushroom_block && block != Blocks.red_mushroom_block) { + if (block != Blocks.BROWN_MUSHROOM_block && block != Blocks.RED_MUSHROOM_block) { return null; } @@ -50,11 +50,11 @@ public class FarmableVanillaMushroom extends FarmableGenericSapling { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { int meta = 0; - if (ItemStackUtil.equals(Blocks.red_mushroom, germling)) { + if (ItemStackUtil.equals(Blocks.RED_MUSHROOM, germling)) { meta = 1; } - Proxies.common.addBlockPlaceEffects(world, pos, Blocks.brown_mushroom.getDefaultState()); + Proxies.common.addBlockPlaceEffects(world, pos, Blocks.BROWN_MUSHROOM.getDefaultState()); return world.setBlockState(pos, PluginFarming.blocks.mushroom.getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } } diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java index 4cc135a32..27b7d07e8 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java @@ -28,7 +28,7 @@ import forestry.plugins.ForestryPluginUids; public class FarmableVanillaSapling extends FarmableGenericSapling { public FarmableVanillaSapling() { - super(Blocks.sapling, -1, new ItemStack(Items.apple), new ItemStack(FarmableCocoa.COCOA_SEED, 1, FarmableCocoa.COCOA_META)); + super(Blocks.SAPLING, -1, new ItemStack(Items.APPLE), new ItemStack(FarmableCocoa.COCOA_SEED, 1, FarmableCocoa.COCOA_META)); } @Override @@ -41,7 +41,7 @@ public class FarmableVanillaSapling extends FarmableGenericSapling { return TreeManager.treeRoot.plantSapling(world, (ITree) tree, player.getGameProfile(), pos); } else { - return germling.copy().onItemUse(player, world, pos.add(0, -1, 0), EnumFacing.UP, 0, 0, 0); + return germling.copy().onItemUse(player, world, pos.down(), EnumFacing.UP, 0, 0, 0); } } diff --git a/src/main/java/forestry/farming/models/EnumFarmBlockTexture.java b/src/main/java/forestry/farming/models/EnumFarmBlockTexture.java index c9bdf4ed4..d36f3c866 100644 --- a/src/main/java/forestry/farming/models/EnumFarmBlockTexture.java +++ b/src/main/java/forestry/farming/models/EnumFarmBlockTexture.java @@ -21,17 +21,17 @@ import net.minecraftforge.fml.relauncher.SideOnly; import forestry.core.render.TextureManager; public enum EnumFarmBlockTexture { - BRICK_STONE(new ItemStack(Blocks.stonebrick, 1, 0)), - BRICK_MOSSY(new ItemStack(Blocks.stonebrick, 1, 1)), - BRICK_CRACKED(new ItemStack(Blocks.stonebrick, 1, 2)), - BRICK(new ItemStack(Blocks.brick_block)), - SANDSTONE_SMOOTH(new ItemStack(Blocks.sandstone, 1, 2)), - SANDSTONE_CHISELED(new ItemStack(Blocks.sandstone, 1, 1)), - BRICK_NETHER(new ItemStack(Blocks.nether_brick)), - BRICK_CHISELED(new ItemStack(Blocks.stonebrick, 1, 3)), - QUARTZ(new ItemStack(Blocks.quartz_block, 1, 0)), - QUARTZ_CHISELED(new ItemStack(Blocks.quartz_block, 1, 1)), - QUARTZ_LINES(new ItemStack(Blocks.quartz_block, 1, 2)); + BRICK_STONE(new ItemStack(Blocks.STONEBRICK, 1, 0)), + BRICK_MOSSY(new ItemStack(Blocks.STONEBRICK, 1, 1)), + BRICK_CRACKED(new ItemStack(Blocks.STONEBRICK, 1, 2)), + BRICK(new ItemStack(Blocks.BRICK_BLOCK)), + SANDSTONE_SMOOTH(new ItemStack(Blocks.SANDSTONE, 1, 2)), + SANDSTONE_CHISELED(new ItemStack(Blocks.SANDSTONE, 1, 1)), + BRICK_NETHER(new ItemStack(Blocks.NETHER_BRICK)), + BRICK_CHISELED(new ItemStack(Blocks.STONEBRICK, 1, 3)), + QUARTZ(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 0)), + QUARTZ_CHISELED(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 1)), + QUARTZ_LINES(new ItemStack(Blocks.QUARTZ_BLOCK, 1, 2)); private final ItemStack base; diff --git a/src/main/java/forestry/farming/tiles/TileFarm.java b/src/main/java/forestry/farming/tiles/TileFarm.java index 82477e263..c2a625d20 100644 --- a/src/main/java/forestry/farming/tiles/TileFarm.java +++ b/src/main/java/forestry/farming/tiles/TileFarm.java @@ -90,7 +90,7 @@ public abstract class TileFarm extends MultiblockTileEntityForestry effects = BeverageEffect.loadEffects(stack); stack.stackSize--; - player.getFoodStats().addStats(this, stack); - world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); - if (world.isRemote) { - return stack; - } + if (entityLiving instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer) entityLiving; + entityplayer.getFoodStats().addStats(this, stack); + worldIn.playSound((EntityPlayer)null, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); - for (IBeverageEffect effect : effects) { - effect.doEffect(world, player); + if (worldIn.isRemote) { + return stack; + } + + for (IBeverageEffect effect : effects) { + effect.doEffect(worldIn, entityplayer); + } + + entityplayer.addStat(StatList.getObjectUseStats(this)); } return stack; @@ -100,15 +113,16 @@ public class ItemBeverage extends ItemForestryFood { } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { - - int meta = itemstack.getItemDamage(); + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) + { + int meta = itemStackIn.getItemDamage(); IBeverageInfo beverage = beverages[meta]; - - if (entityplayer.canEat(beverage.isAlwaysEdible())) { - entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack)); + if (playerIn.canEat(beverage.isAlwaysEdible())) { + playerIn.setActiveHand(hand); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); + } else { + return new ActionResult<>(EnumActionResult.FAIL, itemStackIn); } - return itemstack; } @Override @@ -147,7 +161,6 @@ public class ItemBeverage extends ItemForestryFood { @Override public int getColorFromItemStack(ItemStack itemstack, int j) { - if (j == 1 || beverages[itemstack.getItemDamage()].getSecondaryColor() == 0) { return beverages[itemstack.getItemDamage()].getPrimaryColor(); } else { diff --git a/src/main/java/forestry/greenhouse/PluginGreenhouse.java b/src/main/java/forestry/greenhouse/PluginGreenhouse.java index 97d45c23c..352d41f80 100644 --- a/src/main/java/forestry/greenhouse/PluginGreenhouse.java +++ b/src/main/java/forestry/greenhouse/PluginGreenhouse.java @@ -75,7 +75,7 @@ public class PluginGreenhouse extends BlankForestryPlugin { "###", "#X#", "###", - 'X', Blocks.brick_block, + 'X', Blocks.BRICK_BLOCK, '#', PluginCore.items.craftingMaterial.getCamouflagedPaneling()); ItemStack greenhouseGlassBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS); @@ -205,23 +205,23 @@ public class PluginGreenhouse extends BlankForestryPlugin { IGreenhouseAccess greenhouseAccess = GreenhouseManager.greenhouseAccess; - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.glass, 1, 0), 0.5F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 0), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 1), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 2), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 3), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 4), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 5), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 6), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 7), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 8), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 9), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 10), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 11), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 12), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 13), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 14), 0.25F); - greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.stained_glass, 1, 15), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.GLASS, 1, 0), 0.5F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 0), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 1), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 2), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 3), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 4), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 5), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 6), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 7), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 8), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 9), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 10), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 11), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 12), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 13), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 14), 0.25F); + greenhouseAccess.registerGreenhouseGlass(new ItemStack(Blocks.STAINED_GLASS, 1, 15), 0.25F); proxy.initializeModels(); diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java index 3b09db314..d09a91aba 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java @@ -67,7 +67,7 @@ import forestry.greenhouse.tiles.TileGreenhouseValve; import forestry.plugins.ForestryPluginUids; public abstract class BlockGreenhouse extends BlockStructure implements ISpriteRegister { - + private static final AxisAlignedBB SPRINKLER_BOUNDS = new AxisAlignedBB(0.3125F, 0.25F, 0.3125F, 0.6875F, 1F, 0.6875F); public static final PropertyEnum STATE = PropertyEnum.create("state", State.class); public enum State implements IStringSerializable { @@ -127,7 +127,7 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { - this.setBlockBoundsBasedOnState(worldIn, pos); + return SPRINKLER_BOUNDS; } return super.getSelectedBoundingBox(state, worldIn, pos); } @@ -135,20 +135,11 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { - this.setBlockBoundsBasedOnState(worldIn, pos); + return SPRINKLER_BOUNDS; } return super.getCollisionBoundingBox(blockState, worldIn, pos); } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { - if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { - setBlockBounds(0.3125F, 0.25F, 0.3125F, 0.6875F, 1F, 0.6875F); - } else { - super.setBlockBoundsBasedOnState(worldIn, pos); - } - } - @Override public int getMetaFromState(IBlockState state) { return 0; @@ -218,22 +209,23 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR return new TileGreenhousePlain(); } } - - @Override - public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass) { - TileEntity tile = world.getTileEntity(pos); - if (tile instanceof ICamouflagedBlock) { - ItemStack camouflageStack = CamouflageUtil.getCamouflageBlock(world, pos); - - if (renderPass < 100 && camouflageStack != null) { - return Block.getBlockFromItem(camouflageStack.getItem()).colorMultiplier(world, pos, renderPass); - } - - return super.colorMultiplier(world, pos, renderPass); - } else { - return super.colorMultiplier(world, pos, renderPass); - } - } + + // TODO: greenhouse color +// @Override +// public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass) { +// TileEntity tile = world.getTileEntity(pos); +// if (tile instanceof ICamouflagedBlock) { +// ItemStack camouflageStack = CamouflageUtil.getCamouflageBlock(world, pos); +// +// if (renderPass < 100 && camouflageStack != null) { +// return Block.getBlockFromItem(camouflageStack.getItem()).colorMultiplier(world, pos, renderPass); +// } +// +// return super.colorMultiplier(world, pos, renderPass); +// } else { +// return super.colorMultiplier(world, pos, renderPass); +// } +// } /* MODELS */ @Override diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java index 945ca419f..01eea3bc7 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java @@ -15,25 +15,23 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -56,6 +54,11 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper private static final PropertyBool POWERED = BlockDoor.POWERED; private static final PropertyEnum HALF = BlockDoor.HALF; + protected static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.1875D); + protected static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.8125D, 1.0D, 1.0D, 1.0D); + protected static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.8125D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + protected static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.1875D, 1.0D, 1.0D); + public BlockGreenhouseDoor() { setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, false).withProperty(HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, false).withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER)); } @@ -81,63 +84,23 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } @Override - public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(state, worldIn, pos); - } + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + state = state.getActualState(source, pos); + EnumFacing enumfacing = state.getValue(FACING); + boolean flag = !state.getValue(OPEN); + boolean flag1 = state.getValue(HINGE) == BlockDoor.EnumHingePosition.RIGHT; - @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(blockState, worldIn, pos); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { - this.setBoundBasedOnMeta(combineMetadata(worldIn, pos)); - } - - private void setBoundBasedOnMeta(int combinedMeta) { - float f = 0.1875F; - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); - EnumFacing enumfacing = getFacing(combinedMeta); - boolean flag = isOpen(combinedMeta); - boolean flag1 = isHingeLeft(combinedMeta); - - if (flag) { - if (enumfacing == EnumFacing.EAST) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } else { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } - } else if (enumfacing == EnumFacing.SOUTH) { - if (!flag1) { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } - } else if (enumfacing == EnumFacing.WEST) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - } else { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } - } else if (enumfacing == EnumFacing.NORTH) { - if (!flag1) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } else { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - } - } else if (enumfacing == EnumFacing.EAST) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - } else if (enumfacing == EnumFacing.SOUTH) { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - } else if (enumfacing == EnumFacing.WEST) { - this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } else if (enumfacing == EnumFacing.NORTH) { - this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + switch (enumfacing) + { + case EAST: + default: + return flag ? EAST_AABB : (flag1 ? NORTH_AABB : SOUTH_AABB); + case SOUTH: + return flag ? SOUTH_AABB : (flag1 ? EAST_AABB : WEST_AABB); + case WEST: + return flag ? WEST_AABB : (flag1 ? SOUTH_AABB : NORTH_AABB); + case NORTH: + return flag ? NORTH_AABB : (flag1 ? WEST_AABB : EAST_AABB); } } @@ -221,20 +184,15 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : Item.getItemFromBlock(state.getBlock()); } - @Override - public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.collisionRayTrace(blockState, worldIn, pos, start, end); - } - @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - return pos.getY() < worldIn.getHeight() - 1 && (worldIn.isSideSolid(pos.down(), EnumFacing.UP)) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up())); + return pos.getY() < worldIn.getHeight() - 1 && (worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up())); } @Override - public int getMobilityFlag() { - return 1; + public EnumPushReaction getMobilityFlag(IBlockState state) + { + return EnumPushReaction.DESTROY; } private static int combineMetadata(IBlockAccess worldIn, BlockPos pos) { diff --git a/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java b/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java index e61fa3ff9..040ff07f8 100644 --- a/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java +++ b/src/main/java/forestry/greenhouse/gui/ContainerGreenhouse.java @@ -31,7 +31,7 @@ public class ContainerGreenhouse extends ContainerTile { public void detectAndSendChanges() { super.detectAndSendChanges(); PacketGuiUpdate packet = new PacketGuiUpdate(tile); - sendPacketToCrafters(packet); + sendPacketToListeners(packet); } public IFluidTank getTank(int slot) { diff --git a/src/main/java/forestry/greenhouse/gui/ContainerGreenhouseButterflyHatch.java b/src/main/java/forestry/greenhouse/gui/ContainerGreenhouseButterflyHatch.java index ce4071609..f29764e2c 100644 --- a/src/main/java/forestry/greenhouse/gui/ContainerGreenhouseButterflyHatch.java +++ b/src/main/java/forestry/greenhouse/gui/ContainerGreenhouseButterflyHatch.java @@ -34,7 +34,7 @@ public class ContainerGreenhouseButterflyHatch extends ContainerTile DATAWATCHER_ID_SPECIES = EntityDataManager.createKey(EntityButterfly.class, DataSerializers.STRING); + private static final DataParameter DATAWATCHER_ID_SIZE = EntityDataManager.createKey(EntityButterfly.class, DataSerializers.VARINT); + private static final DataParameter DATAWATCHER_ID_STATE = EntityDataManager.createKey(EntityButterfly.class, DataSerializers.BYTE); private static final float DEFAULT_BUTTERFLY_SIZE = 0.75f; private static final EnumButterflyState DEFAULT_STATE = EnumButterflyState.FLYING; @@ -104,9 +107,9 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly protected void entityInit() { super.entityInit(); - dataWatcher.addObject(DATAWATCHER_ID_SPECIES, ""); - dataWatcher.addObject(DATAWATCHER_ID_SIZE, (int) (DEFAULT_BUTTERFLY_SIZE * 100)); - dataWatcher.addObject(DATAWATCHER_ID_STATE, (byte) DEFAULT_STATE.ordinal()); + dataManager.register(DATAWATCHER_ID_SPECIES, ""); + dataManager.register(DATAWATCHER_ID_SIZE, (int) (DEFAULT_BUTTERFLY_SIZE * 100)); + dataManager.register(DATAWATCHER_ID_STATE, (byte) DEFAULT_STATE.ordinal()); } private void setDefaults() { @@ -170,7 +173,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly if (this.state != state) { this.state = state; if (!worldObj.isRemote) { - dataWatcher.updateObject(DATAWATCHER_ID_STATE, (byte) state.ordinal()); + dataManager.set(DATAWATCHER_ID_STATE, (byte) state.ordinal()); } } } @@ -303,8 +306,8 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly species = genome.getPrimary(); if (!worldObj.isRemote) { - dataWatcher.updateObject(DATAWATCHER_ID_SIZE, (int) (size * 100)); - dataWatcher.updateObject(DATAWATCHER_ID_SPECIES, species.getUID()); + dataManager.set(DATAWATCHER_ID_SIZE, (int) (size * 100)); + dataManager.set(DATAWATCHER_ID_SPECIES, species.getUID()); } else { textureResource = new ResourceLocation(species.getEntityTexture()); } @@ -376,12 +379,11 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly return false; } - ItemStack heldItem = player.getHeldItem(); - if (heldItem == null) { + if (stack == null) { return false; } - if (!(heldItem.getItem() instanceof IToolScoop)) { + if (!(stack.getItem() instanceof IToolScoop)) { return false; } @@ -423,16 +425,16 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly // Update stuff client side if (worldObj.isRemote) { if (species == null) { - String speciesUid = dataWatcher.getWatchableObjectString(DATAWATCHER_ID_SPECIES); + String speciesUid = dataManager.get(DATAWATCHER_ID_SPECIES); IAllele allele = AlleleManager.alleleRegistry.getAllele(speciesUid); if (allele instanceof IAlleleButterflySpecies) { species = (IAlleleButterflySpecies) allele; textureResource = new ResourceLocation(species.getEntityTexture()); - size = dataWatcher.getWatchableObjectInt(DATAWATCHER_ID_SIZE) / 100f; + size = dataManager.get(DATAWATCHER_ID_SIZE) / 100f; } } - int stateOrdinal = dataWatcher.getWatchableObjectByte(DATAWATCHER_ID_STATE); + byte stateOrdinal = dataManager.get(DATAWATCHER_ID_STATE); if (state == null || state.ordinal() != stateOrdinal) { setState(EnumButterflyState.VALUES[stateOrdinal]); } diff --git a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java index 650fedf0b..42e81757e 100755 --- a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java +++ b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java @@ -13,6 +13,7 @@ package forestry.lepidopterology.items; import java.util.List; import java.util.Random; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; @@ -21,6 +22,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -151,16 +154,6 @@ public class ItemButterflyGE extends ItemGE implements ISpriteRegister { } /* MODELS */ - @SideOnly(Side.CLIENT) - @Override - public int getColorFromItemStack(ItemStack itemstack, int renderPass) { - if (!itemstack.hasTagCompound()) { - return super.getColorFromItemStack(itemstack, renderPass); - } - - return getColourFromSpecies(AlleleManager.alleleRegistry.getIndividual(itemstack).getGenome().getPrimary(), renderPass); - } - @SideOnly(Side.CLIENT) @Override public int getColourFromSpecies(IAlleleSpecies species, int renderPass) { @@ -209,25 +202,26 @@ public class ItemButterflyGE extends ItemGE implements ISpriteRegister { } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { - - if (world.isRemote) { - return false; + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + if (worldIn.isRemote) { + return EnumActionResult.PASS; } IButterfly flutter = ButterflyManager.butterflyRoot.getMember(stack); if (flutter == null) { - return false; + return EnumActionResult.PASS; } + TileEntity tileEntity = worldIn.getTileEntity(pos); if (type == EnumFlutterType.COCOON) { int age = stack.getTagCompound().getInteger(NBT_AGE); // x, y, z are the coordinates of the block "hit", can thus either be the soil or tall grass, etc. int yShift; - if (!BlockUtil.isReplaceableBlock(world, pos)) { - if(!world.isAirBlock(pos.add(0, -1, 0))){ - return false; + IBlockState blockState = worldIn.getBlockState(pos); + if (!BlockUtil.isReplaceableBlock(blockState, worldIn, pos)) { + if(!worldIn.isAirBlock(pos.down())){ + return EnumActionResult.PASS; } yShift = 1; } else { @@ -237,54 +231,54 @@ public class ItemButterflyGE extends ItemGE implements ISpriteRegister { IButterflyNursery nursery = null; - if(world.getTileEntity(pos) instanceof IButterflyNursery){ - nursery = (IButterflyNursery) world.getTileEntity(pos); + if(tileEntity instanceof IButterflyNursery){ + nursery = (IButterflyNursery) tileEntity; }else{ - ITree treeLeave = GeneticsUtil.getErsatzPollen(world, pos); + ITree treeLeave = GeneticsUtil.getErsatzPollen(worldIn, pos); if(treeLeave != null){ - treeLeave.setLeaves(world, player.getGameProfile(), pos); - nursery = (IButterflyNursery) world.getTileEntity(pos); + treeLeave.setLeaves(worldIn, playerIn.getGameProfile(), pos); + nursery = (IButterflyNursery) tileEntity; } } if(nursery != null){ if(nursery.canNurse(flutter)){ nursery.setCaterpillar(flutter); - if(ButterflyManager.butterflyRoot.plantCocoon(world, nursery, player.getGameProfile(), age)){ - Proxies.common.addBlockPlaceEffects(world, pos, world.getBlockState(posS)); - if (!player.capabilities.isCreativeMode) { + if(ButterflyManager.butterflyRoot.plantCocoon(worldIn, nursery, playerIn.getGameProfile(), age)){ + Proxies.common.addBlockPlaceEffects(worldIn, pos, worldIn.getBlockState(posS)); + if (!playerIn.capabilities.isCreativeMode) { stack.stackSize--; } - return true; + return EnumActionResult.SUCCESS; }else{ nursery.setCaterpillar(null); - return false; + return EnumActionResult.PASS; } } } - return false; + return EnumActionResult.PASS; }else if (type == EnumFlutterType.CATERPILLAR) { - TileEntity target = world.getTileEntity(pos); + TileEntity target = tileEntity; if (!(target instanceof IButterflyNursery)) { - return false; + return EnumActionResult.PASS; } IButterflyNursery pollinatable = (IButterflyNursery) target; if (!pollinatable.canNurse(flutter)) { - return false; + return EnumActionResult.PASS; } pollinatable.setCaterpillar(flutter); - Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, world, pos, - world.getBlockState(pos)); - if (!player.capabilities.isCreativeMode) { + Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, worldIn, pos, + worldIn.getBlockState(pos)); + if (!playerIn.capabilities.isCreativeMode) { stack.stackSize--; } - return true; + return EnumActionResult.SUCCESS; } else { - return false; + return EnumActionResult.PASS; } } diff --git a/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java b/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java index 402d39e21..87f81f902 100644 --- a/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java +++ b/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java @@ -10,10 +10,21 @@ ******************************************************************************/ package forestry.lepidopterology.proxy; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.client.renderer.color.ItemColors; +import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.client.registry.RenderingRegistry; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAlleleSpecies; import forestry.core.models.ModelIndex; import forestry.core.models.ModelManager; import forestry.core.proxy.Proxies; +import forestry.lepidopterology.PluginLepidopterology; import forestry.lepidopterology.entities.EntityButterfly; import forestry.lepidopterology.render.ModelButterflyItem; import forestry.lepidopterology.render.RenderButterflyEntity; @@ -24,5 +35,26 @@ public class ProxyLepidopterologyClient extends ProxyLepidopterology { public void preInitializeRendering() { RenderingRegistry.registerEntityRenderingHandler(EntityButterfly.class, new RenderButterflyEntity.Factory()); Proxies.render.registerModel(new ModelIndex(ModelManager.getInstance().getModelLocation("butterflyGE"), new ModelButterflyItem())); + + Minecraft minecraft = Minecraft.getMinecraft(); + + ItemColors itemColors = minecraft.getItemColors(); + + itemColors.registerItemColorHandler(new ButterflyItemColor(), + PluginLepidopterology.items.butterflyGE + ); + } + + private static class ButterflyItemColor implements IItemColor { + @Override + public int getColorFromItemstack(ItemStack stack, int tintIndex) { + if (stack.hasTagCompound()) { + IAlleleSpecies species = AlleleManager.alleleRegistry.getIndividual(stack).getGenome().getPrimary(); + if (species != null) { + return species.getSpriteColour(tintIndex); + } + } + return 0xffffff; + } } } diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java b/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java index 36a5f67b3..7e1e121db 100644 --- a/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java @@ -13,15 +13,18 @@ package forestry.lepidopterology.render; import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; -import java.io.IOException; +import java.util.Collections; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ModelLoaderRegistry; @@ -36,28 +39,21 @@ import forestry.core.models.TRSRBakedModel; @SideOnly(Side.CLIENT) public class ModelButterflyItem extends BlankItemModel { - + private ItemOverrideList overrideList; private final Function textureGetter = new DefaultTextureGetter(); @SideOnly(Side.CLIENT) private IRetexturableModel modelButterfly; + protected ItemOverrideList createOverrides() { + return new ButterflyItemOverrideList(); + } + @Override - public IBakedModel handleItemState(ItemStack item) { - if (modelButterfly == null) { - try { - modelButterfly = (IRetexturableModel) ModelLoaderRegistry.getModel(new ModelResourceLocation("forestry:butterflyGE", "inventory")); - } catch (IOException e) { - return null; - } - if (modelButterfly == null) { - return null; - } + public ItemOverrideList getOverrides() { + if (overrideList == null) { + overrideList = createOverrides(); } - IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(item); - if (butterfly == null) { - butterfly = ButterflyManager.butterflyRoot.templateAsIndividual(ButterflyManager.butterflyRoot.getDefaultTemplate()); - } - return bakeModel(butterfly); + return overrideList; } private IBakedModel bakeModel(IButterfly butterfly) { @@ -66,4 +62,29 @@ public class ModelButterflyItem extends BlankItemModel { modelButterfly = (IRetexturableModel) modelButterfly.retexture(textures.build()); return new TRSRBakedModel(modelButterfly.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.0F, -0.03125F, butterfly.getSize() * 1.5F); } + + private class ButterflyItemOverrideList extends ItemOverrideList { + public ButterflyItemOverrideList() { + super(Collections.emptyList()); + } + + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { + if (modelButterfly == null) { + try { + modelButterfly = (IRetexturableModel) ModelLoaderRegistry.getModel(new ModelResourceLocation("forestry:butterflyGE", "inventory")); + } catch (Exception e) { + return null; + } + if (modelButterfly == null) { + return null; + } + } + IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(stack); + if (butterfly == null) { + butterfly = ButterflyManager.butterflyRoot.templateAsIndividual(ButterflyManager.butterflyRoot.getDefaultTemplate()); + } + return bakeModel(butterfly); + } + } } diff --git a/src/main/java/forestry/mail/PluginMail.java b/src/main/java/forestry/mail/PluginMail.java index bd31a977d..fc6f21d28 100644 --- a/src/main/java/forestry/mail/PluginMail.java +++ b/src/main/java/forestry/mail/PluginMail.java @@ -102,7 +102,7 @@ public class PluginMail extends BlankForestryPlugin { letterGlue = Items.slime_ball; } - RecipeUtil.addShapelessRecipe(items.letters.getItemStack(), Items.paper, letterGlue); + RecipeUtil.addShapelessRecipe(items.letters.getItemStack(), Items.PAPER, letterGlue); if (Config.craftingStampsEnabled) { for (EnumStampDefinition stampDefinition : EnumStampDefinition.VALUES) { @@ -117,23 +117,23 @@ public class PluginMail extends BlankForestryPlugin { "###", "ZZZ", 'X', stampDefinition.getCraftingIngredient(), - '#', Items.paper, + '#', Items.PAPER, 'Z', stampGlue); RecipeManagers.carpenterManager.addRecipe(10, Fluids.SEED_OIL.getFluid(300), null, stamps, "XXX", "###", 'X', stampDefinition.getCraftingIngredient(), - '#', Items.paper); + '#', Items.PAPER); } } // Recycling - RecipeUtil.addRecipe(new ItemStack(Items.paper), "###", '#', ItemRegistryMail.emptiedLetterOreDict); + RecipeUtil.addRecipe(new ItemStack(Items.PAPER), "###", '#', ItemRegistryMail.emptiedLetterOreDict); // Carpenter RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(250), null, items.letters.getItemStack(), "###", "###", '#', PluginCore.items.woodPulp); - RecipeUtil.addShapelessRecipe(items.catalogue.getItemStack(), items.stamps.getWildcard(), new ItemStack(Items.book)); + RecipeUtil.addShapelessRecipe(items.catalogue.getItemStack(), items.stamps.getWildcard(), new ItemStack(Items.BOOK)); RecipeUtil.addRecipe(blocks.mail.get(BlockTypeMail.MAILBOX), " # ", diff --git a/src/main/java/forestry/mail/inventory/InventoryTradeStation.java b/src/main/java/forestry/mail/inventory/InventoryTradeStation.java index 56d311960..c6f262441 100644 --- a/src/main/java/forestry/mail/inventory/InventoryTradeStation.java +++ b/src/main/java/forestry/mail/inventory/InventoryTradeStation.java @@ -71,7 +71,7 @@ public class InventoryTradeStation extends InventoryAdapter { return false; } else if (SlotUtil.isSlotInRange(slotIndex, TradeStation.SLOT_LETTERS_1, TradeStation.SLOT_LETTERS_COUNT)) { Item item = itemStack.getItem(); - return item == Items.paper; + return item == Items.PAPER; } else if (SlotUtil.isSlotInRange(slotIndex, TradeStation.SLOT_STAMPS_1, TradeStation.SLOT_STAMPS_COUNT)) { Item item = itemStack.getItem(); return item instanceof IStamps; diff --git a/src/main/java/forestry/mail/tiles/TileTrader.java b/src/main/java/forestry/mail/tiles/TileTrader.java index 262d40928..3791c90c7 100644 --- a/src/main/java/forestry/mail/tiles/TileTrader.java +++ b/src/main/java/forestry/mail/tiles/TileTrader.java @@ -212,7 +212,7 @@ public class TileTrader extends TileBase { } public boolean hasPaperMin(int count) { - return hasItemCount(TradeStation.SLOT_LETTERS_1, TradeStation.SLOT_LETTERS_COUNT, new ItemStack(Items.paper), count); + return hasItemCount(TradeStation.SLOT_LETTERS_1, TradeStation.SLOT_LETTERS_COUNT, new ItemStack(Items.PAPER), count); } public boolean hasInputBufMin(float percentage) { diff --git a/src/main/java/forestry/plugins/compat/PluginIC2.java b/src/main/java/forestry/plugins/compat/PluginIC2.java index 1f3e3da16..1cd5ba6b5 100644 --- a/src/main/java/forestry/plugins/compat/PluginIC2.java +++ b/src/main/java/forestry/plugins/compat/PluginIC2.java @@ -270,7 +270,7 @@ public class PluginIC2 extends BlankForestryPlugin { int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can"); if (bogEarthOutputCan > 0) { ItemStack bogEarthCan = PluginCore.blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, bogEarthOutputCan); - RecipeUtil.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waterCell, 'Y', "sand"); + RecipeUtil.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waterCell, 'Y', "sand"); } } diff --git a/src/main/java/forestry/plugins/compat/PluginNatura.java b/src/main/java/forestry/plugins/compat/PluginNatura.java index 6d496a435..63b4c5a51 100644 --- a/src/main/java/forestry/plugins/compat/PluginNatura.java +++ b/src/main/java/forestry/plugins/compat/PluginNatura.java @@ -211,7 +211,7 @@ public class PluginNatura extends BlankForestryPlugin { ArrayList seedList = new ArrayList<>(); if (seedBarley != null) { seedList.add(seedBarley); - RecipeManagers.moistenerManager.addRecipe(seedBarley, new ItemStack(Blocks.mycelium), 5000); + RecipeManagers.moistenerManager.addRecipe(seedBarley, new ItemStack(Blocks.MYCELIUM), 5000); } if (seedCotton != null) { seedList.add(seedCotton); @@ -272,7 +272,7 @@ public class PluginNatura extends BlankForestryPlugin { int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat"); if (compostWheatAmount > 0) { ItemStack compostWheat = PluginCore.items.fertilizerBio.getItemStack(compostWheatAmount); - RecipeUtil.addRecipe(compostWheat, " X ", "X#X", " X ", '#', Blocks.dirt, 'X', itemBarley); + RecipeUtil.addRecipe(compostWheat, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', itemBarley); } FuelManager.moistenerResource.put(itemBarley, new MoistenerFuel(itemBarley, PluginCore.items.mouldyWheat.getItemStack(), 0, 300)); } diff --git a/src/main/java/forestry/storage/PluginStorage.java b/src/main/java/forestry/storage/PluginStorage.java index 3d5e82bdd..1b5ebef8f 100644 --- a/src/main/java/forestry/storage/PluginStorage.java +++ b/src/main/java/forestry/storage/PluginStorage.java @@ -198,7 +198,7 @@ public class PluginStorage extends BlankForestryPlugin { )); backpackItemDefaults.get(BackpackManager.MINER_UID).addAll(getItemStrings(Arrays.asList( - new ItemStack(Blocks.obsidian), + new ItemStack(Blocks.OBSIDIAN), new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal), PluginCore.items.bronzePickaxe.getItemStack(), @@ -207,11 +207,11 @@ public class PluginStorage extends BlankForestryPlugin { ))); backpackItemDefaults.get(BackpackManager.DIGGER_UID).addAll(getItemStrings(Arrays.asList( - new ItemStack(Blocks.dirt, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Blocks.DIRT, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.gravel), new ItemStack(Items.flint), new ItemStack(Blocks.netherrack), - new ItemStack(Blocks.sandstone, 1, 0), + new ItemStack(Blocks.SANDSTONE, 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Blocks.soul_sand), PluginCore.items.bronzeShovel.getItemStack(), @@ -220,31 +220,31 @@ public class PluginStorage extends BlankForestryPlugin { ))); backpackItemDefaults.get(BackpackManager.FORESTER_UID).addAll(getItemStrings(Arrays.asList( - new ItemStack(Blocks.red_mushroom), - new ItemStack(Blocks.brown_mushroom), + new ItemStack(Blocks.RED_MUSHROOM), + new ItemStack(Blocks.BROWN_MUSHROOM), new ItemStack(Blocks.red_flower), new ItemStack(Blocks.yellow_flower), - new ItemStack(Blocks.cactus), + new ItemStack(Blocks.CACTUS), new ItemStack(Blocks.tallgrass, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.pumpkin), new ItemStack(Blocks.melon_block), new ItemStack(Items.golden_apple), new ItemStack(Items.nether_wart), - new ItemStack(Items.pumpkin_seeds), - new ItemStack(Items.melon_seeds) + new ItemStack(Items.PUMPKIN_SEEDS), + new ItemStack(Items.MELON_SEEDS) ))); backpackItemDefaults.get(BackpackManager.HUNTER_UID).addAll(getItemStrings(Arrays.asList( new ItemStack(Items.feather), - new ItemStack(Items.gunpowder), - new ItemStack(Items.blaze_powder), - new ItemStack(Items.blaze_rod), - new ItemStack(Items.bone), - new ItemStack(Items.string), - new ItemStack(Items.rotten_flesh), - new ItemStack(Items.ghast_tear), + new ItemStack(Items.GUNPOWDER), + new ItemStack(Items.BLAZE_POWDER), + new ItemStack(Items.BLAZE_ROD), + new ItemStack(Items.BONE), + new ItemStack(Items.STRING), + new ItemStack(Items.ROTTEN_FLESH), + new ItemStack(Items.GHAST_TEAR), new ItemStack(Items.gold_nugget), - new ItemStack(Items.arrow), + new ItemStack(Items.ARROW), new ItemStack(Items.porkchop), new ItemStack(Items.cooked_porkchop), new ItemStack(Items.beef), @@ -253,14 +253,14 @@ public class PluginStorage extends BlankForestryPlugin { new ItemStack(Items.cooked_chicken), new ItemStack(Items.leather), new ItemStack(Items.egg), - new ItemStack(Items.ender_pearl), - new ItemStack(Items.spider_eye), + new ItemStack(Items.ENDER_PEARL), + new ItemStack(Items.SPIDER_EYE), new ItemStack(Items.fermented_spider_eye), new ItemStack(Items.slime_ball), - new ItemStack(Items.dye, 1, 0), + new ItemStack(Items.DYE, 1, 0), new ItemStack(Blocks.hay_block), new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE), - new ItemStack(Items.ender_eye), + new ItemStack(Items.ENDER_EYE), new ItemStack(Items.magma_cream), new ItemStack(Items.speckled_melon), new ItemStack(Items.fish), @@ -277,15 +277,15 @@ public class PluginStorage extends BlankForestryPlugin { backpackItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList( new ItemStack(Blocks.redstone_torch), new ItemStack(Blocks.redstone_lamp), - new ItemStack(Blocks.stonebrick, 1, OreDictionary.WILDCARD_VALUE), - new ItemStack(Blocks.sandstone, 1, 1), - new ItemStack(Blocks.sandstone, 1, 2), - new ItemStack(Blocks.brick_block), + new ItemStack(Blocks.STONEBRICK, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Blocks.SANDSTONE, 1, 1), + new ItemStack(Blocks.SANDSTONE, 1, 2), + new ItemStack(Blocks.BRICK_BLOCK), new ItemStack(Blocks.clay), new ItemStack(Blocks.hardened_clay, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.stained_hardened_clay, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Blocks.packed_ice), - new ItemStack(Blocks.nether_brick), + new ItemStack(Blocks.NETHER_BRICK), new ItemStack(Blocks.crafting_table), new ItemStack(Blocks.furnace), new ItemStack(Blocks.lever), @@ -293,8 +293,8 @@ public class PluginStorage extends BlankForestryPlugin { new ItemStack(Blocks.dropper), new ItemStack(Blocks.ladder), new ItemStack(Blocks.iron_bars), - new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), - new ItemStack(Blocks.cobblestone_wall), + new ItemStack(Blocks.QUARTZ_BLOCK, 1, OreDictionary.WILDCARD_VALUE), + new ItemStack(Blocks.COBBLESTONE_wall), new ItemStack(Blocks.stone_button), new ItemStack(Blocks.wooden_button), new ItemStack(Blocks.stone_slab), @@ -454,7 +454,7 @@ public class PluginStorage extends BlankForestryPlugin { addBackpackRecipe(items.diggerBackpack, "stone"); addBackpackRecipe(items.foresterBackpack, "logWood"); addBackpackRecipe(items.hunterBackpack, Items.feather); - addBackpackRecipe(items.adventurerBackpack, Items.bone); + addBackpackRecipe(items.adventurerBackpack, Items.BONE); addBackpackRecipe(items.builderBackpack, Items.clay_ball); // / CARPENTER @@ -483,7 +483,7 @@ public class PluginStorage extends BlankForestryPlugin { "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, + 'X', Items.STRING, 'V', material, 'Y', chest); }