mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 12:42:53 +00:00
* Improve the code * Code improve in binnie.core.utils package * Code improve in binnie.core.triggers package * Code improve in binnie.core.resource package * Code improve in binnie.core.proxy package * Code improve readability in binnie.core package * Add missed constructors * Some improve code readabilty * Expand import with * * Revert "Expand import with *" This reverts commit 3bb4a44f3b69a8559bd5753337e0f6793ad18dc4. * Fix using fully qualified names in imports * Fix missed unnessesary "this." * Removed binnie.craftgui package Optimised imports and removed unnessesary "this." * Some refactoring code in binnie.core.craftgui package * Merge from master1.7.10 * Improve code readability in binnie.core.craftgui.database package * Improve code readability in binnie.core.craftgui.events package * Improve code readability in binnie.core.craftgui.geometry package * Improve code readability in binnie.core.craftgui.* package
116 lines
4.1 KiB
Java
116 lines
4.1 KiB
Java
//
|
|
// Decompiled by Procyon v0.5.30
|
|
//
|
|
|
|
package binnie.extrabees.apiary.machine;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
|
|
import forestry.api.apiculture.IBee;
|
|
import forestry.api.apiculture.IBeeGenome;
|
|
import forestry.api.apiculture.IBeeListener;
|
|
import forestry.api.apiculture.IBeeModifier;
|
|
import forestry.api.apiculture.IHiveFrame;
|
|
import binnie.Binnie;
|
|
import binnie.core.machines.Machine;
|
|
import binnie.core.machines.inventory.ComponentInventorySlots;
|
|
import binnie.core.machines.inventory.SlotValidator;
|
|
import binnie.core.craftgui.minecraft.IMachineInformation;
|
|
import binnie.extrabees.apiary.ComponentBeeModifier;
|
|
import binnie.extrabees.apiary.ComponentExtraBeeGUI;
|
|
import binnie.extrabees.apiary.TileExtraBeeAlveary;
|
|
import binnie.extrabees.core.ExtraBeeGUID;
|
|
import binnie.extrabees.core.ExtraBeeTexture;
|
|
|
|
public class AlvearyFrame
|
|
{
|
|
public static int slotFrame;
|
|
|
|
static {
|
|
AlvearyFrame.slotFrame = 0;
|
|
}
|
|
|
|
public static class PackageAlvearyFrame extends AlvearyMachine.AlvearyPackage implements IMachineInformation
|
|
{
|
|
public PackageAlvearyFrame() {
|
|
super("frame", ExtraBeeTexture.AlvearyFrame.getTexture(), false);
|
|
}
|
|
|
|
@Override
|
|
public void createMachine(final Machine machine) {
|
|
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyFrame);
|
|
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
|
inventory.addSlot(AlvearyFrame.slotFrame, "frame");
|
|
inventory.getSlot(AlvearyFrame.slotFrame).setValidator(new SlotValidatorFrame());
|
|
new ComponentFrameModifier(machine);
|
|
}
|
|
}
|
|
|
|
public static class SlotValidatorFrame extends SlotValidator
|
|
{
|
|
public SlotValidatorFrame() {
|
|
super(SlotValidator.IconFrame);
|
|
}
|
|
|
|
@Override
|
|
public boolean isValid(final ItemStack itemStack) {
|
|
return itemStack != null && 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) {
|
|
if (this.getHiveFrame() == null) {
|
|
return;
|
|
}
|
|
final World world = this.getMachine().getTileEntity().getWorldObj();
|
|
final int wear = Math.round(amount * 5 * Binnie.Genetics.getBeeRoot().getBeekeepingMode(world).getWearModifier());
|
|
this.getInventory().setInventorySlotContents(AlvearyFrame.slotFrame, this.getHiveFrame().frameUsed(((TileExtraBeeAlveary) this.getMachine().getTileEntity()).getMultiblockLogic().getController(), this.getInventory().getStackInSlot(AlvearyFrame.slotFrame), (IBee) null, wear));
|
|
}
|
|
|
|
public IHiveFrame getHiveFrame() {
|
|
if (this.getInventory().getStackInSlot(AlvearyFrame.slotFrame) != null) {
|
|
return (IHiveFrame) this.getInventory().getStackInSlot(AlvearyFrame.slotFrame).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, 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);
|
|
}
|
|
}
|
|
}
|