mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-17 19:15:24 +00:00
Separation basically done
This commit is contained in:
1 parent
b7da877963
commit
2dac035df0
223 files changed
+507
-1575
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extrabees.client;
|
||||
package binnie.core;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
@@ -18,7 +18,7 @@ import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.resource.StyleSheetPunnett;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.gui.ControlChromosome;
|
||||
import binnie.genetics.machine.analyser.Analyser;
|
||||
import forestry.api.genetics.*;
|
||||
|
||||
@@ -3,7 +3,7 @@ package binnie.core.craftgui.resource;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.gui.punnett.ExtraBeeGUITexture;
|
||||
|
||||
public class StyleSheetPunnett extends StyleSheet {
|
||||
|
||||
@@ -1,7 +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;
|
||||
import binnie.extrabees.genetics.ExtraBeesFlowers;
|
||||
@@ -67,7 +66,6 @@ public class ExtraBees {
|
||||
@Mod.EventHandler
|
||||
@SuppressWarnings("all")
|
||||
public void preInit(final FMLPreInitializationEvent event) {
|
||||
GuiHack.INSTANCE.preInit();
|
||||
|
||||
materialBeehive = new MaterialBeehive();
|
||||
configHandler = new ConfigHandler(event.getSuggestedConfigurationFile());
|
||||
@@ -92,8 +90,6 @@ public class ExtraBees {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
GuiHack.INSTANCE.init();
|
||||
|
||||
configHandler.reload(true);
|
||||
ItemHoneyComb.addSubtypes();
|
||||
GameRegistry.registerWorldGenerator(new ExtraBeesWorldGenerator(), 0);
|
||||
@@ -105,8 +101,6 @@ public class ExtraBees {
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
GuiHack.INSTANCE.postInit();
|
||||
|
||||
BlockRegister.postInitBlocks();
|
||||
RecipeRegister.postInitRecipes();
|
||||
//Register mutations
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.client.gui2.AbstractAlvearyContainer;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -102,12 +103,10 @@ public abstract class AbstractAlvearyLogic implements IBeeModifier, IBeeListener
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Container getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
public AbstractAlvearyContainer getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return false;
|
||||
@@ -123,4 +122,8 @@ public abstract class AbstractAlvearyLogic implements IBeeModifier, IBeeListener
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasGui(){
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.client.gui2.AbstractAlvearyContainer;
|
||||
import binnie.extrabees.client.gui2.ContainerFrameHousing;
|
||||
import binnie.extrabees.client.gui2.GuiContainerAlvearyPart;
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
@@ -7,7 +10,11 @@ import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.api.multiblock.IAlvearyController;
|
||||
import forestry.api.multiblock.IMultiblockLogicAlveary;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
@@ -20,12 +27,17 @@ import javax.annotation.Nullable;
|
||||
public class AlvearyLogicFrameHousing extends AbstractAlvearyLogic {
|
||||
|
||||
public AlvearyLogicFrameHousing(TileEntityExtraBeesAlvearyPart tile){
|
||||
this.tile = tile;
|
||||
inv = new ItemStackHandler(1);
|
||||
}
|
||||
|
||||
private TileEntityExtraBeesAlvearyPart tile;
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
public IItemHandlerModifiable getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(final int amount) {
|
||||
IHiveFrame hiveFrame = this.getHiveFrame();
|
||||
@@ -78,4 +90,22 @@ public class AlvearyLogicFrameHousing extends AbstractAlvearyLogic {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getFloweringModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(@Nonnull EntityPlayer player, int data) {
|
||||
return new GuiContainerAlvearyPart(getContainer(player, data));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AbstractAlvearyContainer getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return new ContainerFrameHousing(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,24 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.client.gui2.AbstractAlvearyContainer;
|
||||
import binnie.extrabees.client.gui2.ContainerHatchery;
|
||||
import binnie.extrabees.client.gui2.GuiContainerAlvearyPart;
|
||||
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.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
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.
|
||||
*/
|
||||
@@ -20,6 +30,10 @@ public class AlvearyLogicHatchery extends AbstractAlvearyLogic {
|
||||
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
public IItemHandlerModifiable getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
|
||||
if (tile.getWorldObj().rand.nextInt(2400) == 0) {
|
||||
@@ -40,4 +54,22 @@ public class AlvearyLogicHatchery extends AbstractAlvearyLogic {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(@Nonnull EntityPlayer player, int data) {
|
||||
return new GuiContainerAlvearyPart(getContainer(player, data));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AbstractAlvearyContainer getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return new ContainerHatchery(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,21 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.client.gui2.AbstractAlvearyContainer;
|
||||
import binnie.extrabees.client.gui2.ContainerMutator;
|
||||
import binnie.extrabees.client.gui2.GuiContainerAlvearyPart;
|
||||
import binnie.extrabees.client.gui2.GuiContainerMutator;
|
||||
import binnie.extrabees.utils.AlvearyMutationHandler;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
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.
|
||||
@@ -19,6 +28,10 @@ public class AlvearyLogicMutator extends AbstractAlvearyLogic {
|
||||
|
||||
private final IItemHandlerModifiable inv;
|
||||
|
||||
public IItemHandlerModifiable getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(@Nonnull IBeeGenome genome, @Nonnull IBeeGenome mate, float currentModifier) {
|
||||
ItemStack mutator = inv.getStackInSlot(0);
|
||||
@@ -31,4 +44,22 @@ public class AlvearyLogicMutator extends AbstractAlvearyLogic {
|
||||
inv.extractItem(0, 1, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public GuiContainer getGui(@Nonnull EntityPlayer player, int data) {
|
||||
return new GuiContainerMutator(getContainer(player, data));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AbstractAlvearyContainer getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return new ContainerMutator(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,18 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import binnie.extrabees.circuit.StimulatorCircuit;
|
||||
import binnie.extrabees.client.gui2.AbstractAlvearyContainer;
|
||||
import binnie.extrabees.client.gui2.ContainerStimulator;
|
||||
import binnie.extrabees.client.gui2.GuiContainerAlvearyPart;
|
||||
import binnie.extrabees.client.gui2.GuiContainerStimulator;
|
||||
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.ICircuitBoard;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
@@ -25,7 +32,7 @@ public class AlvearyLogicStimulator extends AbstractAlvearyLogic {
|
||||
this.powerUsage = 0;
|
||||
this.powered = false;
|
||||
this.modifiers = new StimulatorCircuit[0];
|
||||
this.energyStorage = new EnergyStorage(2000);
|
||||
this.energyStorage = new EnergyStorage(10000);
|
||||
this.inv = new ItemStackHandler(1);
|
||||
}
|
||||
|
||||
@@ -34,6 +41,11 @@ public class AlvearyLogicStimulator extends AbstractAlvearyLogic {
|
||||
private StimulatorCircuit[] modifiers;
|
||||
private final IEnergyStorage energyStorage;
|
||||
private final IItemHandlerModifiable inv;
|
||||
private final List<ContainerStimulator> containers = Lists.newArrayList();
|
||||
|
||||
public IItemHandlerModifiable getInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateServer(TileEntityExtraBeesAlvearyPart tile) {
|
||||
@@ -43,6 +55,17 @@ public class AlvearyLogicStimulator extends AbstractAlvearyLogic {
|
||||
this.powerUsage += beeMod.getPowerUsage();
|
||||
}
|
||||
this.powered = energyStorage.extractEnergy(powerUsage, true) >= powerUsage;
|
||||
for (ContainerStimulator c : containers){
|
||||
c.checkPower();
|
||||
}
|
||||
}
|
||||
|
||||
public void onContainerOpened(ContainerStimulator container){
|
||||
containers.add(container);
|
||||
}
|
||||
|
||||
public void onGuiClosed(ContainerStimulator container){
|
||||
containers.remove(container);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -202,4 +225,21 @@ public class AlvearyLogicStimulator extends AbstractAlvearyLogic {
|
||||
return energyStorage;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public GuiContainer getGui(@Nonnull EntityPlayer player, int data) {
|
||||
return new GuiContainerStimulator(getContainer(player, data));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ContainerStimulator getContainer(@Nonnull EntityPlayer player, int data) {
|
||||
return new ContainerStimulator(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,22 @@
|
||||
package binnie.extrabees.alveary;
|
||||
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
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.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -29,6 +35,15 @@ public class BlockAlveary extends Block implements ITileEntityProvider {
|
||||
|
||||
private static final PropertyEnum<AlvearyLogicType> TYPE = PropertyEnum.create("type", AlvearyLogicType.class);
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
TileEntityExtraBeesAlvearyPart tile = TileUtil.getTile(worldIn, pos, TileEntityExtraBeesAlvearyPart.class);
|
||||
if (tile != null && tile.hasGui()){
|
||||
GuiHandler.openGui(playerIn, tile);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(@Nonnull World worldIn, int meta) {
|
||||
|
||||
@@ -53,6 +53,10 @@ public class TileEntityExtraBeesAlvearyPart extends MultiblockTileEntityForestry
|
||||
private AlvearyLogicType type;
|
||||
private AbstractAlvearyLogic alvearyLogic;
|
||||
|
||||
public boolean hasGui(){
|
||||
return alvearyLogic.hasGui();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AbstractAlvearyLogic getAlvearyLogic() {
|
||||
return alvearyLogic;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package binnie.extrabees.apiary;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ComponentBeeModifier extends MachineComponent implements IBeeModifier, IBeeListener {
|
||||
public ComponentBeeModifier(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(final IBeeGenome genome, final 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;
|
||||
}
|
||||
|
||||
public void onQueenChange(final ItemStack queen) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(final int amount) {
|
||||
}
|
||||
|
||||
public void onPostQueenDeath(final IBee queen) {
|
||||
}
|
||||
|
||||
public boolean onEggLaid(final IBee queen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IIndividual individual) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package binnie.extrabees.apiary;
|
||||
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.component.IInteraction;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import binnie.extrabees.client.ExtraBeeGUID;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ComponentExtraBeeGUI extends MachineComponent implements IInteraction.RightClick {
|
||||
ExtraBeeGUID id;
|
||||
|
||||
public ComponentExtraBeeGUI(final Machine machine, final ExtraBeeGUID id) {
|
||||
super(machine);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(final World world, final EntityPlayer player, final BlockPos pos) {
|
||||
GuiHack.INSTANCE.openGui(this.id, player, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package binnie.extrabees.apiary;
|
||||
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.machines.MachineGroup;
|
||||
import binnie.core.machines.inventory.ValidatorSprite;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import binnie.extrabees.circuit.BinnieCircuitLayout;
|
||||
import forestry.api.core.Tabs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ModuleApiary implements IInitializable {
|
||||
|
||||
public static Block blockComponent;
|
||||
public static ValidatorSprite spriteMutator;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
final MachineGroup machineGroup = new MachineGroup(GuiHack.INSTANCE, "alveay", "alveary", AlvearyMachine.values());
|
||||
machineGroup.setCreativeTab(Tabs.tabApiculture);
|
||||
GameRegistry.registerTileEntity(TileExtraBeeAlveary.class, "extrabees.tile.alveary");
|
||||
ModuleApiary.blockComponent = machineGroup.getBlock();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
ModuleApiary.spriteMutator = new ValidatorSprite(GuiHack.INSTANCE, "validator/mutator.0", "validator/mutator.1");
|
||||
}
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
package binnie.extrabees.apiary;
|
||||
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.multiblock.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileExtraBeeAlveary extends TileEntityMachine implements IAlvearyComponent.Active, IAlvearyComponent.BeeModifier, IAlvearyComponent.BeeListener, IBeeListener, IBeeModifier {
|
||||
private IMultiblockLogicAlveary structureLogic;
|
||||
@Nullable
|
||||
private BlockPos min;
|
||||
@Nullable
|
||||
private BlockPos max;
|
||||
|
||||
public TileExtraBeeAlveary() {
|
||||
this.structureLogic = MultiblockManager.logicFactory.createAlvearyLogic();
|
||||
}
|
||||
|
||||
public TileExtraBeeAlveary(final AlvearyMachine.AlvearyPackage alvearyPackage) {
|
||||
super(alvearyPackage);
|
||||
this.structureLogic = MultiblockManager.logicFactory.createAlvearyLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCoordinates() {
|
||||
return getPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
return getMachine().getOwner();
|
||||
}
|
||||
|
||||
public List<TileEntity> getAlvearyBlocks() {
|
||||
LinkedList<TileEntity> tiles = new LinkedList<>();
|
||||
if (min != null && max != null) {
|
||||
for (int x = min.getX(); x <= max.getX(); ++x) {
|
||||
for (int z = min.getZ(); z <= max.getZ(); ++z) {
|
||||
for (int y = min.getY(); y <= max.getY(); ++y) {
|
||||
TileEntity tile = this.getWorld().getTileEntity(new BlockPos(x, y, z));
|
||||
if (tile instanceof IMultiblockComponent) {
|
||||
tiles.add(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled(IMultiblockController arg0, BlockPos min, BlockPos max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineBroken() {
|
||||
this.min = null;
|
||||
this.max = null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMultiblockLogicAlveary getMultiblockLogic() {
|
||||
return structureLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateClient(int arg0) {
|
||||
super.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateServer(int arg0) {
|
||||
super.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
structureLogic.invalidate(world, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
structureLogic.onChunkUnload(world, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
structureLogic.validate(world, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return this.getMachine().getInterface(IBeeModifier.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeListener getBeeListener() {
|
||||
return this.getMachine().getInterface(IBeeListener.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getBeeModifier() == null) ? 1.0f : this.getBeeModifier().getTerritoryModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return (this.getBeeModifier() == null) ? 1.0f : this.getBeeModifier().getMutationModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(final IBeeGenome genome, @Nullable final IBeeGenome mate, final float currentModifier) {
|
||||
return (this.getBeeModifier() == null) ? 1.0f : this.getBeeModifier().getLifespanModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getBeeModifier() == null) ? 1.0f : this.getBeeModifier().getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getBeeModifier() == null) ? 1.0f : this.getBeeModifier().getFloweringModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return this.getBeeModifier() != null && this.getBeeModifier().isSealed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return this.getBeeModifier() != null && this.getBeeModifier().isSelfLighted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return this.getBeeModifier() != null && this.getBeeModifier().isSunlightSimulated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return this.getBeeModifier() != null && this.getBeeModifier().isHellish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
if (this.getBeeListener() != null) {
|
||||
this.getBeeListener().wearOutEquipment(amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath() {
|
||||
if (this.getBeeListener() != null) {
|
||||
this.getBeeListener().onQueenDeath();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IIndividual arg0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound2) {
|
||||
NBTTagCompound nbtTagCompound = super.writeToNBT(nbtTagCompound2);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
structureLogic.writeToNBT(tag);
|
||||
nbtTagCompound.setTag("structureLogic", tag);
|
||||
return nbtTagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
super.readFromNBT(nbtTagCompound);
|
||||
NBTTagCompound tag = nbtTagCompound.getCompoundTag("structureLogic");
|
||||
if (tag != null) {
|
||||
structureLogic.readFromNBT(tag);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
import binnie.extrabees.apiary.ComponentExtraBeeGUI;
|
||||
import binnie.extrabees.apiary.TileExtraBeeAlveary;
|
||||
import binnie.extrabees.client.ExtraBeeGUID;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.multiblock.IAlvearyController;
|
||||
import forestry.api.multiblock.IMultiblockLogicAlveary;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AlvearyFrame {
|
||||
public static int slotFrame = 0;
|
||||
|
||||
public static class PackageAlvearyFrame extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyFrame() {
|
||||
super("frame", ExtraBeeTexture.AlvearyFrame, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyFrame);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(AlvearyFrame.slotFrame, "frame").setValidator(new SlotValidatorFrame());
|
||||
new ComponentFrameModifier(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorFrame extends SlotValidator {
|
||||
public SlotValidatorFrame() {
|
||||
super(SlotValidator.spriteFrame);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(final ItemStack itemStack) {
|
||||
return !itemStack.isEmpty() && itemStack.getItem() instanceof IHiveFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Hive Frames";
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentFrameModifier extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
public ComponentFrameModifier(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wearOutEquipment(final int amount) {
|
||||
IHiveFrame hiveFrame = this.getHiveFrame();
|
||||
if (hiveFrame != null) {
|
||||
final World world = this.getMachine().getTileEntity().getWorld();
|
||||
IBeeRoot beeRoot = Utils.getBeeRoot();
|
||||
IMultiblockLogicAlveary multiblockLogic = ((TileExtraBeeAlveary) this.getMachine().getTileEntity()).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(world).getWearModifier());
|
||||
ItemStack frame = this.getInventory().getStackInSlot(AlvearyFrame.slotFrame);
|
||||
ItemStack frameUsed = hiveFrame.frameUsed(alvearyController, frame, queen, wear);
|
||||
this.getInventory().setInventorySlotContents(AlvearyFrame.slotFrame, frameUsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IHiveFrame getHiveFrame() {
|
||||
ItemStack stackInSlot = this.getInventory().getStackInSlot(AlvearyFrame.slotFrame);
|
||||
if (!stackInSlot.isEmpty()) {
|
||||
return (IHiveFrame) stackInSlot.getItem();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getTerritoryModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getMutationModifier(genome, mate, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(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(final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) {
|
||||
return (this.getHiveFrame() == null) ? 1.0f : this.getHiveFrame().getBeeModifier().getFloweringModifier(genome, currentModifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
import binnie.extrabees.apiary.ComponentExtraBeeGUI;
|
||||
import binnie.extrabees.apiary.TileExtraBeeAlveary;
|
||||
import binnie.extrabees.client.ExtraBeeGUID;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.extrabees.utils.Utils;
|
||||
import forestry.api.apiculture.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class AlvearyHatchery {
|
||||
public static int[] slotLarvae = new int[]{0, 1, 2, 3, 4};
|
||||
|
||||
public static class PackageAlvearyHatchery extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyHatchery() {
|
||||
super("hatchery", ExtraBeeTexture.AlvearyHatchery, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyHatchery);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
for (final InventorySlot slot : inventory.addSlotArray(AlvearyHatchery.slotLarvae, "hatchery")) {
|
||||
slot.setValidator(new SlotValidatorLarvae());
|
||||
}
|
||||
new ComponentFrameModifier(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorLarvae extends SlotValidator {
|
||||
public SlotValidatorLarvae() {
|
||||
super(SlotValidator.spriteBee);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(final ItemStack itemStack) {
|
||||
IBeeRoot beeRoot = Utils.getBeeRoot();
|
||||
return beeRoot.isMember(itemStack) && beeRoot.getType(itemStack) == EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Larvae";
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentFrameModifier extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
public ComponentFrameModifier(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (new Random().nextInt(2400) == 0) {
|
||||
final TileEntity tile = this.getMachine().getTileEntity();
|
||||
if (tile instanceof TileExtraBeeAlveary) {
|
||||
final IBeeHousing house = ((TileExtraBeeAlveary) tile).getMultiblockLogic().getController();
|
||||
if (house != null && !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) {
|
||||
final ItemStack larvae = beeRoot.getMemberStack(beeRoot.getBee(queen.getGenome()), EnumBeeType.LARVAE);
|
||||
new TransferRequest(larvae, this.getInventory()).transfer(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
|
||||
public class AlvearyLighting {
|
||||
public static class PackageAlvearyLighting extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyLighting() {
|
||||
super("lighting", ExtraBeeTexture.AlvearyLighting, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentLighting(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentLighting extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
public ComponentLighting(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.machines.IMachineType;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.MachineRendererBlock;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
import binnie.extrabees.apiary.ModuleApiary;
|
||||
import binnie.extrabees.apiary.TileExtraBeeAlveary;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public enum AlvearyMachine implements IMachineType {
|
||||
Mutator(AlvearyMutator.PackageAlvearyMutator.class),
|
||||
Frame(AlvearyFrame.PackageAlvearyFrame.class),
|
||||
RainShield(AlvearyRainShield.PackageAlvearyRainShield.class),
|
||||
Lighting(AlvearyLighting.PackageAlvearyLighting.class),
|
||||
Stimulator(AlvearyStimulator.PackageAlvearyStimulator.class),
|
||||
Hatchery(AlvearyHatchery.PackageAlvearyHatchery.class),
|
||||
Transmission(AlvearyTransmission.PackageAlvearyTransmission.class);
|
||||
|
||||
Class<? extends MachinePackage> clss;
|
||||
|
||||
AlvearyMachine(final Class<? extends MachinePackage> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends MachinePackage> getPackageClass() {
|
||||
return this.clss;
|
||||
}
|
||||
|
||||
public ItemStack get(final int size) {
|
||||
return new ItemStack(ModuleApiary.blockComponent, size, this.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract static class AlvearyPackage extends MachinePackage {
|
||||
private final IBinnieTexture machineTexture;
|
||||
|
||||
public AlvearyPackage(final String id, final IBinnieTexture machineTexture, final boolean powered) {
|
||||
super(id, powered);
|
||||
this.machineTexture = machineTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileExtraBeeAlveary(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
MachineRendererBlock.instance.renderMachine(this.machineTexture.getTexture(), x, y, z, partialTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
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;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
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;
|
||||
|
||||
public class AlvearyMutator {
|
||||
public static int slotMutator = 0;
|
||||
|
||||
public static class PackageAlvearyMutator extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyMutator() {
|
||||
super("mutator", ExtraBeeTexture.AlvearyMutator, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyMutator);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(AlvearyMutator.slotMutator, "mutator").setValidator(new SlotValidatorMutator());
|
||||
new ComponentMutatorModifier(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorMutator extends SlotValidator {
|
||||
public SlotValidatorMutator() {
|
||||
super(ModuleApiary.spriteMutator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(final ItemStack itemStack) {
|
||||
return AlvearyMutationHandler.isMutationItem(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Mutagenic Agents";
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentMutatorModifier extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
public ComponentMutatorModifier(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) {
|
||||
ItemStack mutator = this.getUtil().getStack(AlvearyMutator.slotMutator);
|
||||
final float mult = AlvearyMutationHandler.getMutationMult(mutator);
|
||||
return Math.min(mult * currentModifier, 15f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostQueenDeath(final IBee queen) {
|
||||
this.getUtil().decreaseStack(AlvearyMutator.slotMutator, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
|
||||
public class AlvearyRainShield {
|
||||
public static class PackageAlvearyRainShield extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyRainShield() {
|
||||
super("rainShield", ExtraBeeTexture.AlvearyRainShield, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentRainShield(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentRainShield extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
public ComponentRainShield(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
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 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 net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlvearyStimulator {
|
||||
public static int slotCircuit = 0;
|
||||
|
||||
public static class PackageAlvearyStimulator extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyStimulator() {
|
||||
super("stimulator", ExtraBeeTexture.AlvearyStimulator, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyStimulator);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
inventory.addSlot(AlvearyStimulator.slotCircuit, "circuit").setValidator(new SlotValidatorCircuit());
|
||||
final ComponentPowerReceptor power = new ComponentPowerReceptor(machine);
|
||||
new ComponentStimulatorModifier(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SlotValidatorCircuit extends SlotValidator {
|
||||
public SlotValidatorCircuit() {
|
||||
super(SlotValidator.spriteCircuit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(final ItemStack itemStack) {
|
||||
return !itemStack.isEmpty() && ChipsetManager.circuitRegistry.isChipset(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return "Forestry Circuits";
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentStimulatorModifier extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
float powerUsage;
|
||||
boolean powered;
|
||||
StimulatorCircuit[] modifiers;
|
||||
|
||||
public ComponentStimulatorModifier(final Machine machine) {
|
||||
super(machine);
|
||||
this.powerUsage = 0.0f;
|
||||
this.powered = false;
|
||||
this.modifiers = new StimulatorCircuit[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
this.modifiers = this.getCircuits();
|
||||
this.powerUsage = 0.0f;
|
||||
for (final StimulatorCircuit beeMod : this.modifiers) {
|
||||
this.powerUsage += beeMod.getPowerUsage();
|
||||
}
|
||||
this.powered = this.getUtil().hasEnergyMJ(this.powerUsage);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ICircuitBoard getHiveFrame() {
|
||||
if (!this.getUtil().isSlotEmpty(AlvearyStimulator.slotCircuit)) {
|
||||
return ChipsetManager.circuitRegistry.getCircuitBoard(this.getUtil().getStack(AlvearyStimulator.slotCircuit));
|
||||
}
|
||||
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(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(final IBeeGenome genome, 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(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(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(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(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) {
|
||||
this.getUtil().useEnergyMJ(this.powerUsage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
|
||||
import binnie.core.craftgui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.power.ComponentPowerReceptor;
|
||||
import binnie.extrabees.apiary.ComponentBeeModifier;
|
||||
import binnie.extrabees.apiary.TileExtraBeeAlveary;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlvearyTransmission {
|
||||
public static class PackageAlvearyTransmission extends AlvearyMachine.AlvearyPackage implements IMachineInformation {
|
||||
public PackageAlvearyTransmission() {
|
||||
super("transmission", ExtraBeeTexture.AlvearyTransmission, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentPowerReceptor(machine, 1000);
|
||||
new ComponentTransmission(machine);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ComponentTransmission extends ComponentBeeModifier implements IBeeModifier, IBeeListener {
|
||||
public ComponentTransmission(final Machine machine) {
|
||||
super(machine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
int energy = this.getUtil().getPoweredMachine().getEnergyStored();
|
||||
if (energy == 0) {
|
||||
return;
|
||||
}
|
||||
final TileExtraBeeAlveary tile = (TileExtraBeeAlveary) this.getMachine().getTileEntity();
|
||||
final List<IEnergyStorage> handlers = new LinkedList<>();
|
||||
for (final TileEntity alvearyTile : tile.getAlvearyBlocks()) {
|
||||
if (alvearyTile != tile && alvearyTile.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH)) {
|
||||
handlers.add(alvearyTile.getCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH));
|
||||
}
|
||||
}
|
||||
if (handlers.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final int maxOutput = 500;
|
||||
int output = energy / handlers.size();
|
||||
if (output > maxOutput) {
|
||||
output = maxOutput;
|
||||
}
|
||||
if (output < 1) {
|
||||
output = 1;
|
||||
}
|
||||
for (final IEnergyStorage handler : handlers) {
|
||||
final int recieved = handler.receiveEnergy(output, false);
|
||||
this.getUtil().getPoweredMachine().receiveEnergy(-recieved, false);
|
||||
energy = this.getUtil().getPoweredMachine().getEnergyStored();
|
||||
if (energy <= 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.extrabees.apiary.machine;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -1,9 +0,0 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.extrabees.apiary;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -1,56 +0,0 @@
|
||||
package binnie.extrabees.client;
|
||||
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.extrabees.client.gui.WindowAlvearyFrame;
|
||||
import binnie.extrabees.client.gui.WindowAlvearyHatchery;
|
||||
import binnie.extrabees.client.gui.WindowAlvearyMutator;
|
||||
import binnie.extrabees.client.gui.WindowAlvearyStimulator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum ExtraBeeGUID implements IBinnieGUID {
|
||||
AlvearyMutator,
|
||||
AlvearyFrame,
|
||||
AlvearyStimulator,
|
||||
AlvearyHatchery;
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
switch (this) {
|
||||
case AlvearyMutator: {
|
||||
window = WindowAlvearyMutator.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case AlvearyFrame: {
|
||||
window = WindowAlvearyFrame.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case AlvearyStimulator: {
|
||||
window = WindowAlvearyStimulator.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
case AlvearyHatchery: {
|
||||
window = WindowAlvearyHatchery.create(player, object, side);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package binnie.extrabees.client;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.apiary.ModuleApiary;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 12-5-2017.
|
||||
*/
|
||||
public class GuiHack extends AbstractMod {
|
||||
|
||||
public static final GuiHack INSTANCE;
|
||||
|
||||
private GuiHack(){
|
||||
proxy = new IProxyCore(){
|
||||
|
||||
@Override
|
||||
public void setMod(AbstractMod mod) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item registerItem(Item item) {
|
||||
return ExtraBees.proxy.registerItem(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block registerBlock(Block block) {
|
||||
return ExtraBees.proxy.registerBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends Block> void registerBlock(B block, ItemBlock itemBlock) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModels() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemAndBlockColors() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(ExtraBees.instance, new binnie.core.gui.BinnieGUIHandler(GuiHack.INSTANCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private IProxyCore proxy;
|
||||
|
||||
public void openGui(final IBinnieGUID ID, final EntityPlayer player, final BlockPos pos) {
|
||||
BinnieCore.getBinnieProxy().openGui(this, ID.ordinal(), player, pos);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void registerModules() {
|
||||
addModule(new ModuleApiary());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public Object getMod() {
|
||||
return ExtraBees.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "EB";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return ExtraBeeGUID.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return ExtraBees.MODID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
INSTANCE = new GuiHack();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package binnie.extrabees.client.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyFrame extends Window {
|
||||
|
||||
public WindowAlvearyFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyFrame(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Frame Housing");
|
||||
ControlPlayerInventory playerInventory = new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 79, 30).assign(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return GuiHack.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBackgroundTextureName() {
|
||||
return "AlvearyFrame";
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package binnie.extrabees.client.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
||||
import binnie.extrabees.apiary.machine.AlvearyHatchery;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyHatchery extends Window {
|
||||
public WindowAlvearyHatchery(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyHatchery(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Hatchery");
|
||||
ControlPlayerInventory playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlotArray.Builder slot = new ControlSlotArray.Builder(this, 43, 30, 5, 1);
|
||||
slot.create(AlvearyHatchery.slotLarvae);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return GuiHack.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBackgroundTextureName() {
|
||||
return "AlvearyHatchery";
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package binnie.extrabees.client.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class WindowAlvearyIndustrialFrame extends Window {
|
||||
public WindowAlvearyIndustrialFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
return new WindowAlvearyIndustrialFrame(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Industrial Frame Housing");
|
||||
ControlPlayerInventory playerInventory = new ControlPlayerInventory(this);
|
||||
new ControlSlot.Builder(this, 79, 30).assign(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return GuiHack.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBackgroundTextureName() {
|
||||
return "AlvearyIndustrialFrame";
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package binnie.extrabees.client.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.geometry.Area;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
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;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
public class WindowAlvearyMutator extends Window {
|
||||
public WindowAlvearyMutator(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 176, player, inventory, side);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyMutator(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Mutator");
|
||||
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 = 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 : AlvearyMutationHandler.getMutagens()) {
|
||||
final ControlItemDisplay display = new ControlItemDisplay(this, x, 66);
|
||||
display.setItemStack(mutagen.getKey());
|
||||
display.hastooltip = true;
|
||||
Float multiplier = mutagen.getValue();
|
||||
|
||||
String format = numberFormat.format(multiplier);
|
||||
display.addTooltip(TextFormatting.GRAY + "Multiplier: " + format + "x");
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return GuiHack.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBackgroundTextureName() {
|
||||
return "AlvearyMutator";
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package binnie.extrabees.client.gui;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.extrabees.apiary.machine.AlvearyStimulator;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WindowAlvearyStimulator extends Window {
|
||||
public WindowAlvearyStimulator(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(176, 144, player, inventory, side);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side) {
|
||||
if (inventory == null) {
|
||||
return null;
|
||||
}
|
||||
return new WindowAlvearyStimulator(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Stimulator");
|
||||
new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT);
|
||||
new ControlSlot.Builder(this, 41, 28).assign(AlvearyStimulator.slotCircuit);
|
||||
new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return GuiHack.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBackgroundTextureName() {
|
||||
return "AlvearyStimulator";
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.extrabees.client.gui;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,59 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import binnie.extrabees.utils.ExtraBeesResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public abstract class AbstractAlvearyContainer extends Container {
|
||||
|
||||
public AbstractAlvearyContainer(EntityPlayer player, IItemHandlerModifiable inv, AlvearyLogicType type, Dimension dimension){
|
||||
this.player = player;
|
||||
this.inv = inv;
|
||||
this.dimension = dimension;
|
||||
String base = "extrabees.machine.alveay."+type.getName();
|
||||
title = ExtraBees.proxy.localise(base+".name");
|
||||
tooltip = ExtraBees.proxy.localise(base+".info");
|
||||
background = new ExtraBeesResourceLocation("textures/gui/gui"+ type.getName()+".png");
|
||||
setupContainer();
|
||||
}
|
||||
|
||||
protected static final Dimension DEFAULT_DIMENSION = new Dimension(176, 144);
|
||||
public final Dimension dimension;
|
||||
protected final EntityPlayer player;
|
||||
protected final IItemHandlerModifiable inv;
|
||||
protected ResourceLocation background;
|
||||
protected int offset = 0;
|
||||
protected String tooltip, title;
|
||||
|
||||
protected abstract void setupContainer();
|
||||
|
||||
protected final void addPlayerInventory(){
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, (84 + this.offset) + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142 + this.offset));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer playerIn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.alveary.AlvearyLogicFrameHousing;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerFrameHousing extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerFrameHousing(EntityPlayer player, AlvearyLogicFrameHousing logic) {
|
||||
super(player, logic.getInventory(), AlvearyLogicType.FRAME, DEFAULT_DIMENSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupContainer() {
|
||||
offset = -21;
|
||||
addPlayerInventory();
|
||||
addSlotToContainer(new SlotItemHandler(inv, 0, 80, 37));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.alveary.AlvearyLogicHatchery;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerHatchery extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerHatchery(EntityPlayer player, AlvearyLogicHatchery logic) {
|
||||
super(player, logic.getInventory(), AlvearyLogicType.HATCHERY, DEFAULT_DIMENSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupContainer() {
|
||||
offset = -21;
|
||||
addPlayerInventory();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
addSlotToContainer(new SlotItemHandler(inv, i, 44 + i * 18, 37));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.alveary.AlvearyLogicMutator;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerMutator extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerMutator(EntityPlayer player, AlvearyLogicMutator logic) {
|
||||
super(player, logic.getInventory(), AlvearyLogicType.MUTATOR, new Dimension(176, 176));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupContainer() {
|
||||
addPlayerInventory();
|
||||
addSlotToContainer(new SlotItemHandler(inv, 0, 81, 29));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.alveary.AlvearyLogicStimulator;
|
||||
import binnie.extrabees.alveary.AlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ContainerListener;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerStimulator extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerStimulator(EntityPlayer player, AlvearyLogicStimulator logic) {
|
||||
super(player, logic.getInventory(), AlvearyLogicType.STIMULATOR, DEFAULT_DIMENSION);
|
||||
this.storage = logic.getEnergyStorage();
|
||||
this.logic = logic;
|
||||
this.maxPower = storage.getMaxEnergyStored();
|
||||
if (!player.world.isRemote){
|
||||
logic.onContainerOpened(this);
|
||||
}
|
||||
}
|
||||
|
||||
private final AlvearyLogicStimulator logic;
|
||||
private final IEnergyStorage storage;
|
||||
protected int power, maxPower;
|
||||
|
||||
@Override
|
||||
protected void setupContainer() {
|
||||
offset = -21;
|
||||
addPlayerInventory();
|
||||
title = "Stimulator";
|
||||
addSlotToContainer(new SlotItemHandler(inv, 0, 44, 37));
|
||||
}
|
||||
|
||||
public void checkPower(){
|
||||
if (power != storage.getEnergyStored()){
|
||||
for (IContainerListener listener : listeners){
|
||||
listener.sendProgressBarUpdate(this, 9, power = storage.getEnergyStored());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer playerIn) {
|
||||
super.onContainerClosed(playerIn);
|
||||
logic.onGuiClosed(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int id, int data) {
|
||||
if (id == 9){
|
||||
power = data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.utils.ExtraBeesResourceLocation;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiContainerAlvearyPart extends GuiContainer {
|
||||
|
||||
public GuiContainerAlvearyPart(AbstractAlvearyContainer container) {
|
||||
super(container);
|
||||
this.container = container;
|
||||
font = Minecraft.getMinecraft().fontRendererObj;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
protected FontRenderer font;
|
||||
protected AbstractAlvearyContainer container;
|
||||
private int titleS = -1;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(container.background);
|
||||
if (titleS == -1){
|
||||
titleS = (i + (xSize / 2)) - (font.getStringWidth(container.title) / 2);
|
||||
}
|
||||
|
||||
drawTexturedModalRect(i, j, 0, 0, container.dimension.width, container.dimension.height);
|
||||
font.drawString(container.title, titleS, j + 8, Color.DARK_GRAY.getRGB());
|
||||
if (mouseX > i + 6 && mouseX < i + 23 && mouseY > j + 5 && mouseY < j + 22){
|
||||
GuiUtils.drawHoveringText(Lists.newArrayList(container.tooltip), mouseX, mouseY, width, height, 150, font);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import binnie.extrabees.utils.AlvearyMutationHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class GuiContainerMutator extends GuiContainerAlvearyPart {
|
||||
|
||||
public GuiContainerMutator(AbstractAlvearyContainer container) {
|
||||
super(container);
|
||||
mutagens = "Possible Mutagens:";
|
||||
}
|
||||
|
||||
private String mutagens;
|
||||
private int titleS = -1;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
int mid = i + (xSize / 2);
|
||||
if (titleS == -1){
|
||||
titleS = mid - (font.getStringWidth(mutagens) / 2);
|
||||
}
|
||||
font.drawString(mutagens, titleS, j + 50, Color.DARK_GRAY.getRGB());
|
||||
int gens = AlvearyMutationHandler.getMutagens().size();
|
||||
int width = gens * 18;
|
||||
int w2 = width / 2;
|
||||
int q = 0;
|
||||
for (final Pair<ItemStack, Float> mutagen : AlvearyMutationHandler.getMutagens()) {
|
||||
Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(mutagen.getLeft(), mid - w2 + q * 18, j + 62);
|
||||
q++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package binnie.extrabees.client.gui2;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class GuiContainerStimulator extends GuiContainerAlvearyPart {
|
||||
|
||||
public GuiContainerStimulator(ContainerStimulator container) {
|
||||
super(container);
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
private ContainerStimulator container;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(container.background);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
float fill = container.power / (float) container.maxPower;
|
||||
float bar = fill * 70;
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
drawTexturedModalRect(i + 71, j + 38, 0, 185, (int) bar, 14);
|
||||
drawTexturedModalRect(i + 71, j + 38, 0, 165, 70, 14);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public final class BlockRegister {
|
||||
public static void preInitBlocks(){
|
||||
registerHives();
|
||||
registerMisc();
|
||||
//ExtraBees.alveary = ExtraBees.proxy.registerBlock(new BlockAlveary());
|
||||
ExtraBees.alveary = ExtraBees.proxy.registerBlock(new BlockAlveary());
|
||||
GameRegistry.registerTileEntity(TileEntityExtraBeesAlvearyPart.class, "TileEntityExtraBeesAlvearyPart");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class ItemRegister {
|
||||
|
||||
@SuppressWarnings("all")
|
||||
private static void registerMisc(){
|
||||
Item /*i; = GameRegistry.register(new ItemBlock(ExtraBees.alveary){
|
||||
Item i = GameRegistry.register(new ItemBlock(ExtraBees.alveary){
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
@@ -49,7 +49,7 @@ public final class ItemRegister {
|
||||
}.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);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package binnie.extrabees.init;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMachine;
|
||||
import binnie.extrabees.circuit.AlvearySimulatorCircuitType;
|
||||
import binnie.extrabees.items.types.*;
|
||||
import binnie.extrabees.circuit.BinnieCircuitLayout;
|
||||
@@ -48,13 +47,13 @@ public final class RecipeRegister {
|
||||
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"));
|
||||
//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);
|
||||
|
||||
@@ -11,7 +11,7 @@ import binnie.core.craftgui.events.EventWidget;
|
||||
import binnie.core.craftgui.geometry.Point;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -4,7 +4,7 @@ import binnie.Binnie;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.database.*;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.extrabees.client.GuiHack;
|
||||
import binnie.genetics.Genetics;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -13,16 +13,16 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.overview", 0));
|
||||
new PageSpeciesClassification(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.classification", 0));
|
||||
new PageSpeciesGenome(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.genome", 0));
|
||||
new PageSpeciesProducts(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.products", 0));
|
||||
new PageSpeciesClimate(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.climate", 0));
|
||||
new PageSpeciesResultant(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.resultant", 0));
|
||||
new PageSpeciesMutations(this.getInfoPages(Mode.SPECIES), new DatabaseTab(GuiHack.INSTANCE, "species.further", 0));
|
||||
new PageBranchOverview(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(GuiHack.INSTANCE, "branches.overview", 0));
|
||||
new PageBranchSpecies(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(GuiHack.INSTANCE, "branches.species", 0));
|
||||
new PageBreeder(this.getInfoPages(Mode.BREEDER), this.getUsername(), new DatabaseTab(GuiHack.INSTANCE, "breeder", 0));
|
||||
new PageSpeciesOverview(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.overview", 0));
|
||||
new PageSpeciesClassification(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.classification", 0));
|
||||
new PageSpeciesGenome(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.genome", 0));
|
||||
new PageSpeciesProducts(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.products", 0));
|
||||
new PageSpeciesClimate(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.climate", 0));
|
||||
new PageSpeciesResultant(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.resultant", 0));
|
||||
new PageSpeciesMutations(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.further", 0));
|
||||
new PageBranchOverview(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.overview", 0));
|
||||
new PageBranchSpecies(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.species", 0));
|
||||
new PageBreeder(this.getInfoPages(Mode.BREEDER), this.getUsername(), new DatabaseTab(Genetics.instance, "breeder", 0));
|
||||
}
|
||||
|
||||
public WindowApiaristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
@@ -35,7 +35,7 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase {
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return GuiHack.INSTANCE;
|
||||
return Genetics.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.control.*;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.craftgui.WindowMachine;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -8,7 +8,7 @@ import binnie.core.craftgui.minecraft.control.*;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.craftgui.window.Panel;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.core.GeneticsTexture;
|
||||
import binnie.genetics.machine.craftgui.WindowMachine;
|
||||
|
||||
@@ -6,7 +6,7 @@ import binnie.core.craftgui.minecraft.GUIIcon;
|
||||
import binnie.core.craftgui.minecraft.control.*;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.craftgui.WindowMachine;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -6,7 +6,7 @@ import binnie.core.craftgui.minecraft.GUIIcon;
|
||||
import binnie.core.craftgui.minecraft.control.*;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.craftgui.WindowMachine;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -10,7 +10,7 @@ import binnie.core.craftgui.minecraft.GUIIcon;
|
||||
import binnie.core.craftgui.minecraft.control.*;
|
||||
import binnie.core.craftgui.resource.Texture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.client.ExtraBeeTexture;
|
||||
import binnie.core.ExtraBeeTexture;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.machine.craftgui.WindowMachine;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
Reference in new issue
Block a user