diff --git a/src/main/java/forestry/Forestry.java b/src/main/java/forestry/Forestry.java index b0c35698d..0bbb15f57 100644 --- a/src/main/java/forestry/Forestry.java +++ b/src/main/java/forestry/Forestry.java @@ -16,7 +16,6 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @@ -87,7 +86,6 @@ public class Forestry { // Register event handler EventHandlerCore eventHandlerCore = new EventHandlerCore(); MinecraftForge.EVENT_BUS.register(eventHandlerCore); - FMLCommonHandler.instance().bus().register(eventHandlerCore); MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler()); configFolder = new File(event.getModConfigurationDirectory(), "forestry"); diff --git a/src/main/java/forestry/api/apiculture/BeeManager.java b/src/main/java/forestry/api/apiculture/BeeManager.java index 280ee751f..c4ef330aa 100644 --- a/src/main/java/forestry/api/apiculture/BeeManager.java +++ b/src/main/java/forestry/api/apiculture/BeeManager.java @@ -25,7 +25,7 @@ public class BeeManager { /** * List of items that can induce swarming. Integer denotes x in 1000 chance. */ - public static HashMap inducers = new HashMap(); + public static HashMap inducers = new HashMap<>(); /** * Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootBees") diff --git a/src/main/java/forestry/api/apiculture/EnumBeeChromosome.java b/src/main/java/forestry/api/apiculture/EnumBeeChromosome.java index d23b0f5d7..845d76612 100644 --- a/src/main/java/forestry/api/apiculture/EnumBeeChromosome.java +++ b/src/main/java/forestry/api/apiculture/EnumBeeChromosome.java @@ -44,7 +44,7 @@ public enum EnumBeeChromosome implements IChromosomeType { */ TEMPERATURE_TOLERANCE(IAlleleTolerance.class), /** - * Slightly incorrectly named. If true, a naturally dirunal bee can work during the night. If true, a naturally nocturnal bee can work during the day. + * Slightly incorrectly named. If true, a naturally diurnal bee can work during the night. If true, a naturally nocturnal bee can work during the day. */ NOCTURNAL(IAlleleBoolean.class), /** @@ -81,15 +81,15 @@ public enum EnumBeeChromosome implements IChromosomeType { */ EFFECT(IAlleleBeeEffect.class); - Class clss; + private final Class alleleClass; - EnumBeeChromosome(Class clss) { - this.clss = clss; + EnumBeeChromosome(Class alleleClass) { + this.alleleClass = alleleClass; } @Override public Class getAlleleClass() { - return clss; + return alleleClass; } @Override diff --git a/src/main/java/forestry/api/apiculture/IBee.java b/src/main/java/forestry/api/apiculture/IBee.java index 7b65a40bc..fa8927bd8 100644 --- a/src/main/java/forestry/api/apiculture/IBee.java +++ b/src/main/java/forestry/api/apiculture/IBee.java @@ -5,6 +5,8 @@ ******************************************************************************/ package forestry.api.apiculture; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; import java.util.Set; @@ -26,12 +28,14 @@ public interface IBee extends IIndividualLiving { /** * @return Bee's genetic information. */ + @Nonnull @Override IBeeGenome getGenome(); /** * @return Genetic information of the bee's mate, null if unmated. */ + @Nullable @Override IBeeGenome getMate(); diff --git a/src/main/java/forestry/api/apiculture/hives/IHiveRegistry.java b/src/main/java/forestry/api/apiculture/hives/IHiveRegistry.java index 68bbea5f7..4d00bbd37 100644 --- a/src/main/java/forestry/api/apiculture/hives/IHiveRegistry.java +++ b/src/main/java/forestry/api/apiculture/hives/IHiveRegistry.java @@ -7,13 +7,14 @@ package forestry.api.apiculture.hives; import java.util.List; -import forestry.api.apiculture.IHiveDrop; import net.minecraft.util.IStringSerializable; +import forestry.api.apiculture.IHiveDrop; + public interface IHiveRegistry { /* Forestry Hive Names */ - public static enum HiveType implements IStringSerializable{ + enum HiveType implements IStringSerializable { FOREST("Forestry:forest"), MEADOWS("Forestry:meadows"), DESERT("Forestry:desert"), @@ -22,11 +23,11 @@ public interface IHiveRegistry { SNOW("Forestry:snow"), SWAMP("Forestry:swamp"); - private HiveType(String name) { + HiveType(String name) { this.name = name; } - public String name; + private final String name; public String getHiveName() { diff --git a/src/main/java/forestry/api/circuits/ICircuitRegistry.java b/src/main/java/forestry/api/circuits/ICircuitRegistry.java index 9fb2b94d5..9f8c05185 100644 --- a/src/main/java/forestry/api/circuits/ICircuitRegistry.java +++ b/src/main/java/forestry/api/circuits/ICircuitRegistry.java @@ -19,7 +19,7 @@ public interface ICircuitRegistry { ICircuit getCircuit(String uid); - ICircuitLibrary getCircuitLibrary(World world, String playername); + ICircuitLibrary getCircuitLibrary(World world, String playerName); /* LAYOUTS */ Map getRegisteredLayouts(); @@ -30,7 +30,7 @@ public interface ICircuitRegistry { ICircuitLayout getDefaultLayout(); - ICircuitBoard getCircuitboard(ItemStack itemstack); + ICircuitBoard getCircuitBoard(ItemStack itemstack); boolean isChipset(ItemStack itemstack); diff --git a/src/main/java/forestry/api/core/BiomeHelper.java b/src/main/java/forestry/api/core/BiomeHelper.java index 3b70ca63c..00c9a91f1 100644 --- a/src/main/java/forestry/api/core/BiomeHelper.java +++ b/src/main/java/forestry/api/core/BiomeHelper.java @@ -9,7 +9,7 @@ import net.minecraftforge.common.BiomeDictionary; public class BiomeHelper { - private static final Map isBiomeHellishCache = new HashMap(); + private static final Map isBiomeHellishCache = new HashMap<>(); /** * Determines if it can rain or snow in the given biome. diff --git a/src/main/java/forestry/api/core/EnumHumidity.java b/src/main/java/forestry/api/core/EnumHumidity.java index a87431691..e6e400a03 100644 --- a/src/main/java/forestry/api/core/EnumHumidity.java +++ b/src/main/java/forestry/api/core/EnumHumidity.java @@ -15,7 +15,7 @@ public enum EnumHumidity { public final String name; - private EnumHumidity(String name) { + EnumHumidity(String name) { this.name = name; } diff --git a/src/main/java/forestry/api/core/EnumTemperature.java b/src/main/java/forestry/api/core/EnumTemperature.java index f38024ac2..5776ff8b4 100644 --- a/src/main/java/forestry/api/core/EnumTemperature.java +++ b/src/main/java/forestry/api/core/EnumTemperature.java @@ -8,6 +8,7 @@ package forestry.api.core; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.BlockPos; import net.minecraft.world.biome.BiomeGenBase; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -23,7 +24,7 @@ public enum EnumTemperature { public final String name; public final String iconIndex; - private EnumTemperature(String name, String iconIndex) { + EnumTemperature(String name, String iconIndex) { this.name = name; this.iconIndex = iconIndex; } diff --git a/src/main/java/forestry/api/core/IArmorNaturalist.java b/src/main/java/forestry/api/core/IArmorNaturalist.java index 87400e271..b4978e2d4 100644 --- a/src/main/java/forestry/api/core/IArmorNaturalist.java +++ b/src/main/java/forestry/api/core/IArmorNaturalist.java @@ -21,5 +21,5 @@ public interface IArmorNaturalist { * Whether or not to actually do the side effects of viewing * @return true if the armor actually allows the player to see pollination. */ - public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee); + boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee); } diff --git a/src/main/java/forestry/api/core/IForestryConstants.java b/src/main/java/forestry/api/core/IForestryConstants.java index 4cf876f67..00ec55322 100644 --- a/src/main/java/forestry/api/core/IForestryConstants.java +++ b/src/main/java/forestry/api/core/IForestryConstants.java @@ -10,15 +10,15 @@ public interface IForestryConstants { /** * @return The villager ID for the Apiarist Villager. */ - public int getApicultureVillagerID(); + int getApicultureVillagerID(); /** * @return The villager ID for the Arborist Villager. */ - public int getArboricultureVillagerID(); + int getArboricultureVillagerID(); /** * @return The ChestGenHooks key for adding items to the Forestry Villager chest. */ - public String getVillagerChestGenKey(); + String getVillagerChestGenKey(); } diff --git a/src/main/java/forestry/api/farming/Farmables.java b/src/main/java/forestry/api/farming/Farmables.java index 9816e64ee..35319a848 100644 --- a/src/main/java/forestry/api/farming/Farmables.java +++ b/src/main/java/forestry/api/farming/Farmables.java @@ -14,6 +14,6 @@ public class Farmables { * * Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom */ - public static HashMap> farmables = new HashMap>(); + public static HashMap> farmables = new HashMap<>(); } diff --git a/src/main/java/forestry/api/genetics/AlleleManager.java b/src/main/java/forestry/api/genetics/AlleleManager.java index 6e3511621..b42955b55 100644 --- a/src/main/java/forestry/api/genetics/AlleleManager.java +++ b/src/main/java/forestry/api/genetics/AlleleManager.java @@ -20,11 +20,11 @@ public class AlleleManager { /** * Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks. */ - public static HashMap ersatzSpecimen = new HashMap(); + public static HashMap ersatzSpecimen = new HashMap<>(); /** * Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings. */ - public static HashMap ersatzSaplings = new HashMap(); + public static HashMap ersatzSaplings = new HashMap<>(); /** * Queryable instance of an {@link IClimateHelper} for easier implementation. */ diff --git a/src/main/java/forestry/api/genetics/IAlleleHandler.java b/src/main/java/forestry/api/genetics/IAlleleHandler.java index 3d052afe4..0e25c652b 100644 --- a/src/main/java/forestry/api/genetics/IAlleleHandler.java +++ b/src/main/java/forestry/api/genetics/IAlleleHandler.java @@ -20,7 +20,7 @@ public interface IAlleleHandler { * @param allele * Allele which was registered. */ - public void onRegisterAllele(IAllele allele); + void onRegisterAllele(IAllele allele); /** * Called when a classification is registered with {@link IAlleleRegistry}. @@ -28,7 +28,7 @@ public interface IAlleleHandler { * @param classification * Classification which was registered. */ - public void onRegisterClassification(IClassification classification); + void onRegisterClassification(IClassification classification); /** * Called when a fruit family is registered with {@link IAlleleRegistry}. @@ -36,6 +36,5 @@ public interface IAlleleHandler { * @param family * Fruit family which was registered. */ - public void onRegisterFruitFamily(IFruitFamily family); - + void onRegisterFruitFamily(IFruitFamily family); } diff --git a/src/main/java/forestry/api/genetics/IAllelePlantType.java b/src/main/java/forestry/api/genetics/IAllelePlantType.java index 211237f20..dc447c525 100644 --- a/src/main/java/forestry/api/genetics/IAllelePlantType.java +++ b/src/main/java/forestry/api/genetics/IAllelePlantType.java @@ -11,6 +11,6 @@ import net.minecraftforge.common.EnumPlantType; public interface IAllelePlantType extends IAllele { - public EnumSet getPlantTypes(); + EnumSet getPlantTypes(); } diff --git a/src/main/java/forestry/api/genetics/IClassification.java b/src/main/java/forestry/api/genetics/IClassification.java index f365b915c..f2faa8e64 100644 --- a/src/main/java/forestry/api/genetics/IClassification.java +++ b/src/main/java/forestry/api/genetics/IClassification.java @@ -12,19 +12,19 @@ package forestry.api.genetics; */ public interface IClassification { - public enum EnumClassLevel { + enum EnumClassLevel { DOMAIN(0x777fff, true), KINGDOM(0x77c3ff), PHYLUM(0x77ffb6, true), DIVISION(0x77ffb6, true), CLASS(0x7bff77), ORDER(0xbeff77), FAMILY(0xfffd77), SUBFAMILY(0xfffd77), TRIBE(0xfffd77), GENUS(0xffba77); - private int colour; - private boolean isDroppable; + private final int colour; + private final boolean isDroppable; - private EnumClassLevel(int colour) { + EnumClassLevel(int colour) { this(colour, false); } - private EnumClassLevel(int colour, boolean isDroppable) { + EnumClassLevel(int colour, boolean isDroppable) { this.colour = colour; this.isDroppable = isDroppable; } diff --git a/src/main/java/forestry/api/genetics/IIndividual.java b/src/main/java/forestry/api/genetics/IIndividual.java index f86aa5829..f2a8772e8 100644 --- a/src/main/java/forestry/api/genetics/IIndividual.java +++ b/src/main/java/forestry/api/genetics/IIndividual.java @@ -5,6 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; +import javax.annotation.Nonnull; import java.util.List; import forestry.api.core.INBTTagable; @@ -34,6 +35,7 @@ public interface IIndividual extends INBTTagable { boolean isSecret(); + @Nonnull IGenome getGenome(); /** diff --git a/src/main/java/forestry/api/mail/EnumPostage.java b/src/main/java/forestry/api/mail/EnumPostage.java index 772114fb0..e59a0093a 100644 --- a/src/main/java/forestry/api/mail/EnumPostage.java +++ b/src/main/java/forestry/api/mail/EnumPostage.java @@ -10,7 +10,7 @@ public enum EnumPostage { private final int value; - private EnumPostage(int value) { + EnumPostage(int value) { this.value = value; } diff --git a/src/main/java/forestry/api/recipes/ICarpenterManager.java b/src/main/java/forestry/api/recipes/ICarpenterManager.java index 9dc700ac8..e30c82a52 100644 --- a/src/main/java/forestry/api/recipes/ICarpenterManager.java +++ b/src/main/java/forestry/api/recipes/ICarpenterManager.java @@ -33,7 +33,7 @@ public interface ICarpenterManager extends ICraftingProvider { * @param materials * Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same. */ - public void addRecipe(ItemStack box, ItemStack product, Object... materials); + void addRecipe(ItemStack box, ItemStack product, Object... materials); /** * Add a shaped recipe to the carpenter. @@ -47,7 +47,7 @@ public interface ICarpenterManager extends ICraftingProvider { * @param materials * Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same. */ - public void addRecipe(int packagingTime, ItemStack box, ItemStack product, Object... materials); + void addRecipe(int packagingTime, ItemStack box, ItemStack product, Object... materials); /** * Add a shaped recipe to the carpenter. @@ -63,5 +63,5 @@ public interface ICarpenterManager extends ICraftingProvider { * @param materials * Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same. */ - public void addRecipe(int packagingTime, FluidStack liquid, ItemStack box, ItemStack product, Object... materials); + void addRecipe(int packagingTime, FluidStack liquid, ItemStack box, ItemStack product, Object... materials); } diff --git a/src/main/java/forestry/api/recipes/IFermenterManager.java b/src/main/java/forestry/api/recipes/IFermenterManager.java index 5aa926ddf..3a1b6e3dc 100644 --- a/src/main/java/forestry/api/recipes/IFermenterManager.java +++ b/src/main/java/forestry/api/recipes/IFermenterManager.java @@ -35,7 +35,7 @@ public interface IFermenterManager extends ICraftingProvider { * @param liquid LiquidStack representing resource liquid and amount. * @throws NullPointerException if resource, output or liquid is null */ - public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid); + void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid); /** * Add a recipe to the fermenter. Defaults to water as input liquid. @@ -49,5 +49,5 @@ public interface IFermenterManager extends ICraftingProvider { * determined by fermentationValue*modifier. * @throws NullPointerException if resource, output or liquid is null */ - public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output); + void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output); } diff --git a/src/main/java/forestry/api/recipes/IMoistenerManager.java b/src/main/java/forestry/api/recipes/IMoistenerManager.java index 3bbd59d44..08531b964 100644 --- a/src/main/java/forestry/api/recipes/IMoistenerManager.java +++ b/src/main/java/forestry/api/recipes/IMoistenerManager.java @@ -29,5 +29,5 @@ public interface IMoistenerManager extends ICraftingProvider { * @param timePerItem * Moistener runs at 1 - 4 time ticks per ingame tick depending on light level. For mycelium this value is currently 5000. */ - public void addRecipe(ItemStack resource, ItemStack product, int timePerItem); + void addRecipe(ItemStack resource, ItemStack product, int timePerItem); } diff --git a/src/main/java/forestry/api/recipes/ISqueezerManager.java b/src/main/java/forestry/api/recipes/ISqueezerManager.java index e02bf4dc2..2190035c9 100644 --- a/src/main/java/forestry/api/recipes/ISqueezerManager.java +++ b/src/main/java/forestry/api/recipes/ISqueezerManager.java @@ -32,7 +32,7 @@ public interface ISqueezerManager extends ICraftingProvider { * @param remnants Item stack representing the possible remnants from this recipe. * @param chance Chance remnants will be produced by a single recipe cycle, from 0 to 100. */ - public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid, ItemStack remnants, int chance); + void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid, ItemStack remnants, int chance); /** * Add a recipe to the squeezer. @@ -41,7 +41,7 @@ public interface ISqueezerManager extends ICraftingProvider { * @param resources Array of item stacks representing the required resources for one process. Stack size will be taken into account. * @param liquid {@link FluidStack} representing the output of this recipe. */ - public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid); + void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid); /** * Add a recipe for a fluid container to the squeezer. diff --git a/src/main/java/forestry/api/recipes/IStillManager.java b/src/main/java/forestry/api/recipes/IStillManager.java index 72cd7398f..a49ce2703 100644 --- a/src/main/java/forestry/api/recipes/IStillManager.java +++ b/src/main/java/forestry/api/recipes/IStillManager.java @@ -30,5 +30,5 @@ public interface IStillManager extends ICraftingProvider { * @param output * FluidStack representing the output liquid */ - public void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output); + void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output); } diff --git a/src/main/java/forestry/api/storage/BackpackManager.java b/src/main/java/forestry/api/storage/BackpackManager.java index 8805904d6..b90b337a8 100644 --- a/src/main/java/forestry/api/storage/BackpackManager.java +++ b/src/main/java/forestry/api/storage/BackpackManager.java @@ -23,5 +23,5 @@ public class BackpackManager { /** * Only use this if you know what you are doing. Prefer backpackInterface. */ - public static HashMap definitions = new HashMap(); + public static HashMap definitions = new HashMap<>(); } diff --git a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java index ef04f76b1..c2eb4ab5c 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java +++ b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java @@ -10,12 +10,12 @@ ******************************************************************************/ package forestry.apiculture.blocks; +import com.google.common.collect.Maps; + import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; -import com.google.common.collect.Maps; - import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; @@ -31,8 +31,10 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.core.IModelManager; import forestry.api.core.IStateMapperRegister; import forestry.api.core.Tabs; @@ -274,7 +276,6 @@ public class BlockAlveary extends BlockStructure implements IStateMapperRegister String s = String.format("%s:%s", Block.blockRegistry.getNameForObject(state.getBlock()).getResourceDomain(), "apiculture/alveary_" + TYPE.getName((Enum) linkedhashmap.remove(TYPE))); - ; return new ModelResourceLocation(s, this.getPropertyString(linkedhashmap)); } diff --git a/src/main/java/forestry/apiculture/blocks/BlockBeehives.java b/src/main/java/forestry/apiculture/blocks/BlockBeehives.java index a39cc4c27..99eb9f7c6 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockBeehives.java +++ b/src/main/java/forestry/apiculture/blocks/BlockBeehives.java @@ -15,7 +15,6 @@ import java.util.Collections; import java.util.List; import net.minecraft.block.BlockContainer; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; @@ -31,8 +30,8 @@ import net.minecraft.world.World; import forestry.api.apiculture.IHiveDrop; import forestry.api.apiculture.hives.IHiveRegistry.HiveType; -import forestry.api.core.IModelManager; import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; import forestry.api.core.Tabs; import forestry.apiculture.MaterialBeehive; import forestry.apiculture.tiles.TileSwarm; @@ -42,7 +41,7 @@ import forestry.core.utils.ItemStackUtil; import forestry.plugins.PluginApiculture; public class BlockBeehives extends BlockContainer implements IItemModelRegister { - private static final PropertyEnum HIVETYPES = PropertyEnum.create("hive", HiveType.class); + private static final PropertyEnum HIVE_TYPES = PropertyEnum.create("hive", HiveType.class); public BlockBeehives() { super(new MaterialBeehive(true)); @@ -50,22 +49,22 @@ public class BlockBeehives extends BlockContainer implements IItemModelRegister setHardness(1.0f); setCreativeTab(Tabs.tabApiculture); setHarvestLevel("scoop", 0); - setDefaultState(this.blockState.getBaseState().withProperty(HIVETYPES, HiveType.FOREST)); + setDefaultState(this.blockState.getBaseState().withProperty(HIVE_TYPES, HiveType.FOREST)); } @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { HIVETYPES }); + return new BlockState(this, HIVE_TYPES); } @Override public int getMetaFromState(IBlockState state) { - return ((HiveType) state.getValue(HIVETYPES)).ordinal() + 1; + return ((HiveType) state.getValue(HIVE_TYPES)).ordinal() + 1; } @Override public IBlockState getStateFromMeta(int meta) { - return getDefaultState().withProperty(HIVETYPES, HiveType.values()[meta - 1]); + return getDefaultState().withProperty(HIVE_TYPES, HiveType.values()[meta - 1]); } @Override @@ -188,7 +187,7 @@ public class BlockBeehives extends BlockContainer implements IItemModelRegister // Swarm hive not added } - /* IETM MODELS */ + /* ITEM MODELS */ @Override public void registerModel(Item item, IModelManager manager) { manager.registerItemModel(item, 1, "beehives/" + HiveType.FOREST.getName()); diff --git a/src/main/java/forestry/apiculture/blocks/BlockCandle.java b/src/main/java/forestry/apiculture/blocks/BlockCandle.java index e01fcc68b..392cd0587 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockCandle.java +++ b/src/main/java/forestry/apiculture/blocks/BlockCandle.java @@ -41,11 +41,13 @@ import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; -import forestry.api.core.IModelManager; + import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; import forestry.api.core.Tabs; import forestry.apiculture.tiles.TileCandle; import forestry.core.utils.ItemStackUtil; @@ -209,7 +211,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister { } private static boolean tryDye(ItemStack held, boolean isLit, TileCandle tileCandle) { - // Check for dye-able ness. + // Check for dye-able. for (Map.Entry colour : colours.entrySet()) { String colourName = colour.getKey(); for (ItemStack stack : OreDictionary.getOres(colourName)) { diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index b72ece46d..d4198b8b8 100644 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.apiculture.genetics; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -72,24 +74,44 @@ public class Bee extends IndividualLiving implements IBee { private int generation; private boolean isNatural = true; + @Nonnull private IBeeGenome genome; + @Nullable private IBeeGenome mate; /* CONSTRUCTOR */ - public Bee(NBTTagCompound nbttagcompound) { - readFromNBT(nbttagcompound); + public Bee(@Nonnull NBTTagCompound nbttagcompound) { + super(nbttagcompound); + + if (nbttagcompound.hasKey("NA")) { + isNatural = nbttagcompound.getBoolean("NA"); + } + + if (nbttagcompound.hasKey("GEN")) { + generation = nbttagcompound.getInteger("GEN"); + } + + if (nbttagcompound.hasKey("Genome")) { + genome = BeeGenome.fromNBT(nbttagcompound.getCompoundTag("Genome")); + } else { + genome = BeeDefinition.FOREST.getGenome(); + } + + if (nbttagcompound.hasKey("Mate")) { + mate = BeeGenome.fromNBT(nbttagcompound.getCompoundTag("Mate")); + } } - public Bee(IBeeGenome genome, IBee mate) { + public Bee(@Nonnull IBeeGenome genome, IBee mate) { this(genome); this.mate = mate.getGenome(); } - public Bee(IBeeGenome genome) { + public Bee(@Nonnull IBeeGenome genome) { this(genome, true, 0); } - private Bee(IBeeGenome genome, boolean isNatural, int generation) { + private Bee(@Nonnull IBeeGenome genome, boolean isNatural, int generation) { super(genome.getLifespan()); this.genome = genome; this.isNatural = isNatural; @@ -227,11 +249,13 @@ public class Bee extends IndividualLiving implements IBee { } // / INFORMATION + @Nonnull @Override public IBeeGenome getGenome() { return genome; } + @Nullable @Override public IBeeGenome getMate() { return mate; diff --git a/src/main/java/forestry/apiculture/items/ItemPollenCluster.java b/src/main/java/forestry/apiculture/items/ItemPollenCluster.java index dd08cf65d..a73491868 100644 --- a/src/main/java/forestry/apiculture/items/ItemPollenCluster.java +++ b/src/main/java/forestry/apiculture/items/ItemPollenCluster.java @@ -17,7 +17,7 @@ import forestry.core.items.ItemOverlay; public class ItemPollenCluster extends ItemOverlay { public ItemPollenCluster() { - super(Tabs.tabApiculture, EnumPollenCluster.VALUES); + super(Tabs.tabApiculture, (IOverlayInfo[]) EnumPollenCluster.VALUES); } public ItemStack get(EnumPollenCluster pollenCluster, int amount) { diff --git a/src/main/java/forestry/apiculture/items/ItemPropolis.java b/src/main/java/forestry/apiculture/items/ItemPropolis.java index 585400343..3c25efc5d 100644 --- a/src/main/java/forestry/apiculture/items/ItemPropolis.java +++ b/src/main/java/forestry/apiculture/items/ItemPropolis.java @@ -17,7 +17,7 @@ import forestry.core.items.ItemOverlay; public class ItemPropolis extends ItemOverlay { public ItemPropolis() { - super(Tabs.tabApiculture, EnumPropolis.VALUES); + super(Tabs.tabApiculture, (IOverlayInfo[]) EnumPropolis.VALUES); } public ItemStack get(EnumPropolis propolis, int amount) { diff --git a/src/main/java/forestry/apiculture/render/ParticleRenderer.java b/src/main/java/forestry/apiculture/render/ParticleRenderer.java index 3842eb5bc..28a37ffd2 100755 --- a/src/main/java/forestry/apiculture/render/ParticleRenderer.java +++ b/src/main/java/forestry/apiculture/render/ParticleRenderer.java @@ -30,8 +30,8 @@ import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @@ -90,7 +90,6 @@ public class ParticleRenderer { private ParticleRenderer() { MinecraftForge.EVENT_BUS.register(this); - FMLCommonHandler.instance().bus().register(this); } private synchronized void update() { diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java b/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java index c4fda2661..e9f806353 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java @@ -18,7 +18,6 @@ import net.minecraft.block.BlockFence; import net.minecraft.block.BlockFenceGate; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EffectRenderer; @@ -32,12 +31,14 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.arboriculture.EnumWoodType; import forestry.api.arboriculture.TreeManager; -import forestry.api.core.IModelManager; import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; import forestry.api.core.Tabs; import forestry.arboriculture.IWoodTyped; import forestry.arboriculture.items.ItemBlockWood; @@ -70,16 +71,16 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, IItemModelR setHarvestLevel("axe", 0); setStepSound(soundTypeWood); setCreativeTab(Tabs.tabArboriculture); - setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)) - .withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)) - .withProperty(WEST, Boolean.valueOf(false)).withProperty(EnumWoodType.WOODTYPE, EnumWoodType.LARCH)); + setDefaultState(this.blockState.getBaseState().withProperty(NORTH, false) + .withProperty(EAST, false).withProperty(SOUTH, false) + .withProperty(WEST, false).withProperty(EnumWoodType.WOODTYPE, EnumWoodType.LARCH)); this.particleCallback = new ParticleHelper.DefaultCallback(this); } @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { NORTH, SOUTH, WEST, EAST, EnumWoodType.WOODTYPE }); + return new BlockState(this, NORTH, SOUTH, WEST, EAST, EnumWoodType.WOODTYPE); } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java index 5d1d22a89..33919cae6 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java @@ -12,7 +12,6 @@ package forestry.arboriculture.blocks; import javax.annotation.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Random; @@ -40,22 +39,23 @@ import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; + +import com.mojang.authlib.GameProfile; + import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.IShearable; import net.minecraftforge.common.property.ExtendedBlockState; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import com.mojang.authlib.GameProfile; - import forestry.api.arboriculture.EnumGermlingType; import forestry.api.arboriculture.IToolGrafter; import forestry.api.arboriculture.ITree; import forestry.api.arboriculture.TreeManager; -import forestry.api.core.IModelManager; import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; import forestry.api.core.IToolScoop; import forestry.api.core.Tabs; import forestry.api.lepidopterology.ButterflyManager; @@ -209,7 +209,8 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP @Override public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { - List ret = new ArrayList(Arrays.asList(new ItemStack(this))); + List ret = new ArrayList<>(); + ret.add(new ItemStack(this)); TileLeaves leaves = getLeafTile(world, pos); NBTTagCompound shearedLeavesNBT = new NBTTagCompound(); @@ -281,8 +282,8 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP if (leaves == null) { return super.colorMultiplier(world, pos, 0); } - int colour = super.colorMultiplier(world, pos, 0); - if(renderPass == 0){ + final int colour; + if (renderPass == 0) { colour = leaves.getFoliageColour(Proxies.common.getClientInstance().thePlayer); if (colour == 0 || colour == PluginArboriculture.proxy.getFoliageColorBasic()) { return super.colorMultiplier(world, pos, 0); diff --git a/src/main/java/forestry/arboriculture/blocks/BlockLog.java b/src/main/java/forestry/arboriculture/blocks/BlockLog.java index 5e5556601..60753c8be 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockLog.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockLog.java @@ -12,7 +12,6 @@ package forestry.arboriculture.blocks; import java.util.List; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; @@ -30,9 +29,9 @@ import forestry.api.arboriculture.TreeManager; public class BlockLog extends BlockWood { - public static final PropertyEnum AXIS = PropertyEnum.create("axis", Axis.class); + private static final PropertyEnum AXIS = PropertyEnum.create("axis", Axis.class); - public static enum Axis implements IStringSerializable { + private enum Axis implements IStringSerializable { NORMAL, SIDE, SIDE_90; @Override @@ -67,7 +66,7 @@ public class BlockLog extends BlockWood { @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { EnumWoodType.WOODTYPE, AXIS }); + return new BlockState(this, EnumWoodType.WOODTYPE, AXIS); } @Override diff --git a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java index 0cff8536c..db40fd87b 100644 --- a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java +++ b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleFruit.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.arboriculture.genetics.alleles; +import javax.annotation.Nonnull; import java.util.Arrays; import java.util.List; @@ -85,7 +86,7 @@ public class AlleleFruit extends AlleleCategorized implements IAlleleFruit { } @Override - public int compareTo(IAlleleFruit arg0) { + public int compareTo(@Nonnull IAlleleFruit arg0) { return 0; } diff --git a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java index 5f8ec6076..de7f61785 100644 --- a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java +++ b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java @@ -10,14 +10,17 @@ ******************************************************************************/ package forestry.arboriculture.genetics.alleles; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.ModelResourceLocation; + import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.arboriculture.EnumGermlingType; import forestry.api.arboriculture.IAlleleTreeSpecies; import forestry.api.arboriculture.IAlleleTreeSpeciesCustom; @@ -130,7 +133,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci } @Override - public int compareTo(IAlleleTreeSpecies o) { + public int compareTo(@Nonnull IAlleleTreeSpecies o) { return 0; } diff --git a/src/main/java/forestry/arboriculture/genetics/pollination/ICheckPollinatable.java b/src/main/java/forestry/arboriculture/genetics/pollination/ICheckPollinatable.java index c1aeaab6b..30d040d33 100644 --- a/src/main/java/forestry/arboriculture/genetics/pollination/ICheckPollinatable.java +++ b/src/main/java/forestry/arboriculture/genetics/pollination/ICheckPollinatable.java @@ -16,7 +16,7 @@ import net.minecraftforge.common.EnumPlantType; import forestry.api.genetics.IIndividual; -/** Just like IPollinatible but for checking only, it can't be mated */ +/** Just like IPollinatable but for checking only, it can't be mated */ public interface ICheckPollinatable { /** diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockWood.java b/src/main/java/forestry/arboriculture/items/ItemBlockWood.java index a99d3bcbb..b5b86f185 100644 --- a/src/main/java/forestry/arboriculture/items/ItemBlockWood.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockWood.java @@ -10,11 +10,10 @@ ******************************************************************************/ package forestry.arboriculture.items; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; @@ -28,8 +27,10 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.arboriculture.EnumWoodType; import forestry.arboriculture.IWoodTyped; import forestry.arboriculture.tiles.TileWood; @@ -172,10 +173,10 @@ public class ItemBlockWood extends ItemBlockForestry { } public static ResourceLocation[] getVariants(IWoodTyped typed) { - List variants = new ArrayList(); + List variants = new ArrayList<>(); for (EnumWoodType type : EnumWoodType.values()) variants.add(new ResourceLocation("forestry", typed.getBlockKind() + "/" + type.getName().toLowerCase())); - return (ResourceLocation[]) variants.toArray(new ResourceLocation[variants.size()]); + return variants.toArray(new ResourceLocation[variants.size()]); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockWoodSlab.java b/src/main/java/forestry/arboriculture/items/ItemBlockWoodSlab.java index bb090f52c..5b66b49b5 100644 --- a/src/main/java/forestry/arboriculture/items/ItemBlockWoodSlab.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockWoodSlab.java @@ -8,8 +8,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.arboriculture.EnumWoodType; import forestry.arboriculture.blocks.BlockSlab; import forestry.arboriculture.blocks.BlockSlabDouble; @@ -65,8 +67,8 @@ public class ItemBlockWoodSlab extends ItemBlockWood { } } - return this.tryPlace(stack, world, pos.offset(side), stackWoodType) ? true : super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ); - } + return this.tryPlace(stack, world, pos.offset(side), stackWoodType) || super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ); + } } @Override @@ -94,7 +96,7 @@ public class ItemBlockWoodSlab extends ItemBlockWood { pos = pos.offset(side); IBlockState iblockstate1 = world.getBlockState(pos); - return iblockstate1.getBlock() == this.slab && stackWoodType == blockWoodType ? true : super.canPlaceBlockOnSide(world, blockpos, side, player, itemStack); + return iblockstate1.getBlock() == this.slab && stackWoodType == blockWoodType || super.canPlaceBlockOnSide(world, blockpos, side, player, itemStack); } private boolean tryPlace(ItemStack itemStack, World world, BlockPos pos, Object variantInStack) diff --git a/src/main/java/forestry/arboriculture/render/FluidPodStateMapper.java b/src/main/java/forestry/arboriculture/render/FluidPodStateMapper.java index a2cc8c132..655f5318f 100644 --- a/src/main/java/forestry/arboriculture/render/FluidPodStateMapper.java +++ b/src/main/java/forestry/arboriculture/render/FluidPodStateMapper.java @@ -1,22 +1,26 @@ package forestry.arboriculture.render; +import com.google.common.collect.Maps; + import java.util.LinkedHashMap; import java.util.Map; -import com.google.common.collect.Maps; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockCocoa; +import net.minecraft.block.BlockDirectional; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import forestry.api.arboriculture.IAlleleFruit; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.arboriculture.blocks.BlockFruitPod; import forestry.core.render.ForestryStateMapper; -import net.minecraft.block.Block; -import net.minecraft.block.BlockCocoa; -import net.minecraft.block.BlockDirectional; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class FluidPodStateMapper extends ForestryStateMapper{ @@ -33,7 +37,7 @@ public class FluidPodStateMapper extends ForestryStateMapper{ IAlleleFruit fruit = (IAlleleFruit) allele; if(fruit.getModelName() != null){ IBlockState state = block.getDefaultState().withProperty(BlockFruitPod.FRUIT, fruit).withProperty(BlockDirectional.FACING, facing).withProperty(BlockCocoa.AGE, age); - LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties()); + LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties()); String modID = fruit.getModID(); if(modID == null){ modID = "forestry"; diff --git a/src/main/java/forestry/arboriculture/render/ModelLeaves.java b/src/main/java/forestry/arboriculture/render/ModelLeaves.java index 8be8e6fff..ce24833df 100644 --- a/src/main/java/forestry/arboriculture/render/ModelLeaves.java +++ b/src/main/java/forestry/arboriculture/render/ModelLeaves.java @@ -14,6 +14,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; + import forestry.api.core.IModelBaker; import forestry.arboriculture.blocks.BlockForestryLeaves; import forestry.arboriculture.genetics.TreeHelper; @@ -24,6 +25,10 @@ import forestry.core.proxy.Proxies; public class ModelLeaves extends ModelBlockOverlay { + public ModelLeaves() { + super(BlockForestryLeaves.class); + } + @Override public void renderInventory(BlockForestryLeaves block, ItemStack itemStack, IModelBaker baker) { if (!(itemStack.getItem() instanceof ItemBlockLeaves) || block == null) { diff --git a/src/main/java/forestry/arboriculture/render/SaplingStateMapper.java b/src/main/java/forestry/arboriculture/render/SaplingStateMapper.java index 159b6de20..28acb4863 100644 --- a/src/main/java/forestry/arboriculture/render/SaplingStateMapper.java +++ b/src/main/java/forestry/arboriculture/render/SaplingStateMapper.java @@ -1,31 +1,34 @@ package forestry.arboriculture.render; +import com.google.common.collect.Maps; + import java.util.LinkedHashMap; import java.util.Map; -import com.google.common.collect.Maps; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import forestry.api.arboriculture.IAlleleTreeSpecies; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.arboriculture.blocks.BlockSapling; import forestry.core.render.ForestryStateMapper; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class SaplingStateMapper extends ForestryStateMapper { @Override - public Map putStateModelLocations(Block block) { + public Map putStateModelLocations(Block block) { for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) { if (allele instanceof IAlleleTreeSpecies) { IAlleleTreeSpecies tree = (IAlleleTreeSpecies)allele; IBlockState state = block.getDefaultState().withProperty(BlockSapling.TREE, tree); - LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties()); + LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties()); String modID = tree.getModID(); if(modID == null){ modID = "forestry"; diff --git a/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java b/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java index ac662764c..bed85c486 100644 --- a/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java +++ b/src/main/java/forestry/arboriculture/tiles/TileFruitPod.java @@ -20,8 +20,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.arboriculture.IAlleleFruit; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; @@ -61,7 +63,7 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl super.readFromNBT(nbttagcompound); IAllele stored = AlleleManager.alleleRegistry.getAllele(nbttagcompound.getString("UID")); - if (stored != null && stored instanceof IAlleleFruit) { + if (stored instanceof IAlleleFruit) { allele = (IAlleleFruit) stored; } else { allele = (IAlleleFruit) AlleleManager.alleleRegistry.getAllele("fruitCocoa"); diff --git a/src/main/java/forestry/core/blocks/BlockSoil.java b/src/main/java/forestry/core/blocks/BlockSoil.java index a1c4a81d6..1f71b2e45 100644 --- a/src/main/java/forestry/core/blocks/BlockSoil.java +++ b/src/main/java/forestry/core/blocks/BlockSoil.java @@ -23,6 +23,7 @@ import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -36,8 +37,9 @@ import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import forestry.api.core.IModelManager; + import forestry.api.core.IItemModelRegister; +import forestry.api.core.IModelManager; import forestry.core.CreativeTabForestry; import forestry.core.config.Constants; import forestry.core.utils.BlockUtil; @@ -234,7 +236,7 @@ public class BlockSoil extends Block implements IItemTyped, IItemModelRegister { } @Override - protected boolean canSilkHarvest() { + public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) { return false; } @@ -255,9 +257,8 @@ public class BlockSoil extends Block implements IItemTyped, IItemModelRegister { } // / CREATIVE INVENTORY - @SuppressWarnings({"rawtypes", "unchecked"}) @Override - public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) { + public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) { itemList.add(new ItemStack(this, 1, 0)); itemList.add(new ItemStack(this, 1, 1)); } diff --git a/src/main/java/forestry/core/blocks/BlockStructure.java b/src/main/java/forestry/core/blocks/BlockStructure.java index e14d22b5c..540351ce1 100644 --- a/src/main/java/forestry/core/blocks/BlockStructure.java +++ b/src/main/java/forestry/core/blocks/BlockStructure.java @@ -40,7 +40,7 @@ public abstract class BlockStructure extends BlockForestry { } @Override - public boolean canSilkHarvest() { + public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) { return false; } diff --git a/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java b/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java index b8d419d05..cc2da41b8 100644 --- a/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java +++ b/src/main/java/forestry/core/blocks/propertys/PropertyAllele.java @@ -10,9 +10,10 @@ ******************************************************************************/ package forestry.core.blocks.propertys; -import forestry.api.genetics.IAllele; import net.minecraft.block.properties.IProperty; +import forestry.api.genetics.IAllele; + public abstract class PropertyAllele> implements IProperty { protected final String name; diff --git a/src/main/java/forestry/core/circuits/CircuitRegistry.java b/src/main/java/forestry/core/circuits/CircuitRegistry.java index 9d754d1c8..003a49f17 100755 --- a/src/main/java/forestry/core/circuits/CircuitRegistry.java +++ b/src/main/java/forestry/core/circuits/CircuitRegistry.java @@ -37,12 +37,12 @@ public class CircuitRegistry implements ICircuitRegistry { } @Override - public ICircuitLibrary getCircuitLibrary(World world, String playername) { - CircuitLibrary library = (CircuitLibrary) world.loadItemData(CircuitLibrary.class, "CircuitLibrary_" + playername); + public ICircuitLibrary getCircuitLibrary(World world, String playerName) { + CircuitLibrary library = (CircuitLibrary) world.loadItemData(CircuitLibrary.class, "CircuitLibrary_" + playerName); if (library == null) { - library = new CircuitLibrary(playername); - world.setItemData("CircuitLibrary_" + playername, library); + library = new CircuitLibrary(playerName); + world.setItemData("CircuitLibrary_" + playerName, library); } return library; @@ -104,7 +104,7 @@ public class CircuitRegistry implements ICircuitRegistry { } @Override - public ICircuitBoard getCircuitboard(ItemStack itemstack) { + public ICircuitBoard getCircuitBoard(ItemStack itemstack) { NBTTagCompound nbttagcompound = itemstack.getTagCompound(); if (nbttagcompound == null) { return null; diff --git a/src/main/java/forestry/core/circuits/ItemCircuitBoard.java b/src/main/java/forestry/core/circuits/ItemCircuitBoard.java index 452260bea..a4ffdc9ac 100755 --- a/src/main/java/forestry/core/circuits/ItemCircuitBoard.java +++ b/src/main/java/forestry/core/circuits/ItemCircuitBoard.java @@ -18,8 +18,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ICircuit; import forestry.api.circuits.ICircuitBoard; @@ -80,7 +82,7 @@ public class ItemCircuitBoard extends ItemForestry { @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) { - ICircuitBoard circuitboard = ChipsetManager.circuitRegistry.getCircuitboard(itemstack); + ICircuitBoard circuitboard = ChipsetManager.circuitRegistry.getCircuitBoard(itemstack); if (circuitboard != null) { circuitboard.addTooltip(list); } diff --git a/src/main/java/forestry/core/commands/RootCommand.java b/src/main/java/forestry/core/commands/RootCommand.java index f3bbafa65..74b902a76 100644 --- a/src/main/java/forestry/core/commands/RootCommand.java +++ b/src/main/java/forestry/core/commands/RootCommand.java @@ -11,7 +11,6 @@ package forestry.core.commands; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -29,13 +28,7 @@ public class RootCommand extends CommandBase implements IForestryCommand { public static final String ROOT_COMMAND_NAME = "forestry"; public static final String ROOT_COMMAND_ALIAS = "for"; - private final SortedSet children = new TreeSet<>(new Comparator() { - - @Override - public int compare(SubCommand o1, SubCommand o2) { - return o1.compareTo(o2); - } - }); + private final SortedSet children = new TreeSet<>(); public void addChildCommand(SubCommand child) { child.setParent(this); @@ -78,7 +71,7 @@ public class RootCommand extends CommandBase implements IForestryCommand { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) { + public List addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) { return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete, pos); } diff --git a/src/main/java/forestry/core/commands/SubCommand.java b/src/main/java/forestry/core/commands/SubCommand.java index 7a2a5b5f0..84cbba095 100644 --- a/src/main/java/forestry/core/commands/SubCommand.java +++ b/src/main/java/forestry/core/commands/SubCommand.java @@ -10,8 +10,8 @@ ******************************************************************************/ package forestry.core.commands; +import javax.annotation.Nonnull; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -42,13 +42,7 @@ public abstract class SubCommand implements IForestryCommand { private final List aliases = new ArrayList<>(); private PermLevel permLevel = PermLevel.EVERYONE; private IForestryCommand parent; - private final SortedSet children = new TreeSet<>(new Comparator() { - - @Override - public int compare(SubCommand o1, SubCommand o2) { - return o1.compareTo(o2); - } - }); + private final SortedSet children = new TreeSet<>(); public SubCommand(String name) { this.name = name; @@ -135,7 +129,7 @@ public abstract class SubCommand implements IForestryCommand { } @Override - public int compareTo(ICommand command) { + public int compareTo(@Nonnull ICommand command) { return this.getCommandName().compareTo(command.getCommandName()); } diff --git a/src/main/java/forestry/core/entities/EntityFXSnow.java b/src/main/java/forestry/core/entities/EntityFXSnow.java index 88c14308e..60a20e60c 100644 --- a/src/main/java/forestry/core/entities/EntityFXSnow.java +++ b/src/main/java/forestry/core/entities/EntityFXSnow.java @@ -68,7 +68,7 @@ public class EntityFXSnow extends EntityFX { int k = i & 65535; worldRenderer.pos((x - rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), (z - rotationZ * scale - rotationXY * scale)).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); worldRenderer.pos((x - rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), (z - rotationZ * scale + rotationXY * scale)).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos((x + rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), (z + rotationZ * scale + rotationXY * scale)).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();; - worldRenderer.pos((x + rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), (z + rotationZ * scale - rotationXY * scale)).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex();; + worldRenderer.pos((x + rotationX * scale + rotationYZ * scale), (y + rotationXZ * scale), (z + rotationZ * scale + rotationXY * scale)).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRenderer.pos((x + rotationX * scale - rotationYZ * scale), (y - rotationXZ * scale), (z + rotationZ * scale - rotationXY * scale)).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); } } diff --git a/src/main/java/forestry/core/fluids/PipetteContents.java b/src/main/java/forestry/core/fluids/PipetteContents.java index ff654ebe3..dec494296 100644 --- a/src/main/java/forestry/core/fluids/PipetteContents.java +++ b/src/main/java/forestry/core/fluids/PipetteContents.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.core.fluids; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; import net.minecraft.nbt.NBTTagCompound; @@ -19,6 +21,7 @@ import net.minecraftforge.fluids.FluidStack; import forestry.api.core.INBTTagable; public class PipetteContents implements INBTTagable { + @Nullable private FluidStack contents; public PipetteContents(NBTTagCompound nbttagcompound) { @@ -27,11 +30,12 @@ public class PipetteContents implements INBTTagable { } } + @Nullable public FluidStack getContents() { return contents; } - public void setContents(FluidStack contents) { + public void setContents(@Nonnull FluidStack contents) { this.contents = contents; } @@ -40,7 +44,7 @@ public class PipetteContents implements INBTTagable { return false; } - return contents.getFluid().getID() > 0 && contents.amount >= 1000; + return contents.amount >= 1000; } public void addTooltip(List list) { diff --git a/src/main/java/forestry/core/genetics/Individual.java b/src/main/java/forestry/core/genetics/Individual.java index 863f80703..3ad4d12ae 100755 --- a/src/main/java/forestry/core/genetics/Individual.java +++ b/src/main/java/forestry/core/genetics/Individual.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.core.genetics; +import javax.annotation.Nonnull; + import net.minecraft.nbt.NBTTagCompound; import forestry.api.genetics.IChromosomeType; @@ -19,6 +21,14 @@ public abstract class Individual implements IIndividual { protected boolean isAnalyzed = false; + protected Individual() { + + } + + protected Individual(@Nonnull NBTTagCompound nbt) { + isAnalyzed = nbt.getBoolean("IsAnalyzed"); + } + @Override public boolean isAnalyzed() { return isAnalyzed; diff --git a/src/main/java/forestry/core/genetics/IndividualLiving.java b/src/main/java/forestry/core/genetics/IndividualLiving.java index b5cf80246..20e4e32db 100755 --- a/src/main/java/forestry/core/genetics/IndividualLiving.java +++ b/src/main/java/forestry/core/genetics/IndividualLiving.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.core.genetics; +import javax.annotation.Nonnull; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -27,6 +29,12 @@ public abstract class IndividualLiving extends Individual implements IIndividual protected IndividualLiving(int newHealth) { health = maxHealth = newHealth; } + + protected IndividualLiving(@Nonnull NBTTagCompound nbt) { + super(nbt); + health = nbt.getInteger("Health"); + maxHealth = nbt.getInteger("MaxH"); + } /* SAVING & LOADING */ @Override diff --git a/src/main/java/forestry/core/gui/ContainerSocketedHelper.java b/src/main/java/forestry/core/gui/ContainerSocketedHelper.java index bff547c9f..7187edbb0 100644 --- a/src/main/java/forestry/core/gui/ContainerSocketedHelper.java +++ b/src/main/java/forestry/core/gui/ContainerSocketedHelper.java @@ -46,7 +46,7 @@ public class ContainerSocketedHelper impleme return; } - ICircuitBoard circuitBoard = ChipsetManager.circuitRegistry.getCircuitboard(itemstack); + ICircuitBoard circuitBoard = ChipsetManager.circuitRegistry.getCircuitBoard(itemstack); if (circuitBoard == null) { return; } diff --git a/src/main/java/forestry/core/gui/GuiType.java b/src/main/java/forestry/core/gui/GuiType.java index f413b701c..6c70f601b 100644 --- a/src/main/java/forestry/core/gui/GuiType.java +++ b/src/main/java/forestry/core/gui/GuiType.java @@ -13,5 +13,5 @@ package forestry.core.gui; public enum GuiType { Item, Tile, - Entity; + Entity } diff --git a/src/main/java/forestry/core/items/ItemElectronTube.java b/src/main/java/forestry/core/items/ItemElectronTube.java index a088c6dcf..ba625fd90 100644 --- a/src/main/java/forestry/core/items/ItemElectronTube.java +++ b/src/main/java/forestry/core/items/ItemElectronTube.java @@ -34,7 +34,7 @@ import forestry.core.utils.StringUtil; public class ItemElectronTube extends ItemOverlay { public ItemElectronTube() { - super(CreativeTabForestry.tabForestry, EnumElectronTube.VALUES); + super(CreativeTabForestry.tabForestry, (IOverlayInfo[]) EnumElectronTube.VALUES); } @SuppressWarnings({"rawtypes", "unchecked"}) diff --git a/src/main/java/forestry/core/items/ItemPipette.java b/src/main/java/forestry/core/items/ItemPipette.java index 554871e45..54836d297 100755 --- a/src/main/java/forestry/core/items/ItemPipette.java +++ b/src/main/java/forestry/core/items/ItemPipette.java @@ -19,9 +19,11 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.core.IModelManager; import forestry.api.core.IToolPipette; import forestry.core.config.Constants; @@ -112,10 +114,10 @@ public class ItemPipette extends ItemForestry implements IToolPipette { models[1] = manager.getModelLocation("pipette.1"); manager.registerVariant(item, new ResourceLocation("forestry:pipette.0")); manager.registerVariant(item, new ResourceLocation("forestry:pipette.1")); - manager.registerItemModel(item, new PippetMeshDefinition()); + manager.registerItemModel(item, new PipetteMeshDefinition()); } - public class PippetMeshDefinition implements ItemMeshDefinition { + public class PipetteMeshDefinition implements ItemMeshDefinition { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { @@ -131,7 +133,7 @@ public class ItemPipette extends ItemForestry implements IToolPipette { @Override public FluidStack drain(ItemStack pipette, int maxDrain, boolean doDrain) { PipetteContents contained = new PipetteContents(pipette.getTagCompound()); - if (contained.getContents() == null || contained.getContents().getFluid().getID() <= 0) { + if (contained.getContents() == null) { return null; } diff --git a/src/main/java/forestry/core/models/ModelBlockOverlay.java b/src/main/java/forestry/core/models/ModelBlockOverlay.java index 3efc6d2fb..980b7fa57 100644 --- a/src/main/java/forestry/core/models/ModelBlockOverlay.java +++ b/src/main/java/forestry/core/models/ModelBlockOverlay.java @@ -10,8 +10,13 @@ ******************************************************************************/ package forestry.core.models; +import javax.annotation.Nonnull; +import java.util.Collections; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.IBakedModel; @@ -19,11 +24,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; + import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.client.model.ISmartItemModel; import net.minecraftforge.common.property.IExtendedBlockState; -import java.util.Collections; -import java.util.List; import forestry.api.core.IModelBaker; import forestry.core.blocks.propertys.UnlistedBlockAccess; @@ -34,6 +38,12 @@ import forestry.core.models.baker.ModelBaker; * A overlay block model to make a block with 2 or more texture layers */ public abstract class ModelBlockOverlay implements ISmartItemModel, ISmartBlockModel { + @Nonnull + private final Class blockClass; + + protected ModelBlockOverlay(@Nonnull Class blockClass) { + this.blockClass = blockClass; + } protected void renderBottomFace(IBlockAccess world, B block, BlockPos pos, IModelBaker baker, TextureAtlasSprite sprite, int colorIndex) { @@ -109,12 +119,12 @@ public abstract class ModelBlockOverlay implements ISmartItemMo } @Override - public List getFaceQuads(EnumFacing face) { + public List getFaceQuads(EnumFacing face) { return Collections.emptyList(); } @Override - public List getGeneralQuads() { + public List getGeneralQuads() { return Collections.emptyList(); } @@ -151,10 +161,14 @@ public abstract class ModelBlockOverlay implements ISmartItemMo IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS); BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS); Block block = state.getBlock(); + if (!blockClass.isInstance(block)) { + return null; + } + B bBlock = blockClass.cast(block); baker.setRenderBoundsFromBlock(block); try{ - renderInWorld((B) block, world, pos, baker); + renderInWorld(bBlock, world, pos, baker); }catch(Exception e){ return null; } @@ -166,11 +180,15 @@ public abstract class ModelBlockOverlay implements ISmartItemMo public IBakedModel handleItemState(ItemStack stack) { IModelBaker baker = ModelBaker.getInstance(); Block block = Block.getBlockFromItem(stack.getItem()); + if (!blockClass.isInstance(block)) { + return null; + } + B bBlock = blockClass.cast(block); block.setBlockBoundsForItemRender(); baker.setRenderBoundsFromBlock(block); try{ - renderInventory((B) block, stack, baker); + renderInventory(bBlock, stack, baker); }catch(Exception e){ return null; } diff --git a/src/main/java/forestry/core/models/ModelCrate.java b/src/main/java/forestry/core/models/ModelCrate.java index c09f7694a..1ccd4ae8f 100644 --- a/src/main/java/forestry/core/models/ModelCrate.java +++ b/src/main/java/forestry/core/models/ModelCrate.java @@ -10,14 +10,20 @@ ******************************************************************************/ package forestry.core.models; +import com.google.common.base.Charsets; +import com.google.common.base.Function; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; + import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; -import java.util.HashMap; import java.util.IdentityHashMap; import java.util.List; +import java.util.Map; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; @@ -31,6 +37,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.client.ItemModelMesherForge; import net.minecraftforge.client.model.IFlexibleBakedModel; import net.minecraftforge.client.model.IModel; @@ -41,20 +48,16 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import com.google.common.base.Charsets; -import com.google.common.base.Function; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - import forestry.core.items.ItemCrated; import forestry.core.utils.StringUtil; import forestry.plugins.PluginStorage; + import gnu.trove.map.hash.TIntObjectHashMap; @SideOnly(Side.CLIENT) public class ModelCrate implements ISmartItemModel { - private HashMap crates = Maps.newHashMap(); + private final Map crates = Maps.newHashMap(); public static IModel crateModel; private final Function textureGetter; @@ -64,12 +67,7 @@ public class ModelCrate implements ISmartItemModel { public static ModelLoader loader; public ModelCrate() { - textureGetter = new Function() { - @Override - public TextureAtlasSprite apply(ResourceLocation location) { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); - } - }; + textureGetter = new CrateTextureGetter(); } /** @@ -275,4 +273,11 @@ public class ModelCrate implements ISmartItemModel { } return crates.get(crateUID); } + + private static class CrateTextureGetter implements Function { + @Override + public TextureAtlasSprite apply(ResourceLocation location) { + return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); + } + } } \ No newline at end of file diff --git a/src/main/java/forestry/core/models/baker/ModelBaker.java b/src/main/java/forestry/core/models/baker/ModelBaker.java index 9b65f581a..caccd0300 100644 --- a/src/main/java/forestry/core/models/baker/ModelBaker.java +++ b/src/main/java/forestry/core/models/baker/ModelBaker.java @@ -14,10 +14,6 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import org.lwjgl.util.vector.Vector3f; - -import forestry.api.core.ForestryAPI; -import forestry.api.core.IModelBaker; import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BlockFaceUV; @@ -28,10 +24,16 @@ import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.client.resources.model.ModelRotation; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; + import net.minecraftforge.client.model.IColoredBakedQuad; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.util.vector.Vector3f; + +import forestry.api.core.ForestryAPI; +import forestry.api.core.IModelBaker; + /** * A model baker to make custom models in the mod */ @@ -127,7 +129,7 @@ public class ModelBaker implements IModelBaker { private final float quadsUV[] = new float[] { 0, 0, 1, 1, 0, 0, 1, 1 }; protected EnumSet renderFaces = EnumSet.allOf(EnumFacing.class); - private List faces = new ArrayList(); + private List faces = new ArrayList<>(); protected float[] getFaceUvs(final EnumFacing face, final Vector3f to_16, final Vector3f from_16) { float from_a = 0; @@ -289,7 +291,7 @@ public class ModelBaker implements IModelBaker { protected ModelBakerModel clearBaker() { ModelBakerModel model = generatedModel.copy(); generatedModel = new ModelBakerModel(); - faces = new ArrayList(); + faces = new ArrayList<>(); return model; } diff --git a/src/main/java/forestry/core/models/baker/ModelBakerModel.java b/src/main/java/forestry/core/models/baker/ModelBakerModel.java index 300774b8b..93a6882bf 100644 --- a/src/main/java/forestry/core/models/baker/ModelBakerModel.java +++ b/src/main/java/forestry/core/models/baker/ModelBakerModel.java @@ -11,10 +11,9 @@ package forestry.core.models.baker; import java.util.ArrayList; +import java.util.EnumMap; import java.util.List; -import org.lwjgl.util.vector.Vector3f; - import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; @@ -22,21 +21,25 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.util.vector.Vector3f; + @SideOnly(Side.CLIENT) public class ModelBakerModel implements IBakedModel { - protected List[] faces = new List[6]; + private EnumMap> faces = new EnumMap<>(EnumFacing.class); protected List general; public ModelBakerModel() { - general = new ArrayList(); - for (EnumFacing f : EnumFacing.VALUES) - faces[f.ordinal()] = new ArrayList(); + general = new ArrayList<>(); + for (EnumFacing f : EnumFacing.VALUES) { + faces.put(f, new ArrayList()); + } } - private ModelBakerModel(List general, List[] faces) { + private ModelBakerModel(List general, EnumMap> faces) { this.general = general; this.faces = faces; } @@ -66,7 +69,7 @@ public class ModelBakerModel implements IBakedModel { return getTransform(); } - public ItemCameraTransforms getTransform() { + public static ItemCameraTransforms getTransform() { Vector3f rotation = new Vector3f(getRotation()[0], getRotation()[1], getRotation()[2]); Vector3f translation = new Vector3f(getTranslation()[0], getTranslation()[1], getTranslation()[2]); translation.scale(0.0625F); @@ -83,26 +86,26 @@ public class ModelBakerModel implements IBakedModel { return new ItemCameraTransforms(transformV, ItemCameraTransforms.DEFAULT.firstPerson, ItemCameraTransforms.DEFAULT.head, ItemCameraTransforms.DEFAULT.gui, ItemCameraTransforms.DEFAULT.ground, ItemCameraTransforms.DEFAULT.fixed); } - protected float[] getRotation() { + protected static float[] getRotation() { return new float[] { -80, -45, 170 }; } - protected float[] getTranslation() { + protected static float[] getTranslation() { return new float[] { 0, 1.5F, -2.75F }; } - protected float[] getScale() { + protected static float[] getScale() { return new float[] { 0.375F, 0.375F, 0.375F }; } @Override - public List getGeneralQuads() { + public List getGeneralQuads() { return general; } @Override - public List getFaceQuads(EnumFacing face) { - return faces[face.ordinal()]; + public List getFaceQuads(EnumFacing face) { + return faces.get(face); } public ModelBakerModel copy() { diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index ceb01fca4..cf7e92526 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -24,6 +24,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Loader; + import forestry.core.TickHandlerCoreServer; import forestry.core.multiblock.MultiblockServerTickHandler; import forestry.core.network.packets.PacketFXSignal; @@ -37,10 +38,10 @@ public class ProxyCommon { public void registerTickHandlers(WorldGenerator worldGenerator) { TickHandlerCoreServer tickHandlerCoreServer = new TickHandlerCoreServer(worldGenerator); - FMLCommonHandler.instance().bus().register(tickHandlerCoreServer); MinecraftForge.EVENT_BUS.register(tickHandlerCoreServer); - FMLCommonHandler.instance().bus().register(new MultiblockServerTickHandler()); + MultiblockServerTickHandler multiblockServerTickHandler = new MultiblockServerTickHandler(); + MinecraftForge.EVENT_BUS.register(multiblockServerTickHandler); } public String getDisplayName(ItemStack itemstack) { diff --git a/src/main/java/forestry/core/proxy/ProxyCommonClient.java b/src/main/java/forestry/core/proxy/ProxyCommonClient.java index 2fbcb8d19..f858cd4de 100644 --- a/src/main/java/forestry/core/proxy/ProxyCommonClient.java +++ b/src/main/java/forestry/core/proxy/ProxyCommonClient.java @@ -20,7 +20,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; + +import net.minecraftforge.common.MinecraftForge; import org.lwjgl.input.Keyboard; @@ -34,8 +35,8 @@ public class ProxyCommonClient extends ProxyCommon { public void registerTickHandlers(WorldGenerator worldGenerator) { super.registerTickHandlers(worldGenerator); - FMLCommonHandler.instance().bus().register(new TickHandlerCoreClient()); - FMLCommonHandler.instance().bus().register(new MultiblockClientTickHandler()); + MinecraftForge.EVENT_BUS.register(new TickHandlerCoreClient()); + MinecraftForge.EVENT_BUS.register(new MultiblockClientTickHandler()); } @Override diff --git a/src/main/java/forestry/core/proxy/ProxyRender.java b/src/main/java/forestry/core/proxy/ProxyRender.java old mode 100755 new mode 100644 index d65c79cf3..e6716968f --- a/src/main/java/forestry/core/proxy/ProxyRender.java +++ b/src/main/java/forestry/core/proxy/ProxyRender.java @@ -20,6 +20,7 @@ import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; + import forestry.core.fluids.Fluids; import forestry.core.models.BlockModelIndex; import forestry.core.models.ModelIndex; diff --git a/src/main/java/forestry/core/proxy/ProxyRenderClient.java b/src/main/java/forestry/core/proxy/ProxyRenderClient.java index da08d3363..7915441e1 100644 --- a/src/main/java/forestry/core/proxy/ProxyRenderClient.java +++ b/src/main/java/forestry/core/proxy/ProxyRenderClient.java @@ -121,14 +121,9 @@ public class ProxyRenderClient extends ProxyRender { } @Override - public void registerBlockModel(@Nonnull BlockModelIndex index) { + public void registerBlockModel(@Nonnull final BlockModelIndex index) { ModelManager.registerCustomBlockModel(index); - StateMapperBase ignoreState = new StateMapperBase() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState iBlockState) { - return index.blockModelLocation; - } - }; + StateMapperBase ignoreState = new BlockModeStateMapper(index); registerStateMapper(index.block, ignoreState); } @@ -141,19 +136,9 @@ public class ProxyRenderClient extends ProxyRender { public void registerFluidStateMapper(Block block, final Fluids forestryFluid) { final ModelResourceLocation fluidLocation = new ModelResourceLocation("forestry:blockforestryfluid", forestryFluid.getTag()); - StateMapperBase ignoreState = new StateMapperBase() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState iBlockState) { - return fluidLocation; - } - }; + StateMapperBase ignoreState = new FluidStateMapper(fluidLocation); registerStateMapper(block, ignoreState); - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(block), new ItemMeshDefinition() { - @Override - public ModelResourceLocation getModelLocation(ItemStack stack) { - return fluidLocation; - } - }); + ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(block), new FluidItemMeshDefinition(fluidLocation)); ModelBakery.registerItemVariants(Item.getItemFromBlock(block), fluidLocation); } @@ -258,4 +243,43 @@ public class ProxyRenderClient extends ProxyRender { Proxies.common.getClientInstance().effectRenderer.addEffect(entityfx); } + + private static class BlockModeStateMapper extends StateMapperBase { + private final BlockModelIndex index; + + public BlockModeStateMapper(BlockModelIndex index) { + this.index = index; + } + + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState iBlockState) { + return index.blockModelLocation; + } + } + + private static class FluidStateMapper extends StateMapperBase { + private final ModelResourceLocation fluidLocation; + + public FluidStateMapper(ModelResourceLocation fluidLocation) { + this.fluidLocation = fluidLocation; + } + + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState iBlockState) { + return fluidLocation; + } + } + + private static class FluidItemMeshDefinition implements ItemMeshDefinition { + private final ModelResourceLocation fluidLocation; + + public FluidItemMeshDefinition(ModelResourceLocation fluidLocation) { + this.fluidLocation = fluidLocation; + } + + @Override + public ModelResourceLocation getModelLocation(ItemStack stack) { + return fluidLocation; + } + } } diff --git a/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java b/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java index 0651ca665..bff07190e 100644 --- a/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java +++ b/src/main/java/forestry/core/recipes/ShapedRecipeCustom.java @@ -80,7 +80,7 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR throw new RuntimeException(ret); } - HashMap itemMap = new HashMap(); + HashMap itemMap = new HashMap<>(); for (; idx < recipe.length; idx += 2) { Character chr = (Character) recipe[idx]; diff --git a/src/main/java/forestry/core/render/ForestryStateMapper.java b/src/main/java/forestry/core/render/ForestryStateMapper.java index ceaa63610..6db910f79 100644 --- a/src/main/java/forestry/core/render/ForestryStateMapper.java +++ b/src/main/java/forestry/core/render/ForestryStateMapper.java @@ -14,18 +14,16 @@ public abstract class ForestryStateMapper implements IStateMapper { protected Map mapStateModelLocations = Maps.newLinkedHashMap(); - public String getPropertyString(Map p_178131_1_) { + public String getPropertyString(Map map) { StringBuilder stringbuilder = new StringBuilder(); - for (Object o : p_178131_1_.entrySet()) { - Entry entry = (Entry) o; - + for (Entry entry : map.entrySet()) { if (stringbuilder.length() != 0) { stringbuilder.append(","); } - IProperty iproperty = (IProperty) entry.getKey(); - Comparable comparable = (Comparable) entry.getValue(); + IProperty iproperty = entry.getKey(); + Comparable comparable = entry.getValue(); stringbuilder.append(iproperty.getName()); stringbuilder.append("="); stringbuilder.append(iproperty.getName(comparable)); diff --git a/src/main/java/forestry/core/render/MachineStateMapper.java b/src/main/java/forestry/core/render/MachineStateMapper.java index c97a58860..3111cb75a 100644 --- a/src/main/java/forestry/core/render/MachineStateMapper.java +++ b/src/main/java/forestry/core/render/MachineStateMapper.java @@ -1,21 +1,25 @@ package forestry.core.render; +import com.google.common.collect.Maps; + import java.util.LinkedHashMap; import java.util.Map; -import com.google.common.collect.Maps; -import forestry.core.blocks.IBlockType; -import forestry.core.blocks.IMachinePropertiesTesr; import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import forestry.core.blocks.IBlockType; +import forestry.core.blocks.IMachinePropertiesTesr; + @SideOnly(Side.CLIENT) public class MachineStateMapper & IBlockType & IStringSerializable> extends ForestryStateMapper { @@ -38,7 +42,7 @@ public class MachineStateMapper & IBlockType & IStringSerializ if (facing == EnumFacing.DOWN || facing == EnumFacing.UP) continue; IBlockState state = block.getDefaultState().withProperty(META, type).withProperty(FACE, facing); - LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties()); + LinkedHashMap linkedhashmap = Maps.newLinkedHashMap(state.getProperties()); ResourceLocation blockLocation = Block.blockRegistry.getNameForObject(block); String s = String.format("%s:%s", blockLocation.getResourceDomain(), blockLocation.getResourcePath() + "_" + META.getName((T) linkedhashmap.remove(META))); mapStateModelLocations.put(state, new ModelResourceLocation(s, getPropertyString(linkedhashmap))); diff --git a/src/main/java/forestry/core/render/RenderMill.java b/src/main/java/forestry/core/render/RenderMill.java index 200d9d163..7cb5643ad 100755 --- a/src/main/java/forestry/core/render/RenderMill.java +++ b/src/main/java/forestry/core/render/RenderMill.java @@ -23,8 +23,7 @@ import forestry.core.tiles.TileMill; public class RenderMill extends TileEntitySpecialRenderer { - private final ModelBase model = new ModelBase() { - }; + private final ModelBase model = new MillModelBase(); private enum Textures {PEDESTAL, EXTENSION, BLADE_1, BLADE_2, CHARGE} @@ -196,4 +195,6 @@ public class RenderMill extends TileEntitySpecialRenderer { } + private static class MillModelBase extends ModelBase { + } } diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index b8e276e03..40ebbf8c1 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -34,6 +34,7 @@ import forestry.core.config.Constants; import forestry.core.tiles.TileEngine; import forestry.core.utils.vect.Vect; import forestry.core.utils.vect.VectUtil; + import cofh.api.energy.IEnergyConnection; import cofh.api.energy.IEnergyReceiver; @@ -110,7 +111,7 @@ public abstract class BlockUtil { } public static int getMaturityPod(IBlockState state) { - return state.getValue(BlockCocoa.AGE).intValue(); + return state.getValue(BlockCocoa.AGE); } public static boolean isWoodSlabBlock(Block block) { diff --git a/src/main/java/forestry/core/utils/vect/Vect.java b/src/main/java/forestry/core/utils/vect/Vect.java index e005f1cc9..df75f3aef 100644 --- a/src/main/java/forestry/core/utils/vect/Vect.java +++ b/src/main/java/forestry/core/utils/vect/Vect.java @@ -16,6 +16,7 @@ import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; + import forestry.api.farming.FarmDirection; /** @@ -95,7 +96,7 @@ public class Vect extends IVect { @Override public Vect add(BlockPos pos) { - return add(pos); + return add(pos.getX(), pos.getY(), pos.getZ()); } @Override diff --git a/src/main/java/forestry/energy/render/RenderEngine.java b/src/main/java/forestry/energy/render/RenderEngine.java index c3026ffe3..6fd381c91 100755 --- a/src/main/java/forestry/energy/render/RenderEngine.java +++ b/src/main/java/forestry/energy/render/RenderEngine.java @@ -27,8 +27,7 @@ import forestry.core.utils.Log; public class RenderEngine extends TileEntitySpecialRenderer { - private final ModelBase model = new ModelBase() { - }; + private final ModelBase model = new EngineModelBase(); private final ModelRenderer boiler; private final ModelRenderer trunk; private final ModelRenderer piston; @@ -205,4 +204,7 @@ public class RenderEngine extends TileEntitySpecialRenderer { GL11.glPopAttrib(); GL11.glPopMatrix(); } + + private static class EngineModelBase extends ModelBase { + } } diff --git a/src/main/java/forestry/factory/recipes/jei/FactoryJeiPlugin.java b/src/main/java/forestry/factory/recipes/jei/FactoryJeiPlugin.java index 5eb0b9dff..5d2408819 100644 --- a/src/main/java/forestry/factory/recipes/jei/FactoryJeiPlugin.java +++ b/src/main/java/forestry/factory/recipes/jei/FactoryJeiPlugin.java @@ -2,7 +2,6 @@ package forestry.factory.recipes.jei; import javax.annotation.Nonnull; import javax.annotation.Nullable; - import java.awt.Rectangle; import java.util.List; diff --git a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java index fd78d62b2..b9e030869 100644 --- a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java +++ b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java @@ -1,5 +1,6 @@ package forestry.factory.recipes.jei.bottler; +import javax.annotation.Nonnull; import java.util.Collections; import java.util.List; @@ -15,17 +16,20 @@ public class BottlerRecipeWrapper extends ForestryRecipeWrapper { public BottlerRecipeWrapper(BottlerRecipe recipe) { super(recipe); } - + + @Nonnull @Override public List getFluidInputs() { return Collections.singletonList(getRecipe().input); } - + + @Nonnull @Override public List getInputs() { return Collections.singletonList(getRecipe().empty); } - + + @Nonnull @Override public List getOutputs() { return Collections.singletonList(getRecipe().filled); diff --git a/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeWrapper.java b/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeWrapper.java index 8f8535a65..619ff8ee0 100644 --- a/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeWrapper.java +++ b/src/main/java/forestry/factory/recipes/jei/fabricator/FabricatorRecipeWrapper.java @@ -17,7 +17,8 @@ public class FabricatorRecipeWrapper extends ForestryRecipeWrapper inputs = new ArrayList<>(); diff --git a/src/main/java/forestry/factory/recipes/jei/fermenter/FermenterRecipeWrapper.java b/src/main/java/forestry/factory/recipes/jei/fermenter/FermenterRecipeWrapper.java index 1dd544aa5..add436843 100644 --- a/src/main/java/forestry/factory/recipes/jei/fermenter/FermenterRecipeWrapper.java +++ b/src/main/java/forestry/factory/recipes/jei/fermenter/FermenterRecipeWrapper.java @@ -24,7 +24,8 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper inputs = new ArrayList<>(); @@ -39,7 +40,8 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper getFluidInputs() { return Collections.singletonList(getRecipe().getFluidResource()); diff --git a/src/main/java/forestry/factory/recipes/jei/moistener/MoistenerRecipeWrapper.java b/src/main/java/forestry/factory/recipes/jei/moistener/MoistenerRecipeWrapper.java index 7f3f92af0..9d21c0a52 100644 --- a/src/main/java/forestry/factory/recipes/jei/moistener/MoistenerRecipeWrapper.java +++ b/src/main/java/forestry/factory/recipes/jei/moistener/MoistenerRecipeWrapper.java @@ -19,7 +19,8 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper getInputs() { List inputs = new ArrayList<>(); @@ -29,6 +30,7 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper getOutputs() { List outputs = new ArrayList<>(); diff --git a/src/main/java/forestry/factory/tiles/TileCentrifuge.java b/src/main/java/forestry/factory/tiles/TileCentrifuge.java index 72d6b1117..9c443ae76 100644 --- a/src/main/java/forestry/factory/tiles/TileCentrifuge.java +++ b/src/main/java/forestry/factory/tiles/TileCentrifuge.java @@ -22,7 +22,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.common.Optional; + import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.CircuitSocketType; import forestry.api.circuits.ICircuitBoard; @@ -95,7 +97,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn ItemStack chip = sockets.getStackInSlot(0); if (chip != null) { - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(chip); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(chip); if (chipset != null) { chipset.onLoad(this); } @@ -224,7 +226,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn // Dispose correctly of old chipsets if (sockets.getStackInSlot(slot) != null) { if (ChipsetManager.circuitRegistry.isChipset(sockets.getStackInSlot(slot))) { - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(sockets.getStackInSlot(slot)); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(sockets.getStackInSlot(slot)); if (chipset != null) { chipset.onRemoval(this); } @@ -236,7 +238,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn return; } - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(stack); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(stack); if (chipset != null) { chipset.onInsertion(this); } diff --git a/src/main/java/forestry/factory/tiles/TileSqueezer.java b/src/main/java/forestry/factory/tiles/TileSqueezer.java index 8e362f86d..76d57d81a 100644 --- a/src/main/java/forestry/factory/tiles/TileSqueezer.java +++ b/src/main/java/forestry/factory/tiles/TileSqueezer.java @@ -17,6 +17,7 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; @@ -85,7 +86,7 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve ItemStack chip = sockets.getStackInSlot(0); if (chip != null) { - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(chip); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(chip); if (chipset != null) { chipset.onLoad(this); } @@ -261,7 +262,7 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve // Dispose correctly of old chipsets if (sockets.getStackInSlot(slot) != null) { if (ChipsetManager.circuitRegistry.isChipset(sockets.getStackInSlot(slot))) { - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(sockets.getStackInSlot(slot)); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(sockets.getStackInSlot(slot)); if (chipset != null) { chipset.onRemoval(this); } @@ -273,7 +274,7 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve return; } - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(stack); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(stack); if (chipset != null) { chipset.onInsertion(this); } diff --git a/src/main/java/forestry/farming/blocks/BlockFarm.java b/src/main/java/forestry/farming/blocks/BlockFarm.java index 251cd05f6..de4d42b85 100644 --- a/src/main/java/forestry/farming/blocks/BlockFarm.java +++ b/src/main/java/forestry/farming/blocks/BlockFarm.java @@ -35,12 +35,14 @@ import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; + import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.property.ExtendedBlockState; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import forestry.api.core.IModelManager; import forestry.core.blocks.BlockStructure; import forestry.core.blocks.propertys.UnlistedBlockAccess; @@ -221,7 +223,7 @@ public class BlockFarm extends BlockStructure { return ParticleHelper.addDestroyEffects(world, this, world.getBlockState(pos), pos, effectRenderer, particleCallback); } - public class FarmCallback extends DefaultCallback{ + private static class FarmCallback extends DefaultCallback { public FarmCallback(Block block) { super(block); diff --git a/src/main/java/forestry/farming/models/ModelFarmBlock.java b/src/main/java/forestry/farming/models/ModelFarmBlock.java index 8e1d41b94..f123a0700 100644 --- a/src/main/java/forestry/farming/models/ModelFarmBlock.java +++ b/src/main/java/forestry/farming/models/ModelFarmBlock.java @@ -1,17 +1,22 @@ package forestry.farming.models; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; + import forestry.api.core.IModelBaker; import forestry.core.models.ModelBlockOverlay; import forestry.farming.blocks.BlockFarm; import forestry.farming.blocks.EnumFarmBlockType; import forestry.farming.tiles.TileFarm; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.world.IBlockAccess; public class ModelFarmBlock extends ModelBlockOverlay { + public ModelFarmBlock() { + super(BlockFarm.class); + } + @Override public void renderInventory(BlockFarm blockFarm, ItemStack item, IModelBaker baker) { if (blockFarm == null) { diff --git a/src/main/java/forestry/farming/multiblock/FarmController.java b/src/main/java/forestry/farming/multiblock/FarmController.java index 06fb2d0f1..9772e0b20 100644 --- a/src/main/java/forestry/farming/multiblock/FarmController.java +++ b/src/main/java/forestry/farming/multiblock/FarmController.java @@ -378,7 +378,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen // See whether we have socketed stuff. ItemStack chip = sockets.getStackInSlot(0); if (chip != null) { - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(chip); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(chip); if (chipset != null) { chipset.onLoad(this); } @@ -835,7 +835,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen // Dispose old chipsets correctly if (sockets.getStackInSlot(slot) != null) { if (ChipsetManager.circuitRegistry.isChipset(sockets.getStackInSlot(slot))) { - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(sockets.getStackInSlot(slot)); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(sockets.getStackInSlot(slot)); if (chipset != null) { chipset.onRemoval(this); } @@ -849,7 +849,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen return; } - ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitboard(stack); + ICircuitBoard chipset = ChipsetManager.circuitRegistry.getCircuitBoard(stack); if (chipset != null) { chipset.onInsertion(this); } diff --git a/src/main/java/forestry/food/BeverageEffect.java b/src/main/java/forestry/food/BeverageEffect.java index 74e831da5..7709c4240 100755 --- a/src/main/java/forestry/food/BeverageEffect.java +++ b/src/main/java/forestry/food/BeverageEffect.java @@ -23,11 +23,6 @@ import forestry.api.food.IBeverageEffect; import forestry.core.utils.StringUtil; public abstract class BeverageEffect implements IBeverageEffect { - - public static final IBeverageEffect weakAlcoholic = new BeverageEffectDrunk(10, 0.2f); - public static final IBeverageEffect weakAntidote = new BeverageEffectAntidote(20, 0.5f); - public static final IBeverageEffect strongAntidote = new BeverageEffectAntidote(21, 1.0f); - private final int id; protected String description; @@ -35,8 +30,7 @@ public abstract class BeverageEffect implements IBeverageEffect { this.id = id; if (BeverageManager.effectList[id] != null) { - throw new RuntimeException("Beverage effect slot " + id + " was already occupied by " + BeverageManager.effectList[id].toString() - + " when trying to add " + this.toString()); + throw new RuntimeException("Beverage effect slot " + id + " was already occupied by " + BeverageManager.effectList[id] + " when trying to add " + this); } else { BeverageManager.effectList[id] = this; } diff --git a/src/main/java/forestry/food/BeverageEffects.java b/src/main/java/forestry/food/BeverageEffects.java new file mode 100644 index 000000000..0f8973a75 --- /dev/null +++ b/src/main/java/forestry/food/BeverageEffects.java @@ -0,0 +1,13 @@ +package forestry.food; + +import forestry.api.food.IBeverageEffect; + +public class BeverageEffects { + public static final IBeverageEffect weakAlcoholic = new BeverageEffectDrunk(10, 0.2f); + public static final IBeverageEffect weakAntidote = new BeverageEffectAntidote(20, 0.5f); + public static final IBeverageEffect strongAntidote = new BeverageEffectAntidote(21, 1.0f); + + private BeverageEffects() { + + } +} diff --git a/src/main/java/forestry/food/items/ItemRegistryFood.java b/src/main/java/forestry/food/items/ItemRegistryFood.java index a0d61043d..4aedfb93b 100644 --- a/src/main/java/forestry/food/items/ItemRegistryFood.java +++ b/src/main/java/forestry/food/items/ItemRegistryFood.java @@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack; import forestry.core.items.ItemForestryFood; import forestry.core.items.ItemRegistry; import forestry.food.BeverageEffect; +import forestry.food.BeverageEffects; public class ItemRegistryFood extends ItemRegistry { public final ItemForestryFood honeyedSlice; @@ -37,6 +38,6 @@ public class ItemRegistryFood extends ItemRegistry { registerItem(infuser, "infuser"); // Mead - BeverageEffect.saveEffects(new ItemStack(beverage), Collections.singletonList(BeverageEffect.weakAlcoholic)); + BeverageEffect.saveEffects(new ItemStack(beverage), Collections.singletonList(BeverageEffects.weakAlcoholic)); } } diff --git a/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java b/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java index 919fe871d..26a1e61df 100644 --- a/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java +++ b/src/main/java/forestry/lepidopterology/proxy/ProxyLepidopterologyClient.java @@ -10,9 +10,10 @@ ******************************************************************************/ package forestry.lepidopterology.proxy; +import net.minecraftforge.fml.client.registry.RenderingRegistry; + import forestry.lepidopterology.entities.EntityButterfly; import forestry.lepidopterology.render.RenderButterflyEntity; -import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ProxyLepidopterologyClient extends ProxyLepidopterology { diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java b/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java index d9bfe81ea..b4b78ef1e 100644 --- a/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java @@ -10,17 +10,14 @@ ******************************************************************************/ package forestry.lepidopterology.render; -import java.io.IOException; -import java.util.List; - import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; -import forestry.api.lepidopterology.ButterflyManager; -import forestry.api.lepidopterology.IButterfly; -import forestry.core.models.TRSRBakedModel; -import forestry.core.utils.Log; +import java.io.IOException; +import java.util.List; + import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -29,10 +26,16 @@ import net.minecraft.client.resources.model.ModelRotation; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.client.model.IRetexturableModel; import net.minecraftforge.client.model.ISmartItemModel; import net.minecraftforge.client.model.ModelLoaderRegistry; +import forestry.api.lepidopterology.ButterflyManager; +import forestry.api.lepidopterology.IButterfly; +import forestry.core.models.TRSRBakedModel; +import forestry.core.utils.Log; + public class ModelButterflyItem implements ISmartItemModel { public IRetexturableModel modelButterfly; @@ -44,12 +47,12 @@ public class ModelButterflyItem implements ISmartItemModel { } @Override - public List getFaceQuads(EnumFacing p_177551_1_) { + public List getFaceQuads(EnumFacing p_177551_1_) { return null; } @Override - public List getGeneralQuads() { + public List getGeneralQuads() { return null; } @@ -84,8 +87,7 @@ public class ModelButterflyItem implements ISmartItemModel { try { modelButterfly = (IRetexturableModel) ModelLoaderRegistry.getModel(location); } catch (IOException e) { - Log.warning( - "Failed to find Butterfly Model for (" + location.toString() + ") in the Forestry registry."); + Log.warning("Failed to find Butterfly Model for (" + location + ") in the Forestry registry."); } if (modelButterfly == null) { return null; @@ -100,15 +102,10 @@ public class ModelButterflyItem implements ISmartItemModel { } public IBakedModel bakeModel(IButterfly butterfly) { - Function textureGetter = new Function() { - @Override - public TextureAtlasSprite apply(ResourceLocation location) { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); - } - }; + Function textureGetter = new ButterflyTextureGetter(); ImmutableMap.Builder textures = ImmutableMap.builder(); - textures.put("#ButterflyGE", butterfly.getGenome().getSecondary().getEntityTexture().toString().replace(".png", "").replace("textures/", "")); - textures.put("Butterfly2texture", butterfly.getGenome().getSecondary().getEntityTexture().toString().replace(".png", "").replace("textures/", "")); + textures.put("#ButterflyGE", butterfly.getGenome().getSecondary().getEntityTexture().replace(".png", "").replace("textures/", "")); + textures.put("Butterfly2texture", butterfly.getGenome().getSecondary().getEntityTexture().replace(".png", "").replace("textures/", "")); modelButterfly = (IRetexturableModel) modelButterfly.retexture(textures.build()); return new TRSRBakedModel(modelButterfly.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.5F, -1.5F, 1.5F, 0, (float)Math.PI * 2, 0, 1F); } @@ -137,4 +134,10 @@ public class ModelButterflyItem implements ISmartItemModel { return flap < 0.5 ? 0.75f + flap : 1.75f - flap; } + private static class ButterflyTextureGetter implements Function { + @Override + public TextureAtlasSprite apply(ResourceLocation location) { + return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); + } + } } diff --git a/src/main/java/forestry/lepidopterology/render/RenderButterflyEntity.java b/src/main/java/forestry/lepidopterology/render/RenderButterflyEntity.java index 087c75fc6..b7822555a 100644 --- a/src/main/java/forestry/lepidopterology/render/RenderButterflyEntity.java +++ b/src/main/java/forestry/lepidopterology/render/RenderButterflyEntity.java @@ -12,14 +12,11 @@ package forestry.lepidopterology.render; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import forestry.lepidopterology.entities.EntityButterfly; -public class RenderButterflyEntity extends RenderLiving { +public class RenderButterflyEntity extends RenderLiving { private final ModelButterfly butterflyModel; @@ -38,18 +35,18 @@ public class RenderButterflyEntity extends RenderLiving { } @Override - public void doRender(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTickTime) { - this.renderButterfly((EntityButterfly) entity, x, y, z, entityYaw, partialTickTime); + public void doRender(EntityButterfly entity, double x, double y, double z, float entityYaw, float partialTickTime) { + this.renderButterfly(entity, x, y, z, entityYaw, partialTickTime); } @Override - protected ResourceLocation getEntityTexture(Entity entity) { - return ((EntityButterfly) entity).getTexture(); + protected ResourceLocation getEntityTexture(EntityButterfly entity) { + return entity.getTexture(); } @Override - protected float handleRotationFloat(EntityLivingBase entity, float partialTickTime) { - return ((EntityButterfly) entity).getWingFlap(partialTickTime); + protected float handleRotationFloat(EntityButterfly entity, float partialTickTime) { + return entity.getWingFlap(partialTickTime); } } diff --git a/src/main/java/forestry/mail/blocks/BlockTypeMail.java b/src/main/java/forestry/mail/blocks/BlockTypeMail.java index aa59e55ce..ad6795453 100644 --- a/src/main/java/forestry/mail/blocks/BlockTypeMail.java +++ b/src/main/java/forestry/mail/blocks/BlockTypeMail.java @@ -11,6 +11,7 @@ package forestry.mail.blocks; import javax.annotation.Nonnull; + import forestry.core.blocks.IBlockType; import forestry.core.blocks.IMachineProperties; import forestry.core.blocks.MachineProperties; diff --git a/src/main/java/forestry/mail/gui/GuiMailboxInfo.java b/src/main/java/forestry/mail/gui/GuiMailboxInfo.java index 1c65dc68a..ac7414a19 100755 --- a/src/main/java/forestry/mail/gui/GuiMailboxInfo.java +++ b/src/main/java/forestry/mail/gui/GuiMailboxInfo.java @@ -27,11 +27,11 @@ import forestry.mail.POBoxInfo; public class GuiMailboxInfo extends Gui { public enum XPosition { - LEFT, RIGHT; + LEFT, RIGHT } public enum YPosition { - TOP, BOTTOM; + TOP, BOTTOM } public static final GuiMailboxInfo instance = new GuiMailboxInfo(); diff --git a/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java b/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java index b5dfcac3f..cad33bae3 100644 --- a/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java +++ b/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java @@ -46,7 +46,7 @@ public class AddresseeSlot extends Widget { @Override protected String getLegacyTooltip(EntityPlayer player) { - return StringUtil.localize("gui.addressee." + containerLetter.getCarrierType().toString()); + return StringUtil.localize("gui.addressee." + containerLetter.getCarrierType()); } @Override diff --git a/src/main/java/forestry/mail/items/ItemStamps.java b/src/main/java/forestry/mail/items/ItemStamps.java index 5ad941919..af06e6774 100755 --- a/src/main/java/forestry/mail/items/ItemStamps.java +++ b/src/main/java/forestry/mail/items/ItemStamps.java @@ -19,7 +19,7 @@ import forestry.core.items.ItemOverlay; public class ItemStamps extends ItemOverlay implements IStamps { public ItemStamps() { - super(CreativeTabForestry.tabForestry, EnumStampDefinition.VALUES); + super(CreativeTabForestry.tabForestry, (IOverlayInfo[]) EnumStampDefinition.VALUES); } @Override diff --git a/src/main/java/forestry/mail/tiles/TileMailbox.java b/src/main/java/forestry/mail/tiles/TileMailbox.java index 9b2df5060..2efe74738 100644 --- a/src/main/java/forestry/mail/tiles/TileMailbox.java +++ b/src/main/java/forestry/mail/tiles/TileMailbox.java @@ -20,10 +20,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -import net.minecraftforge.fml.common.Optional; import com.mojang.authlib.GameProfile; +import net.minecraftforge.fml.common.Optional; + import forestry.api.mail.ILetter; import forestry.api.mail.IMailAddress; import forestry.api.mail.IPostalState; @@ -89,12 +90,12 @@ public class TileMailbox extends TileBase implements IMailContainer { return PostRegistry.getOrCreatePOBox(worldObj, address); } - private IPostalState tryDispatchLetter(ItemStack letterstack) { - ILetter letter = PostManager.postRegistry.getLetter(letterstack); + private IPostalState tryDispatchLetter(ItemStack letterStack) { + ILetter letter = PostManager.postRegistry.getLetter(letterStack); IPostalState result; if (letter != null) { - result = PostManager.postRegistry.getPostOffice(worldObj).lodgeLetter(worldObj, letterstack, true); + result = PostManager.postRegistry.getPostOffice(worldObj).lodgeLetter(worldObj, letterStack, true); } else { result = EnumDeliveryState.NOT_MAILABLE; } @@ -102,7 +103,6 @@ public class TileMailbox extends TileBase implements IMailContainer { return result; } - /* IMAILCONTAINER */ @Override public boolean hasMail() { @@ -116,7 +116,6 @@ public class TileMailbox extends TileBase implements IMailContainer { return false; } - /* ITRIGGERPROVIDER */ @Optional.Method(modid = "BuildCraftAPI|statements") @Override public Collection getExternalTriggers(EnumFacing side, TileEntity tile) { diff --git a/src/main/java/forestry/mail/tiles/TileTrader.java b/src/main/java/forestry/mail/tiles/TileTrader.java index 77baa8ef5..c8c30fd58 100644 --- a/src/main/java/forestry/mail/tiles/TileTrader.java +++ b/src/main/java/forestry/mail/tiles/TileTrader.java @@ -21,7 +21,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.common.Optional; + import forestry.api.core.IErrorLogic; import forestry.api.mail.IMailAddress; import forestry.api.mail.IStamps; @@ -310,7 +312,6 @@ public class TileTrader extends TileBase { return (TradeStation) PostManager.postRegistry.getOrCreateTradeStation(worldObj, getAccessHandler().getOwner(), address); } - /* ITRIGGERPROVIDER */ @Optional.Method(modid = "BuildCraftAPI|statements") @Override public Collection getExternalTriggers(EnumFacing side, TileEntity tile) { diff --git a/src/main/java/forestry/plugins/PluginFood.java b/src/main/java/forestry/plugins/PluginFood.java index 4d50b5e61..4b92b3007 100755 --- a/src/main/java/forestry/plugins/PluginFood.java +++ b/src/main/java/forestry/plugins/PluginFood.java @@ -20,7 +20,7 @@ import forestry.core.config.Constants; import forestry.core.fluids.Fluids; import forestry.core.fluids.LiquidRegistryHelper; import forestry.core.recipes.RecipeUtil; -import forestry.food.BeverageEffect; +import forestry.food.BeverageEffects; import forestry.food.InfuserIngredientManager; import forestry.food.InfuserMixtureManager; import forestry.food.items.EnumBeverage; @@ -56,8 +56,8 @@ public class PluginFood extends BlankForestryPlugin { BeverageManager.ingredientManager.addIngredient(normalPollenCluster, "Strong Curative"); BeverageManager.ingredientManager.addIngredient(crystallinePollenCluster, "Weak Curative"); - BeverageManager.infuserManager.addMixture(1, normalPollenCluster, BeverageEffect.strongAntidote); - BeverageManager.infuserManager.addMixture(1, crystallinePollenCluster, BeverageEffect.weakAntidote); + BeverageManager.infuserManager.addMixture(1, normalPollenCluster, BeverageEffects.strongAntidote); + BeverageManager.infuserManager.addMixture(1, crystallinePollenCluster, BeverageEffects.weakAntidote); } } diff --git a/src/main/java/forestry/plugins/PluginMail.java b/src/main/java/forestry/plugins/PluginMail.java index f8f5239c8..eb55090e2 100755 --- a/src/main/java/forestry/plugins/PluginMail.java +++ b/src/main/java/forestry/plugins/PluginMail.java @@ -13,7 +13,7 @@ package forestry.plugins; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.common.MinecraftForge; import forestry.api.mail.EnumAddressee; import forestry.api.mail.PostManager; @@ -64,7 +64,7 @@ public class PluginMail extends BlankForestryPlugin { PluginCore.rootCommand.addChildCommand(new CommandMail()); if (Config.mailAlertEnabled) { - FMLCommonHandler.instance().bus().register(new EventHandlerMailAlert()); + MinecraftForge.EVENT_BUS.register(new EventHandlerMailAlert()); } blocks.mail.addDefinitions(BlockTypeMail.VALUES); diff --git a/src/main/java/forestry/storage/BackpackDefinition.java b/src/main/java/forestry/storage/BackpackDefinition.java index 64dea70d8..eaa0616fd 100755 --- a/src/main/java/forestry/storage/BackpackDefinition.java +++ b/src/main/java/forestry/storage/BackpackDefinition.java @@ -19,6 +19,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; + import net.minecraftforge.oredict.OreDictionary; import forestry.api.apiculture.BeeManager; @@ -56,7 +57,7 @@ public class BackpackDefinition implements IBackpackDefinition { @Override public String getName(ItemStack backpack) { Item item = backpack.getItem(); - String display = ("" + StatCollector.translateToLocal(item.getUnlocalizedNameInefficiently(backpack) + ".name")).trim(); + String display = (StatCollector.translateToLocal(item.getUnlocalizedNameInefficiently(backpack) + ".name")).trim(); if (backpack.hasTagCompound() && backpack.getTagCompound().hasKey("display", 10)) { NBTTagCompound nbt = backpack.getTagCompound().getCompoundTag("display");