mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-17 10:55:06 +00:00
Begin code cleanup for generics, types, warnings, nulls, and spelling
This commit is contained in:
1 parent
c9b2f7bd3e
commit
406392e7f7
98 files changed
+472
-314
No files matched your search
@@ -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");
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BeeManager {
|
||||
/**
|
||||
* List of items that can induce swarming. Integer denotes x in 1000 chance.
|
||||
*/
|
||||
public static HashMap<ItemStack, Integer> inducers = new HashMap<ItemStack, Integer>();
|
||||
public static HashMap<ItemStack, Integer> inducers = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootBees")
|
||||
|
||||
@@ -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<? extends IAllele> clss;
|
||||
private final Class<? extends IAllele> alleleClass;
|
||||
|
||||
EnumBeeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
EnumBeeChromosome(Class<? extends IAllele> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return clss;
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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<String, ICircuitLayout> getRegisteredLayouts();
|
||||
@@ -30,7 +30,7 @@ public interface ICircuitRegistry {
|
||||
|
||||
ICircuitLayout getDefaultLayout();
|
||||
|
||||
ICircuitBoard getCircuitboard(ItemStack itemstack);
|
||||
ICircuitBoard getCircuitBoard(ItemStack itemstack);
|
||||
|
||||
boolean isChipset(ItemStack itemstack);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
public class BiomeHelper {
|
||||
|
||||
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<BiomeGenBase, Boolean>();
|
||||
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Determines if it can rain or snow in the given biome.
|
||||
|
||||
@@ -15,7 +15,7 @@ public enum EnumHumidity {
|
||||
|
||||
public final String name;
|
||||
|
||||
private EnumHumidity(String name) {
|
||||
EnumHumidity(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -14,6 +14,6 @@ public class Farmables {
|
||||
*
|
||||
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
*/
|
||||
public static HashMap<String, Collection<IFarmable>> farmables = new HashMap<String, Collection<IFarmable>>();
|
||||
public static HashMap<String, Collection<IFarmable>> farmables = new HashMap<>();
|
||||
|
||||
}
|
||||
@@ -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<ItemStack, IIndividual> ersatzSpecimen = new HashMap<ItemStack, IIndividual>();
|
||||
public static HashMap<ItemStack, IIndividual> ersatzSpecimen = new HashMap<>();
|
||||
/**
|
||||
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
|
||||
*/
|
||||
public static HashMap<ItemStack, IIndividual> ersatzSaplings = new HashMap<ItemStack, IIndividual>();
|
||||
public static HashMap<ItemStack, IIndividual> ersatzSaplings = new HashMap<>();
|
||||
/**
|
||||
* Queryable instance of an {@link IClimateHelper} for easier implementation.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -11,6 +11,6 @@ import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public interface IAllelePlantType extends IAllele {
|
||||
|
||||
public EnumSet<EnumPlantType> getPlantTypes();
|
||||
EnumSet<EnumPlantType> getPlantTypes();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ public enum EnumPostage {
|
||||
|
||||
private final int value;
|
||||
|
||||
private EnumPostage(int value) {
|
||||
EnumPostage(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface ICarpenterManager extends ICraftingProvider<ICarpenterRecipe> {
|
||||
* @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<ICarpenterRecipe> {
|
||||
* @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<ICarpenterRecipe> {
|
||||
* @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);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public interface IFermenterManager extends ICraftingProvider<IFermenterRecipe> {
|
||||
* @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<IFermenterRecipe> {
|
||||
* 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);
|
||||
}
|
||||
@@ -29,5 +29,5 @@ public interface IMoistenerManager extends ICraftingProvider<IMoistenerRecipe> {
|
||||
* @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);
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public interface ISqueezerManager extends ICraftingProvider<ISqueezerRecipe> {
|
||||
* @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<ISqueezerRecipe> {
|
||||
* @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.
|
||||
|
||||
@@ -30,5 +30,5 @@ public interface IStillManager extends ICraftingProvider<IStillRecipe> {
|
||||
* @param output
|
||||
* FluidStack representing the output liquid
|
||||
*/
|
||||
public void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output);
|
||||
void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output);
|
||||
}
|
||||
@@ -23,5 +23,5 @@ public class BackpackManager {
|
||||
/**
|
||||
* Only use this if you know what you are doing. Prefer backpackInterface.
|
||||
*/
|
||||
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<String, IBackpackDefinition>();
|
||||
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<>();
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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<String, Integer> colour : colours.entrySet()) {
|
||||
String colourName = colour.getKey();
|
||||
for (ItemStack stack : OreDictionary.getOres(colourName)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
|
||||
List<ItemStack> ret = new ArrayList(Arrays.asList(new ItemStack(this)));
|
||||
List<ItemStack> 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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<String>();
|
||||
List<ResourceLocation> 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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<IProperty, Comparable> linkedhashmap = Maps.newLinkedHashMap(state.getProperties());
|
||||
String modID = fruit.getModID();
|
||||
if(modID == null){
|
||||
modID = "forestry";
|
||||
|
||||
@@ -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<BlockForestryLeaves> {
|
||||
|
||||
public ModelLeaves() {
|
||||
super(BlockForestryLeaves.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(BlockForestryLeaves block, ItemStack itemStack, IModelBaker baker) {
|
||||
if (!(itemStack.getItem() instanceof ItemBlockLeaves) || block == null) {
|
||||
|
||||
@@ -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<IBlockState, ModelResourceLocation> 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<IProperty, Comparable> linkedhashmap = Maps.newLinkedHashMap(state.getProperties());
|
||||
String modID = tree.getModID();
|
||||
if(modID == null){
|
||||
modID = "forestry";
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<ItemStack> itemList) {
|
||||
itemList.add(new ItemStack(this, 1, 0));
|
||||
itemList.add(new ItemStack(this, 1, 1));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<A extends IAllele & Comparable<A>> implements IProperty<A> {
|
||||
|
||||
protected final String name;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<SubCommand> children = new TreeSet<>(new Comparator<SubCommand>() {
|
||||
|
||||
@Override
|
||||
public int compare(SubCommand o1, SubCommand o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
});
|
||||
private final SortedSet<SubCommand> 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<String> addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) {
|
||||
return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete, pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> aliases = new ArrayList<>();
|
||||
private PermLevel permLevel = PermLevel.EVERYONE;
|
||||
private IForestryCommand parent;
|
||||
private final SortedSet<SubCommand> children = new TreeSet<>(new Comparator<SubCommand>() {
|
||||
|
||||
@Override
|
||||
public int compare(SubCommand o1, SubCommand o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
});
|
||||
private final SortedSet<SubCommand> 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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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<String> list) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ContainerSocketedHelper<T extends TileEntity & ISocketable> impleme
|
||||
return;
|
||||
}
|
||||
|
||||
ICircuitBoard circuitBoard = ChipsetManager.circuitRegistry.getCircuitboard(itemstack);
|
||||
ICircuitBoard circuitBoard = ChipsetManager.circuitRegistry.getCircuitBoard(itemstack);
|
||||
if (circuitBoard == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,5 +13,5 @@ package forestry.core.gui;
|
||||
public enum GuiType {
|
||||
Item,
|
||||
Tile,
|
||||
Entity;
|
||||
Entity
|
||||
}
|
||||
@@ -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"})
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<B extends Block> implements ISmartItemModel, ISmartBlockModel {
|
||||
@Nonnull
|
||||
private final Class<B> blockClass;
|
||||
|
||||
protected ModelBlockOverlay(@Nonnull Class<B> 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<B extends Block> implements ISmartItemMo
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getFaceQuads(EnumFacing face) {
|
||||
public List<BakedQuad> getFaceQuads(EnumFacing face) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getGeneralQuads() {
|
||||
public List<BakedQuad> getGeneralQuads() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -151,10 +161,14 @@ public abstract class ModelBlockOverlay<B extends Block> 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<B extends Block> 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;
|
||||
}
|
||||
|
||||
@@ -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<String, MultiModel.Baked> crates = Maps.newHashMap();
|
||||
private final Map<String, MultiModel.Baked> crates = Maps.newHashMap();
|
||||
|
||||
public static IModel crateModel;
|
||||
private final Function<ResourceLocation, TextureAtlasSprite> textureGetter;
|
||||
@@ -64,12 +67,7 @@ public class ModelCrate implements ISmartItemModel {
|
||||
public static ModelLoader loader;
|
||||
|
||||
public ModelCrate() {
|
||||
textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
|
||||
@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<ResourceLocation, TextureAtlasSprite> {
|
||||
@Override
|
||||
public TextureAtlasSprite apply(ResourceLocation location) {
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<EnumFacing> renderFaces = EnumSet.allOf(EnumFacing.class);
|
||||
private List<ModelBakerFace> faces = new ArrayList();
|
||||
private List<ModelBakerFace> 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<ModelBakerFace>();
|
||||
faces = new ArrayList<>();
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<BakedQuad>[] faces = new List[6];
|
||||
private EnumMap<EnumFacing, List<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
||||
protected List<BakedQuad> general;
|
||||
|
||||
public ModelBakerModel() {
|
||||
general = new ArrayList<BakedQuad>();
|
||||
for (EnumFacing f : EnumFacing.VALUES)
|
||||
faces[f.ordinal()] = new ArrayList<BakedQuad>();
|
||||
general = new ArrayList<>();
|
||||
for (EnumFacing f : EnumFacing.VALUES) {
|
||||
faces.put(f, new ArrayList<BakedQuad>());
|
||||
}
|
||||
}
|
||||
|
||||
private ModelBakerModel(List<BakedQuad> general, List<BakedQuad>[] faces) {
|
||||
private ModelBakerModel(List<BakedQuad> general, EnumMap<EnumFacing, List<BakedQuad>> 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<BakedQuad> getGeneralQuads() {
|
||||
return general;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getFaceQuads(EnumFacing face) {
|
||||
return faces[face.ordinal()];
|
||||
public List<BakedQuad> getFaceQuads(EnumFacing face) {
|
||||
return faces.get(face);
|
||||
}
|
||||
|
||||
public ModelBakerModel copy() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Executable → Regular
+1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class ShapedRecipeCustom extends ShapedOreRecipe implements IDescriptiveR
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
HashMap<Character, Object> itemMap = new HashMap<>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2) {
|
||||
Character chr = (Character) recipe[idx];
|
||||
|
||||
@@ -14,18 +14,16 @@ public abstract class ForestryStateMapper implements IStateMapper {
|
||||
|
||||
protected Map<IBlockState, ModelResourceLocation> mapStateModelLocations = Maps.newLinkedHashMap();
|
||||
|
||||
public String getPropertyString(Map p_178131_1_) {
|
||||
public String getPropertyString(Map<IProperty, Comparable> map) {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
|
||||
for (Object o : p_178131_1_.entrySet()) {
|
||||
Entry entry = (Entry) o;
|
||||
|
||||
for (Entry<IProperty, Comparable> 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));
|
||||
|
||||
@@ -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<T extends Enum<T> & IBlockType & IStringSerializable> extends ForestryStateMapper {
|
||||
|
||||
@@ -38,7 +42,7 @@ public class MachineStateMapper<T extends Enum<T> & 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<IProperty, Comparable> 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)));
|
||||
|
||||
@@ -23,8 +23,7 @@ import forestry.core.tiles.TileMill;
|
||||
|
||||
public class RenderMill extends TileEntitySpecialRenderer<TileMill> {
|
||||
|
||||
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<TileMill> {
|
||||
|
||||
}
|
||||
|
||||
private static class MillModelBase extends ModelBase {
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,8 +27,7 @@ import forestry.core.utils.Log;
|
||||
|
||||
public class RenderEngine extends TileEntitySpecialRenderer<TileEngine> {
|
||||
|
||||
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<TileEngine> {
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private static class EngineModelBase extends ModelBase {
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<BottlerRecipe> {
|
||||
public BottlerRecipeWrapper(BottlerRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(getRecipe().input);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return Collections.singletonList(getRecipe().empty);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(getRecipe().filled);
|
||||
|
||||
@@ -17,7 +17,8 @@ public class FabricatorRecipeWrapper extends ForestryRecipeWrapper<IFabricatorRe
|
||||
public FabricatorRecipeWrapper(@Nonnull IFabricatorRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
|
||||
@@ -24,7 +24,8 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterReci
|
||||
super(recipe);
|
||||
this.fermentable = fermentable;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
@@ -39,7 +40,8 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterReci
|
||||
public ItemStack getFermentable() {
|
||||
return fermentable;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(getRecipe().getFluidResource());
|
||||
|
||||
@@ -19,7 +19,8 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerReci
|
||||
super(recipe);
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
@@ -29,6 +30,7 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerReci
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<BlockFarm> {
|
||||
|
||||
public ModelFarmBlock() {
|
||||
super(BlockFarm.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(BlockFarm blockFarm, ItemStack item, IModelBaker baker) {
|
||||
if (blockFarm == null) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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<BakedQuad> getFaceQuads(EnumFacing p_177551_1_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getGeneralQuads() {
|
||||
public List<BakedQuad> 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<ResourceLocation, TextureAtlasSprite> textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() {
|
||||
@Override
|
||||
public TextureAtlasSprite apply(ResourceLocation location) {
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
|
||||
}
|
||||
};
|
||||
Function<ResourceLocation, TextureAtlasSprite> textureGetter = new ButterflyTextureGetter();
|
||||
ImmutableMap.Builder<String, String> 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<ResourceLocation, TextureAtlasSprite> {
|
||||
@Override
|
||||
public TextureAtlasSprite apply(ResourceLocation location) {
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<EntityButterfly> {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
|
||||
@@ -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<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user