mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 12:42:53 +00:00
Fixed textures, split the alveary stuff, onlt GUI left to do!
This commit is contained in:
1 parent
a5e27bfd47
commit
34a9a90ab3
35 files changed
+1453
-586
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package binnie.extrabees;
|
||||
|
||||
import binnie.extrabees.alveary.TileEntityExtraBeesAlvearyPart;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import binnie.extrabees.genetics.ExtraBeeMutation;
|
||||
import binnie.extrabees.genetics.ExtraBeesBranch;
|
||||
@@ -11,22 +12,34 @@ import binnie.extrabees.init.ItemRegister;
|
||||
import binnie.extrabees.init.RecipeRegister;
|
||||
import binnie.extrabees.items.ItemHoneyComb;
|
||||
import binnie.extrabees.proxy.ExtraBeesCommonProxy;
|
||||
import binnie.extrabees.utils.AlvearyMutationHandler;
|
||||
import binnie.extrabees.utils.MaterialBeehive;
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import binnie.extrabees.utils.config.ConfigHandler;
|
||||
import binnie.extrabees.utils.config.ConfigurationMain;
|
||||
import binnie.extrabees.worldgen.ExtraBeesWorldGenerator;
|
||||
import com.google.common.collect.Lists;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.core.gui.GuiIdRegistry;
|
||||
import forestry.core.gui.GuiType;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
@Mod(modid = ExtraBees.MODID, name = "Binnie's Extra Bees", useMetadata = true)
|
||||
public class ExtraBees {
|
||||
|
||||
@@ -38,10 +51,10 @@ public class ExtraBees {
|
||||
@SidedProxy(clientSide = "binnie.extrabees.proxy.ExtraBeesClientProxy", serverSide = "binnie.extrabees.proxy.ExtraBeesCommonProxy")
|
||||
public static ExtraBeesCommonProxy proxy;
|
||||
public static ConfigHandler configHandler;
|
||||
public static NetworkHandler networkHandler;
|
||||
|
||||
public static Block hive;
|
||||
public static Material materialBeehive;
|
||||
public static Block hive;
|
||||
public static Block alveary;
|
||||
public static Block ectoplasm;
|
||||
public static Item comb;
|
||||
public static Item propolis;
|
||||
@@ -52,21 +65,29 @@ public class ExtraBees {
|
||||
public static Item itemMisc;
|
||||
|
||||
@Mod.EventHandler
|
||||
@SuppressWarnings("all")
|
||||
public void preInit(final FMLPreInitializationEvent event) {
|
||||
GuiHack.INSTANCE.preInit();
|
||||
|
||||
networkHandler = new NetworkHandler(MODID);
|
||||
materialBeehive = new MaterialBeehive();
|
||||
configHandler = new ConfigHandler(event.getSuggestedConfigurationFile());
|
||||
configHandler.addConfigurable(new ConfigurationMain());
|
||||
BlockRegister.preInitBlocks();
|
||||
ItemRegister.preInitItems();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(proxy);
|
||||
ExtraBeesBranch.setSpeciesBranches();
|
||||
// Register species
|
||||
for (final ExtraBeesSpecies species : ExtraBeesSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
}
|
||||
try {
|
||||
Method m = GuiIdRegistry.class.getDeclaredMethod("registerGuiHandlers", GuiType.class, List.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(null, new Object[]{GuiType.Tile, Lists.newArrayList(TileEntityExtraBeesAlvearyPart.class)});
|
||||
} catch (Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Proxies.render.registerModels();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
@@ -88,16 +109,17 @@ public class ExtraBees {
|
||||
|
||||
BlockRegister.postInitBlocks();
|
||||
RecipeRegister.postInitRecipes();
|
||||
}
|
||||
|
||||
private static class NetworkHandler {
|
||||
|
||||
private NetworkHandler(String channel){
|
||||
this.networkWrapper = new SimpleNetworkWrapper(channel);
|
||||
}
|
||||
|
||||
private final SimpleNetworkWrapper networkWrapper;
|
||||
|
||||
//Register mutations
|
||||
AlvearyMutationHandler.addMutationItem(new ItemStack(Blocks.SOUL_SAND), 1.5f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("UranFuel"), 4.0f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("MOXFuel"), 10.0f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("Plutonium"), 8.0f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("smallPlutonium"), 5.0f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("Uran235"), 4.0f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("smallUran235"), 2.5f);
|
||||
AlvearyMutationHandler.addMutationItem(Utils.getIC2Item("Uran238"), 2.0f);
|
||||
AlvearyMutationHandler.addMutationItem(new ItemStack(Items.ENDER_PEARL), 2.0f);
|
||||
AlvearyMutationHandler.addMutationItem(new ItemStack(Items.ENDER_EYE), 4.0f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public abstract class AbstractAlvearyLogic implements IBeeModifier, IBeeListener, ICapabilityProvider {
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(@Nonnull IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull IBeeGenome genome, @Nonnull IBeeGenome mate, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(@Nonnull IBeeGenome genome, @Nullable IBeeGenome mate, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(@Nonnull IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(@Nonnull IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(@Nonnull IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(@Nonnull IIndividual pollen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateClient(TileEntityExtraBeesAlvearyPart tile){
|
||||
|
||||
}
|
||||
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile){
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(@Nonnull EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Container getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnergyStorage getEnergyStorage(){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.multiblock.IAlvearyController;
|
||||
import forestry.api.multiblock.IMultiblockLogicAlveary;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicFrameHousing extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicFrameHousing(TileEntityExtraBeesAlvearyPart tile){
|
||||
inv = new ItemStackHandler(1);
|
||||
}
|
||||
|
||||
private TileEntityExtraBeesAlvearyPart tile;
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(final int amount) {
|
||||
IHiveFrame hiveFrame = this.getHiveFrame();
|
||||
if (hiveFrame != null) {
|
||||
IBeeRoot beeRoot = Utils.getBeeRoot();
|
||||
IMultiblockLogicAlveary multiblockLogic = tile.getMultiblockLogic();
|
||||
IAlvearyController alvearyController = multiblockLogic.getController();
|
||||
ItemStack queenStack = alvearyController.getBeeInventory().getQueen();
|
||||
IBee queen = beeRoot.getMember(queenStack);
|
||||
if (queen != null) {
|
||||
final int wear = Math.round(amount * 5 * beeRoot.getBeekeepingMode(tile.getWorldObj()).getWearModifier());
|
||||
ItemStack frame = inv.getStackInSlot(0);
|
||||
ItemStack frameUsed = hiveFrame.frameUsed(alvearyController, frame, queen, wear);
|
||||
inv.setStackInSlot(0, frameUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IHiveFrame getHiveFrame() {
|
||||
ItemStack stackInSlot = inv.getStackInSlot(0);
|
||||
if (!stackInSlot.isEmpty()) {
|
||||
return (IHiveFrame) stackInSlot.getItem();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getTerritoryModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull final IBeeGenome genome, @Nonnull final IBeeGenome mate, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getMutationModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(@Nonnull final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getLifespanModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getFloweringModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicHatchery extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicHatchery(){
|
||||
inv = new ItemStackHandler(5);
|
||||
}
|
||||
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
@Override
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
|
||||
if (tile.getWorldObj().rand.nextInt(2400) == 0) {
|
||||
final IBeeHousing house = tile.getMultiblockLogic().getController();
|
||||
if (!house.getErrorLogic().hasErrors()) {
|
||||
final ItemStack queenStack = house.getBeeInventory().getQueen();
|
||||
IBeeRoot beeRoot = Utils.getBeeRoot();
|
||||
final IBee queen = (queenStack.isEmpty()) ? null : beeRoot.getMember(queenStack);
|
||||
if (queen != null) {
|
||||
ItemStack larvae = beeRoot.getMemberStack(beeRoot.getBee(queen.getGenome()), EnumBeeType.LARVAE);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (inv.insertItem(i, larvae, false).isEmpty()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicLighting extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicLighting(){
|
||||
this.energyStorage = new EnergyStorage(2000);
|
||||
}
|
||||
|
||||
private final IEnergyStorage energyStorage;
|
||||
private boolean lighted;
|
||||
|
||||
@Override
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
|
||||
lighted = energyStorage.extractEnergy(10, false) >= 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return lighted;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.utils.AlvearyMutationHandler;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicMutator extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicMutator(){
|
||||
this.inv = new ItemStackHandler(1);
|
||||
}
|
||||
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull IBeeGenome genome, @Nonnull IBeeGenome mate, float currentModifier) {
|
||||
ItemStack mutator = inv.getStackInSlot(0);
|
||||
float mult = AlvearyMutationHandler.getMutationMult(mutator);
|
||||
return Math.min(mult * currentModifier, 15f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath() {
|
||||
inv.extractItem(0, 1, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicRainShield extends AbstractAlvearyLogic {
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.circuit.StimulatorCircuit;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicStimulator extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicStimulator() {
|
||||
this.powerUsage = 0;
|
||||
this.powered = false;
|
||||
this.modifiers = new StimulatorCircuit[0];
|
||||
this.energyStorage = new EnergyStorage(2000);
|
||||
this.inv = new ItemStackHandler(1);
|
||||
}
|
||||
|
||||
private int powerUsage;
|
||||
private boolean powered;
|
||||
private StimulatorCircuit[] modifiers;
|
||||
private final IEnergyStorage energyStorage;
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
@Override
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
|
||||
this.modifiers = this.getCircuits();
|
||||
this.powerUsage = 0;
|
||||
for (final StimulatorCircuit beeMod : this.modifiers) {
|
||||
this.powerUsage += beeMod.getPowerUsage();
|
||||
}
|
||||
this.powered = energyStorage.extractEnergy(powerUsage, true) >= powerUsage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ICircuitBoard getHiveFrame() {
|
||||
if (!this.inv.getStackInSlot(0).isEmpty()) {
|
||||
return ChipsetManager.circuitRegistry.getCircuitBoard(this.inv.getStackInSlot(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StimulatorCircuit[] getCircuits() {
|
||||
final ICircuitBoard board = this.getHiveFrame();
|
||||
if (board == null) {
|
||||
return new StimulatorCircuit[0];
|
||||
}
|
||||
final ICircuit[] circuits = board.getCircuits();
|
||||
final List<StimulatorCircuit> mod = new ArrayList<>();
|
||||
for (final ICircuit circuit : circuits) {
|
||||
if (circuit instanceof StimulatorCircuit) {
|
||||
mod.add((StimulatorCircuit) circuit);
|
||||
}
|
||||
}
|
||||
return mod.toArray(new StimulatorCircuit[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
if (!this.powered) {
|
||||
return mod;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
mod *= beeMod.getTerritoryModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull final IBeeGenome genome, @Nonnull final IBeeGenome mate, final float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
if (!this.powered) {
|
||||
return mod;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
mod *= beeMod.getMutationModifier(genome, mate, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(@Nonnull final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
if (!this.powered) {
|
||||
return mod;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
mod *= beeMod.getLifespanModifier(genome, mate, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
if (!this.powered) {
|
||||
return mod;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
mod *= beeMod.getProductionModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
if (!this.powered) {
|
||||
return mod;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
mod *= beeMod.getFloweringModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
if (!this.powered) {
|
||||
return mod;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
mod *= beeMod.getGeneticDecay(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
if (!this.powered) {
|
||||
return false;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
if (beeMod.isSealed()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
if (!this.powered) {
|
||||
return false;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
if (beeMod.isSelfLighted()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
if (!this.powered) {
|
||||
return false;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
if (beeMod.isSunlightSimulated()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
if (!this.powered) {
|
||||
return false;
|
||||
}
|
||||
for (final IBeeModifier beeMod : this.modifiers) {
|
||||
if (beeMod.isHellish()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(final int amount) {
|
||||
energyStorage.extractEnergy(powerUsage, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEnergyStorage getEnergyStorage() {
|
||||
return energyStorage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyLogicTransmitter extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicTransmitter(){
|
||||
internalStorage = new EnergyStorage(2000);
|
||||
}
|
||||
|
||||
private IEnergyStorage internalStorage;
|
||||
|
||||
@Override
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
|
||||
if (internalStorage.getEnergyStored() < 2){
|
||||
return;
|
||||
}
|
||||
List<IEnergyStorage> esL = Lists.newArrayList();
|
||||
for (TileEntityExtraBeesAlvearyPart part : tile.getExtraBeesParts()){
|
||||
if (part.getAlvearyLogic().getEnergyStorage() != null){
|
||||
esL.add(part.getAlvearyLogic().getEnergyStorage());
|
||||
}
|
||||
}
|
||||
if (esL.isEmpty()){
|
||||
return;
|
||||
}
|
||||
int div = esL.size();
|
||||
int maxOutput = 500;
|
||||
int output = internalStorage.getEnergyStored() / div;
|
||||
if (output > maxOutput) {
|
||||
output = maxOutput;
|
||||
}
|
||||
if (output < 1) {
|
||||
return;
|
||||
}
|
||||
for (IEnergyStorage handler : esL) {
|
||||
int recieved = handler.receiveEnergy(output, false);
|
||||
internalStorage.extractEnergy(recieved, false);
|
||||
if (internalStorage.getEnergyStored() < output) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public enum AlvearyLogicType implements IStringSerializable {
|
||||
|
||||
FRAME {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicFrameHousing(tile);
|
||||
}
|
||||
|
||||
},
|
||||
HATCHERY {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicHatchery();
|
||||
}
|
||||
|
||||
},
|
||||
LIGHTING {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicLighting();
|
||||
}
|
||||
|
||||
},
|
||||
MUTATOR {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicMutator();
|
||||
}
|
||||
|
||||
},
|
||||
RAINSHIELD {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicRainShield();
|
||||
}
|
||||
|
||||
},
|
||||
STIMULATOR {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicStimulator();
|
||||
}
|
||||
|
||||
},
|
||||
TRANSMISSION {
|
||||
|
||||
@Override
|
||||
public AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile) {
|
||||
return new AlvearyLogicTransmitter();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public abstract AbstractAlvearyLogic createLogic(TileEntityExtraBeesAlvearyPart tile);
|
||||
|
||||
@Nonnull
|
||||
public String getName(){
|
||||
return toString().toLowerCase();
|
||||
}
|
||||
|
||||
public static AlvearyLogicType[] VALUES = values();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BlockAlveary extends Block implements ITileEntityProvider {
|
||||
|
||||
public BlockAlveary() {
|
||||
super(new MaterialBeehive(false));
|
||||
setRegistryName("alveary");
|
||||
}
|
||||
|
||||
private static final PropertyEnum<AlvearyLogicType> TYPE = PropertyEnum.create("type", AlvearyLogicType.class);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta) {
|
||||
return new TileEntityExtraBeesAlvearyPart(getType(meta));
|
||||
}
|
||||
|
||||
private AlvearyLogicType getType(int meta){
|
||||
IBlockState state = getStateFromMeta(meta);
|
||||
return state.getValue(TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < AlvearyLogicType.VALUES.length; i++) {
|
||||
list.add(new ItemStack(itemIn, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String getUnlocalizedName() {
|
||||
return getUnlocalizedName(0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUnlocalizedName(int meta) {
|
||||
return "extrabees.machine.alveay."+getType(meta).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
meta = meta >= 0 && meta < AlvearyLogicType.VALUES.length ? meta : 0;
|
||||
return getDefaultState().withProperty(TYPE, AlvearyLogicType.VALUES[meta]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.api.multiblock.IMultiblockController;
|
||||
import forestry.apiculture.multiblock.MultiblockLogicAlveary;
|
||||
import forestry.core.multiblock.MultiblockTileEntityForestry;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class TileEntityExtraBeesAlvearyPart extends MultiblockTileEntityForestry<MultiblockLogicAlveary> implements IAlvearyComponent.Active, IAlvearyComponent.BeeModifier, IAlvearyComponent.BeeListener {
|
||||
|
||||
public TileEntityExtraBeesAlvearyPart(){
|
||||
this(null);
|
||||
}
|
||||
|
||||
protected TileEntityExtraBeesAlvearyPart(AlvearyLogicType type) {
|
||||
super(new MultiblockLogicAlveary());
|
||||
if (type != null) {
|
||||
this.type = type;
|
||||
initFromType();
|
||||
}
|
||||
}
|
||||
|
||||
private void initFromType(){
|
||||
if (alvearyLogic == null){
|
||||
this.unlocalizedTitle = "tile.for.alveary." + type.getName() + ".name";
|
||||
this.alvearyLogic = type.createLogic(this);
|
||||
}
|
||||
}
|
||||
|
||||
private String unlocalizedTitle;
|
||||
private AlvearyLogicType type;
|
||||
private AbstractAlvearyLogic alvearyLogic;
|
||||
|
||||
@Nonnull
|
||||
public AbstractAlvearyLogic getAlvearyLogic() {
|
||||
return alvearyLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
type = AlvearyLogicType.VALUES[data.getByte("avType")];
|
||||
initFromType();
|
||||
super.readFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound data) {
|
||||
data.setByte("avType", (byte) type.ordinal());
|
||||
return super.writeToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled(@Nonnull IMultiblockController multiblockController, @Nonnull BlockPos minCoord, @Nonnull BlockPos maxCoord) {
|
||||
// Re-render this block on the client
|
||||
if (world.isRemote) {
|
||||
this.world.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
}
|
||||
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState) {
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineBroken() {
|
||||
// Re-render this block on the client
|
||||
if (world.isRemote) {
|
||||
this.world.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
}
|
||||
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(@Nonnull EntityPlayer player, int data) {
|
||||
return alvearyLogic.getGui(player, data);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Container getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return alvearyLogic.getContainer(player, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateServer(int tickCount) {
|
||||
alvearyLogic.updateServer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateClient(int tickCount) {
|
||||
alvearyLogic.updateClient(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IBeeListener getBeeListener() {
|
||||
return alvearyLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return alvearyLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return alvearyLogic.hasCapability(capability, facing) || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
return alvearyLogic.hasCapability(capability, facing) ? alvearyLogic.getCapability(capability, facing) : super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
public Collection<IMultiblockComponent> getConnectedComponents(){
|
||||
return getMultiblockLogic().getController().getComponents();
|
||||
}
|
||||
|
||||
public Set<TileEntityExtraBeesAlvearyPart> getExtraBeesParts(){
|
||||
return getConnectedComponents().stream().filter(p -> p instanceof TileEntityExtraBeesAlvearyPart).map(p -> (TileEntityExtraBeesAlvearyPart) p).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,32 +3,17 @@ package binnie.extrabees.apiary;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.machines.MachineGroup;
|
||||
import binnie.core.machines.inventory.ValidatorSprite;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMutator;
|
||||
import binnie.extrabees.apiary.machine.AlvearyStimulator;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import binnie.extrabees.items.types.EnumHiveFrame;
|
||||
import binnie.extrabees.utils.BinnieCircuitLayout;
|
||||
import binnie.extrabees.utils.BinnieCircuitSocketType;
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import binnie.extrabees.circuit.BinnieCircuitLayout;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.core.PluginCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
public class ModuleApiary implements IInitializable {
|
||||
|
||||
public static Block blockComponent;
|
||||
public static ValidatorSprite spriteMutator;
|
||||
BinnieCircuitLayout stimulatorLayout;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
@@ -36,43 +21,15 @@ public class ModuleApiary implements IInitializable {
|
||||
machineGroup.setCreativeTab(Tabs.tabApiculture);
|
||||
GameRegistry.registerTileEntity(TileExtraBeeAlveary.class, "extrabees.tile.alveary");
|
||||
ModuleApiary.blockComponent = machineGroup.getBlock();
|
||||
AlvearyMutator.addMutationItem(new ItemStack(Blocks.SOUL_SAND), 1.5f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("UranFuel"), 4.0f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("MOXFuel"), 10.0f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("Plutonium"), 8.0f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("smallPlutonium"), 5.0f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("Uran235"), 4.0f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("smallUran235"), 2.5f);
|
||||
AlvearyMutator.addMutationItem(Utils.getIC2Item("Uran238"), 2.0f);
|
||||
AlvearyMutator.addMutationItem(new ItemStack(Items.ENDER_PEARL), 2.0f);
|
||||
AlvearyMutator.addMutationItem(new ItemStack(Items.ENDER_EYE), 4.0f);
|
||||
for (final EnumHiveFrame frame : EnumHiveFrame.values()) {
|
||||
ExtraBees.proxy.registerItem(frame.getItem());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
EnumHiveFrame.init();
|
||||
ItemStack alveary = PluginApiculture.getBlocks().getAlvearyBlock(BlockAlvearyType.PLAIN);
|
||||
Item thermionicTubes = PluginCore.getItems().tubes;
|
||||
Item chipsets = PluginCore.getItems().circuitboards;
|
||||
|
||||
GameRegistry.addRecipe(AlvearyMachine.Mutator.get(1), "g g", " a ", "t t", 'g', Items.GOLD_INGOT, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 5));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Frame.get(1), "iii", "tat", " t ", 'i', Items.IRON_INGOT, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.RainShield.get(1), " b ", "bab", "t t", 'b', Items.BRICK, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Lighting.get(1), "iii", "iai", " t ", 'i', Items.GLOWSTONE_DUST, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Stimulator.get(1), "kik", "iai", " t ", 'i', Items.GOLD_NUGGET, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4), 'k', new ItemStack(chipsets, 1, 2));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Hatchery.get(1), "i i", " a ", "iti", 'i', Blocks.GLASS_PANE, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 5));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(AlvearyMachine.Transmission.get(1), " t ", "tat", " t ", 'a', alveary, 't', "gearTin"));
|
||||
for (final AlvearyStimulator.CircuitType type : AlvearyStimulator.CircuitType.values()) {
|
||||
type.createCircuit(this.stimulatorLayout);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.stimulatorLayout = new BinnieCircuitLayout("Stimulator", BinnieCircuitSocketType.STIMULATOR);
|
||||
ModuleApiary.spriteMutator = new ValidatorSprite(GuiHack.INSTANCE, "validator/mutator.0", "validator/mutator.1");
|
||||
}
|
||||
}
|
||||
@@ -201,289 +201,4 @@ public class TileExtraBeeAlveary extends TileEntityMachine implements IAlvearyCo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// @Override
|
||||
// public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
// super.readFromNBT(nbttagcompound);
|
||||
// this.isMaster = nbttagcompound.getBoolean("IsMaster");
|
||||
// this.masterX = nbttagcompound.getInteger("MasterX");
|
||||
// this.masterY = nbttagcompound.getInteger("MasterY");
|
||||
// this.masterZ = nbttagcompound.getInteger("MasterZ");
|
||||
// if (this.isMaster) {
|
||||
// this.makeMaster();
|
||||
// }
|
||||
// // this.structureLogic.readFromNBT(nbttagcompound);
|
||||
// // this.updateAlvearyBlocks();
|
||||
// this.init = false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
||||
// super.writeToNBT(nbttagcompound);
|
||||
// nbttagcompound.setBoolean("IsMaster", this.isMaster);
|
||||
// nbttagcompound.setInteger("MasterX", this.masterX);
|
||||
// nbttagcompound.setInteger("MasterY", this.masterY);
|
||||
// nbttagcompound.setInteger("MasterZ", this.masterZ);
|
||||
// //this.structureLogic.writeToNBT(nbttagcompound);
|
||||
// }
|
||||
//
|
||||
// AlvearyMachine.AlvearyPackage getAlvearyPackage() {
|
||||
// return (AlvearyMachine.AlvearyPackage)this.getMachine().getPackage();
|
||||
// }
|
||||
//
|
||||
// public TileExtraBeeAlveary() {
|
||||
// this.init = false;
|
||||
// this.masterY = -99;
|
||||
// this.tiles = new ArrayList<TileEntity>();
|
||||
// //this.structureLogic =
|
||||
// Binnie.Genetics.getBeeRoot().createAlvearyStructureLogic((IAlvearyComponent)this);
|
||||
// }
|
||||
//
|
||||
// public TileExtraBeeAlveary(final AlvearyMachine.AlvearyPackage
|
||||
// alvearyPackage) {
|
||||
// super(alvearyPackage);
|
||||
// this.init = false;
|
||||
// this.masterY = -99;
|
||||
// this.tiles = new ArrayList<TileEntity>();
|
||||
// // this.structureLogic =
|
||||
// Binnie.Genetics.getBeeRoot().createAlvearyStructureLogic((IAlvearyComponent)this);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void makeMaster() {
|
||||
// }
|
||||
//
|
||||
// // public void onStructureReset() {
|
||||
// // this.setCentralTE(null);
|
||||
// // this.isMaster = false;
|
||||
// // this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord,
|
||||
// this.zCoord);
|
||||
// // this.updateAlvearyBlocks();
|
||||
// // }
|
||||
// //
|
||||
// // public IMultiblockComponent getCentralTE() {
|
||||
// // if (this.worldObj == null || !this.isIntegratedIntoStructure()) {
|
||||
// // return null;
|
||||
// // }
|
||||
// // if (this.isMaster()) {
|
||||
// // return (IMultiblockComponent)this;
|
||||
// // }
|
||||
// // final TileEntity tile = this.worldObj.getTileEntity(this.masterX,
|
||||
// this.masterY, this.masterZ);
|
||||
// // if (!(tile instanceof IMultiblockComponent)) {
|
||||
// // return null;
|
||||
// // }
|
||||
// // final IMultiblockComponent master =
|
||||
// (IMultiblockComponent)this.worldObj.getTileEntity(this.masterX,
|
||||
// this.masterY, this.masterZ);
|
||||
// // if (master.isMaster()) {
|
||||
// // return master;
|
||||
// // }
|
||||
// // return null;
|
||||
// // }
|
||||
//
|
||||
// // public void validateStructure() {
|
||||
// // this.structureLogic.validateStructure();
|
||||
// // this.updateAlvearyBlocks();
|
||||
// // }
|
||||
//
|
||||
// private boolean isSameTile(final TileEntity tile) {
|
||||
// return tile.xCoord == this.xCoord && tile.yCoord == this.yCoord &&
|
||||
// tile.zCoord == this.zCoord;
|
||||
// }
|
||||
//
|
||||
// // public void setCentralTE(final TileEntity tile) {
|
||||
// // if (tile == null || tile == this || this.isSameTile(tile)) {
|
||||
// // final boolean b = false;
|
||||
// // this.masterZ = (b ? 1 : 0);
|
||||
// // this.masterX = (b ? 1 : 0);
|
||||
// // this.masterY = -99;
|
||||
// // this.updateAlvearyBlocks();
|
||||
// // return;
|
||||
// // }
|
||||
// // this.isMaster = false;
|
||||
// // this.masterX = tile.xCoord;
|
||||
// // this.masterY = tile.yCoord;
|
||||
// // this.masterZ = tile.zCoord;
|
||||
// // this.markDirty();
|
||||
// // if (this.getBeeListener() != null) {
|
||||
// // ((IAlvearyComponent)tile).registerBeeListener(this.getBeeListener());
|
||||
// // }
|
||||
// // if (this.getBeeModifier() != null) {
|
||||
// // ((IAlvearyComponent)tile).registerBeeModifier(this.getBeeModifier());
|
||||
// // }
|
||||
// // this.updateAlvearyBlocks();
|
||||
// // }
|
||||
//
|
||||
// public boolean isMaster() {
|
||||
// return this.isMaster;
|
||||
// }
|
||||
//
|
||||
// protected boolean hasMaster() {
|
||||
// return this.masterY >= 0;
|
||||
// }
|
||||
//
|
||||
// public boolean isIntegratedIntoStructure() {
|
||||
// return this.isMaster || this.masterY >= 0;
|
||||
// }
|
||||
//
|
||||
// public void registerBeeModifier(final IBeeModifier modifier) {
|
||||
// }
|
||||
//
|
||||
// public void removeBeeModifier(final IBeeModifier modifier) {
|
||||
// }
|
||||
//
|
||||
// public void addTemperatureChange(final float change, final float
|
||||
// boundaryDown, final float boundaryUp) {
|
||||
// }
|
||||
//
|
||||
// public void addHumidityChange(final float change, final float
|
||||
// boundaryDown, final float boundaryUp) {
|
||||
// }
|
||||
//
|
||||
// public boolean hasFunction() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public IBeeModifier getBeeModifier() {
|
||||
// return this.getMachine().getInterface(IBeeModifier.class);
|
||||
// }
|
||||
//
|
||||
// public IBeeListener getBeeListener() {
|
||||
// return this.getMachine().getInterface(IBeeListener.class);
|
||||
// }
|
||||
//
|
||||
// public float getTerritoryModifier(final IBeeGenome genome, final float
|
||||
// currentModifier) {
|
||||
// return (this.getBeeModifier() == null) ? 1.0f :
|
||||
// this.getBeeModifier().getTerritoryModifier(genome, currentModifier);
|
||||
// }
|
||||
//
|
||||
// public float getMutationModifier(final IBeeGenome genome, final
|
||||
// IBeeGenome mate, final float currentModifier) {
|
||||
// return (this.getBeeModifier() == null) ? 1.0f :
|
||||
// this.getBeeModifier().getMutationModifier(genome, mate, currentModifier);
|
||||
// }
|
||||
//
|
||||
// public float getLifespanModifier(final IBeeGenome genome, final
|
||||
// IBeeGenome mate, final float currentModifier) {
|
||||
// return (this.getBeeModifier() == null) ? 1.0f :
|
||||
// this.getBeeModifier().getLifespanModifier(genome, mate, currentModifier);
|
||||
// }
|
||||
//
|
||||
// public float getProductionModifier(final IBeeGenome genome, final float
|
||||
// currentModifier) {
|
||||
// return (this.getBeeModifier() == null) ? 1.0f :
|
||||
// this.getBeeModifier().getProductionModifier(genome, currentModifier);
|
||||
// }
|
||||
//
|
||||
// public float getFloweringModifier(final IBeeGenome genome, final float
|
||||
// currentModifier) {
|
||||
// return (this.getBeeModifier() == null) ? 1.0f :
|
||||
// this.getBeeModifier().getFloweringModifier(genome, currentModifier);
|
||||
// }
|
||||
//
|
||||
// public boolean isSealed() {
|
||||
// return this.getBeeModifier() != null && this.getBeeModifier().isSealed();
|
||||
// }
|
||||
//
|
||||
// public boolean isSelfLighted() {
|
||||
// return this.getBeeModifier() != null &&
|
||||
// this.getBeeModifier().isSelfLighted();
|
||||
// }
|
||||
//
|
||||
// public boolean isSunlightSimulated() {
|
||||
// return this.getBeeModifier() != null &&
|
||||
// this.getBeeModifier().isSunlightSimulated();
|
||||
// }
|
||||
//
|
||||
// public boolean isHellish() {
|
||||
// return this.getBeeModifier() != null &&
|
||||
// this.getBeeModifier().isHellish();
|
||||
// }
|
||||
//
|
||||
// public void registerBeeListener(final IBeeListener event) {
|
||||
// }
|
||||
//
|
||||
// public void removeBeeListener(final IBeeListener event) {
|
||||
// }
|
||||
//
|
||||
// // public void onQueenChange(final ItemStack queen) {
|
||||
// // if (this.getBeeListener() != null) {
|
||||
// // this.getBeeListener().onQueenChange(queen);
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// public void wearOutEquipment(final int amount) {
|
||||
// if (this.getBeeListener() != null) {
|
||||
// this.getBeeListener().wearOutEquipment(amount);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // public void onQueenDeath(final IBee queen) {
|
||||
// // if (this.getBeeListener() != null) {
|
||||
// // this.getBeeListener().onQueenDeath(queen);
|
||||
// // }
|
||||
// // }
|
||||
// //
|
||||
// // public void onPostQueenDeath(final IBee queen) {
|
||||
// // if (this.getBeeListener() != null) {
|
||||
// // this.getBeeListener().onPostQueenDeath(queen);
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// public boolean onPollenRetrieved(final IBee queen, final IIndividual
|
||||
// pollen, final boolean isHandled) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public boolean onEggLaid(final IBee queen) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public float getGeneticDecay(final IBeeGenome genome, final float
|
||||
// currentModifier) {
|
||||
// return 1.0f;
|
||||
// }
|
||||
//
|
||||
// // public IBeeHousing getBeeHousing() {
|
||||
// // return (this.getCentralTE() == null) ? null :
|
||||
// ((IBeeHousing)this.getCentralTE());
|
||||
// // }
|
||||
//
|
||||
// // public List<TileEntity> getAlvearyBlocks() {
|
||||
// // this.updateAlvearyBlocks();
|
||||
// // return this.tiles;
|
||||
// // }
|
||||
//
|
||||
// // private void updateAlvearyBlocks() {
|
||||
// // this.tiles.clear();
|
||||
// // if (this.getCentralTE() != null) {
|
||||
// // final IMultiblockComponent struct = this.getCentralTE();
|
||||
// // if (!struct.isIntegratedIntoStructure()) {
|
||||
// // return;
|
||||
// // }
|
||||
// // final TileEntity central = (TileEntity)struct;
|
||||
// // for (int x = -2; x <= 2; ++x) {
|
||||
// // for (int z = -2; z <= 2; ++z) {
|
||||
// // for (int y = -2; y <= 2; ++y) {
|
||||
// // final TileEntity tile = this.getWorldObj().getTileEntity(this.xCoord +
|
||||
// x, this.yCoord + y, this.zCoord + z);
|
||||
// // if (tile != null && tile instanceof IMultiblockComponent &&
|
||||
// ((IMultiblockComponent)tile).getMultiblockLogic().getCentralTE() ==
|
||||
// struct) {
|
||||
// // this.tiles.add(tile);
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
//
|
||||
// public ISidedInventory getStructureInventory() {
|
||||
// return this.getMachine().getInterface(ISidedInventory.class);
|
||||
// }
|
||||
//
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import binnie.extrabees.apiary.ComponentExtraBeeGUI;
|
||||
import binnie.extrabees.apiary.ModuleApiary;
|
||||
import binnie.extrabees.client.ExtraBeeGUID;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.extrabees.utils.AlvearyMutationHandler;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
@@ -28,39 +29,6 @@ import static org.apache.commons.lang3.ObjectUtils.firstNonNull;
|
||||
|
||||
public class AlvearyMutator {
|
||||
public static int slotMutator = 0;
|
||||
private static final List<Pair<ItemStack, Float>> MUTATIONS = new ArrayList<>();
|
||||
|
||||
public static boolean isMutationItem(final ItemStack item) {
|
||||
return getMutationMult(item) > 0.0f;
|
||||
}
|
||||
|
||||
public static float getMutationMult(final ItemStack item) {
|
||||
if (!item.isEmpty()) {
|
||||
for (final Pair<ItemStack, Float> comp : AlvearyMutator.MUTATIONS) {
|
||||
ItemStack key = comp.getKey();
|
||||
if (item.isItemEqual(key) && ItemStack.areItemStackTagsEqual(item, key)) {
|
||||
return comp.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public static void addMutationItem(@Nullable Item item, float chance){
|
||||
addMutationItem(new ItemStack(firstNonNull(item, Item.getItemFromBlock(Blocks.AIR))), chance);
|
||||
}
|
||||
|
||||
public static void addMutationItem(final ItemStack item, final float chance) {
|
||||
if (item.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
AlvearyMutator.MUTATIONS.add(Pair.of(item, chance));
|
||||
AlvearyMutator.MUTATIONS.sort(Comparator.comparing(Pair::getValue));
|
||||
}
|
||||
|
||||
public static List<Pair<ItemStack, Float>> getMutagens() {
|
||||
return Collections.unmodifiableList(AlvearyMutator.MUTATIONS);
|
||||
}
|
||||
|
||||
public static class PackageAlvearyMutator extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyMutator() {
|
||||
@@ -83,7 +51,7 @@ public class AlvearyMutator {
|
||||
|
||||
@Override
|
||||
public boolean isValid(final ItemStack itemStack) {
|
||||
return AlvearyMutator.isMutationItem(itemStack);
|
||||
return AlvearyMutationHandler.isMutationItem(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,7 +68,7 @@ public class AlvearyMutator {
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
ItemStack mutator = this.getUtil().getStack(AlvearyMutator.slotMutator);
|
||||
final float mult = AlvearyMutator.getMutationMult(mutator);
|
||||
final float mult = AlvearyMutationHandler.getMutationMult(mutator);
|
||||
return Math.min(mult * currentModifier, 15f);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.circuits.BinnieCircuit;
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
@@ -9,18 +7,15 @@ import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
import binnie.extrabees.apiary.ComponentExtraBeeGUI;
|
||||
import binnie.extrabees.circuit.StimulatorCircuit;
|
||||
import binnie.extrabees.client.ExtraBeeGUID;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.extrabees.utils.BeeModifierLogic;
|
||||
import binnie.extrabees.utils.EnumBeeBooleanModifier;
|
||||
import binnie.extrabees.utils.EnumBeeModifier;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -237,170 +232,4 @@ public class AlvearyStimulator {
|
||||
}
|
||||
}
|
||||
|
||||
public static class StimulatorCircuit extends BinnieCircuit implements IBeeModifier {
|
||||
CircuitType type;
|
||||
|
||||
public StimulatorCircuit(final CircuitType type, final ICircuitLayout layout) {
|
||||
super("stimulator." + type.toString().toLowerCase(), 4, layout, Mods.Forestry.item("thermionic_tubes"), type.recipe);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getPowerUsage() {
|
||||
return this.type.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getTerritoryModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return this.type.getMutationModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return this.type.getLifespanModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getFloweringModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return this.type.isSealed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return this.type.isSelfLighted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return this.type.isSunlightSimulated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return this.type.isHellish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getGeneticDecay(genome, currentModifier);
|
||||
}
|
||||
}
|
||||
|
||||
public enum CircuitType implements IBeeModifier {
|
||||
LowVoltage(3, 10),
|
||||
HighVoltage(5, 20),
|
||||
Plant(10, 10),
|
||||
Death(6, 10),
|
||||
Life(11, 10),
|
||||
Nether(7, 15),
|
||||
Mutation(4, 15),
|
||||
Inhibitor(1, 10),
|
||||
Territory(2, 10);
|
||||
|
||||
public int recipe;
|
||||
public int power;
|
||||
BeeModifierLogic logic;
|
||||
|
||||
CircuitType(final int recipe, final int power) {
|
||||
this.logic = new BeeModifierLogic();
|
||||
this.recipe = recipe;
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
public void createCircuit(final ICircuitLayout layout) {
|
||||
final StimulatorCircuit circuit = new StimulatorCircuit(this, layout);
|
||||
for (final EnumBeeModifier modifier : EnumBeeModifier.values()) {
|
||||
final float mod = this.logic.getModifier(modifier, 1.0f);
|
||||
if (mod != 1.0f) {
|
||||
if (mod > 1.0f) {
|
||||
final int increase = (int) ((mod - 1.0f) * 100.0f);
|
||||
circuit.addTooltipString("Increases " + modifier.getName() + " by " + increase + "%");
|
||||
} else {
|
||||
final int decrease = (int) ((1.0f - mod) * 100.0f);
|
||||
circuit.addTooltipString("Decreases " + modifier.getName() + " by " + decrease + "%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Territory, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Mutation, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Lifespan, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Production, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Flowering, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.GeneticDecay, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.Sealed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.SelfLighted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.SunlightStimulated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.Hellish);
|
||||
}
|
||||
|
||||
static {
|
||||
CircuitType.LowVoltage.logic.setModifier(EnumBeeModifier.Production, 1.5f, 5.0f);
|
||||
CircuitType.HighVoltage.logic.setModifier(EnumBeeModifier.Production, 2.5f, 10.0f);
|
||||
CircuitType.Plant.logic.setModifier(EnumBeeModifier.Flowering, 1.5f, 5.0f);
|
||||
CircuitType.Death.logic.setModifier(EnumBeeModifier.Lifespan, 0.8f, 0.2f);
|
||||
CircuitType.Life.logic.setModifier(EnumBeeModifier.Lifespan, 1.5f, 5.0f);
|
||||
CircuitType.Nether.logic.setModifier(EnumBeeBooleanModifier.Hellish);
|
||||
CircuitType.Mutation.logic.setModifier(EnumBeeModifier.Mutation, 1.5f, 5.0f);
|
||||
CircuitType.Inhibitor.logic.setModifier(EnumBeeModifier.Territory, 0.4f, 0.1f);
|
||||
CircuitType.Inhibitor.logic.setModifier(EnumBeeModifier.Production, 0.9f, 0.5f);
|
||||
CircuitType.Territory.logic.setModifier(EnumBeeModifier.Territory, 1.5f, 5.0f);
|
||||
for (final CircuitType type : values()) {
|
||||
type.logic.setModifier(EnumBeeModifier.GeneticDecay, 1.5f, 10.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class BlockExtraBeeHive extends Block {
|
||||
this.setCreativeTab(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
public static final PropertyEnum<EnumHiveType> hiveType = PropertyEnum.create("hive_type", EnumHiveType.class);
|
||||
public static final PropertyEnum<EnumHiveType> hiveType = PropertyEnum.create("type", EnumHiveType.class);
|
||||
|
||||
public String getUnlocalizedName(final ItemStack itemStack) {
|
||||
return "extrabees.block.hive." + itemStack.getItemDamage();
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package binnie.extrabees.circuit;
|
||||
|
||||
import binnie.extrabees.utils.BeeModifierLogic;
|
||||
import binnie.extrabees.utils.EnumBeeBooleanModifier;
|
||||
import binnie.extrabees.utils.EnumBeeModifier;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public enum AlvearySimulatorCircuitType implements IBeeModifier {
|
||||
|
||||
LowVoltage(3, 10),
|
||||
HighVoltage(5, 20),
|
||||
Plant(10, 10),
|
||||
Death(6, 10),
|
||||
Life(11, 10),
|
||||
Nether(7, 15),
|
||||
Mutation(4, 15),
|
||||
Inhibitor(1, 10),
|
||||
Territory(2, 10);
|
||||
|
||||
public int recipe;
|
||||
public int power;
|
||||
BeeModifierLogic logic;
|
||||
|
||||
AlvearySimulatorCircuitType(final int recipe, final int power) {
|
||||
this.logic = new BeeModifierLogic();
|
||||
this.recipe = recipe;
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
public void createCircuit(final ICircuitLayout layout) {
|
||||
final StimulatorCircuit circuit = new StimulatorCircuit(this, layout);
|
||||
for (final EnumBeeModifier modifier : EnumBeeModifier.values()) {
|
||||
final float mod = this.logic.getModifier(modifier, 1.0f);
|
||||
if (mod != 1.0f) {
|
||||
if (mod > 1.0f) {
|
||||
final int increase = (int) ((mod - 1.0f) * 100.0f);
|
||||
circuit.addTooltip("Increases " + modifier.getName() + " by " + increase + "%");
|
||||
} else {
|
||||
final int decrease = (int) ((1.0f - mod) * 100.0f);
|
||||
circuit.addTooltip("Decreases " + modifier.getName() + " by " + decrease + "%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Territory, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull final IBeeGenome genome, @Nonnull final IBeeGenome mate, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Mutation, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(@Nonnull final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Lifespan, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Production, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.Flowering, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.logic.getModifier(EnumBeeModifier.GeneticDecay, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.Sealed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.SelfLighted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.SunlightStimulated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return this.logic.getModifier(EnumBeeBooleanModifier.Hellish);
|
||||
}
|
||||
|
||||
static {
|
||||
LowVoltage.logic.setModifier(EnumBeeModifier.Production, 1.5f, 5.0f);
|
||||
HighVoltage.logic.setModifier(EnumBeeModifier.Production, 2.5f, 10.0f);
|
||||
Plant.logic.setModifier(EnumBeeModifier.Flowering, 1.5f, 5.0f);
|
||||
Death.logic.setModifier(EnumBeeModifier.Lifespan, 0.8f, 0.2f);
|
||||
Life.logic.setModifier(EnumBeeModifier.Lifespan, 1.5f, 5.0f);
|
||||
Nether.logic.setModifier(EnumBeeBooleanModifier.Hellish);
|
||||
Mutation.logic.setModifier(EnumBeeModifier.Mutation, 1.5f, 5.0f);
|
||||
Inhibitor.logic.setModifier(EnumBeeModifier.Territory, 0.4f, 0.1f);
|
||||
Inhibitor.logic.setModifier(EnumBeeModifier.Production, 0.9f, 0.5f);
|
||||
Territory.logic.setModifier(EnumBeeModifier.Territory, 1.5f, 5.0f);
|
||||
for (final AlvearySimulatorCircuitType type : values()) {
|
||||
type.logic.setModifier(EnumBeeModifier.GeneticDecay, 1.5f, 10.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extrabees.utils;
|
||||
package binnie.extrabees.circuit;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extrabees.utils;
|
||||
package binnie.extrabees.circuit;
|
||||
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
package binnie.extrabees.circuit;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.core.PluginCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class StimulatorCircuit implements ICircuit, IBeeModifier {
|
||||
|
||||
public StimulatorCircuit(final AlvearySimulatorCircuitType type, final ICircuitLayout layout) {
|
||||
uid = "binnie.circuit.stimulator." + type.toString().toLowerCase();
|
||||
this.type = type;
|
||||
ItemStack stack = new ItemStack(PluginCore.getItems().tubes, 1, type.recipe);
|
||||
ChipsetManager.circuitRegistry.registerCircuit(this);
|
||||
ChipsetManager.solderManager.addRecipe(layout, stack, this);
|
||||
tooltip = Lists.newArrayList();
|
||||
}
|
||||
|
||||
private final AlvearySimulatorCircuitType type;
|
||||
private final String uid;
|
||||
private final List<String> tooltip;
|
||||
|
||||
public int getPowerUsage() {
|
||||
return this.type.power;
|
||||
}
|
||||
|
||||
public void addTooltip(String tt){
|
||||
this.tooltip.add(tt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getTerritoryModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull final IBeeGenome genome, @Nonnull final IBeeGenome mate, final float currentModifier) {
|
||||
return this.type.getMutationModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(@Nonnull final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return this.type.getLifespanModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getFloweringModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return this.type.isSealed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return this.type.isSelfLighted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return this.type.isSunlightSimulated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return this.type.isHellish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(@Nonnull final IBeeGenome genome, final float currentModifier) {
|
||||
return this.type.getGeneticDecay(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public String getUnlocalizedName() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(@Nonnull Object tile) {
|
||||
System.out.println("isCircuitable: "+tile);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int slot, @Nonnull Object tile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int slot, @Nonnull Object tile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int slot, @Nonnull Object tile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int slot, @Nonnull Object tile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(@Nonnull List<String> list) {
|
||||
list.addAll(tooltip);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMutator;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import binnie.extrabees.utils.AlvearyMutationHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -40,12 +41,12 @@ public class WindowAlvearyMutator extends Window {
|
||||
new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 79, 30).assign(0);
|
||||
new ControlText(this, new Area(0, 52, this.width(), 16), "Possible Mutagens:", TextJustification.MiddleCenter).setColour(5592405);
|
||||
final int size = AlvearyMutator.getMutagens().size();
|
||||
final int size = AlvearyMutationHandler.getMutagens().size();
|
||||
final int w = size * 18;
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(MinecraftForgeClient.getLocale());
|
||||
if (size > 0) {
|
||||
int x = (this.width() - w) / 2;
|
||||
for (final Pair<ItemStack, Float> mutagen : AlvearyMutator.getMutagens()) {
|
||||
for (final Pair<ItemStack, Float> mutagen : AlvearyMutationHandler.getMutagens()) {
|
||||
final ControlItemDisplay display = new ControlItemDisplay(this, x, 66);
|
||||
display.setItemStack(mutagen.getKey());
|
||||
display.hastooltip = true;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package binnie.extrabees.init;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.alveary.BlockAlveary;
|
||||
import binnie.extrabees.alveary.TileEntityExtraBeesAlvearyPart;
|
||||
import binnie.extrabees.blocks.BlockEctoplasm;
|
||||
import binnie.extrabees.blocks.BlockExtraBeeHive;
|
||||
import binnie.extrabees.blocks.type.EnumHiveType;
|
||||
@@ -21,6 +23,8 @@ public final class BlockRegister {
|
||||
public static void preInitBlocks(){
|
||||
registerHives();
|
||||
registerMisc();
|
||||
//ExtraBees.alveary = ExtraBees.proxy.registerBlock(new BlockAlveary());
|
||||
GameRegistry.registerTileEntity(TileEntityExtraBeesAlvearyPart.class, "TileEntityExtraBeesAlvearyPart");
|
||||
}
|
||||
|
||||
public static void postInitBlocks(){
|
||||
@@ -34,7 +38,6 @@ public final class BlockRegister {
|
||||
@SuppressWarnings("all")
|
||||
private static void registerHives(){
|
||||
GameRegistry.register(ExtraBees.hive = new BlockExtraBeeHive());
|
||||
GameRegistry.register(new ItemBeehive(ExtraBees.hive));
|
||||
}
|
||||
|
||||
private static void registerHiveDrops(){
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package binnie.extrabees.init;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import binnie.extrabees.alveary.BlockAlveary;
|
||||
import binnie.extrabees.blocks.type.EnumHiveType;
|
||||
import binnie.extrabees.items.*;
|
||||
import binnie.extrabees.items.types.EnumHiveFrame;
|
||||
import binnie.extrabees.items.types.EnumHoneyComb;
|
||||
import binnie.extrabees.items.types.ExtraBeeItems;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -23,9 +29,37 @@ public final class ItemRegister {
|
||||
|
||||
@SuppressWarnings("all")
|
||||
private static void registerMisc(){
|
||||
Item i = /*GameRegistry.register(new ItemBlock(ExtraBees.alveary){
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return ((BlockAlveary) block).getUnlocalizedName(stack.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasSubtypes() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}.setRegistryName(ExtraBees.alveary.getRegistryName()));
|
||||
for (int j = 0; j < AlvearyLogicType.VALUES.length; j++) {
|
||||
ExtraBees.proxy.registerModel(i, j);
|
||||
}*/
|
||||
i = GameRegistry.register(new ItemBeehive(ExtraBees.hive));
|
||||
for (int j = 0; j < EnumHiveType.values().length; j++) {
|
||||
ExtraBees.proxy.registerModel(i, j);
|
||||
}
|
||||
ExtraBees.proxy.registerItem(ExtraBees.dictionary = new ItemDictionary());
|
||||
GameRegistry.register(new ItemBlock(ExtraBees.ectoplasm).setRegistryName(ExtraBees.ectoplasm.getRegistryName()));
|
||||
ExtraBees.proxy.registerModel(GameRegistry.register(new ItemBlock(ExtraBees.ectoplasm).setRegistryName(ExtraBees.ectoplasm.getRegistryName())), 0);
|
||||
ExtraBees.itemMisc = ExtraBees.proxy.registerItem(new ItemMiscProduct(Tabs.tabApiculture, ExtraBeeItems.values()));
|
||||
for (final EnumHiveFrame frame : EnumHiveFrame.values()) {
|
||||
ExtraBees.proxy.registerItem(frame.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerProducts(){
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package binnie.extrabees.init;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.items.types.EnumHoneyComb;
|
||||
import binnie.extrabees.items.types.EnumHoneyDrop;
|
||||
import binnie.extrabees.items.types.EnumPropolis;
|
||||
import binnie.extrabees.items.types.ExtraBeeItems;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
||||
import binnie.extrabees.circuit.AlvearySimulatorCircuitType;
|
||||
import binnie.extrabees.items.types.*;
|
||||
import binnie.extrabees.circuit.BinnieCircuitLayout;
|
||||
import binnie.extrabees.circuit.BinnieCircuitSocketType;
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -16,6 +19,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
@@ -33,8 +37,28 @@ public final class RecipeRegister {
|
||||
for (final EnumPropolis info3 : EnumPropolis.values()) {
|
||||
info3.addRecipe();
|
||||
}
|
||||
EnumHiveFrame.init();
|
||||
addForestryRecipes();
|
||||
addMiscItemRecipes();
|
||||
addAlvearyRecipes();
|
||||
}
|
||||
|
||||
private static void addAlvearyRecipes(){
|
||||
ItemStack alveary = PluginApiculture.getBlocks().getAlvearyBlock(BlockAlvearyType.PLAIN);
|
||||
Item thermionicTubes = PluginCore.getItems().tubes;
|
||||
Item chipsets = PluginCore.getItems().circuitboards;
|
||||
|
||||
GameRegistry.addRecipe(AlvearyMachine.Mutator.get(1), "g g", " a ", "t t", 'g', Items.GOLD_INGOT, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 5));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Frame.get(1), "iii", "tat", " t ", 'i', Items.IRON_INGOT, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.RainShield.get(1), " b ", "bab", "t t", 'b', Items.BRICK, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Lighting.get(1), "iii", "iai", " t ", 'i', Items.GLOWSTONE_DUST, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Stimulator.get(1), "kik", "iai", " t ", 'i', Items.GOLD_NUGGET, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4), 'k', new ItemStack(chipsets, 1, 2));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Hatchery.get(1), "i i", " a ", "iti", 'i', Blocks.GLASS_PANE, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 5));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(AlvearyMachine.Transmission.get(1), " t ", "tat", " t ", 'a', alveary, 't', "gearTin"));
|
||||
ICircuitLayout stimulatorLayout = new BinnieCircuitLayout("Stimulator", BinnieCircuitSocketType.STIMULATOR);
|
||||
for (final AlvearySimulatorCircuitType type : AlvearySimulatorCircuitType.values()) {
|
||||
type.createCircuit(stimulatorLayout);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addForestryRecipes(){
|
||||
|
||||
@@ -5,6 +5,7 @@ import binnie.extrabees.client.ExtraBeeGUID;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -13,9 +14,11 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
@@ -59,7 +62,8 @@ public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
@Nonnull
|
||||
public String getItemStackDisplayName(@Nonnull ItemStack i) {
|
||||
return (i.getItemDamage() == 0) ? "Apiarist Database" : "Master Apiarist Database";
|
||||
}
|
||||
|
||||
@@ -67,8 +71,8 @@ public class ItemDictionary extends Item implements IItemModelRegister {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("all")
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, getRegistryName().getResourcePath());
|
||||
manager.registerItemModel(item, 1, getRegistryName().getResourcePath() + "_master");
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(getRegistryName().toString() + "_master", "inventory"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
package binnie.extrabees.items;
|
||||
|
||||
import binnie.extrabees.items.types.EnumHiveFrame;
|
||||
import binnie.extrabees.utils.ExtraBeesResourceLocation;
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -36,7 +39,7 @@ public class ItemHiveFrame extends Item implements IHiveFrame, IBeeModifier, IIt
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("all")
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "frames/" + getRegistryName().getResourcePath());
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ExtraBeesResourceLocation("frames/" + getRegistryName().getResourcePath()), "inventroy"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,11 +2,14 @@ package binnie.extrabees.items;
|
||||
|
||||
import binnie.extrabees.items.types.IEBEnumItem;
|
||||
import binnie.extrabees.items.types.IEBItemMiscProvider;
|
||||
import binnie.extrabees.utils.ExtraBeesResourceLocation;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -35,7 +38,7 @@ public class ItemMiscProduct extends ItemProduct {
|
||||
@SuppressWarnings("all")
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (IEBEnumItem type : types) {
|
||||
manager.registerItemModel(item, type.ordinal(), "misc/" + ((IEBItemMiscProvider) type).getModelPath());
|
||||
ModelLoader.setCustomModelResourceLocation(item, type.ordinal(), new ModelResourceLocation(new ExtraBeesResourceLocation("misc/" + ((IEBItemMiscProvider) type).getModelPath()), "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ package binnie.extrabees.items;
|
||||
import binnie.extrabees.items.types.IEBEnumItem;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -48,7 +50,7 @@ public class ItemProduct extends Item implements IItemModelRegister {
|
||||
@SuppressWarnings("all")
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (IEBEnumItem type : types) {
|
||||
manager.registerItemModel(item, type.ordinal(), getRegistryName().getResourcePath());
|
||||
ModelLoader.setCustomModelResourceLocation(item, type.ordinal(), new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,30 @@
|
||||
package binnie.extrabees.proxy;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import binnie.extrabees.blocks.type.EnumHiveType;
|
||||
import binnie.extrabees.utils.ExtraBeesResourceLocation;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import forestry.core.models.BlankModel;
|
||||
import forestry.core.models.ModelManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.*;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
@@ -32,4 +50,36 @@ public class ExtraBeesClientProxy extends ExtraBeesCommonProxy {
|
||||
public void registerModel(@Nonnull Item item, int meta) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelsBaked(ModelBakeEvent event){
|
||||
IRegistry<ModelResourceLocation, IBakedModel> registry = event.getModelRegistry();
|
||||
registerItemBlockLink(new ExtraBeesResourceLocation("alveary"), ExtraBees.alveary, registry);
|
||||
registerItemBlockLink(new ExtraBeesResourceLocation("ectoplasm"), ExtraBees.ectoplasm, registry);
|
||||
registerItemBlockLink(new ExtraBeesResourceLocation("hive"), ExtraBees.hive, registry);
|
||||
}
|
||||
|
||||
private void registerItemBlockLink(ResourceLocation item, Block block, IRegistry<ModelResourceLocation, IBakedModel> registry){
|
||||
registry.putObject(new ModelResourceLocation(item, "inventory"), bakeModelFor(block));
|
||||
}
|
||||
|
||||
private static IBakedModel bakeModelFor(Block block){
|
||||
return new BlankModel() {
|
||||
|
||||
@Override
|
||||
protected ItemOverrideList createOverrides() {
|
||||
return new ItemOverrideList(ImmutableList.of()){
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity) {
|
||||
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(block.getStateFromMeta(stack.getMetadata()));
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package binnie.extrabees.utils;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.firstNonNull;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class AlvearyMutationHandler {
|
||||
|
||||
private static final List<Pair<ItemStack, Float>> MUTATIONS = new ArrayList<>();
|
||||
|
||||
public static boolean isMutationItem(final ItemStack item) {
|
||||
return getMutationMult(item) > 0.0f;
|
||||
}
|
||||
|
||||
public static float getMutationMult(final ItemStack item) {
|
||||
if (!item.isEmpty()) {
|
||||
for (final Pair<ItemStack, Float> comp : MUTATIONS) {
|
||||
ItemStack key = comp.getKey();
|
||||
if (item.isItemEqual(key) && ItemStack.areItemStackTagsEqual(item, key)) {
|
||||
return comp.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public static void addMutationItem(@Nullable Item item, float chance){
|
||||
addMutationItem(new ItemStack(firstNonNull(item, Item.getItemFromBlock(Blocks.AIR))), chance);
|
||||
}
|
||||
|
||||
public static void addMutationItem(final ItemStack item, final float chance) {
|
||||
if (item.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
MUTATIONS.add(Pair.of(item, chance));
|
||||
MUTATIONS.sort(Comparator.comparing(Pair::getValue));
|
||||
}
|
||||
|
||||
public static List<Pair<ItemStack, Float>> getMutagens() {
|
||||
return Collections.unmodifiableList(MUTATIONS);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user