mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55866d6a64 | ||
|
|
510cf83670 | ||
|
|
656a6451bf | ||
|
|
69ee5bde65 | ||
|
|
592895cc48 | ||
|
|
7b5febd394 | ||
|
|
71481d5ace |
No files matched your search
+1
-1
Submodule api/forestry updated: 87d0201ad9...5c3dc357e8.
@@ -2,4 +2,4 @@ mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
version_major=4
|
||||
version_minor=0
|
||||
version_patch=3
|
||||
version_patch=5
|
||||
@@ -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
|
||||
|
||||
@@ -38,6 +38,7 @@ 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 +48,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 +142,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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -93,8 +93,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));
|
||||
|
||||
Reference in new issue
Block a user