mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cc0da5c04 | ||
|
|
6e68768259 | ||
|
|
9ee34b06b6 | ||
|
|
b05c395300 | ||
|
|
48ef020dc9 | ||
|
|
83b7ce00f7 | ||
|
|
6165d80c0c | ||
|
|
31cb40f7b6 | ||
|
|
16e4801d48 | ||
|
|
8fb7d5eb67 | ||
|
|
55866d6a64 | ||
|
|
510cf83670 | ||
|
|
656a6451bf | ||
|
|
69ee5bde65 | ||
|
|
592895cc48 | ||
|
|
7b5febd394 | ||
|
|
71481d5ace | ||
|
|
1d0efd537e | ||
|
|
5052df8844 | ||
|
|
b1d496f24f | ||
|
|
2bfe576f7e | ||
|
|
cc5c8af338 | ||
|
|
19a9c2681c | ||
|
|
f020dcf2e2 | ||
|
|
dd34765223 | ||
|
|
3253077466 | ||
|
|
8743f29613 | ||
|
|
0b6b201366 |
No files matched your search
@@ -31,7 +31,7 @@ Beware of ugly code.
|
||||
|
||||
Bugfixes are generally welcome. If you want to contribute something which changes game mechanics, please talk to someone with commit privileges first. Nothing is more frustrating than putting a lot of work and effort into a new game mechanic and then having the PR rejected because it doesn’t fit gameplay-wise.
|
||||
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://www.clahub.com/agreements/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://cla-assistant.io/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
|
||||
### License & Copyright
|
||||
|
||||
|
||||
+1
-1
Submodule api/forestry updated: 2da7580337...d0444f3ca9.
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
version_major=4
|
||||
version_minor=0
|
||||
version_patch=0
|
||||
version_patch=6
|
||||
@@ -3,3 +3,4 @@ samtrion;[email protected];2015-01-18
|
||||
GenuineSounds;[email protected];2015-02-26
|
||||
airbreather;[email protected];2015-04-10
|
||||
ganymedes01;[email protected];2015-05-27
|
||||
infinityraider;theoneandonlyraider@gmail;com;2015-10-03
|
||||
+1
-1
Submodule lang updated: 2518a210e7...fc688b7589.
@@ -73,8 +73,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
public BeekeepingLogic(IBeeHousing housing) {
|
||||
this.housing = housing;
|
||||
this.beeModifier = new BeeHousingModifier(housing);
|
||||
this.beeListener = new BeeHousingListener(housing);
|
||||
this.beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
this.beeListener = BeeManager.beeRoot.createBeeHousingListener(housing);
|
||||
}
|
||||
|
||||
// / SAVING & LOADING
|
||||
|
||||
@@ -34,10 +34,12 @@ import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
@@ -47,7 +49,6 @@ import forestry.api.genetics.IFlower;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.utils.vect.MutableVect;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.PluginManager;
|
||||
@@ -142,7 +143,7 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
Set<IFlower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
World world = beeHousing.getWorld();
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(beeHousing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
|
||||
Vect area = getArea(bee.getGenome(), beeModifier);
|
||||
Vect housingPos = new Vect(beeHousing.getCoordinates()).add(-area.x / 2, -area.y / 2, -area.z / 2);
|
||||
@@ -190,15 +191,21 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
meta = world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled() && (flowerType.equals(FlowerManager.FlowerTypeWheat) || flowerType.equals(FlowerManager.FlowerTypeNether))) {
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
|
||||
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
|
||||
if (block == cropBlock) {
|
||||
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
|
||||
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
|
||||
return true;
|
||||
}
|
||||
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return true;
|
||||
if(block instanceof IPlantable) {
|
||||
//For agricraft versions which implement IPlantable in the BlockCrop class
|
||||
block = ((IPlantable) block).getPlant(world, x, y, z);
|
||||
} else {
|
||||
//For earlier versions of AgriCraft
|
||||
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
|
||||
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
|
||||
return true;
|
||||
}
|
||||
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.arboriculture.genetics.pollination.FakePollinatable;
|
||||
import forestry.arboriculture.genetics.pollination.ICheckPollinatable;
|
||||
import forestry.core.config.Config;
|
||||
@@ -253,7 +252,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
Set<IErrorState> errorStates = new HashSet<IErrorState>();
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
// / Rain needs tolerant flyers
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(biome) && !beeModifier.isSealed()) {
|
||||
@@ -458,7 +457,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
setIsNatural(false);
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = mode.getBeeModifier();
|
||||
|
||||
// Bee genetic speed * beehousing * beekeeping mode
|
||||
@@ -630,7 +629,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -673,7 +672,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public boolean pollinateRandom(IBeeHousing housing, IIndividual pollen) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = (int) (genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -720,7 +719,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public void plantFlowerRandom(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
@@ -42,6 +44,8 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.apiculture.BeeHousingListener;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.apiculture.BeekeepingLogic;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
@@ -326,6 +330,16 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
return new BeekeepingLogic(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier createBeeHousingModifier(IBeeHousing housing) {
|
||||
return new BeeHousingModifier(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeListener createBeeHousingListener(IBeeHousing housing) {
|
||||
return new BeeHousingListener(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
|
||||
@@ -21,7 +21,6 @@ import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
@@ -48,7 +47,7 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
return 0;
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
|
||||
@@ -16,13 +16,13 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
return false;
|
||||
}
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
return queen.getGeneration() > 96 + rand.nextInt(6) + rand.nextInt(6) &&
|
||||
rand.nextFloat() < 0.02f * beeModifier.getGeneticDecay(queen.getGenome(), 1f);
|
||||
@@ -92,7 +92,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isOverworked(IBee queen, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f);
|
||||
if (productionModifier > 16) {
|
||||
@@ -106,7 +106,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float mutationModifier = beeModifier.getMutationModifier(queen.getGenome(), queen.getMate(), 1.0f);
|
||||
if (mutationModifier > 10) {
|
||||
|
||||
@@ -12,12 +12,12 @@ package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.core.utils.vect.MutableVect;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
@@ -51,7 +51,7 @@ public class AlleleEffectNone extends AlleleCategorized implements IAlleleBeeEff
|
||||
}
|
||||
|
||||
protected Vect getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
@@ -71,7 +71,7 @@ public class AlleleEffectNone extends AlleleCategorized implements IAlleleBeeEff
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1.0f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
|
||||
@@ -12,13 +12,12 @@ package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.items.ItemAlyzer;
|
||||
@@ -48,48 +47,11 @@ public class ItemBeealyzer extends ItemAlyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSpecimen(ItemStack itemStack) {
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
protected ISpeciesRoot getSpeciesRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
// Source slot to analyze empty
|
||||
if (getStackInSlot(SLOT_SPECIMEN) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBee bee = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
// No bee, abort
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Analyze if necessary
|
||||
if (!bee.isAnalyzed()) {
|
||||
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
bee.analyze();
|
||||
if (player != null) {
|
||||
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getPrimary());
|
||||
BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(bee.getGenome().getSecondary());
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
bee.writeToNBT(nbttagcompound);
|
||||
getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
}
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZE_1, getStackInSlot(SLOT_SPECIMEN));
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
}
|
||||
|
||||
// / IHINTSOURCE
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,6 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.apiculture.BeeHousingInventory;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.multiblock.CoordTriplet;
|
||||
@@ -384,7 +383,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(this);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(this);
|
||||
if (beeModifier.isHellish() && tempChange >= 0) {
|
||||
return EnumTemperature.HELLISH;
|
||||
}
|
||||
|
||||
@@ -33,12 +33,13 @@ import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.worldgen.BlockTypeLog;
|
||||
import forestry.arboriculture.worldgen.BlockTypeVanillaStairs;
|
||||
import forestry.arboriculture.worldgen.BlockTypeWood;
|
||||
@@ -79,12 +80,14 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
boolean fireproof = (random.nextInt(4) == 0);
|
||||
|
||||
WoodType roofWood = WoodType.getRandom(random);
|
||||
EnumWoodType roofWood = EnumWoodType.getRandom(random);
|
||||
EnumWoodType logWood = EnumWoodType.getRandom(random);
|
||||
EnumWoodType fenceWood = EnumWoodType.getRandom(random);
|
||||
|
||||
logs = new BlockTypeLog(WoodType.getRandom(random).getLog(fireproof));
|
||||
planks = new BlockTypeWood(roofWood.getPlanks(fireproof));
|
||||
stairs = new BlockTypeWoodStairs(roofWood.getStairs(fireproof));
|
||||
fence = new BlockTypeWood(WoodType.getRandom(random).getFence(fireproof));
|
||||
logs = new BlockTypeLog(TreeManager.woodItemAccess.getLog(logWood, fireproof));
|
||||
planks = new BlockTypeWood(TreeManager.woodItemAccess.getPlanks(roofWood, fireproof));
|
||||
stairs = new BlockTypeWoodStairs(TreeManager.woodItemAccess.getStairs(roofWood, fireproof));
|
||||
fence = new BlockTypeWood(TreeManager.woodItemAccess.getFence(fenceWood, fireproof));
|
||||
} else {
|
||||
int roofMeta = random.nextInt(16);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.village.MerchantRecipeList;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
@@ -40,8 +41,8 @@ public class VillageHandlerArboriculture implements IVillageTradeHandler {
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 8), randomTreeStack));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 2), ForestryItem.grafterProven.getItemStack()));
|
||||
|
||||
WoodType randomWoodType = WoodType.VALUES[random.nextInt(WoodType.VALUES.length)];
|
||||
ItemStack planks = randomWoodType.getPlanks(false);
|
||||
EnumWoodType randomWoodType = EnumWoodType.getRandom(random);
|
||||
ItemStack planks = TreeManager.woodItemAccess.getPlanks(randomWoodType, false);
|
||||
planks.stackSize = 32;
|
||||
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), planks));
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.IWoodItemAccess;
|
||||
|
||||
public class WoodItemAccess implements IWoodItemAccess {
|
||||
private static final EnumMap<EnumWoodType, ItemStack> logs = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> logsFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> planks = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> planksFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> slabs = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> slabsFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> fences = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> fencesFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> stairs = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
private static final EnumMap<EnumWoodType, ItemStack> stairsFireproof = new EnumMap<EnumWoodType, ItemStack>(EnumWoodType.class);
|
||||
|
||||
private static ItemStack getStack(EnumWoodType woodType, Block block) {
|
||||
NBTTagCompound woodNBT = new NBTTagCompound();
|
||||
woodType.saveToCompound(woodNBT);
|
||||
|
||||
ItemStack itemStack = new ItemStack(block);
|
||||
itemStack.setTagCompound(woodNBT);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void registerLog(Block block, EnumWoodType woodType, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(woodType, block);
|
||||
if (fireproof) {
|
||||
logsFireproof.put(woodType, itemStack);
|
||||
} else {
|
||||
logs.put(woodType, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerPlanks(Block block, EnumWoodType woodType, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(woodType, block);
|
||||
if (fireproof) {
|
||||
planksFireproof.put(woodType, itemStack);
|
||||
} else {
|
||||
planks.put(woodType, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerSlab(Block block, EnumWoodType woodType, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(woodType, block);
|
||||
if (fireproof) {
|
||||
slabsFireproof.put(woodType, itemStack);
|
||||
} else {
|
||||
slabs.put(woodType, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerFence(Block block, EnumWoodType woodType, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(woodType, block);
|
||||
if (fireproof) {
|
||||
fencesFireproof.put(woodType, itemStack);
|
||||
} else {
|
||||
fences.put(woodType, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerStairs(Block block, EnumWoodType woodType, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(woodType, block);
|
||||
if (fireproof) {
|
||||
stairsFireproof.put(woodType, itemStack);
|
||||
} else {
|
||||
stairs.put(woodType, itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPlanks(EnumWoodType woodType, boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return planksFireproof.get(woodType).copy();
|
||||
} else {
|
||||
return planks.get(woodType).copy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getLog(EnumWoodType woodType, boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return logsFireproof.get(woodType).copy();
|
||||
} else {
|
||||
return logs.get(woodType).copy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSlab(EnumWoodType woodType, boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return slabsFireproof.get(woodType).copy();
|
||||
} else {
|
||||
return slabs.get(woodType).copy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getFence(EnumWoodType woodType, boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return fencesFireproof.get(woodType).copy();
|
||||
} else {
|
||||
return fences.get(woodType).copy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStairs(EnumWoodType woodType, boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return stairsFireproof.get(woodType).copy();
|
||||
} else {
|
||||
return stairs.get(woodType).copy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,241 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public enum WoodType {
|
||||
LARCH, TEAK, ACACIA, LIME,
|
||||
CHESTNUT, WENGE, BAOBAB, SEQUOIA(4.0f),
|
||||
KAPOK, EBONY, MAHOGANY, BALSA(1.0f),
|
||||
WILLOW, WALNUT, GREENHEART(7.5f), CHERRY,
|
||||
MAHOE, POPLAR, PALM, PAPAYA,
|
||||
PINE(3.0f), PLUM, MAPLE, CITRUS,
|
||||
GIGANTEUM, IPE, PADAUK, COCOBOLO,
|
||||
ZEBRAWOOD;
|
||||
|
||||
public static final float DEFAULT_HARDNESS = 2.0f;
|
||||
|
||||
public static final WoodType[] VALUES = values();
|
||||
|
||||
private final float hardness;
|
||||
|
||||
private ItemStack log;
|
||||
private ItemStack logFireproof;
|
||||
private ItemStack planks;
|
||||
private ItemStack planksFireproof;
|
||||
private ItemStack slab;
|
||||
private ItemStack slabFireproof;
|
||||
private ItemStack fence;
|
||||
private ItemStack fenceFireproof;
|
||||
private ItemStack stairs;
|
||||
private ItemStack stairsFireproof;
|
||||
|
||||
WoodType() {
|
||||
this(DEFAULT_HARDNESS);
|
||||
}
|
||||
|
||||
WoodType(float hardness) {
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon[][] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
icons = new IIcon[3][VALUES.length];
|
||||
for (int i = 0; i < VALUES.length; i++) {
|
||||
WoodType woodType = VALUES[i];
|
||||
String woodName = woodType.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
icons[0][i] = TextureManager.getInstance().registerTex(register, "wood/planks." + woodName);
|
||||
icons[1][i] = TextureManager.getInstance().registerTex(register, "wood/bark." + woodName);
|
||||
icons[2][i] = TextureManager.getInstance().registerTex(register, "wood/heart." + woodName);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getPlankIcon() {
|
||||
return icons[0][ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getBarkIcon() {
|
||||
return icons[1][ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getHeartIcon() {
|
||||
return icons[2][ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int meta, int side) {
|
||||
int oriented = meta & 12;
|
||||
switch (oriented) {
|
||||
case 4:
|
||||
if (side > 3) {
|
||||
return getHeartIcon();
|
||||
} else {
|
||||
return getBarkIcon();
|
||||
}
|
||||
case 8:
|
||||
if (side == 2 || side == 3) {
|
||||
return getHeartIcon();
|
||||
} else {
|
||||
return getBarkIcon();
|
||||
}
|
||||
case 0:
|
||||
default:
|
||||
if (side < 2) {
|
||||
return getHeartIcon();
|
||||
} else {
|
||||
return getBarkIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float getHardness() {
|
||||
return hardness;
|
||||
}
|
||||
|
||||
public void saveToCompound(NBTTagCompound compound) {
|
||||
compound.setInteger("WoodType", this.ordinal());
|
||||
}
|
||||
|
||||
public static WoodType getFromCompound(NBTTagCompound compound) {
|
||||
|
||||
if (compound != null) {
|
||||
int typeOrdinal = compound.getInteger("WoodType");
|
||||
if (typeOrdinal < WoodType.VALUES.length) {
|
||||
return WoodType.VALUES[typeOrdinal];
|
||||
}
|
||||
}
|
||||
|
||||
return WoodType.LARCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
private ItemStack getStack(Block block) {
|
||||
NBTTagCompound woodNBT = new NBTTagCompound();
|
||||
saveToCompound(woodNBT);
|
||||
|
||||
ItemStack itemStack = new ItemStack(block);
|
||||
itemStack.setTagCompound(woodNBT);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public void registerLog(Block block, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(block);
|
||||
if (fireproof) {
|
||||
this.logFireproof = itemStack;
|
||||
} else {
|
||||
this.log = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerPlanks(Block block, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(block);
|
||||
if (fireproof) {
|
||||
this.planksFireproof = itemStack;
|
||||
} else {
|
||||
this.planks = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerSlab(Block block, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(block);
|
||||
if (fireproof) {
|
||||
this.slabFireproof = itemStack;
|
||||
} else {
|
||||
this.slab = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerFence(Block block, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(block);
|
||||
if (fireproof) {
|
||||
this.fenceFireproof = itemStack;
|
||||
} else {
|
||||
this.fence = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerStairs(Block block, boolean fireproof) {
|
||||
ItemStack itemStack = getStack(block);
|
||||
if (fireproof) {
|
||||
this.stairsFireproof = itemStack;
|
||||
} else {
|
||||
this.stairs = itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getPlanks(boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return planksFireproof.copy();
|
||||
} else {
|
||||
return planks.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getLog(boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return logFireproof.copy();
|
||||
} else {
|
||||
return log.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getSlab(boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return slabFireproof.copy();
|
||||
} else {
|
||||
return slab.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getFence(boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return fenceFireproof.copy();
|
||||
} else {
|
||||
return fence.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getStairs(boolean fireproof) {
|
||||
if (fireproof) {
|
||||
return stairsFireproof.copy();
|
||||
} else {
|
||||
return stairs.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public static WoodType getRandom(Random random) {
|
||||
return VALUES[random.nextInt(VALUES.length)];
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
@@ -60,8 +62,8 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) {
|
||||
for (WoodType woodType : WoodType.VALUES) {
|
||||
list.add(woodType.getFence(fireproof));
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getFence(woodType, fireproof));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,20 +90,20 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
WoodType.registerIcons(register);
|
||||
IconProviderWood.registerIcons(register);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodType.ACACIA.getPlankIcon();
|
||||
return IconProviderWood.getPlankIcon(EnumWoodType.LARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileWood wood = BlockWood.getWoodTile(world, x, y, z);
|
||||
WoodType type = wood.getWoodType();
|
||||
return type.getPlankIcon();
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
return IconProviderWood.getPlankIcon(woodType);
|
||||
}
|
||||
|
||||
private static boolean isFence(IBlockAccess world, int x, int y, int z) {
|
||||
@@ -143,7 +145,7 @@ public class BlockArbFence extends BlockFence implements IWoodTyped, ITileEntity
|
||||
public final float getBlockHardness(World world, int x, int y, int z) {
|
||||
TileWood wood = BlockWood.getWoodTile(world, x, y, z);
|
||||
if (wood == null) {
|
||||
return WoodType.DEFAULT_HARDNESS;
|
||||
return EnumWoodType.DEFAULT_HARDNESS;
|
||||
}
|
||||
return wood.getWoodType().getHardness();
|
||||
}
|
||||
|
||||
@@ -31,9 +31,11 @@ import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
|
||||
public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEntityProvider {
|
||||
@@ -55,8 +57,8 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEnti
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (WoodType woodType : WoodType.VALUES) {
|
||||
list.add(woodType.getStairs(fireproof));
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getStairs(woodType, fireproof));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,21 +90,21 @@ public class BlockArbStairs extends BlockStairs implements IWoodTyped, ITileEnti
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
WoodType.registerIcons(register);
|
||||
IconProviderWood.registerIcons(register);
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodType.ACACIA.getPlankIcon();
|
||||
return IconProviderWood.getPlankIcon(EnumWoodType.LARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileWood wood = BlockWood.getWoodTile(world, x, y, z);
|
||||
WoodType type = wood.getWoodType();
|
||||
return type.getPlankIcon();
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
return IconProviderWood.getPlankIcon(woodType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
|
||||
public class BlockLog extends BlockWood {
|
||||
@@ -84,8 +86,8 @@ public class BlockLog extends BlockWood {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (WoodType woodType : WoodType.VALUES) {
|
||||
list.add(woodType.getLog(isFireproof()));
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getLog(woodType, isFireproof()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,18 +95,18 @@ public class BlockLog extends BlockWood {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodType.ACACIA.getIcon(meta, side);
|
||||
return IconProviderWood.getLogIcon(EnumWoodType.LARCH, meta, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
TileWood wood = getWoodTile(world, x, y, z);
|
||||
WoodType type = wood.getWoodType();
|
||||
EnumWoodType type = wood.getWoodType();
|
||||
if (type == null) {
|
||||
return getIcon(side, meta);
|
||||
}
|
||||
return type.getIcon(meta, side);
|
||||
return IconProviderWood.getLogIcon(type, meta, side);
|
||||
}
|
||||
|
||||
/* PROPERTIES */
|
||||
|
||||
@@ -20,7 +20,9 @@ import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
|
||||
public class BlockPlanks extends BlockWood {
|
||||
@@ -34,8 +36,8 @@ public class BlockPlanks extends BlockWood {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) {
|
||||
for (WoodType woodType : WoodType.VALUES) {
|
||||
list.add(woodType.getPlanks(isFireproof()));
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getPlanks(woodType, isFireproof()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,14 +45,14 @@ public class BlockPlanks extends BlockWood {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodType.ACACIA.getPlankIcon();
|
||||
return IconProviderWood.getPlankIcon(EnumWoodType.LARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileWood wood = getWoodTile(world, x, y, z);
|
||||
WoodType type = wood.getWoodType();
|
||||
return type.getPlankIcon();
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
return IconProviderWood.getPlankIcon(woodType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,9 +35,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
|
||||
public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyped, ITileEntityProvider {
|
||||
@@ -66,21 +68,21 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
WoodType.registerIcons(register);
|
||||
IconProviderWood.registerIcons(register);
|
||||
}
|
||||
|
||||
/* ICONS */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return WoodType.ACACIA.getPlankIcon();
|
||||
return IconProviderWood.getPlankIcon(EnumWoodType.LARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileWood wood = BlockWood.getWoodTile(world, x, y, z);
|
||||
WoodType type = wood.getWoodType();
|
||||
return type.getPlankIcon();
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
return IconProviderWood.getPlankIcon(woodType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,8 +103,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List list) {
|
||||
for (WoodType woodType : WoodType.VALUES) {
|
||||
list.add(woodType.getSlab(fireproof));
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
list.add(TreeManager.woodItemAccess.getSlab(woodType, fireproof));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +142,7 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
public final float getBlockHardness(World world, int x, int y, int z) {
|
||||
TileWood wood = BlockWood.getWoodTile(world, x, y, z);
|
||||
if (wood == null) {
|
||||
return WoodType.DEFAULT_HARDNESS;
|
||||
return EnumWoodType.DEFAULT_HARDNESS;
|
||||
}
|
||||
return wood.getWoodType().getHardness();
|
||||
}
|
||||
|
||||
@@ -30,9 +30,10 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.render.IconProviderWood;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
@@ -70,7 +71,7 @@ public abstract class BlockWood extends Block implements ITileEntityProvider, IW
|
||||
if (wood == null) {
|
||||
return nbttagcompound;
|
||||
}
|
||||
WoodType woodType = wood.getWoodType();
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
woodType.saveToCompound(nbttagcompound);
|
||||
return nbttagcompound;
|
||||
}
|
||||
@@ -78,7 +79,7 @@ public abstract class BlockWood extends Block implements ITileEntityProvider, IW
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerBlockIcons(IIconRegister register) {
|
||||
WoodType.registerIcons(register);
|
||||
IconProviderWood.registerIcons(register);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,7 +115,7 @@ public abstract class BlockWood extends Block implements ITileEntityProvider, IW
|
||||
public final float getBlockHardness(World world, int x, int y, int z) {
|
||||
TileWood wood = getWoodTile(world, x, y, z);
|
||||
if (wood == null) {
|
||||
return WoodType.DEFAULT_HARDNESS;
|
||||
return EnumWoodType.DEFAULT_HARDNESS;
|
||||
}
|
||||
return wood.getWoodType().getHardness();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import forestry.api.arboriculture.EnumFruitFamily;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumLeafType;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpeciesCustom;
|
||||
import forestry.api.arboriculture.IGermlingIconProvider;
|
||||
import forestry.api.arboriculture.ILeafIconProvider;
|
||||
@@ -39,7 +40,6 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.render.IconProviderGermling;
|
||||
import forestry.arboriculture.render.IconProviderGermlingVanilla;
|
||||
@@ -156,7 +156,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Lime(TreeBranchDefinition.TILIA, "silverLime", "pendula", true, EnumLeafType.DECIDUOUS, new Color(0x5ea107), new Color(0x5ea107).brighter(), WoodType.LIME) {
|
||||
Lime(TreeBranchDefinition.TILIA, "silverLime", "pendula", true, EnumLeafType.DECIDUOUS, new Color(0x5ea107), new Color(0x5ea107).brighter(), EnumWoodType.LIME) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenLime(tree);
|
||||
@@ -182,7 +182,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Birch, Oak, 15);
|
||||
}
|
||||
},
|
||||
Walnut(TreeBranchDefinition.JUGLANS, "commonWalnut", "regia", true, EnumLeafType.DECIDUOUS, new Color(0x798c55), new Color(0xb0c648), WoodType.WALNUT) {
|
||||
Walnut(TreeBranchDefinition.JUGLANS, "commonWalnut", "regia", true, EnumLeafType.DECIDUOUS, new Color(0x798c55), new Color(0xb0c648), EnumWoodType.WALNUT) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenWalnut(tree);
|
||||
@@ -210,7 +210,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Lime, Cherry, 10);
|
||||
}
|
||||
},
|
||||
Chestnut(TreeBranchDefinition.CASTANEA, "sweetChestnut", "sativa", true, EnumLeafType.DECIDUOUS, new Color(0x5ea107), new Color(0xb0c648), WoodType.CHESTNUT) {
|
||||
Chestnut(TreeBranchDefinition.CASTANEA, "sweetChestnut", "sativa", true, EnumLeafType.DECIDUOUS, new Color(0x5ea107), new Color(0xb0c648), EnumWoodType.CHESTNUT) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenChestnut(tree);
|
||||
@@ -238,7 +238,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Walnut, Cherry, 10);
|
||||
}
|
||||
},
|
||||
Cherry(TreeBranchDefinition.PRUNUS, "hillCherry", "serrulata", true, EnumLeafType.DECIDUOUS, new Color(0xe691da), new Color(0xe63e59), WoodType.CHERRY) {
|
||||
Cherry(TreeBranchDefinition.PRUNUS, "hillCherry", "serrulata", true, EnumLeafType.DECIDUOUS, new Color(0xe691da), new Color(0xe63e59), EnumWoodType.CHERRY) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenCherry(tree);
|
||||
@@ -265,7 +265,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Lime, Birch, 10);
|
||||
}
|
||||
},
|
||||
Lemon(TreeBranchDefinition.CITRUS, "lemon", "limon", true, EnumLeafType.DECIDUOUS, new Color(0x88af54), new Color(0xa3b850), WoodType.CITRUS) {
|
||||
Lemon(TreeBranchDefinition.CITRUS, "lemon", "limon", true, EnumLeafType.DECIDUOUS, new Color(0x88af54), new Color(0xa3b850), EnumWoodType.CITRUS) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenLemon(tree);
|
||||
@@ -290,7 +290,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Lime, Cherry, 5);
|
||||
}
|
||||
},
|
||||
Plum(TreeBranchDefinition.PRUNUS, "plum", "domestica", true, EnumLeafType.DECIDUOUS, new Color(0x589246), new Color(0xa3b850), WoodType.PLUM) {
|
||||
Plum(TreeBranchDefinition.PRUNUS, "plum", "domestica", true, EnumLeafType.DECIDUOUS, new Color(0x589246), new Color(0xa3b850), EnumWoodType.PLUM) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenPlum(tree);
|
||||
@@ -315,7 +315,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Lemon, Cherry, 5);
|
||||
}
|
||||
},
|
||||
Maple(TreeBranchDefinition.ACER, "sugarMaple", "saccharum", true, EnumLeafType.MAPLE, new Color(0xd4f425), new Color(0x619a3c), WoodType.MAPLE) {
|
||||
Maple(TreeBranchDefinition.ACER, "sugarMaple", "saccharum", true, EnumLeafType.MAPLE, new Color(0xd4f425), new Color(0x619a3c), EnumWoodType.MAPLE) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenMaple(tree);
|
||||
@@ -362,7 +362,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Larch(TreeBranchDefinition.LARIX, "mundaneLarch", "decidua", true, EnumLeafType.CONIFERS, new Color(0x698f90), new Color(0x569896), WoodType.LARCH) {
|
||||
Larch(TreeBranchDefinition.LARIX, "mundaneLarch", "decidua", true, EnumLeafType.CONIFERS, new Color(0x698f90), new Color(0x569896), EnumWoodType.LARCH) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenLarch(tree);
|
||||
@@ -386,7 +386,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Spruce, Oak, 10);
|
||||
}
|
||||
},
|
||||
Pine(TreeBranchDefinition.PINUS, "bullPine", "sabiniana", true, EnumLeafType.CONIFERS, new Color(0xfeff8f), new Color(0xffd98f), WoodType.PINE) {
|
||||
Pine(TreeBranchDefinition.PINUS, "bullPine", "sabiniana", true, EnumLeafType.CONIFERS, new Color(0xfeff8f), new Color(0xffd98f), EnumWoodType.PINE) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenPine(tree);
|
||||
@@ -409,7 +409,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Spruce, Larch, 10);
|
||||
}
|
||||
},
|
||||
Sequioa(TreeBranchDefinition.SEQUOIA, "coastSequoia", "sempervirens", false, EnumLeafType.CONIFERS, new Color(0x418e71), new Color(0x569896), WoodType.SEQUOIA) {
|
||||
Sequioa(TreeBranchDefinition.SEQUOIA, "coastSequoia", "sempervirens", false, EnumLeafType.CONIFERS, new Color(0x418e71), new Color(0x569896), EnumWoodType.SEQUOIA) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenSequoia(tree);
|
||||
@@ -434,7 +434,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Larch, Pine, 5);
|
||||
}
|
||||
},
|
||||
Gigant(TreeBranchDefinition.SEQUOIADENDRON, "giantSequoia", "giganteum", false, EnumLeafType.CONIFERS, new Color(0x738434), new Color(0x738434).brighter(), WoodType.GIGANTEUM) {
|
||||
Gigant(TreeBranchDefinition.SEQUOIADENDRON, "giantSequoia", "giganteum", false, EnumLeafType.CONIFERS, new Color(0x738434), new Color(0x738434).brighter(), EnumWoodType.GIGANTEUM) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenGiganteum(tree);
|
||||
@@ -482,7 +482,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Teak(TreeBranchDefinition.TECTONA, "teak", "grandis", true, EnumLeafType.JUNGLE, new Color(0xfeff8f), new Color(0xffd98f), WoodType.TEAK) {
|
||||
Teak(TreeBranchDefinition.TECTONA, "teak", "grandis", true, EnumLeafType.JUNGLE, new Color(0xfeff8f), new Color(0xffd98f), EnumWoodType.TEAK) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenTeak(tree);
|
||||
@@ -503,7 +503,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(DarkOak, Jungle, 10);
|
||||
}
|
||||
},
|
||||
Ipe(TreeBranchDefinition.TABEBUIA, "ipe", "serratifolia", true, EnumLeafType.JUNGLE, new Color(0xfdd207), new Color(0xad8f04), WoodType.IPE) {
|
||||
Ipe(TreeBranchDefinition.TABEBUIA, "ipe", "serratifolia", true, EnumLeafType.JUNGLE, new Color(0xfdd207), new Color(0xad8f04), EnumWoodType.IPE) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenIpe(tree);
|
||||
@@ -526,7 +526,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Teak, DarkOak, 10);
|
||||
}
|
||||
},
|
||||
Kapok(TreeBranchDefinition.CEIBA, "kapok", "pentandra", true, EnumLeafType.JUNGLE, new Color(0x89987b), new Color(0x89aa9e), WoodType.KAPOK) {
|
||||
Kapok(TreeBranchDefinition.CEIBA, "kapok", "pentandra", true, EnumLeafType.JUNGLE, new Color(0x89987b), new Color(0x89aa9e), EnumWoodType.KAPOK) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenKapok(tree);
|
||||
@@ -550,7 +550,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Jungle, Teak, 10);
|
||||
}
|
||||
},
|
||||
Ebony(TreeBranchDefinition.EBONY, "myrtleEbony", "pentamera", true, EnumLeafType.JUNGLE, new Color(0xa2d24a), new Color(0xc4d24a), WoodType.EBONY) {
|
||||
Ebony(TreeBranchDefinition.EBONY, "myrtleEbony", "pentamera", true, EnumLeafType.JUNGLE, new Color(0xa2d24a), new Color(0xc4d24a), EnumWoodType.EBONY) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenEbony(tree);
|
||||
@@ -575,7 +575,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(DarkOak, Kapok, 10);
|
||||
}
|
||||
},
|
||||
Zebrawood(TreeBranchDefinition.ASTRONIUM, "zebrawood", "graveolens", false, EnumLeafType.JUNGLE, new Color(0xa2d24a), new Color(0xc4d24a), WoodType.ZEBRAWOOD) {
|
||||
Zebrawood(TreeBranchDefinition.ASTRONIUM, "zebrawood", "graveolens", false, EnumLeafType.JUNGLE, new Color(0xa2d24a), new Color(0xc4d24a), EnumWoodType.ZEBRAWOOD) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenZebrawood(tree);
|
||||
@@ -597,7 +597,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Ebony, Poplar, 5);
|
||||
}
|
||||
},
|
||||
Mahogony(TreeBranchDefinition.MAHOGANY, "yellowMeranti", "gibbosa", true, EnumLeafType.JUNGLE, new Color(0x8ab154), new Color(0xa9b154), WoodType.MAHOGANY) {
|
||||
Mahogony(TreeBranchDefinition.MAHOGANY, "yellowMeranti", "gibbosa", true, EnumLeafType.JUNGLE, new Color(0x8ab154), new Color(0xa9b154), EnumWoodType.MAHOGANY) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenMahogany(tree);
|
||||
@@ -643,7 +643,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
// vanilla
|
||||
}
|
||||
},
|
||||
Acacia(TreeBranchDefinition.ACACIA, "desertAcacia", "erioloba", true, EnumLeafType.DECIDUOUS, new Color(0x748C1C), new Color(0xb3b302), WoodType.ACACIA) {
|
||||
Acacia(TreeBranchDefinition.ACACIA, "desertAcacia", "erioloba", true, EnumLeafType.DECIDUOUS, new Color(0x748C1C), new Color(0xb3b302), EnumWoodType.ACACIA) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenAcacia(tree);
|
||||
@@ -665,7 +665,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Teak, Balsa, 10);
|
||||
}
|
||||
},
|
||||
Padauk(TreeBranchDefinition.PTEROCARPUS, "padauk", "soyauxii", true, EnumLeafType.DECIDUOUS, new Color(0xd0df8c), new Color(0x435c32), WoodType.PADAUK) {
|
||||
Padauk(TreeBranchDefinition.PTEROCARPUS, "padauk", "soyauxii", true, EnumLeafType.DECIDUOUS, new Color(0xd0df8c), new Color(0x435c32), EnumWoodType.PADAUK) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenPadauk(tree);
|
||||
@@ -687,7 +687,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(AcaciaVanilla, Jungle, 10);
|
||||
}
|
||||
},
|
||||
Balsa(TreeBranchDefinition.OCHROMA, "balsa", "pyramidale", true, EnumLeafType.DECIDUOUS, new Color(0x59ac00), new Color(0xfeff8f), WoodType.BALSA) {
|
||||
Balsa(TreeBranchDefinition.OCHROMA, "balsa", "pyramidale", true, EnumLeafType.DECIDUOUS, new Color(0x59ac00), new Color(0xfeff8f), EnumWoodType.BALSA) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenBalsa(tree);
|
||||
@@ -711,7 +711,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Teak, AcaciaVanilla, 10);
|
||||
}
|
||||
},
|
||||
Cocobolo(TreeBranchDefinition.DALBERGIA, "cocobolo", "retusa", false, EnumLeafType.DECIDUOUS, new Color(0x6aa17a), new Color(0x487d4c), WoodType.COCOBOLO) {
|
||||
Cocobolo(TreeBranchDefinition.DALBERGIA, "cocobolo", "retusa", false, EnumLeafType.DECIDUOUS, new Color(0x6aa17a), new Color(0x487d4c), EnumWoodType.COCOBOLO) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenCocobolo(tree);
|
||||
@@ -732,7 +732,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Acacia, DarkOak, 10);
|
||||
}
|
||||
},
|
||||
Wenge(TreeBranchDefinition.MILLETTIA, "wenge", "laurentii", true, EnumLeafType.DECIDUOUS, new Color(0xada157), new Color(0xad8a57), WoodType.WENGE) {
|
||||
Wenge(TreeBranchDefinition.MILLETTIA, "wenge", "laurentii", true, EnumLeafType.DECIDUOUS, new Color(0xada157), new Color(0xad8a57), EnumWoodType.WENGE) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenWenge(tree);
|
||||
@@ -755,7 +755,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Cocobolo, Balsa, 10);
|
||||
}
|
||||
},
|
||||
Baobab(TreeBranchDefinition.ADANSONIA, "grandidierBaobab", "digitata", true, EnumLeafType.DECIDUOUS, new Color(0xfeff8f), new Color(0xffd98f), WoodType.BAOBAB) {
|
||||
Baobab(TreeBranchDefinition.ADANSONIA, "grandidierBaobab", "digitata", true, EnumLeafType.DECIDUOUS, new Color(0xfeff8f), new Color(0xffd98f), EnumWoodType.BAOBAB) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenBaobab(tree);
|
||||
@@ -781,7 +781,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Balsa, Wenge, 10);
|
||||
}
|
||||
},
|
||||
Mahoe(TreeBranchDefinition.TALIPARITI, "blueMahoe", "elatum", true, EnumLeafType.DECIDUOUS, new Color(0xa0ba1b), new Color(0x79a175), WoodType.MAHOE) {
|
||||
Mahoe(TreeBranchDefinition.TALIPARITI, "blueMahoe", "elatum", true, EnumLeafType.DECIDUOUS, new Color(0xa0ba1b), new Color(0x79a175), EnumWoodType.MAHOE) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenMahoe(tree);
|
||||
@@ -806,7 +806,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Balsa, Acacia, 5);
|
||||
}
|
||||
},
|
||||
Willow(TreeBranchDefinition.SALIX, "whiteWillow", "alba", true, EnumLeafType.WILLOW, new Color(0xa3b8a5), new Color(0xa3b850), WoodType.WILLOW) {
|
||||
Willow(TreeBranchDefinition.SALIX, "whiteWillow", "alba", true, EnumLeafType.WILLOW, new Color(0xa3b8a5), new Color(0xa3b850), EnumWoodType.WILLOW) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenWillow(tree);
|
||||
@@ -839,7 +839,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
.restrictHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
},
|
||||
Sipiri(TreeBranchDefinition.CHLOROCARDIUM, "sipiri", "rodiei", true, EnumLeafType.DECIDUOUS, new Color(0x678911), new Color(0x79a175), WoodType.GREENHEART) {
|
||||
Sipiri(TreeBranchDefinition.CHLOROCARDIUM, "sipiri", "rodiei", true, EnumLeafType.DECIDUOUS, new Color(0x678911), new Color(0x79a175), EnumWoodType.GREENHEART) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenGreenheart(tree);
|
||||
@@ -865,7 +865,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
.restrictHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
},
|
||||
Papaya(TreeBranchDefinition.CARICA, "papaya", "papaya", true, EnumLeafType.PALM, new Color(0x6d9f58), new Color(0x9ee67f), WoodType.PAPAYA) {
|
||||
Papaya(TreeBranchDefinition.CARICA, "papaya", "papaya", true, EnumLeafType.PALM, new Color(0x6d9f58), new Color(0x9ee67f), EnumWoodType.PAPAYA) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenPapaya(tree);
|
||||
@@ -890,7 +890,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Jungle, Cherry, 5);
|
||||
}
|
||||
},
|
||||
Date(TreeBranchDefinition.PHOENIX, "datePalm", "dactylifera", true, EnumLeafType.PALM, new Color(0xcbcd79), new Color(0xf0f38f), WoodType.PALM) {
|
||||
Date(TreeBranchDefinition.PHOENIX, "datePalm", "dactylifera", true, EnumLeafType.PALM, new Color(0xcbcd79), new Color(0xf0f38f), EnumWoodType.PALM) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenDate(tree);
|
||||
@@ -916,7 +916,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
registerMutation(Jungle, Papaya, 5);
|
||||
}
|
||||
},
|
||||
Poplar(TreeBranchDefinition.POPULUS, "whitePoplar", "alba", true, EnumLeafType.DECIDUOUS, new Color(0xa3b8a5), new Color(0x539d12), WoodType.POPLAR) {
|
||||
Poplar(TreeBranchDefinition.POPULUS, "whitePoplar", "alba", true, EnumLeafType.DECIDUOUS, new Color(0xa3b8a5), new Color(0x539d12), EnumWoodType.POPLAR) {
|
||||
@Override
|
||||
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
|
||||
return new WorldGenPoplar(tree);
|
||||
@@ -946,7 +946,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
private final TreeBranchDefinition branch;
|
||||
private final IAlleleTreeSpeciesCustom species;
|
||||
|
||||
private final WoodType woodType; // for forestry trees
|
||||
private final EnumWoodType woodType; // for forestry trees
|
||||
private final ItemStack vanillaWood; // for vanilla trees
|
||||
|
||||
private IAllele[] template;
|
||||
@@ -969,7 +969,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
}
|
||||
|
||||
// forestry tree constructor
|
||||
TreeDefinition(TreeBranchDefinition branch, String speciesName, String binomial, boolean dominant, EnumLeafType leafType, Color primary, Color secondary, WoodType woodType) {
|
||||
TreeDefinition(TreeBranchDefinition branch, String speciesName, String binomial, boolean dominant, EnumLeafType leafType, Color primary, Color secondary, EnumWoodType woodType) {
|
||||
String uid = "forestry.tree" + this.toString();
|
||||
String unlocalizedDescription = "for.description.tree" + this.toString();
|
||||
String unlocalizedName = "for.trees.species." + speciesName;
|
||||
@@ -999,7 +999,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
} else {
|
||||
AlleleBoolean fireproofAllele = (AlleleBoolean) genome.getActiveAllele(EnumTreeChromosome.FIREPROOF);
|
||||
boolean fireproof = fireproofAllele.getValue();
|
||||
ItemStack log = woodType.getLog(fireproof);
|
||||
ItemStack log = TreeManager.woodItemAccess.getLog(woodType, fireproof);
|
||||
|
||||
BlockTypeLog logBlock = new BlockTypeLog(log);
|
||||
logBlock.setDirection(facing);
|
||||
|
||||
@@ -18,8 +18,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
@@ -32,7 +32,7 @@ public class ItemBlockWood extends ItemBlockForestry {
|
||||
}
|
||||
|
||||
public static boolean placeWood(ItemStack stack, @Nullable EntityPlayer player, World world, int x, int y, int z, int metadata) {
|
||||
WoodType woodType = WoodType.getFromCompound(stack.getTagCompound());
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(stack.getTagCompound());
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
|
||||
boolean placed = world.setBlock(x, y, z, block, metadata, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
@@ -72,7 +72,7 @@ public class ItemBlockWood extends ItemBlockForestry {
|
||||
return super.getItemStackDisplayName(itemstack);
|
||||
}
|
||||
|
||||
WoodType woodType = getWood(itemstack);
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemstack.getTagCompound());
|
||||
if (woodType == null) {
|
||||
return super.getItemStackDisplayName(itemstack);
|
||||
}
|
||||
@@ -98,7 +98,4 @@ public class ItemBlockWood extends ItemBlockForestry {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
private static WoodType getWood(ItemStack itemStack) {
|
||||
return WoodType.getFromCompound(itemStack.getTagCompound());
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,12 @@ package forestry.arboriculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.items.ItemAlyzer;
|
||||
@@ -50,52 +49,32 @@ public class ItemTreealyzer extends ItemAlyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSpecimen(ItemStack itemStack) {
|
||||
return GeneticsUtil.getGeneticEquivalent(itemStack) instanceof ITree;
|
||||
protected ISpeciesRoot getSpeciesRoot() {
|
||||
return TreeManager.treeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (!TreeManager.treeRoot.isMember(itemStack)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(itemStack);
|
||||
if (ersatz != null) {
|
||||
return super.canSlotAccept(slotIndex, ersatz);
|
||||
}
|
||||
}
|
||||
return super.canSlotAccept(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
// Source slot to analyze empty
|
||||
if (getStackInSlot(SLOT_SPECIMEN) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TreeManager.treeRoot.isMember(getStackInSlot(SLOT_SPECIMEN))) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(getStackInSlot(SLOT_SPECIMEN));
|
||||
ItemStack specimen = getStackInSlot(SLOT_SPECIMEN);
|
||||
if (!TreeManager.treeRoot.isMember(specimen)) {
|
||||
ItemStack ersatz = GeneticsUtil.convertSaplingToGeneticEquivalent(specimen);
|
||||
if (ersatz != null) {
|
||||
setInventorySlotContents(SLOT_SPECIMEN, ersatz);
|
||||
}
|
||||
}
|
||||
ITree tree = TreeManager.treeRoot.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
// No tree, abort
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Analyze if necessary
|
||||
if (!tree.isAnalyzed()) {
|
||||
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
tree.analyze();
|
||||
if (player != null) {
|
||||
TreeManager.treeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(tree.getGenome().getPrimary());
|
||||
TreeManager.treeRoot.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(tree.getGenome().getSecondary());
|
||||
}
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
tree.writeToNBT(nbttagcompound);
|
||||
getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
}
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZE_1, getStackInSlot(SLOT_SPECIMEN));
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
super.onSlotClick(player);
|
||||
}
|
||||
|
||||
// / IHINTSOURCE
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.render;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public abstract class IconProviderWood {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon[][] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
icons = new IIcon[3][EnumWoodType.VALUES.length];
|
||||
for (int i = 0; i < EnumWoodType.VALUES.length; i++) {
|
||||
EnumWoodType woodType = EnumWoodType.VALUES[i];
|
||||
String woodName = woodType.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
icons[0][i] = TextureManager.getInstance().registerTex(register, "wood/planks." + woodName);
|
||||
icons[1][i] = TextureManager.getInstance().registerTex(register, "wood/bark." + woodName);
|
||||
icons[2][i] = TextureManager.getInstance().registerTex(register, "wood/heart." + woodName);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getPlankIcon(EnumWoodType woodType) {
|
||||
return icons[0][woodType.ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getBarkIcon(EnumWoodType woodType) {
|
||||
return icons[1][woodType.ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getHeartIcon(EnumWoodType woodType) {
|
||||
return icons[2][woodType.ordinal()];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getLogIcon(EnumWoodType woodType, int meta, int side) {
|
||||
int oriented = meta & 12;
|
||||
switch (oriented) {
|
||||
case 4:
|
||||
if (side > 3) {
|
||||
return getHeartIcon(woodType);
|
||||
} else {
|
||||
return getBarkIcon(woodType);
|
||||
}
|
||||
case 8:
|
||||
if (side == 2 || side == 3) {
|
||||
return getHeartIcon(woodType);
|
||||
} else {
|
||||
return getBarkIcon(woodType);
|
||||
}
|
||||
case 0:
|
||||
default:
|
||||
if (side < 2) {
|
||||
return getHeartIcon(woodType);
|
||||
} else {
|
||||
return getBarkIcon(woodType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
|
||||
public class RenderFenceItem implements IItemRenderer {
|
||||
@Override
|
||||
@@ -61,8 +61,8 @@ public class RenderFenceItem implements IItemRenderer {
|
||||
private static void renderItem(RenderBlocks renderer, ItemStack itemStack, float x, float y, float z) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
WoodType woodType = WoodType.getFromCompound(itemStack.getTagCompound());
|
||||
IIcon plankIcon = woodType.getPlankIcon();
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
IIcon plankIcon = IconProviderWood.getPlankIcon(woodType);
|
||||
Block block = Block.getBlockFromItem(itemStack.getItem());
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
||||
@@ -49,6 +49,11 @@ public class RenderLeavesItem implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderItem((RenderBlocks) data[0], item, 0f, 0f, 0f);
|
||||
@@ -62,6 +67,8 @@ public class RenderLeavesItem implements IItemRenderer {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void renderItem(RenderBlocks renderer, ItemStack itemStack, float x, float y, float z) {
|
||||
@@ -79,8 +86,6 @@ public class RenderLeavesItem implements IItemRenderer {
|
||||
leaves.setTree(TreeHelper.treeTemplates.get(0));
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon leavesIcon = leaves.getIcon(Proxies.render.fancyGraphicsEnabled());
|
||||
if (leavesIcon == null) {
|
||||
return;
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
@@ -68,12 +68,10 @@ public class RenderLogItem implements IItemRenderer {
|
||||
return;
|
||||
}
|
||||
|
||||
WoodType woodType = WoodType.getFromCompound(itemStack.getTagCompound());
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon barkIcon = woodType.getBarkIcon();
|
||||
IIcon heartIcon = woodType.getHeartIcon();
|
||||
IIcon barkIcon = IconProviderWood.getBarkIcon(woodType);
|
||||
IIcon heartIcon = IconProviderWood.getHeartIcon(woodType);
|
||||
if (barkIcon == null || heartIcon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
@@ -68,11 +68,9 @@ public class RenderPlankItem implements IItemRenderer {
|
||||
return;
|
||||
}
|
||||
|
||||
WoodType woodType = WoodType.getFromCompound(itemStack.getTagCompound());
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon plankIcon = woodType.getPlankIcon();
|
||||
IIcon plankIcon = IconProviderWood.getPlankIcon(woodType);
|
||||
if (plankIcon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
@@ -58,11 +58,9 @@ public class RenderSlabItem implements IItemRenderer {
|
||||
return;
|
||||
}
|
||||
|
||||
WoodType woodType = WoodType.getFromCompound(itemStack.getTagCompound());
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon plankIcon = woodType.getPlankIcon();
|
||||
IIcon plankIcon = IconProviderWood.getPlankIcon(woodType);
|
||||
if (plankIcon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class RenderStairItem implements IItemRenderer {
|
||||
@@ -60,12 +61,17 @@ public class RenderStairItem implements IItemRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float x, float y, float z) {
|
||||
private static void renderStairBlock(RenderBlocks renderBlocks, ItemStack itemStack, float x, float y, float z) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ItemStackUtil.getBlock(item);
|
||||
Block block = ItemStackUtil.getBlock(itemStack);
|
||||
|
||||
IIcon texture = WoodType.getFromCompound(item.getTagCompound()).getPlankIcon();
|
||||
if (!(itemStack.getItem() instanceof ItemBlockWood) || block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
IIcon texture = IconProviderWood.getPlankIcon(woodType);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (i == 0) {
|
||||
@@ -103,7 +109,6 @@ public class RenderStairItem implements IItemRenderer {
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,8 +20,8 @@ import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
@@ -29,18 +29,18 @@ import forestry.core.network.PacketTileStream;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class TileWood extends TileEntity implements IStreamable {
|
||||
private WoodType woodType;
|
||||
private EnumWoodType woodType;
|
||||
|
||||
public TileWood() {
|
||||
this.woodType = WoodType.ACACIA;
|
||||
this.woodType = EnumWoodType.LARCH;
|
||||
}
|
||||
|
||||
public void setWoodType(WoodType woodType) {
|
||||
public void setWoodType(EnumWoodType woodType) {
|
||||
this.woodType = woodType;
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public WoodType getWoodType() {
|
||||
public EnumWoodType getWoodType() {
|
||||
return woodType;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
int ordinal = data.readVarInt();
|
||||
woodType = WoodType.VALUES[ordinal];
|
||||
woodType = EnumWoodType.VALUES[ordinal];
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
super.readFromNBT(nbt);
|
||||
if (nbt.hasKey("WT")) {
|
||||
int ordinal = nbt.getInteger("WT");
|
||||
woodType = WoodType.VALUES[ordinal];
|
||||
woodType = EnumWoodType.VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@@ -82,11 +83,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
ChipsetManager.circuitRegistry.getDefaultLayout();
|
||||
}
|
||||
|
||||
List<ICircuit> readcircuits = new ArrayList<ICircuit>();
|
||||
|
||||
if (circuits != null) {
|
||||
return;
|
||||
}
|
||||
circuits = new ICircuit[4];
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!nbttagcompound.hasKey("CA.I" + i)) {
|
||||
@@ -94,10 +91,9 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
}
|
||||
ICircuit circuit = ChipsetManager.circuitRegistry.getCircuit(nbttagcompound.getString("CA.I" + i));
|
||||
if (circuit != null) {
|
||||
readcircuits.add(circuit);
|
||||
circuits[i] = circuit;
|
||||
}
|
||||
}
|
||||
circuits = readcircuits.toArray(new ICircuit[readcircuits.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,4 +166,9 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
public ICircuit[] getCircuits() {
|
||||
return circuits;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return layout.getSocketType();
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,17 @@
|
||||
package forestry.core.circuits;
|
||||
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class CircuitLayout implements ICircuitLayout {
|
||||
|
||||
private final String uid;
|
||||
private final ICircuitSocketType socketType;
|
||||
|
||||
public CircuitLayout(String uid) {
|
||||
public CircuitLayout(String uid, ICircuitSocketType socketType) {
|
||||
this.uid = uid;
|
||||
this.socketType = socketType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,4 +38,9 @@ public class CircuitLayout implements ICircuitLayout {
|
||||
public String getUsage() {
|
||||
return StringUtil.localize("circuit.layout." + this.uid + ".usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return socketType;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
@@ -26,7 +27,7 @@ import forestry.core.config.ForestryItem;
|
||||
|
||||
public class CircuitRegistry implements ICircuitRegistry {
|
||||
|
||||
public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy");
|
||||
public static final ICircuitLayout DUMMY_LAYOUT = new CircuitLayout("dummy", CircuitSocketType.NONE);
|
||||
private static final Map<String, ICircuitLayout> DUMMY_MAP = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final Map<String, ICircuitLayout> layoutMap = new LinkedHashMap<String, ICircuitLayout>();
|
||||
private final Map<String, ICircuit> circuitMap = new LinkedHashMap<String, ICircuit>();
|
||||
|
||||
@@ -10,10 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.circuits;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.core.circuits.ItemSolderingIron.CircuitRecipe;
|
||||
import forestry.core.circuits.ItemSolderingIron.SolderingInventory;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -37,17 +43,32 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, Solder
|
||||
String title = layout.getName();
|
||||
fontRendererObj.drawString(title, guiLeft + 8 + getCenteredOffset(title, 138), guiTop + 16, fontColor.get("gui.screen"));
|
||||
|
||||
for (int l = 2; l < inventory.getSizeInventory(); l++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String description;
|
||||
CircuitRecipe recipe = ItemSolderingIron.SolderManager.getMatchingRecipe(layout, inventory.getStackInSlot(l));
|
||||
ItemStack tube = inventory.getStackInSlot(i + 2);
|
||||
CircuitRecipe recipe = ItemSolderingIron.SolderManager.getMatchingRecipe(layout, tube);
|
||||
if (recipe == null) {
|
||||
description = "(" + StringUtil.localize("gui.noeffect") + ")";
|
||||
} else {
|
||||
description = StringUtil.localize(recipe.circuit.getName()) + " (" + recipe.circuit.getLimit() + ")";
|
||||
}
|
||||
|
||||
int row = (l - 2) * 20;
|
||||
int row = i * 20;
|
||||
fontRendererObj.drawString(description, guiLeft + 32, guiTop + 36 + row, fontColor.get("gui.screen"));
|
||||
|
||||
if (tube == null) {
|
||||
try {
|
||||
ICircuitSocketType socketType = layout.getSocketType();
|
||||
if (CircuitSocketType.FARM.equals(socketType)) {
|
||||
FarmDirection farmDirection = FarmDirection.values()[i];
|
||||
String farmDirectionString = farmDirection.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedDirection = StringUtil.localize("gui.solder." + farmDirectionString);
|
||||
fontRendererObj.drawString(localizedDirection, guiLeft + 17, guiTop + 36 + row, fontColor.get("gui.screen"));
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
// older circuit layouts do not have getSocketType()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,14 @@ package forestry.core.circuits;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
|
||||
public interface ISocketable {
|
||||
int getSocketCount();
|
||||
|
||||
ItemStack getSocket(int slot);
|
||||
|
||||
void setSocket(int slot, ItemStack stack);
|
||||
|
||||
ICircuitSocketType getSocketType();
|
||||
}
|
||||
@@ -134,11 +134,11 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
layouts.rotateLeft();
|
||||
}
|
||||
|
||||
private Collection<ICircuit> getCircuits(EnumCircuitBoardType type, boolean doConsume) {
|
||||
private ICircuit[] getCircuits(boolean doConsume) {
|
||||
|
||||
ArrayList<ICircuit> circuits = new ArrayList<ICircuit>();
|
||||
ICircuit[] circuits = new ICircuit[ingredientSlotCount];
|
||||
|
||||
for (short i = 0; i < type.sockets; i++) {
|
||||
for (short i = 0; i < ingredientSlotCount; i++) {
|
||||
ItemStack ingredient = getStackInSlot(ingredientSlot1 + i);
|
||||
if (ingredient == null) {
|
||||
continue;
|
||||
@@ -157,7 +157,7 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
if (doConsume) {
|
||||
decrStackSize(ingredientSlot1 + i, recipe.resource.stackSize);
|
||||
}
|
||||
circuits.add(recipe.circuit);
|
||||
circuits[i] = recipe.circuit;
|
||||
}
|
||||
|
||||
return circuits;
|
||||
@@ -192,25 +192,33 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
}
|
||||
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[blank.getItemDamage()];
|
||||
Collection<ICircuit> circuits = getCircuits(type, false);
|
||||
|
||||
if (circuits.size() != type.sockets) {
|
||||
if (getCircuitCount() != type.sockets) {
|
||||
return;
|
||||
}
|
||||
|
||||
circuits = getCircuits(type, true);
|
||||
ICircuit[] circuits = getCircuits(true);
|
||||
|
||||
ICircuit[] circuitsArray = circuits.toArray(new ICircuit[circuits.size()]);
|
||||
ItemStack circuitBoard = ItemCircuitBoard.createCircuitboard(type, layouts.getCurrent(), circuitsArray);
|
||||
ItemStack circuitBoard = ItemCircuitBoard.createCircuitboard(type, layouts.getCurrent(), circuits);
|
||||
|
||||
setInventorySlotContents(finishedSlot, circuitBoard);
|
||||
setInventorySlotContents(blankSlot, null);
|
||||
}
|
||||
|
||||
public static int getCount(ICircuit circuit, ArrayList<ICircuit> circuits) {
|
||||
private int getCircuitCount() {
|
||||
ICircuit[] circuits = getCircuits(false);
|
||||
int count = 0;
|
||||
for (ICircuit circuit : circuits) {
|
||||
if (circuit != null) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static int getCount(ICircuit circuit, ICircuit[] circuits) {
|
||||
int count = 0;
|
||||
for (ICircuit other : circuits) {
|
||||
if (other.getUID().equals(circuit.getUID())) {
|
||||
if (other != null && other.getUID().equals(circuit.getUID())) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -242,8 +250,8 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
if (circuitCount != type.sockets) {
|
||||
errorStates.add(EnumErrorCode.CIRCUITMISMATCH);
|
||||
} else {
|
||||
Collection<ICircuit> circuits = getCircuits(type, false);
|
||||
if (circuits.size() != type.sockets) {
|
||||
int count = getCircuitCount();
|
||||
if (count != type.sockets) {
|
||||
errorStates.add(EnumErrorCode.NOCIRCUITLAYOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
@@ -152,16 +151,18 @@ public final class FluidHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hasRoomForDrainedContainer(input, output, drainedItem, inputSlot, outputSlot)) {
|
||||
// consume forestry containers if there is only one slot
|
||||
if (outputSlot == inputSlot && drainedItem != null) {
|
||||
Item item = drainedItem.getItem();
|
||||
// consume forestry containers if there is no room for them
|
||||
if (ForestryItem.canEmpty.isItemEqual(item) || ForestryItem.waxCapsule.isItemEqual(item) || ForestryItem.refractoryEmpty.isItemEqual(item)) {
|
||||
drainedItem = null;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasRoomForDrainedContainer(input, output, drainedItem, inputSlot, outputSlot)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
|
||||
if (drainedItem != null) {
|
||||
@@ -196,23 +197,6 @@ public final class FluidHelper {
|
||||
return output.stackSize + drainedItem.stackSize <= output.getMaxStackSize();
|
||||
}
|
||||
|
||||
public static boolean isFillableContainer(ItemStack stack, FluidStack liquid) {
|
||||
ItemStack empty = ItemStackUtil.createSplitStack(stack, 1);
|
||||
Item item = empty.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
IFluidContainerItem containerItem = (IFluidContainerItem) item;
|
||||
return containerItem.fill(empty, liquid, false) > 0;
|
||||
}
|
||||
|
||||
for (FluidContainerData cont : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (cont.fluid.isFluidEqual(liquid) && (cont.emptyContainer != null && cont.emptyContainer.isItemEqual(empty))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEmptyContainer(ItemStack empty) {
|
||||
|
||||
if (FluidContainerRegistry.isEmptyContainer(empty)) {
|
||||
@@ -299,8 +283,7 @@ public final class FluidHelper {
|
||||
|
||||
Item item = empty.getItem();
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
ItemStack full = empty.copy();
|
||||
full.stackSize = 1;
|
||||
ItemStack full = ItemStackUtil.createSplitStack(empty, 1);
|
||||
IFluidContainerItem containerItem = (IFluidContainerItem) item;
|
||||
containerItem.fill(full, liquid, true);
|
||||
return full;
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.core.circuits.ISocketable;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.network.PacketSlotClick;
|
||||
@@ -41,6 +43,23 @@ public class ContainerSocketedHelper<T extends TileEntity & ISocketable> impleme
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ChipsetManager.circuitRegistry.isChipset(itemstack)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ICircuitBoard circuitBoard = ChipsetManager.circuitRegistry.getCircuitboard(itemstack);
|
||||
if (circuitBoard == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!tile.getSocketType().equals(circuitBoard.getSocketType())) {
|
||||
return;
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
// older circuitBoards don't have getSocketType()
|
||||
}
|
||||
|
||||
ItemStack toSocket = itemstack.copy();
|
||||
toSocket.stackSize = 1;
|
||||
tile.setSocket(slot, toSocket);
|
||||
|
||||
@@ -14,9 +14,13 @@ import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.IErrorSource;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
@@ -58,15 +62,71 @@ public abstract class ItemAlyzer extends ItemInventoried {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract boolean isSpecimen(ItemStack itemStack);
|
||||
protected abstract ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_ENERGY) {
|
||||
return isEnergy(itemStack);
|
||||
} else {
|
||||
return !hasSpecimen() && isSpecimen(itemStack);
|
||||
}
|
||||
|
||||
ISpeciesRoot speciesRoot = getSpeciesRoot();
|
||||
if (!speciesRoot.isMember(itemStack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// only allow one slot to be used at a time
|
||||
if (hasSpecimen() && getStackInSlot(slotIndex) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (slotIndex == SLOT_SPECIMEN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IIndividual individual = speciesRoot.getMember(itemStack);
|
||||
return individual.isAnalyzed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
// Source slot to analyze empty
|
||||
ItemStack specimen = getStackInSlot(SLOT_SPECIMEN);
|
||||
if (specimen == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IIndividual individual = getSpeciesRoot().getMember(specimen);
|
||||
// No individual, abort
|
||||
if (individual == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Analyze if necessary
|
||||
if (!individual.isAnalyzed()) {
|
||||
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
individual.analyze();
|
||||
if (player != null) {
|
||||
IBreedingTracker breedingTracker = getSpeciesRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
breedingTracker.registerSpecies(individual.getGenome().getPrimary());
|
||||
breedingTracker.registerSpecies(individual.getGenome().getSecondary());
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
individual.writeToNBT(nbttagcompound);
|
||||
specimen.setTagCompound(nbttagcompound);
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
}
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZE_1, specimen);
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ public enum PacketId {
|
||||
FX_SIGNAL,
|
||||
|
||||
WORKTABLE_MEMORY_UPDATE,
|
||||
WORKTABLE_NEI_SELECT,
|
||||
|
||||
HABITAT_BIOME_POINTER,
|
||||
CANDLE,
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.network.PacketNBT;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.OffsetPositioner;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
/**
|
||||
* @author bdew
|
||||
*/
|
||||
public class CustomOverlayHandler implements IOverlayHandler {
|
||||
private final int xOffs;
|
||||
private final int yOffs;
|
||||
private final boolean forceShift;
|
||||
|
||||
public CustomOverlayHandler(int xOffs, int yOffs, boolean forceShift) {
|
||||
this.xOffs = xOffs;
|
||||
this.yOffs = yOffs;
|
||||
this.forceShift = forceShift;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer cont, IRecipeHandler recipe, int recipeIndex, boolean shift) {
|
||||
List<PositionedStack> ingr = recipe.getIngredientStacks(recipeIndex);
|
||||
|
||||
if (shift || forceShift) {
|
||||
NBTTagList stacksnbt = new NBTTagList();
|
||||
|
||||
for (PositionedStack pstack : ingr) {
|
||||
if (pstack != null) {
|
||||
// This is back-asswards but i don't see a better way :(
|
||||
int x = (pstack.relx - 25) / 18;
|
||||
int y = (pstack.rely - 6) / 18;
|
||||
|
||||
ItemStack stack = pstack.item;
|
||||
NBTTagCompound stacknbt = stack.writeToNBT(new NBTTagCompound());
|
||||
stacknbt.setInteger("slot", y * 3 + x);
|
||||
stacksnbt.appendTag(stacknbt);
|
||||
}
|
||||
|
||||
ItemStack stack = recipe.getResultStack(recipeIndex).items[0];
|
||||
NBTTagCompound stacknbt = stack.writeToNBT(new NBTTagCompound());
|
||||
stacknbt.setInteger("slot", 9);
|
||||
stacksnbt.appendTag(stacknbt);
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setTag("stacks", stacksnbt);
|
||||
|
||||
Proxies.net.sendToServer(new PacketNBT(PacketId.WORKTABLE_NEI_SELECT, data));
|
||||
} else {
|
||||
IStackPositioner positioner = new OffsetPositioner(xOffs, yOffs);
|
||||
LayoutManager.overlayRenderer = new DefaultOverlayRenderer(ingr, positioner);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
|
||||
/**
|
||||
* @author bdew
|
||||
*/
|
||||
public class ItemFilterForestry implements ItemFilter {
|
||||
private final boolean items;
|
||||
|
||||
public ItemFilterForestry(Boolean items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
if (item == null || item.getItem() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.getItem() instanceof ItemBlock && items) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(item.getItem() instanceof ItemBlock) && !items) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String itemName = Item.itemRegistry.getNameForObject(item.getItem());
|
||||
if (itemName == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String[] s = itemName.split(":");
|
||||
if (s.length <= 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return s[0].equals(Constants.MOD);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
|
||||
/**
|
||||
* @author bdew
|
||||
*/
|
||||
public class ItemFilterGenetic implements ItemFilter {
|
||||
private final ISpeciesRoot root;
|
||||
private final int type;
|
||||
private final boolean analyzedOnly;
|
||||
|
||||
public ItemFilterGenetic(ISpeciesRoot root, int type, boolean analyzedOnly) {
|
||||
this.root = root;
|
||||
this.type = type;
|
||||
this.analyzedOnly = analyzedOnly;
|
||||
}
|
||||
|
||||
private boolean isMember(ItemStack item) {
|
||||
if (type >= 0) {
|
||||
return root.isMember(item, type);
|
||||
} else {
|
||||
return root.isMember(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
if (analyzedOnly) {
|
||||
if (!isMember(item)) {
|
||||
return false;
|
||||
}
|
||||
IIndividual individual = root.getMember(item);
|
||||
return individual.isAnalyzed() || !individual.isSecret();
|
||||
} else {
|
||||
return isMember(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
/**
|
||||
* @author bdew
|
||||
*/
|
||||
public class ItemFilterOther extends ItemFilterForestry {
|
||||
|
||||
public ItemFilterOther(Boolean items) {
|
||||
super(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return super.matches(item) && !AlleleManager.alleleRegistry.isIndividual(item);
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,11 @@ public class NEIHandlerShapedCustom extends RecipeHandlerBase {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return NEIUtils.translate("handler.forestry.shaped");
|
||||
|
||||
@@ -100,6 +100,11 @@ public class NEIHandlerShapelessCustom extends RecipeHandlerBase {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return NEIUtils.translate("handler.forestry.shapeless");
|
||||
|
||||
@@ -10,7 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.factory.gui.GuiWorktable;
|
||||
import forestry.factory.recipes.nei.NEIHandlerBottler;
|
||||
import forestry.factory.recipes.nei.NEIHandlerCarpenter;
|
||||
import forestry.factory.recipes.nei.NEIHandlerCentrifuge;
|
||||
@@ -19,6 +27,7 @@ import forestry.factory.recipes.nei.NEIHandlerFermenter;
|
||||
import forestry.factory.recipes.nei.NEIHandlerMoistener;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
import forestry.factory.recipes.nei.NEIHandlerStill;
|
||||
import forestry.plugins.PluginLepidopterology;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
@@ -39,6 +48,24 @@ public class NEIIntegrationConfig implements IConfigureNEI {
|
||||
registerHandler(new NEIHandlerMoistener());
|
||||
registerHandler(new NEIHandlerSqueezer());
|
||||
registerHandler(new NEIHandlerStill());
|
||||
|
||||
CustomOverlayHandler handler = new CustomOverlayHandler(-14, 14, true);
|
||||
API.registerGuiOverlayHandler(GuiWorktable.class, handler, "crafting");
|
||||
|
||||
API.addSubset("Forestry.Bees.Princesses", new ItemFilterGenetic(BeeManager.beeRoot, EnumBeeType.PRINCESS.ordinal(), true));
|
||||
API.addSubset("Forestry.Bees.Drones", new ItemFilterGenetic(BeeManager.beeRoot, EnumBeeType.DRONE.ordinal(), true));
|
||||
API.addSubset("Forestry.Bees.Larvae", new ItemFilterGenetic(BeeManager.beeRoot, EnumBeeType.LARVAE.ordinal(), true));
|
||||
|
||||
API.addSubset("Forestry.Trees.Saplings", new ItemFilterGenetic(TreeManager.treeRoot, EnumGermlingType.SAPLING.ordinal(), true));
|
||||
API.addSubset("Forestry.Trees.Pollen", new ItemFilterGenetic(TreeManager.treeRoot, EnumGermlingType.POLLEN.ordinal(), true));
|
||||
|
||||
API.addSubset("Forestry.Butterflies.Butterflies", new ItemFilterGenetic(PluginLepidopterology.butterflyInterface, EnumFlutterType.BUTTERFLY.ordinal(), true));
|
||||
API.addSubset("Forestry.Butterflies.Caterpillars", new ItemFilterGenetic(PluginLepidopterology.butterflyInterface, EnumFlutterType.CATERPILLAR.ordinal(), true));
|
||||
API.addSubset("Forestry.Butterflies.Serum", new ItemFilterGenetic(PluginLepidopterology.butterflyInterface, EnumFlutterType.SERUM.ordinal(), true));
|
||||
|
||||
API.addSubset("Forestry.Bees.Combs", OreDictionary.getOres("beeComb"));
|
||||
API.addSubset("Forestry.Blocks", new ItemFilterOther(false));
|
||||
API.addSubset("Forestry.Items", new ItemFilterOther(true));
|
||||
}
|
||||
|
||||
protected static void registerHandler(IRecipeHandlerBase handler) {
|
||||
@@ -54,7 +81,7 @@ public class NEIIntegrationConfig implements IConfigureNEI {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.0.0";
|
||||
return "1.1.0";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -113,7 +113,6 @@ public class PositionedFluidTank {
|
||||
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
|
||||
int color = this.tank.getFluid().getFluid().getColor(this.tank.getFluid());
|
||||
GL11.glColor3ub((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF));
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
int amount = Math.max(Math.min(this.position.height, this.tank.getFluid().amount * this.position.height / this.tank.getCapacity()), 1);
|
||||
int posY = this.position.y + this.position.height - amount;
|
||||
@@ -141,8 +140,6 @@ public class PositionedFluidTank {
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
if (this.overlayTexture != null && this.overlayTexturePos != null) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(this.overlayTexture);
|
||||
|
||||
@@ -53,10 +53,6 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
|
||||
public abstract String getRecipeID();
|
||||
|
||||
public String getRecipeSubName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void changeToGuiTexture() {
|
||||
GuiDraw.changeTexture(this.getGuiTexture());
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -70,9 +66,6 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
public void drawForeground(int recipe) {
|
||||
super.drawForeground(recipe);
|
||||
this.drawFluidTanks(recipe);
|
||||
if (recipe % this.recipiesPerPage() == 0 && this.getRecipeSubName() != null) {
|
||||
GuiDraw.drawStringC(this.getRecipeSubName(), 83, -2, 0x404040, false);
|
||||
}
|
||||
this.changeToGuiTexture();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
/**
|
||||
* @author bdew
|
||||
*/
|
||||
public class SetRecipeCommandHandler {
|
||||
private final Class<? extends Container> containerClass;
|
||||
private final Class<? extends Slot> slotClass;
|
||||
|
||||
public SetRecipeCommandHandler(Class<? extends Container> containerClass, Class<? extends Slot> slotClass) {
|
||||
this.containerClass = containerClass;
|
||||
this.slotClass = slotClass;
|
||||
}
|
||||
|
||||
public void handle(NBTTagCompound data, EntityPlayerMP player) {
|
||||
NBTTagList stacks = data.getTagList("stacks", 10);
|
||||
Container cont = player.openContainer;
|
||||
if (!containerClass.isInstance(cont)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<Integer, ItemStack> stmap = new HashMap<Integer, ItemStack>();
|
||||
for (int i = 0; i < stacks.tagCount(); i++) {
|
||||
NBTTagCompound itemdata = stacks.getCompoundTagAt(i);
|
||||
stmap.put(itemdata.getInteger("slot"), ItemStack.loadItemStackFromNBT(itemdata));
|
||||
}
|
||||
for (Object slotobj : cont.inventorySlots) {
|
||||
if (!slotClass.isInstance(slotobj)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Slot slot = (Slot) slotobj;
|
||||
if (stmap.containsKey(slot.getSlotIndex())) {
|
||||
slot.putStack(stmap.get(slot.getSlotIndex()));
|
||||
} else {
|
||||
slot.putStack(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,6 +159,9 @@ public class GeneticsUtil {
|
||||
}
|
||||
|
||||
public static IIndividual getGeneticEquivalent(ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return null;
|
||||
}
|
||||
Item item = itemStack.getItem();
|
||||
if (item instanceof ItemGE) {
|
||||
return ((ItemGE) item).getIndividual(itemStack);
|
||||
@@ -192,20 +195,19 @@ public class GeneticsUtil {
|
||||
exclude.add(species);
|
||||
|
||||
for (IMutation mutation : species.getRoot().getPaths(species, speciesChromosome)) {
|
||||
if (!exclude.contains(mutation.getAllele0())) {
|
||||
int otherAdvance = getGeneticAdvancement(mutation.getAllele0(), exclude, speciesChromosome);
|
||||
if (otherAdvance > highest) {
|
||||
highest = otherAdvance;
|
||||
}
|
||||
}
|
||||
if (!exclude.contains(mutation.getAllele1())) {
|
||||
int otherAdvance = getGeneticAdvancement(mutation.getAllele1(), exclude, speciesChromosome);
|
||||
if (otherAdvance > highest) {
|
||||
highest = otherAdvance;
|
||||
}
|
||||
}
|
||||
highest = getHighestAdvancement(mutation.getAllele0(), highest, exclude, speciesChromosome);
|
||||
highest = getHighestAdvancement(mutation.getAllele1(), highest, exclude, speciesChromosome);
|
||||
}
|
||||
|
||||
return 1 + highest;
|
||||
}
|
||||
|
||||
private static int getHighestAdvancement(IAlleleSpecies mutationSpecies, int highest, Set<IAlleleSpecies> exclude, IChromosomeType speciesChromosome) {
|
||||
if (exclude.contains(mutationSpecies) || AlleleManager.alleleRegistry.isBlacklisted(mutationSpecies.getUID())) {
|
||||
return highest;
|
||||
}
|
||||
|
||||
int otherAdvance = getGeneticAdvancement(mutationSpecies, exclude, speciesChromosome);
|
||||
return otherAdvance > highest ? otherAdvance : highest;
|
||||
}
|
||||
}
|
||||
@@ -459,12 +459,14 @@ public abstract class InventoryUtil {
|
||||
}
|
||||
|
||||
public static boolean tryAddStack(IInventory inventory, ItemStack stack, int startSlot, int slots, boolean all, boolean doAdd) {
|
||||
int added = addStack(inventory, stack, startSlot, slots, doAdd);
|
||||
if (all) {
|
||||
return added == stack.stackSize;
|
||||
} else {
|
||||
return added > 0;
|
||||
int added = addStack(inventory, stack, startSlot, slots, false);
|
||||
boolean success = all ? (added == stack.stackSize) : (added > 0);
|
||||
|
||||
if (success && doAdd) {
|
||||
addStack(inventory, stack, startSlot, slots, true);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public static int addStack(IInventory inventory, ItemStack stack, boolean doAdd) {
|
||||
|
||||
@@ -202,7 +202,7 @@ public abstract class ItemStackUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (craftingTools && isCraftingTool(base) && base.getItem() == comparison.getItem()) {
|
||||
if (craftingTools && isCraftingToolEquivalent(base, comparison)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -235,19 +235,30 @@ public abstract class ItemStackUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isCraftingTool(ItemStack itemstack) {
|
||||
Item item = itemstack.getItem();
|
||||
if (item == null) {
|
||||
public static boolean isCraftingToolEquivalent(ItemStack base, ItemStack comparison) {
|
||||
if (base == null || comparison == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.hasContainerItem(itemstack)) {
|
||||
if (item.isDamageable() || itemstack.hasTagCompound()) {
|
||||
return !item.doesContainerItemLeaveCraftingGrid(itemstack);
|
||||
}
|
||||
Item baseItem = base.getItem();
|
||||
if (baseItem.doesContainerItemLeaveCraftingGrid(base)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (baseItem != comparison.getItem()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (base.stackTagCompound == null || base.stackTagCompound.hasNoTags()) {
|
||||
// tool uses meta for damage
|
||||
return true;
|
||||
} else {
|
||||
// tool uses NBT for damage
|
||||
if (base.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
return true;
|
||||
}
|
||||
return base.getItemDamage() == comparison.getItemDamage();
|
||||
}
|
||||
}
|
||||
|
||||
public static void dropItemStackAsEntity(ItemStack items, World world, double x, double y, double z) {
|
||||
|
||||
@@ -18,7 +18,9 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.core.circuits.ISocketable;
|
||||
@@ -309,6 +311,11 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.ELECTRIC_ENGINE;
|
||||
}
|
||||
|
||||
private static class EngineTinInventoryAdapter extends TileInventoryAdapter<TileEngineElectric> {
|
||||
public EngineTinInventoryAdapter(TileEngineElectric engineTin) {
|
||||
super(engineTin, 1, "electrical");
|
||||
|
||||
@@ -13,13 +13,20 @@ package forestry.factory.network;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import forestry.core.gui.slots.SlotCraftMatrix;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.IPacketHandler;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.network.PacketNBT;
|
||||
import forestry.core.recipes.nei.SetRecipeCommandHandler;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
|
||||
public class PacketHandlerFactory implements IPacketHandler {
|
||||
|
||||
private static final SetRecipeCommandHandler worktableNEISelectHandler = new SetRecipeCommandHandler(ContainerWorktable.class, SlotCraftMatrix.class);
|
||||
|
||||
@Override
|
||||
public boolean onPacketData(PacketId packetID, DataInputStreamForestry data, EntityPlayer player) throws IOException {
|
||||
|
||||
@@ -28,6 +35,11 @@ public class PacketHandlerFactory implements IPacketHandler {
|
||||
PacketWorktableMemoryUpdate.onPacketData(data);
|
||||
return true;
|
||||
}
|
||||
case WORKTABLE_NEI_SELECT: {
|
||||
PacketNBT packet = new PacketNBT(data);
|
||||
worktableNEISelectHandler.handle(packet.getTagCompound(), (EntityPlayerMP) player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class SqueezerContainerRecipe implements ISqueezerContainerRecipe {
|
||||
|
||||
@@ -52,9 +53,14 @@ public class SqueezerContainerRecipe implements ISqueezerContainerRecipe {
|
||||
|
||||
@Override
|
||||
public ISqueezerRecipe getSqueezerRecipe(ItemStack filledContainer) {
|
||||
if (filledContainer == null) {
|
||||
return null;
|
||||
}
|
||||
FluidStack fluidOutput = FluidHelper.getFluidStackInContainer(filledContainer);
|
||||
ItemStack filledContainerCopy = filledContainer.copy();
|
||||
filledContainerCopy.stackSize = 1;
|
||||
if (fluidOutput == null) {
|
||||
return null;
|
||||
}
|
||||
ItemStack filledContainerCopy = ItemStackUtil.createSplitStack(filledContainer, 1);
|
||||
return new SqueezerRecipe(processingTime, new ItemStack[]{filledContainerCopy}, fluidOutput, remnants, remnantsChance);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,10 +221,12 @@ public class NEIHandlerSqueezer extends RecipeHandlerBase {
|
||||
}
|
||||
for (ISqueezerContainerRecipe containerRecipe : TileSqueezer.RecipeManager.containerRecipes.values()) {
|
||||
ItemStack emptyContainer = containerRecipe.getEmptyContainer();
|
||||
if (FluidHelper.isFillableContainer(emptyContainer, result)) {
|
||||
ItemStack filledContainer = FluidHelper.getFilledContainer(result, emptyContainer);
|
||||
ItemStack filledContainer = FluidHelper.getFilledContainer(result, emptyContainer);
|
||||
if (filledContainer != null) {
|
||||
ISqueezerRecipe recipe = containerRecipe.getSqueezerRecipe(filledContainer);
|
||||
this.arecipes.add(new CachedSqueezerRecipe(recipe, true));
|
||||
if (recipe != null) {
|
||||
this.arecipes.add(new CachedSqueezerRecipe(recipe, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.recipes.ICentrifugeManager;
|
||||
@@ -282,6 +284,11 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.MACHINE;
|
||||
}
|
||||
|
||||
/* RECIPE MANAGEMENT */
|
||||
public static class CentrifugeRecipe implements ICentrifugeRecipe {
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_RESOURCE) {
|
||||
return FluidHelper.isFillableContainer(itemStack, Fluids.WATER.getFluid(1000));
|
||||
return FluidHelper.getFilledContainer(Fluids.WATER.getFluid(1000), itemStack) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,9 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.recipes.ISqueezerManager;
|
||||
@@ -315,6 +317,11 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.MACHINE;
|
||||
}
|
||||
|
||||
public static class SqueezerInventory extends TileInventoryAdapter<TileSqueezer> {
|
||||
public static final short SLOT_RESOURCE_1 = 0;
|
||||
public static final short SLOTS_RESOURCE_COUNT = 9;
|
||||
@@ -415,9 +422,12 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve
|
||||
public static ISqueezerRecipe findMatchingRecipe(ItemStack[] items) {
|
||||
// Find container recipes
|
||||
for (ItemStack itemStack : items) {
|
||||
ISqueezerContainerRecipe recipe = findMatchingContainerRecipe(itemStack);
|
||||
if (recipe != null) {
|
||||
return recipe.getSqueezerRecipe(itemStack);
|
||||
ISqueezerContainerRecipe containerRecipe = findMatchingContainerRecipe(itemStack);
|
||||
if (containerRecipe != null) {
|
||||
ISqueezerRecipe recipe = containerRecipe.getSqueezerRecipe(itemStack);
|
||||
if (recipe != null) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -175,11 +175,14 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
ItemStack[] set = InventoryUtil.getStacks(currentRecipe.getMatrix(), SLOT_CRAFTING_1, SLOT_CRAFTING_COUNT);
|
||||
ItemStack[] removed = InventoryUtil.removeSets(this, 1, set, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT, player, false, true, true);
|
||||
|
||||
if (removed == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < removed.length; i++) {
|
||||
craftingInventory.setInventorySlotContents(i, removed[i]);
|
||||
}
|
||||
|
||||
return removed != null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,8 +42,8 @@ public class GuiFarm extends GuiForestry<ContainerFarm, TileFarm> {
|
||||
|
||||
widgetManager.add(new FarmLogicSlot(widgetManager, 69, 22, FarmDirection.NORTH));
|
||||
widgetManager.add(new FarmLogicSlot(widgetManager, 69, 58, FarmDirection.SOUTH));
|
||||
widgetManager.add(new FarmLogicSlot(widgetManager, 51, 40, FarmDirection.EAST));
|
||||
widgetManager.add(new FarmLogicSlot(widgetManager, 87, 40, FarmDirection.WEST));
|
||||
widgetManager.add(new FarmLogicSlot(widgetManager, 51, 40, FarmDirection.WEST));
|
||||
widgetManager.add(new FarmLogicSlot(widgetManager, 87, 40, FarmDirection.EAST));
|
||||
|
||||
this.xSize = 216;
|
||||
this.ySize = 220;
|
||||
|
||||
@@ -20,6 +20,7 @@ import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class FarmableVanillaSapling extends FarmableGenericSapling {
|
||||
|
||||
@@ -29,12 +30,16 @@ public class FarmableVanillaSapling extends FarmableGenericSapling {
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling);
|
||||
if (!(tree instanceof ITree)) {
|
||||
return false;
|
||||
}
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
IIndividual tree = GeneticsUtil.getGeneticEquivalent(germling);
|
||||
if (!(tree instanceof ITree)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return TreeManager.treeRoot.plantSapling(world, (ITree) tree, player.getGameProfile(), x, y, z);
|
||||
return TreeManager.treeRoot.plantSapling(world, (ITree) tree, player.getGameProfile(), x, y, z);
|
||||
} else {
|
||||
return germling.copy().tryPlaceItemIntoWorld(player, world, x, y - 1, z, 1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
@@ -152,6 +154,11 @@ public class FakeFarmController implements IFarmController {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
return FakeErrorLogic.instance;
|
||||
|
||||
@@ -35,7 +35,9 @@ import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
@@ -123,6 +125,9 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
|
||||
private final FarmHydrationManager hydrationManager;
|
||||
private final FarmFertilizerManager fertilizerManager;
|
||||
|
||||
// the number of work ticks that this farm has had no power
|
||||
private int noPowerTime = 0;
|
||||
|
||||
private BiomeGenBase cachedBiome;
|
||||
|
||||
public FarmController(World world) {
|
||||
@@ -267,12 +272,28 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
|
||||
inventory.drainCan(tankManager);
|
||||
}
|
||||
|
||||
boolean hasPower = false;
|
||||
for (Map.Entry<IFarmComponent.Active, Integer> entry : farmActiveComponents.entrySet()) {
|
||||
IFarmComponent.Active farmComponent = entry.getKey();
|
||||
if (farmComponent instanceof TileGearbox) {
|
||||
hasPower |= ((TileGearbox) farmComponent).getEnergyManager().getTotalEnergyStored() > 0;
|
||||
}
|
||||
|
||||
int tickOffset = entry.getValue();
|
||||
farmComponent.updateServer(tickCount + tickOffset);
|
||||
}
|
||||
|
||||
if (hasPower) {
|
||||
noPowerTime = 0;
|
||||
getErrorLogic().setCondition(false, EnumErrorCode.NOPOWER);
|
||||
} else {
|
||||
if (noPowerTime <= 4) {
|
||||
noPowerTime++;
|
||||
} else {
|
||||
getErrorLogic().setCondition(true, EnumErrorCode.NOPOWER);
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: be smarter about the farm needing to save
|
||||
return true;
|
||||
}
|
||||
@@ -848,4 +869,8 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.FARM;
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,6 @@ import forestry.farming.blocks.BlockFarm;
|
||||
public class RenderFarmItem implements IItemRenderer {
|
||||
|
||||
private static void renderFarmBlock(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
BlockFarm block = (BlockFarm) ItemStackUtil.getBlock(item);
|
||||
if (block == null) {
|
||||
@@ -81,8 +76,6 @@ public class RenderFarmItem implements IItemRenderer {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,6 +98,11 @@ public class RenderFarmItem implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderFarmBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
@@ -118,6 +116,8 @@ public class RenderFarmItem implements IItemRenderer {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
@@ -178,6 +179,11 @@ public abstract class TileFarm extends RectangularMultiblockTileEntityBase imple
|
||||
getFarmController().setSocket(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return getFarmController().getSocketType();
|
||||
}
|
||||
|
||||
/* IStreamableGui */
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
|
||||
@@ -14,9 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.farming.IFarmComponent;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.tiles.IPowerHandler;
|
||||
import forestry.energy.EnergyManager;
|
||||
import forestry.farming.multiblock.IFarmController;
|
||||
@@ -57,13 +55,7 @@ public class TileGearbox extends TileFarm implements IPowerHandler, IFarmCompone
|
||||
|
||||
@Override
|
||||
public void updateServer(int tickCount) {
|
||||
|
||||
IFarmController farmController = getFarmController();
|
||||
IErrorLogic errorLogic = farmController.getErrorLogic();
|
||||
|
||||
boolean hasPower = energyManager.getTotalEnergyStored() > 0;
|
||||
|
||||
if (errorLogic.setCondition(!hasPower, EnumErrorCode.NOPOWER)) {
|
||||
if (energyManager.getTotalEnergyStored() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,6 +70,7 @@ public class TileGearbox extends TileFarm implements IPowerHandler, IFarmCompone
|
||||
}
|
||||
|
||||
if (workCounter >= WORK_CYCLES && (tickCount % 5 == 0)) {
|
||||
IFarmController farmController = getFarmController();
|
||||
if (farmController.doWork()) {
|
||||
workCounter = 0;
|
||||
previousDelays = 0;
|
||||
|
||||
@@ -12,12 +12,11 @@ package forestry.lepidopterology.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.items.ItemAlyzer;
|
||||
@@ -33,46 +32,8 @@ public class ItemFlutterlyzer extends ItemAlyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSpecimen(ItemStack itemStack) {
|
||||
return PluginLepidopterology.butterflyInterface.isMember(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
// Source slot to analyze empty
|
||||
if (getStackInSlot(SLOT_SPECIMEN) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IButterfly butterfly = PluginLepidopterology.butterflyInterface.getMember(getStackInSlot(SLOT_SPECIMEN));
|
||||
// No tree, abort
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Analyze if necessary
|
||||
if (!butterfly.isAnalyzed()) {
|
||||
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
butterfly.analyze();
|
||||
if (player != null) {
|
||||
PluginLepidopterology.butterflyInterface.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(butterfly.getGenome().getPrimary());
|
||||
PluginLepidopterology.butterflyInterface.getBreedingTracker(player.worldObj, player.getGameProfile()).registerSpecies(butterfly.getGenome().getSecondary());
|
||||
}
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
butterfly.writeToNBT(nbttagcompound);
|
||||
getStackInSlot(SLOT_SPECIMEN).setTagCompound(nbttagcompound);
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
}
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZE_1, getStackInSlot(SLOT_SPECIMEN));
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
protected ISpeciesRoot getSpeciesRoot() {
|
||||
return PluginLepidopterology.butterflyInterface;
|
||||
}
|
||||
|
||||
/* IHINTSOURCE */
|
||||
|
||||
@@ -48,9 +48,6 @@ public class GuiMailboxInfo extends Gui {
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glEnable(3042);
|
||||
GL11.glEnable(32826);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Proxies.common.bindTexture(textureAlert);
|
||||
|
||||
@@ -58,10 +55,6 @@ public class GuiMailboxInfo extends Gui {
|
||||
|
||||
fontRendererObj.drawString(Integer.toString(poInfo.playerLetters), x + 27 + getCenteredOffset(Integer.toString(poInfo.playerLetters), 22), y + 5, 0xffffff);
|
||||
fontRendererObj.drawString(Integer.toString(poInfo.tradeLetters), x + 75 + getCenteredOffset(Integer.toString(poInfo.tradeLetters), 22), y + 5, 0xffffff);
|
||||
|
||||
GL11.glDisable(32826);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
}
|
||||
|
||||
protected int getCenteredOffset(String string, int xWidth) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
|
||||
import forestry.api.arboriculture.EnumFruitFamily;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -46,7 +47,7 @@ import forestry.arboriculture.FruitProviderRandom;
|
||||
import forestry.arboriculture.FruitProviderRipening;
|
||||
import forestry.arboriculture.GuiHandlerArboriculture;
|
||||
import forestry.arboriculture.VillageHandlerArboriculture;
|
||||
import forestry.arboriculture.WoodType;
|
||||
import forestry.arboriculture.WoodItemAccess;
|
||||
import forestry.arboriculture.blocks.BlockArbFence;
|
||||
import forestry.arboriculture.blocks.BlockArbStairs;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
@@ -118,6 +119,8 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
TreeManager.treeFactory = new TreeFactory();
|
||||
TreeManager.treeMutationFactory = new TreeMutationFactory();
|
||||
|
||||
TreeManager.woodItemAccess = new WoodItemAccess();
|
||||
|
||||
// Init tree interface
|
||||
TreeManager.treeRoot = new TreeHelper();
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(TreeManager.treeRoot);
|
||||
@@ -156,18 +159,18 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
ForestryBlock.fencesFireproof.registerBlock(new BlockArbFence(true), ItemBlockWood.class, "fencesFireproof");
|
||||
ForestryBlock.stairsFireproof.registerBlock(new BlockArbStairs(ForestryBlock.planksFireproof.block(), true), ItemBlockWood.class, "stairsFireproof");
|
||||
|
||||
for (WoodType woodType : WoodType.VALUES) {
|
||||
woodType.registerLog(ForestryBlock.logs.block(), false);
|
||||
woodType.registerPlanks(ForestryBlock.planks.block(), false);
|
||||
woodType.registerSlab(ForestryBlock.slabs.block(), false);
|
||||
woodType.registerFence(ForestryBlock.fences.block(), false);
|
||||
woodType.registerStairs(ForestryBlock.stairs.block(), false);
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
WoodItemAccess.registerLog(ForestryBlock.logs.block(), woodType, false);
|
||||
WoodItemAccess.registerPlanks(ForestryBlock.planks.block(), woodType, false);
|
||||
WoodItemAccess.registerSlab(ForestryBlock.slabs.block(), woodType, false);
|
||||
WoodItemAccess.registerFence(ForestryBlock.fences.block(), woodType, false);
|
||||
WoodItemAccess.registerStairs(ForestryBlock.stairs.block(), woodType, false);
|
||||
|
||||
woodType.registerLog(ForestryBlock.logsFireproof.block(), true);
|
||||
woodType.registerPlanks(ForestryBlock.planksFireproof.block(), true);
|
||||
woodType.registerSlab(ForestryBlock.slabsFireproof.block(), true);
|
||||
woodType.registerFence(ForestryBlock.fencesFireproof.block(), true);
|
||||
woodType.registerStairs(ForestryBlock.stairsFireproof.block(), true);
|
||||
WoodItemAccess.registerLog(ForestryBlock.logsFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerPlanks(ForestryBlock.planksFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerSlab(ForestryBlock.slabsFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerFence(ForestryBlock.fencesFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerStairs(ForestryBlock.stairsFireproof.block(), woodType, true);
|
||||
}
|
||||
|
||||
// Saplings
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
@@ -234,7 +235,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'C', "chestWood"))
|
||||
.setFaces(0, 1, 2, 3, 4, 4));
|
||||
|
||||
ICircuitLayout layoutMachineUpgrade = new CircuitLayout("machine.upgrade");
|
||||
ICircuitLayout layoutMachineUpgrade = new CircuitLayout("machine.upgrade", CircuitSocketType.MACHINE);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutMachineUpgrade);
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.farming.IFarmable;
|
||||
@@ -93,8 +94,10 @@ public class PluginFarming extends ForestryPlugin {
|
||||
|
||||
Farmables.farmables.put("farmArboreal", new ArrayList<IFarmable>());
|
||||
Farmables.farmables.get("farmArboreal").add(new FarmableVanillaSapling());
|
||||
Farmables.farmables.get("farmArboreal").add(new FarmableGE());
|
||||
|
||||
if (PluginManager.Module.ARBORICULTURE.isEnabled()) {
|
||||
Farmables.farmables.get("farmArboreal").add(new FarmableGE());
|
||||
}
|
||||
|
||||
Farmables.farmables.put("farmOrchard", new ArrayList<IFarmable>());
|
||||
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.wheat, 7));
|
||||
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.potatoes, 7));
|
||||
@@ -133,9 +136,9 @@ public class PluginFarming extends ForestryPlugin {
|
||||
proxy.initializeRendering();
|
||||
|
||||
// Layouts
|
||||
ICircuitLayout layoutManaged = new CircuitLayout("farms.managed");
|
||||
ICircuitLayout layoutManaged = new CircuitLayout("farms.managed", CircuitSocketType.FARM);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutManaged);
|
||||
ICircuitLayout layoutManual = new CircuitLayout("farms.manual");
|
||||
ICircuitLayout layoutManual = new CircuitLayout("farms.manual", CircuitSocketType.FARM);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutManual);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.fuels.EngineBronzeFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
@@ -169,7 +170,7 @@ public class PluginIC2 extends ForestryPlugin {
|
||||
|
||||
Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", FarmLogicRubber.class);
|
||||
|
||||
ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin");
|
||||
ICircuitLayout layoutEngineTin = new CircuitLayout("engine.tin", CircuitSocketType.ELECTRIC_ENGINE);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutEngineTin);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user