mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 23:46:05 +00:00
Begin adding stricter null annotations to prepare for 1.11
This commit is contained in:
1 parent
4140ba7d7f
commit
16b955b443
330 files changed
+2302
-921
No files matched your search
@@ -4,7 +4,7 @@ import binnie.Constants;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import binnie.botany.ceramic.BlockStainedGlass;
|
||||
@@ -57,9 +57,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@Mod(modid = Constants.BOTANY_MOD_ID, name = "Binnie's Botany", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID)
|
||||
public class Botany extends AbstractMod {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Mod.Instance(Constants.BOTANY_MOD_ID)
|
||||
public static Botany instance;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
|
||||
@@ -255,7 +257,7 @@ public class Botany extends AbstractMod {
|
||||
World world = event.getWorld();
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (!BinnieCore.proxy.isSimulating(event.getWorld())) {
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(event.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IA
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getFlowerColour(EnumFlowerStage type, int renderPass);
|
||||
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getFlowerModel(EnumFlowerStage type, boolean flowered);
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api.gardening;
|
||||
package binnie.botany.api;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
@@ -7,10 +7,8 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public interface IFlowerFactory {
|
||||
|
||||
@Nonnull
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(@Nonnull String uid, @Nonnull String unlocalizedName, @Nonnull String authority, @Nonnull String unlocalizedDescription, boolean isDominant, @Nonnull IClassification branch, @Nonnull String binomial, @Nonnull IFlowerType flowerType);
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||
|
||||
@Nonnull
|
||||
IFlowerMutationBuilder createMutation(@Nonnull IAlleleFlowerSpecies parentFlower0, @Nonnull IAlleleFlowerSpecies parentFlower1, @Nonnull IAllele[] result, int chance);
|
||||
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies parentFlower0, IAlleleFlowerSpecies parentFlower1, IAllele[] result, int chance);
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,6 +39,7 @@ public interface IFlowerRoot extends ISpeciesRoot {
|
||||
|
||||
void addConversion(ItemStack memberStack, IAllele[] template);
|
||||
|
||||
@Nullable
|
||||
IFlower getConversion(ItemStack memberStack);
|
||||
|
||||
Collection<IColourMix> getColourMixes(boolean p0);
|
||||
|
||||
@@ -13,7 +13,6 @@ public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
|
||||
@Nonnull
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getModel(EnumFlowerStage type, boolean flowered);
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -57,7 +57,7 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CeramicTileRecipe implements IRecipe {
|
||||
ItemStack cached;
|
||||
@Nullable
|
||||
private ItemStack cached;
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
||||
@@ -68,9 +70,8 @@ public class CeramicTileRecipe implements IRecipe {
|
||||
return this.cached;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(@Nonnull InventoryCrafting inv) {
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class PigmentRecipe implements IRecipe {
|
||||
@Override
|
||||
public boolean matches(@Nonnull final InventoryCrafting crafting, @Nonnull final World world) {
|
||||
public boolean matches(final InventoryCrafting crafting, final World world) {
|
||||
return this.getCraftingResult(crafting) != null;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PigmentRecipe implements IRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(@Nonnull final InventoryCrafting crafting) {
|
||||
public ItemStack getCraftingResult(final InventoryCrafting crafting) {
|
||||
int n = 0;
|
||||
ItemStack stack = null;
|
||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||
@@ -47,9 +47,8 @@ public class PigmentRecipe implements IRecipe {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(@Nonnull InventoryCrafting inv) {
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
||||
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -78,7 +79,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
@@ -228,7 +229,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite(CeramicBrickPair type, EnumFacing facing, int pass) {
|
||||
public TextureAtlasSprite getSprite(CeramicBrickPair type, @Nullable EnumFacing facing, int pass) {
|
||||
return type.getSprite(pass);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum CeramicBrickType implements IStringSerializable {
|
||||
Tile("tile", "Ceramic Tile"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -49,18 +52,21 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
},
|
||||
Brick("brick", "Ceramic Bricks"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getBrickRecipe(this, stacks);
|
||||
}
|
||||
},
|
||||
StripeBrick("brickstripe", "Striped Ceramic Bricks"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getBrickRecipe(this, stacks);
|
||||
}
|
||||
},
|
||||
LargeBrick("bricklarge", "Large Ceramic Bricks"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() == 1) {
|
||||
@@ -110,6 +116,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
},
|
||||
Split("split", "Split Ceramic Tile"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -138,6 +145,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
},
|
||||
Chequered("cheque", "Chequered Ceramic Tile"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -168,6 +176,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
},
|
||||
Mixed("mixed", "Mixed Ceramic Tile"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
@@ -207,18 +216,21 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
},
|
||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
},
|
||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
},
|
||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks"){
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
@@ -244,9 +256,11 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
public boolean canDouble() {
|
||||
return this != CeramicBrickType.Tile;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public abstract ItemStack getRecipe(List<ItemStack> stacks);
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getVerticalBrickRecipe(List<ItemStack> stacks){
|
||||
if (stacks.size() != 1) {
|
||||
return null;
|
||||
@@ -267,7 +281,8 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getBrickRecipe(CeramicBrickType ceramicType, List<ItemStack> stacks){
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.ceramic.brick;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -10,10 +10,11 @@ import binnie.craftgui.core.Tooltip;
|
||||
import binnie.craftgui.core.renderer.RenderUtil;
|
||||
|
||||
public class ControlColourDisplay extends Control implements IControlValue<IFlowerColour>, ITooltip {
|
||||
IFlowerColour value;
|
||||
private IFlowerColour value;
|
||||
|
||||
public ControlColourDisplay(final IWidget parent, final int x, final int y) {
|
||||
public ControlColourDisplay(final IWidget parent, final int x, final int y, final IFlowerColour value) {
|
||||
super(parent, x, y, 16, 16);
|
||||
this.value = value;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,23 @@
|
||||
package binnie.botany.craftgui;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.craftgui.controls.listbox.ControlList;
|
||||
import binnie.craftgui.controls.listbox.ControlOption;
|
||||
import binnie.craftgui.mod.database.WindowAbstractDatabase;
|
||||
|
||||
public class ControlColourMixItem extends ControlOption<IColourMix> {
|
||||
ControlColourDisplay itemWidget1;
|
||||
ControlColourDisplay itemWidget2;
|
||||
ControlColourDisplay itemWidget3;
|
||||
ControlColourMixSymbol addSymbol;
|
||||
ControlColourMixSymbol arrowSymbol;
|
||||
private final ControlColourDisplay itemWidget1;
|
||||
private final ControlColourDisplay itemWidget2;
|
||||
private final ControlColourDisplay itemWidget3;
|
||||
private final ControlColourMixSymbol addSymbol;
|
||||
private final ControlColourMixSymbol arrowSymbol;
|
||||
|
||||
public ControlColourMixItem(final ControlList<IColourMix> controlList, final IColourMix option, final int y) {
|
||||
super(controlList, option, y);
|
||||
this.itemWidget1 = new ControlColourDisplay(this, 4, 4);
|
||||
this.itemWidget2 = new ControlColourDisplay(this, 44, 4);
|
||||
this.itemWidget3 = new ControlColourDisplay(this, 104, 4);
|
||||
this.addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||
this.arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||
final BreedingSystem system = ((WindowAbstractDatabase) this.getSuperParent()).getBreedingSystem();
|
||||
if (this.getValue() != null) {
|
||||
this.itemWidget1.setValue(this.getValue().getColourFirst());
|
||||
this.itemWidget2.setValue(this.getValue().getColourSecond());
|
||||
this.itemWidget3.setValue(this.getValue().getResult());
|
||||
this.addSymbol.setValue(this.getValue());
|
||||
this.arrowSymbol.setValue(this.getValue());
|
||||
}
|
||||
IColourMix value = this.getValue();
|
||||
this.itemWidget1 = new ControlColourDisplay(this, 4, 4, value.getColourFirst());
|
||||
this.itemWidget2 = new ControlColourDisplay(this, 44, 4, value.getColourSecond());
|
||||
this.itemWidget3 = new ControlColourDisplay(this, 104, 4, value.getResult());
|
||||
this.addSymbol = new ControlColourMixSymbol(this, 24, 4, 0, value);
|
||||
this.arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1, value);
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,9 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
}
|
||||
}
|
||||
|
||||
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type) {
|
||||
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColourMix value) {
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
this.value = null;
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ControlColourOption extends ControlTextOption<IFlowerColour> {
|
||||
public ControlColourOption(final ControlList<IFlowerColour> controlList, final IFlowerColour option, final int y) {
|
||||
super(controlList, option, option.getColourName(), y);
|
||||
this.setSize(new IPoint(this.getSize().x(), 20));
|
||||
(this.controlBee = new ControlColourDisplay(this, 2, 2)).setValue(option);
|
||||
this.controlBee = new ControlColourDisplay(this, 2, 2, option);
|
||||
this.addAttribute(Attribute.MouseOver);
|
||||
CraftGUIUtil.moveWidget(this.textWidget, new IPoint(22, 0));
|
||||
this.textWidget.setSize(this.textWidget.getSize().sub(new IPoint(24, 0)));
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.craftgui;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -5,7 +5,7 @@ import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.farm;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -110,7 +110,7 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
final TileEntity flower = world.getTileEntity(pos);
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
@@ -258,7 +258,7 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
final List<ItemStack> drops = this.getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
final boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (final ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import forestry.core.items.IColoredItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -103,7 +104,7 @@ public class ItemBotany extends Item implements IColoredItem, IItemModelRegister
|
||||
list.add(TextFormatting.YELLOW + colorInfo.replaceAll("%PRIMARY", primaryColor).replaceAll("%SECONDARY", secondaryColor).replaceAll("%STEM", stemColor));
|
||||
|
||||
if (individual.isAnalyzed()) {
|
||||
if (BinnieCore.proxy.isShiftDown()) {
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
individual.addTooltip(list);
|
||||
} else {
|
||||
list.add(TextFormatting.ITALIC + "<" + Binnie.LANGUAGE.localise("for.gui.tooltip.tmi") + ">");
|
||||
|
||||
@@ -312,7 +312,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
||||
|
||||
public void setSection(final int i) {
|
||||
this.section = i;
|
||||
if (BinnieCore.proxy.isSimulating(this.worldObj)) {
|
||||
if (BinnieCore.getBinnieProxy().isSimulating(this.worldObj)) {
|
||||
this.updateRender(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -3,7 +3,7 @@ package binnie.botany.gardening;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@@ -6,7 +6,7 @@ import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@@ -5,7 +5,7 @@ import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.BinnieCore;
|
||||
@@ -114,7 +114,7 @@ public class Gardening {
|
||||
}
|
||||
|
||||
public static void tryGrowSection(final World world, final BlockPos pos) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
final TileEntity flower = world.getTileEntity(pos);
|
||||
|
||||
@@ -4,7 +4,7 @@ import binnie.Binnie;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
@@ -49,7 +49,7 @@ public class ItemSoilMeter extends Item implements IItemModelRegister {
|
||||
pos = pos.down();
|
||||
block = world.getBlockState(pos).getBlock();
|
||||
}
|
||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||
if (Gardening.isSoil(block) && !BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
String info = Binnie.LANGUAGE.localise("botany.soil.type") + ": ";
|
||||
info = info + soil.getType(world, pos).getTranslated(true);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ModuleGardening implements IInitializable {
|
||||
Botany.proxy.registerItem(Botany.clay);
|
||||
Botany.ceramic = new BlockCeramic();
|
||||
Botany.proxy.registerBlock(Botany.ceramic, new ItemCeramic(Botany.ceramic));
|
||||
BinnieCore.proxy.registerTileEntity(TileCeramic.class, "botany.tile.ceramic");
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramic.class, "botany.tile.ceramic");
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
Botany.stained = new BlockStainedGlass();
|
||||
Botany.proxy.registerBlock(Botany.stained, new ItemStainedGlass(Botany.stained));
|
||||
@@ -94,7 +94,7 @@ public class ModuleGardening implements IInitializable {
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
Botany.proxy.registerBlock(Botany.ceramicBrick, new ItemCeramicBrick(Botany.ceramicBrick));
|
||||
GameRegistry.registerTileEntity(TileCeramicBrick.class, "");
|
||||
BinnieCore.proxy.registerTileEntity(TileCeramicBrick.class, "botany.tile.ceramicBrick");
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramicBrick.class, "botany.tile.ceramicBrick");
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -20,22 +20,19 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerSpecies, IAlleleFlowerSpeciesBuilder {
|
||||
|
||||
@Nonnull
|
||||
private final IFlowerType flowerType;
|
||||
@Nonnull
|
||||
private EnumAcidity acidity = EnumAcidity.Neutral;
|
||||
@Nonnull
|
||||
private EnumMoisture moisture = EnumMoisture.Normal;
|
||||
|
||||
public AlleleFlowerSpecies(
|
||||
@Nonnull String uid,
|
||||
@Nonnull String unlocalizedName,
|
||||
@Nonnull String authority,
|
||||
@Nonnull String unlocalizedDescription,
|
||||
String uid,
|
||||
String unlocalizedName,
|
||||
String authority,
|
||||
String unlocalizedDescription,
|
||||
boolean isDominant,
|
||||
@Nonnull IClassification branch,
|
||||
@Nonnull String binomial,
|
||||
@Nonnull IFlowerType flowerType) {
|
||||
IClassification branch,
|
||||
String binomial,
|
||||
IFlowerType flowerType) {
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial);
|
||||
this.flowerType = flowerType;
|
||||
}
|
||||
@@ -58,7 +55,6 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISpeciesRoot getRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
|
||||
@@ -16,6 +16,7 @@ import forestry.core.genetics.Individual;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -23,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Flower extends Individual implements IFlower {
|
||||
@Nonnull
|
||||
public IFlowerGenome genome;
|
||||
@Nullable
|
||||
public IFlowerGenome mate;
|
||||
@@ -31,34 +31,29 @@ public class Flower extends Individual implements IFlower {
|
||||
private boolean wilting;
|
||||
private boolean flowered;
|
||||
|
||||
public Flower(@Nonnull final NBTTagCompound nbt) {
|
||||
public Flower(final NBTTagCompound nbt) {
|
||||
super(nbt);
|
||||
if (nbt == null) {
|
||||
this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
return;
|
||||
}
|
||||
|
||||
if (nbt.hasKey("Age")) {
|
||||
this.age = nbt.getInteger("Age");
|
||||
} else {
|
||||
this.age = 0;
|
||||
}
|
||||
if (nbt.hasKey("Wilt")) {
|
||||
this.wilting = nbt.getBoolean("Wilt");
|
||||
} else {
|
||||
this.wilting = false;
|
||||
}
|
||||
|
||||
this.wilting = nbt.hasKey("Wilt") && nbt.getBoolean("Wilt");
|
||||
|
||||
if (nbt.hasKey("Flowered")) {
|
||||
this.flowered = nbt.getBoolean("Flowered");
|
||||
} else {
|
||||
if (age > 0) {
|
||||
this.flowered = true;
|
||||
} else {
|
||||
this.flowered = false;
|
||||
}
|
||||
this.flowered = age > 0;
|
||||
}
|
||||
|
||||
if (nbt.hasKey("Genome")) {
|
||||
this.genome = new FlowerGenome(nbt.getCompoundTag("Genome"));
|
||||
} else {
|
||||
this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
}
|
||||
|
||||
if (nbt.hasKey("Mate")) {
|
||||
this.mate = new FlowerGenome(nbt.getCompoundTag("Mate"));
|
||||
}
|
||||
@@ -69,20 +64,13 @@ public class Flower extends Individual implements IFlower {
|
||||
this.wilting = false;
|
||||
this.genome = genome;
|
||||
this.age = age;
|
||||
if (age > 0) {
|
||||
this.flowered = true;
|
||||
} else {
|
||||
this.flowered = false;
|
||||
}
|
||||
this.flowered = age > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
final IAlleleFlowerSpecies species = this.getGenome().getPrimary();
|
||||
String name = "";
|
||||
if (species != null) {
|
||||
name += species.getName();
|
||||
}
|
||||
String name = species.getName();
|
||||
if (this.age == 0) {
|
||||
name += "";
|
||||
}
|
||||
@@ -114,15 +102,13 @@ public class Flower extends Individual implements IFlower {
|
||||
nbttagcompound.setInteger("Age", this.age);
|
||||
nbttagcompound.setBoolean("Wilt", this.wilting);
|
||||
nbttagcompound.setBoolean("Flowered", this.flowered);
|
||||
if (this.genome != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.genome.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Genome", NBTmachine);
|
||||
}
|
||||
final NBTTagCompound nbtGenome = new NBTTagCompound();
|
||||
this.genome.writeToNBT(nbtGenome);
|
||||
nbttagcompound.setTag("Genome", nbtGenome);
|
||||
if (this.mate != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.mate.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Mate", NBTmachine);
|
||||
final NBTTagCompound nbtMate = new NBTTagCompound();
|
||||
this.mate.writeToNBT(nbtMate);
|
||||
nbttagcompound.setTag("Mate", nbtMate);
|
||||
}
|
||||
return nbttagcompound;
|
||||
}
|
||||
@@ -157,6 +143,7 @@ public class Flower extends Individual implements IFlower {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IFlowerGenome getMate() {
|
||||
return this.mate;
|
||||
}
|
||||
@@ -217,17 +204,21 @@ public class Flower extends Individual implements IFlower {
|
||||
|
||||
@Override
|
||||
public IFlower getOffspring(final World world, final BlockPos pos) {
|
||||
final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length];
|
||||
IChromosome[] parentFirst = this.genome.getChromosomes();
|
||||
IChromosome[] parentSecond = this.mate.getChromosomes();
|
||||
parentFirst = this.mutateSpecies(world, pos, this.genome, this.mate);
|
||||
parentSecond = this.mutateSpecies(world, pos, this.mate, this.genome);
|
||||
for (int i = 0; i < parentFirst.length; ++i) {
|
||||
if (parentFirst[i] != null && parentSecond[i] != null) {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parentFirst[i], parentSecond[i]);
|
||||
if (this.mate != null) {
|
||||
final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length];
|
||||
IChromosome[] parentFirst = this.mutateSpecies(world, pos, this.genome, this.mate);
|
||||
IChromosome[] parentSecond = this.mutateSpecies(world, pos, this.mate, this.genome);
|
||||
for (int i = 0; i < parentFirst.length; ++i) {
|
||||
if (parentFirst[i] != null && parentSecond[i] != null) {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parentFirst[i], parentSecond[i]);
|
||||
}
|
||||
}
|
||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||
} else {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
return new Flower(nbt);
|
||||
}
|
||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||
}
|
||||
|
||||
private IChromosome[] mutateSpecies(World world, BlockPos pos, IFlowerGenome genomeFirst, IFlowerGenome genomeSecond) {
|
||||
|
||||
@@ -52,16 +52,16 @@ public class FlowerBreedingSystem extends BreedingSystem {
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumFlowerChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -254,6 +255,7 @@ public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IFlower getConversion(final ItemStack itemstack) {
|
||||
for (final Map.Entry<ItemStack, IFlower> entry : this.conversions.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(itemstack)) {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ModuleGenetics implements IInitializable {
|
||||
|
||||
Botany.flower = new BlockFlower();
|
||||
Botany.proxy.registerBlock(Botany.flower);
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
|
||||
Botany.flowerItem = new ItemBotany("itemFlower", EnumFlowerStage.FLOWER, "");
|
||||
Botany.pollen = new ItemBotany("pollen", EnumFlowerStage.POLLEN, "pollen");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.items;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -22,7 +22,7 @@ public enum PacketID implements IPacketID {
|
||||
if (this == PacketID.FIELDKIT && context.side == Side.CLIENT) {
|
||||
MessageNBT packet = new MessageNBT(message);
|
||||
NBTTagCompound data = packet.getTagCompound();
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer();
|
||||
String info = "";
|
||||
if (data.hasNoTags()) {
|
||||
info += Binnie.LANGUAGE.localise("botany.flowers.species.not.discover");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.network;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.proxy;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -7,15 +7,18 @@ import binnie.core.network.IPacketID;
|
||||
import binnie.core.network.IPacketProvider;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
@Nullable
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
protected List<IInitializable> modules;
|
||||
|
||||
@@ -50,6 +53,7 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
public abstract String getModID();
|
||||
|
||||
public SimpleNetworkWrapper getNetworkWrapper() {
|
||||
Preconditions.checkState(wrapper != null, "Tried to get network wrapper before it has been init.");
|
||||
return this.wrapper;
|
||||
}
|
||||
|
||||
@@ -80,7 +84,8 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
return;
|
||||
}
|
||||
this.getProxy().init();
|
||||
(this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(this.getChannel())).registerMessage(this.getPacketHandler(), MessageBinnie.class, 1, Side.CLIENT);
|
||||
this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(this.getChannel());
|
||||
this.wrapper.registerMessage(this.getPacketHandler(), MessageBinnie.class, 1, Side.CLIENT);
|
||||
this.wrapper.registerMessage(this.getPacketHandler(), MessageBinnie.class, 1, Side.SERVER);
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.init();
|
||||
|
||||
@@ -19,10 +19,13 @@ import binnie.core.models.ModelManager;
|
||||
import binnie.core.network.BinnieCorePacketID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.BinnieModProxy;
|
||||
import binnie.core.proxy.BinnieProxy;
|
||||
import binnie.core.proxy.IBinnieModProxy;
|
||||
import binnie.core.proxy.IBinnieProxy;
|
||||
import binnie.core.triggers.ModuleTrigger;
|
||||
import binnie.craftgui.minecraft.ModuleCraftGUI;
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.plugins.PluginManager;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -45,6 +48,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -55,15 +59,54 @@ public final class BinnieCore extends AbstractMod {
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Mod.Instance(Constants.CORE_MOD_ID)
|
||||
public static BinnieCore instance;
|
||||
private static BinnieCore instance;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "binnie.core.proxy.BinnieProxyClient", serverSide = "binnie.core.proxy.BinnieProxyServer")
|
||||
public static BinnieProxy proxy;
|
||||
private static BinnieProxy proxy;
|
||||
|
||||
public static int multipassRenderID;
|
||||
private static List<AbstractMod> modList = new ArrayList<>();
|
||||
public static MachineGroup packageCompartment;
|
||||
public static ItemGenesis genesis;
|
||||
public static ItemFieldKit fieldKit;
|
||||
private static final List<AbstractMod> modList = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
private static MachineGroup packageCompartment;
|
||||
@Nullable
|
||||
private static ItemGenesis genesis;
|
||||
@Nullable
|
||||
private static ItemFieldKit fieldKit;
|
||||
|
||||
public static MachineGroup getPackageCompartment() {
|
||||
Preconditions.checkState(packageCompartment != null, "packageCompartment has not been init");
|
||||
return packageCompartment;
|
||||
}
|
||||
|
||||
public static void setPackageCompartment(MachineGroup packageCompartment) {
|
||||
BinnieCore.packageCompartment = packageCompartment;
|
||||
}
|
||||
|
||||
public static ItemGenesis getGenesis() {
|
||||
Preconditions.checkState(genesis != null, "genesis has not been init");
|
||||
return genesis;
|
||||
}
|
||||
|
||||
public static void setGenesis(ItemGenesis genesis) {
|
||||
BinnieCore.genesis = genesis;
|
||||
}
|
||||
|
||||
public static ItemFieldKit getFieldKit() {
|
||||
Preconditions.checkState(fieldKit != null, "fieldKit has not been init");
|
||||
return fieldKit;
|
||||
}
|
||||
|
||||
public static void setFieldKit(ItemFieldKit fieldKit) {
|
||||
BinnieCore.fieldKit = fieldKit;
|
||||
}
|
||||
|
||||
public static BinnieCore getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
@@ -71,7 +114,7 @@ public final class BinnieCore extends AbstractMod {
|
||||
Binnie.CONFIGURATION.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (FluidContainerType container : FluidContainerType.getBinnieContainers()) {
|
||||
Item item = new ItemFluidContainer(container);
|
||||
BinnieCore.proxy.registerItem(item);
|
||||
getProxy().registerItem(item);
|
||||
}
|
||||
this.preInit();
|
||||
}
|
||||
@@ -115,7 +158,11 @@ public final class BinnieCore extends AbstractMod {
|
||||
|
||||
@Override
|
||||
public IBinnieProxy getProxy() {
|
||||
return BinnieCore.proxy;
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public static BinnieProxy getBinnieProxy() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -176,7 +223,7 @@ public final class BinnieCore extends AbstractMod {
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(BinnieCore.instance);
|
||||
super(BinnieCore.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,7 @@ public class Mods {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Override
|
||||
public Item item(final String name) {
|
||||
Item item = super.item(name);
|
||||
if (item == null) {
|
||||
@@ -87,8 +86,7 @@ public class Mods {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Override
|
||||
public Block block(final String name) {
|
||||
Block block = super.block(name);
|
||||
if (block == null) {
|
||||
@@ -97,22 +95,19 @@ public class Mods {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Override
|
||||
public ItemStack stack(final String name) {
|
||||
Item item = this.item(name);
|
||||
return new ItemStack(item);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Override
|
||||
public ItemStack stack(final String name, final int amount) {
|
||||
Item item = this.item(name);
|
||||
return new ItemStack(item, amount);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
@Override
|
||||
public ItemStack stack(final String name, final int amount, final int meta) {
|
||||
Item item = this.item(name);
|
||||
return new ItemStack(item, amount, meta);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
drops = block.getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for(ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.block;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -9,39 +9,32 @@ import forestry.api.circuits.ICircuitSocketType;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class BinnieCircuitLayout implements ICircuitLayout {
|
||||
@Nonnull
|
||||
private final String uid;
|
||||
@Nonnull
|
||||
private final AbstractMod mod;
|
||||
@Nonnull
|
||||
private final ICircuitSocketType socketType;
|
||||
|
||||
public BinnieCircuitLayout(@Nonnull final AbstractMod mod, @Nonnull final String uid, @Nonnull final ICircuitSocketType socketType) {
|
||||
public BinnieCircuitLayout(final AbstractMod mod, final String uid, final ICircuitSocketType socketType) {
|
||||
this.uid = uid;
|
||||
this.mod = mod;
|
||||
this.socketType = socketType;
|
||||
ChipsetManager.circuitRegistry.registerLayout(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.circuitLayout" + this.uid;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.LANGUAGE.localise(this.mod, "circuit.layout." + this.uid.toLowerCase());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Binnie.LANGUAGE.localise(this.mod, "circuit.layout." + this.uid.toLowerCase() + ".usage");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return this.socketType;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.circuits;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -56,16 +56,16 @@ class BeeBreedingSystem extends BreedingSystem {
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumBeeChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -71,11 +72,11 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
}
|
||||
|
||||
public String getChromosomeName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
|
||||
return BinnieCore.getBinnieProxy().localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
|
||||
}
|
||||
|
||||
public String getChromosomeShortName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
|
||||
return BinnieCore.getBinnieProxy().localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
|
||||
}
|
||||
|
||||
public final String getEpitome(final float discoveredPercentage) {
|
||||
@@ -95,7 +96,7 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
} else if (discoveredPercentage < 1.0f) {
|
||||
i = 5;
|
||||
}
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".epitome." + i);
|
||||
return BinnieCore.getBinnieProxy().localise(this.getSpeciesRoot().getUID() + ".epitome." + i);
|
||||
}
|
||||
|
||||
public abstract ISpeciesRoot getSpeciesRoot();
|
||||
@@ -405,7 +406,7 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
}
|
||||
|
||||
public final String getDescriptor() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".descriptor");
|
||||
return BinnieCore.getBinnieProxy().localise(this.getSpeciesRoot().getUID() + ".descriptor");
|
||||
}
|
||||
|
||||
public final String getIdent() {
|
||||
@@ -425,16 +426,16 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (allele instanceof IAlleleBoolean) {
|
||||
return ((IAlleleBoolean) allele).getValue() ? Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.true") : Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.false");
|
||||
return ((IAlleleBoolean) allele).getValue() ? Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.true") : Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.false");
|
||||
}
|
||||
if (Objects.equals(allele.getName(), "for.gui.maximum")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.fertility.maximum");
|
||||
}
|
||||
return allele.getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".shortName");
|
||||
return BinnieCore.getBinnieProxy().localise(this.getSpeciesRoot().getUID() + ".shortName");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -452,6 +453,7 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
|
||||
public abstract boolean isDNAManipulable(final ISpeciesType type);
|
||||
|
||||
@Nullable
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ public enum EnumBeeModifier {
|
||||
GeneticDecay;
|
||||
|
||||
public String getName() {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "beemodifier." + this.name().toLowerCase());
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "beemodifier." + this.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,14 @@ package binnie.core.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.genetics.api.IGene;
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class Gene implements IGene, INbtReadable, INbtWritable {
|
||||
public class Gene implements IGene {
|
||||
private IAllele allele;
|
||||
private IChromosomeType chromosome;
|
||||
private ISpeciesRoot root;
|
||||
@@ -32,17 +31,26 @@ public class Gene implements IGene, INbtReadable, INbtWritable {
|
||||
}
|
||||
|
||||
public Gene(final NBTTagCompound nbt) {
|
||||
this.readFromNBT(nbt);
|
||||
this.allele = AlleleManager.alleleRegistry.getAllele(nbt.getString("allele"));
|
||||
String rootKey = nbt.getString("root");
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(rootKey);
|
||||
Preconditions.checkArgument(root != null, "Could not find root: %s", rootKey);
|
||||
this.root = root;
|
||||
final int chromoID = nbt.getByte("chromo");
|
||||
Preconditions.checkArgument(chromoID >= 0 && chromoID < this.root.getKaryotype().length, "Invalid chromosomeId: %s", chromoID);
|
||||
this.chromosome = this.root.getKaryotype()[chromoID];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
this.allele = AlleleManager.alleleRegistry.getAllele(nbt.getString("allele"));
|
||||
this.root = AlleleManager.alleleRegistry.getSpeciesRoot(nbt.getString("root"));
|
||||
String rootKey = nbt.getString("root");
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(rootKey);
|
||||
Preconditions.checkArgument(root != null, "Could not find root: %s", rootKey);
|
||||
this.root = root;
|
||||
final int chromoID = nbt.getByte("chromo");
|
||||
if (this.root != null && chromoID >= 0 && chromoID < this.root.getKaryotype().length) {
|
||||
this.chromosome = this.root.getKaryotype()[chromoID];
|
||||
}
|
||||
Preconditions.checkArgument(chromoID >= 0 && chromoID < this.root.getKaryotype().length, "Invalid chromosomeId: %s", chromoID);
|
||||
this.chromosome = this.root.getKaryotype()[chromoID];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,18 +61,12 @@ public class Gene implements IGene, INbtReadable, INbtWritable {
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public boolean isCorrupted() {
|
||||
return this.allele == null || this.chromosome == null || this.root == null;
|
||||
}
|
||||
|
||||
public static Gene create(final NBTTagCompound nbt) {
|
||||
final Gene gene = new Gene(nbt);
|
||||
return gene.isCorrupted() ? null : gene;
|
||||
return new Gene(nbt);
|
||||
}
|
||||
|
||||
public static Gene create(final IAllele allele, final IChromosomeType chromosome, final ISpeciesRoot root) {
|
||||
final Gene gene = new Gene(allele, chromosome, root);
|
||||
return gene.isCorrupted() ? null : gene;
|
||||
return new Gene(allele, chromosome, root);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ interface IBreedingMessage {
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "gui.breedingmessage.species");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "gui.breedingmessage.species");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@ interface IBreedingMessage {
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "gui.breedingmessage.branch");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "gui.breedingmessage.branch");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +95,7 @@ interface IBreedingMessage {
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "gui.breedingmessage.epithet");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "gui.breedingmessage.epithet");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.genetics.FlowerBreedingSystem;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.ManagerBase;
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
@@ -101,18 +102,15 @@ public class ManagerGenetics extends ManagerBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BreedingSystem getSystem(final ISpeciesRoot root) {
|
||||
return this.getSystem(root.getUID());
|
||||
String rootUID = root.getUID();
|
||||
BreedingSystem system = this.getSystem(rootUID);
|
||||
Preconditions.checkState(system != null, "Could not find system for species root %s", rootUID);
|
||||
return system;
|
||||
}
|
||||
|
||||
public ISpeciesRoot getSpeciesRoot(final IAlleleSpecies species) {
|
||||
for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
|
||||
if (root.getKaryotype()[0].getAlleleClass().isInstance(species)) {
|
||||
return root;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return species.getRoot();
|
||||
}
|
||||
|
||||
public IAllele getToleranceAllele(final EnumTolerance tol) {
|
||||
@@ -131,6 +129,7 @@ public class ManagerGenetics extends ManagerBase {
|
||||
this.BREEDING_SYSTEMS.put(system.getSpeciesRoot(), system);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BreedingSystem getConversionSystem(final ItemStack stack) {
|
||||
for (final BreedingSystem system : this.getActiveSystems()) {
|
||||
if (system.getConversion(stack) != null) {
|
||||
@@ -140,11 +139,13 @@ public class ManagerGenetics extends ManagerBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getConversionStack(final ItemStack stack) {
|
||||
final BreedingSystem system = this.getConversionSystem(stack);
|
||||
return (system == null) ? null : system.getConversionStack(stack);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
final BreedingSystem system = this.getConversionSystem(stack);
|
||||
return (system == null) ? null : system.getConversion(stack);
|
||||
|
||||
@@ -49,24 +49,24 @@ class MothBreedingSystem extends BreedingSystem {
|
||||
if (chromosome == EnumButterflyChromosome.METABOLISM) {
|
||||
final int metabolism = ((IAlleleInteger) allele).getValue();
|
||||
if (metabolism >= 19) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.highest");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.highest");
|
||||
}
|
||||
if (metabolism >= 16) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.higher");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.higher");
|
||||
}
|
||||
if (metabolism >= 13) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.high");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.high");
|
||||
}
|
||||
if (metabolism >= 10) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.normal");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.normal");
|
||||
}
|
||||
if (metabolism >= 7) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.slow");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.slow");
|
||||
}
|
||||
if (metabolism >= 4) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.slower");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.slower");
|
||||
}
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.metabolism.slowest");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.metabolism.slowest");
|
||||
} else {
|
||||
if (chromosome == EnumButterflyChromosome.FERTILITY) {
|
||||
final int metabolism = ((IAlleleInteger) allele).getValue();
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
@@ -86,18 +87,18 @@ public class TreeBreedingSystem extends BreedingSystem {
|
||||
}
|
||||
if (chromosome == EnumTreeChromosome.PLANT) {
|
||||
final EnumSet<EnumPlantType> types = ((IAllelePlantType) allele).getPlantTypes();
|
||||
return types.isEmpty() ? Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.none") : types.iterator().next().toString();
|
||||
return types.isEmpty() ? Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.none") : types.iterator().next().toString();
|
||||
}
|
||||
if (chromosome == EnumTreeChromosome.FRUITS && allele.getUID().contains(".")) {
|
||||
final IFruitProvider provider = ((IAlleleFruit) allele).getProvider();
|
||||
return (provider.getProducts().size() == 0) ? Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.none") : provider.getProducts().keySet().iterator().next().getDisplayName();
|
||||
return (provider.getProducts().size() == 0) ? Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.none") : provider.getProducts().keySet().iterator().next().getDisplayName();
|
||||
}
|
||||
if (chromosome == EnumTreeChromosome.GROWTH) {
|
||||
if (allele.getUID().contains("Tropical")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.growth.tropical");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.growth.tropical");
|
||||
}
|
||||
if (allele.getUID().contains("Lightlevel")) {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "allele.growth.lightlevel");
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "allele.growth.lightlevel");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
@@ -240,10 +241,8 @@ public class TreeBreedingSystem extends BreedingSystem {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
// for (final Map.Entry<ItemStack, IIndividual> entry : TreeManager.treeRoot.getIndividualTemplates()) {
|
||||
// if (ItemStack.areItemStacksEqual(stack, entry.getKey())) {
|
||||
// return entry.getValue();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -27,7 +27,7 @@ public final class BinnieGUIHandler implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public final Object getClientGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
if (BinnieCore.proxy.isSimulating(world)) {
|
||||
if (BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
return this.getServerGuiElement(id, player, world, x, y, z);
|
||||
}
|
||||
final Window window = this.getWindow(id, player, world, x, y, z, Side.CLIENT);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.gui;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -6,7 +6,10 @@ import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Drawables {
|
||||
@Nullable
|
||||
private static Drawables INSTANCE;
|
||||
|
||||
public static Drawables getDrawables(IGuiHelper guiHelper) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.integration.jei;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -66,7 +66,7 @@ public class ItemFieldKit extends ItemCore {
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) {
|
||||
if (!player.isSneaking() && hand == EnumHand.MAIN_HAND) {
|
||||
BinnieCore.proxy.openGui(BinnieCoreGUI.FieldKit, player, new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ));
|
||||
BinnieCore.getBinnieProxy().openGui(BinnieCoreGUI.FieldKit, player, new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ));
|
||||
}
|
||||
return super.onItemRightClick(itemStack, world, player, hand);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ItemGenesis extends ItemCore {
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) {
|
||||
BinnieCore.proxy.openGui(BinnieCoreGUI.Genesis, player, new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ));
|
||||
BinnieCore.getBinnieProxy().openGui(BinnieCoreGUI.Genesis, player, new BlockPos((int) player.posX, (int) player.posY, (int) player.posZ));
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ItemMisc extends ItemCore {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(@Nonnull final Item itemIn, final CreativeTabs creativeTabs, List<ItemStack> subItems) {
|
||||
public void getSubItems(final Item itemIn, final CreativeTabs creativeTabs, List<ItemStack> subItems) {
|
||||
for (IItemMiscProvider item : this.items) {
|
||||
if (item.isActive()) {
|
||||
subItems.add(this.getStack(item, 1));
|
||||
@@ -32,7 +32,6 @@ public class ItemMisc extends ItemCore {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private IItemMiscProvider getItem(int damage) {
|
||||
return (damage >= this.items.length) ? this.items[0] : this.items[damage];
|
||||
}
|
||||
@@ -57,9 +56,8 @@ public class ItemMisc extends ItemCore {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getItemStackDisplayName(@Nonnull final ItemStack stack) {
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
IItemMiscProvider item = this.getItem(stack.getItemDamage());
|
||||
return item.getName(stack);
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
public class ModuleItems implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
BinnieCore.fieldKit = new ItemFieldKit();
|
||||
BinnieCore.proxy.registerItem(BinnieCore.fieldKit);
|
||||
BinnieCore.genesis = new ItemGenesis();
|
||||
BinnieCore.proxy.registerItem(BinnieCore.genesis);
|
||||
BinnieCore.setFieldKit(new ItemFieldKit());
|
||||
BinnieCore.getBinnieProxy().registerItem(BinnieCore.getFieldKit());
|
||||
BinnieCore.setGenesis(new ItemGenesis());
|
||||
BinnieCore.getBinnieProxy().registerItem(BinnieCore.getGenesis());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,7 +35,7 @@ public class ModuleItems implements IInitializable {
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new ItemStack(BinnieCore.fieldKit, 1, 63), "g ", " is", " pi", 'g', Blocks.GLASS_PANE, 'i', Items.IRON_INGOT, 'p', Items.PAPER, 's', new ItemStack(Items.DYE, 1));
|
||||
GameRegistry.addRecipe(new ItemStack(BinnieCore.getFieldKit(), 1, 63), "g ", " is", " pi", 'g', Blocks.GLASS_PANE, 'i', Items.IRON_INGOT, 'p', Items.PAPER, 's', new ItemStack(Items.DYE, 1));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -50,7 +50,7 @@ public class ModuleItems implements IInitializable {
|
||||
|
||||
if (player != null) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem != null && heldItem.getItem() == BinnieCore.fieldKit && player.isSneaking()) {
|
||||
if (heldItem != null && heldItem.getItem() == BinnieCore.getFieldKit() && player.isSneaking()) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.item;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.language;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -35,7 +35,7 @@ public enum FluidContainerType {
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return BinnieCore.proxy.localise("item.container." + this.name().toLowerCase());
|
||||
return BinnieCore.getBinnieProxy().localise("item.container." + this.name().toLowerCase());
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.liquid;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -112,7 +112,7 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
return true;
|
||||
}
|
||||
if (player.isSneaking()) {
|
||||
@@ -134,7 +134,7 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entityliving, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, entityliving, stack);
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
final IMachine machine = Machine.getMachine(world.getTileEntity(pos));
|
||||
@@ -173,7 +173,7 @@ class BlockMachine extends BlockContainer implements IBlockMachine {
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
if (BinnieCore.proxy.isSimulating(world) && this.canHarvestBlock(world, pos, player) && !player.capabilities.isCreativeMode) {
|
||||
if (BinnieCore.getBinnieProxy().isSimulating(world) && this.canHarvestBlock(world, pos, player) && !player.capabilities.isCreativeMode) {
|
||||
//final int metadata = this.getMetaFromState(state);
|
||||
//final ItemStack stack = new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(state));
|
||||
this.dropBlockAsItem(world, pos, state, 0);
|
||||
|
||||
@@ -113,14 +113,14 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
|
||||
}
|
||||
|
||||
public void sendPacket() {
|
||||
if (!BinnieCore.proxy.isSimulating(this.getTileEntity().getWorld())) {
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(this.getTileEntity().getWorld())) {
|
||||
return;
|
||||
}
|
||||
BinnieCore.proxy.sendNetworkEntityPacket((INetworkedEntity) this.getTileEntity());
|
||||
BinnieCore.getBinnieProxy().sendNetworkEntityPacket((INetworkedEntity) this.getTileEntity());
|
||||
}
|
||||
|
||||
public Side getSide() {
|
||||
return BinnieCore.proxy.isSimulating(this.getTileEntity().getWorld()) ? Side.SERVER : Side.CLIENT;
|
||||
return BinnieCore.getBinnieProxy().isSimulating(this.getTileEntity().getWorld()) ? Side.SERVER : Side.CLIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,7 +153,7 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
if (BinnieCore.proxy.isSimulating(this.getWorld())) {
|
||||
if (BinnieCore.getBinnieProxy().isSimulating(this.getWorld())) {
|
||||
for (final MachineComponent component : this.getComponents()) {
|
||||
component.onUpdate();
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public class Machine implements INetworkedEntity, INbtReadable, INbtWritable, IN
|
||||
if (nbt.hasNoTags()) {
|
||||
return null;
|
||||
}
|
||||
return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageTileNBT(BinnieCorePacketID.TileDescriptionSync.ordinal(), this.getTileEntity(), nbt).GetMessage());
|
||||
return BinnieCore.getInstance().getNetworkWrapper().getPacketFrom(new MessageTileNBT(BinnieCorePacketID.TileDescriptionSync.ordinal(), this.getTileEntity(), nbt).GetMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class MachineGroup {
|
||||
mod.getProxy().registerBlock(this.block);
|
||||
Item i = mod.getProxy().registerItem(new ItemMachine(this.block));
|
||||
for (int j = 0; j < types.length; j++) {
|
||||
BinnieCore.proxy.registermodel(i, j, new ModelResourceLocation(i.getRegistryName(), "machine_type=" + j));
|
||||
BinnieCore.getBinnieProxy().registermodel(i, j, new ModelResourceLocation(i.getRegistryName(), "machine_type=" + j));
|
||||
}
|
||||
|
||||
for (final MachinePackage pack2 : this.getPackages()) {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MachineRendererBlock {
|
||||
GlStateManager.translate(x + 0.5, y + 1.5, z + 0.5);
|
||||
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
BinnieCore.getBinnieProxy().bindTexture(texture);
|
||||
this.model.render((float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
@@ -51,6 +51,7 @@ public class MachineUtil {
|
||||
return amount <= space;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getStack(final int slot) {
|
||||
return this.getInventory().getStackInSlot(slot);
|
||||
}
|
||||
@@ -59,11 +60,12 @@ public class MachineUtil {
|
||||
this.setStack(slot, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack decreaseStack(final int slot, final int amount) {
|
||||
return this.getInventory().decrStackSize(slot, amount);
|
||||
}
|
||||
|
||||
public void setStack(final int slot, final ItemStack stack) {
|
||||
public void setStack(final int slot, @Nullable final ItemStack stack) {
|
||||
this.getInventory().setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
@@ -73,10 +75,10 @@ public class MachineUtil {
|
||||
}
|
||||
|
||||
public void addStack(final int slot, final ItemStack addition) {
|
||||
if (this.isSlotEmpty(slot)) {
|
||||
final ItemStack merge = this.getStack(slot);
|
||||
if (merge == null) {
|
||||
this.setStack(slot, addition);
|
||||
} else {
|
||||
final ItemStack merge = this.getStack(slot);
|
||||
if (merge.isItemEqual(addition) && merge.stackSize + addition.stackSize <= merge.getMaxStackSize()) {
|
||||
merge.stackSize += addition.stackSize;
|
||||
this.setStack(slot, merge);
|
||||
@@ -84,6 +86,7 @@ public class MachineUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FluidStack drainTank(final int tank, final int amount) {
|
||||
return this.getTank(tank).drain(amount, true);
|
||||
}
|
||||
@@ -94,8 +97,7 @@ public class MachineUtil {
|
||||
return drain != null && drain.amount == amount;
|
||||
}
|
||||
|
||||
public void damageItem(final int slot, final int damage) {
|
||||
final ItemStack item = this.getStack(slot);
|
||||
public void damageItem(final ItemStack item, final int slot, final int damage) {
|
||||
if (damage < 0) {
|
||||
item.setItemDamage(Math.max(0, item.getItemDamage() + damage));
|
||||
} else if (item.attemptDamageItem(damage, new Random())) {
|
||||
@@ -208,6 +210,6 @@ public class MachineUtil {
|
||||
}
|
||||
|
||||
public boolean isServer() {
|
||||
return BinnieCore.proxy.isSimulating(this.machine.getWorld());
|
||||
return BinnieCore.getBinnieProxy().isSimulating(this.machine.getWorld());
|
||||
}
|
||||
}
|
||||
@@ -71,17 +71,17 @@ public class ManagerMachine extends ManagerBase {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
SlotValidator.spriteBee = new ValidatorSprite(BinnieCore.instance, "validator/bee.0", "validator/bee.1");
|
||||
SlotValidator.spriteFrame = new ValidatorSprite(BinnieCore.instance, "validator/frame.0", "validator/frame.1");
|
||||
SlotValidator.spriteCircuit = new ValidatorSprite(BinnieCore.instance, "validator/circuit.0", "validator/circuit.1");
|
||||
SlotValidator.spriteBlock = new ValidatorSprite(BinnieCore.instance, "validator/block.0", "validator/block.1");
|
||||
SlotValidator.spriteBee = new ValidatorSprite(BinnieCore.getInstance(), "validator/bee.0", "validator/bee.1");
|
||||
SlotValidator.spriteFrame = new ValidatorSprite(BinnieCore.getInstance(), "validator/frame.0", "validator/frame.1");
|
||||
SlotValidator.spriteCircuit = new ValidatorSprite(BinnieCore.getInstance(), "validator/circuit.0", "validator/circuit.1");
|
||||
SlotValidator.spriteBlock = new ValidatorSprite(BinnieCore.getInstance(), "validator/block.0", "validator/block.1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
// TODO fix rendering
|
||||
Object rendererMachine = null; // BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine");
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityMachine.class, "binnie.tile.machine", rendererMachine);
|
||||
BinnieCore.getBinnieProxy().registerTileEntity(TileEntityMachine.class, "binnie.tile.machine", rendererMachine);
|
||||
}
|
||||
|
||||
public Class<? extends MachineComponent>[] getComponentInterfaces(final Class<? extends MachineComponent> clss) {
|
||||
|
||||
@@ -32,7 +32,7 @@ class DefaultInventory implements IInventoryMachine {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(final int i, final ItemStack itemstack) {
|
||||
public void setInventorySlotContents(final int i, @Nullable final ItemStack itemstack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.base;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.component;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -5,6 +5,7 @@ import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
@@ -34,6 +35,7 @@ public abstract class BaseSlot<T> implements INbtWritable, INbtReadable, IValida
|
||||
return item == null || this.validator == null || this.validator.isValid(item);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract T getContent();
|
||||
|
||||
public abstract void setContent(final T p0);
|
||||
|
||||
@@ -56,7 +56,6 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
return content;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return new TextComponentString("");
|
||||
@@ -92,7 +91,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(final int index, final ItemStack itemStack) {
|
||||
public void setInventorySlotContents(final int index, @Nullable final ItemStack itemStack) {
|
||||
if (this.inventory.containsKey(index) && (itemStack == null || this.inventory.get(index).isValid(itemStack))) {
|
||||
this.inventory.get(index).setContent(itemStack);
|
||||
}
|
||||
@@ -108,7 +107,6 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
@@ -120,17 +118,17 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(@Nonnull final EntityPlayer var1) {
|
||||
public boolean isUseableByPlayer(final EntityPlayer var1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(@Nonnull EntityPlayer player) {
|
||||
public void closeInventory(EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(@Nonnull EntityPlayer player) {
|
||||
public void openInventory(EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@@ -218,7 +216,7 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(final int slot, @Nonnull final ItemStack itemStack) {
|
||||
public boolean isItemValidForSlot(final int slot, final ItemStack itemStack) {
|
||||
final InventorySlot iSlot = this.getSlot(slot);
|
||||
return iSlot != null && (iSlot.isValid(itemStack) && !this.isReadOnly(slot));
|
||||
}
|
||||
@@ -244,9 +242,8 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public int[] getSlotsForFace(@Nonnull final EnumFacing var1) {
|
||||
public int[] getSlotsForFace(final EnumFacing var1) {
|
||||
final List<Integer> slots = new ArrayList<>();
|
||||
for (final InventorySlot slot : this.inventory.values()) {
|
||||
if (slot.canInsert() || slot.canExtract()) {
|
||||
@@ -261,12 +258,12 @@ public class ComponentInventorySlots extends ComponentInventory implements IInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(final int i, @Nonnull final ItemStack itemstack, @Nonnull final EnumFacing direction) {
|
||||
public boolean canInsertItem(final int i, final ItemStack itemstack, final EnumFacing direction) {
|
||||
return this.isItemValidForSlot(i, itemstack) && this.getSlot(i).canInsert(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(final int i, @Nonnull final ItemStack itemstack, @Nonnull final EnumFacing direction) {
|
||||
public boolean canExtractItem(final int i, final ItemStack itemstack, final EnumFacing direction) {
|
||||
return this.getSlot(i).canExtract(direction);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import binnie.core.machines.transfer.TransferRequest;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,19 +19,23 @@ public class ComponentInventoryTransfer extends MachineComponent {
|
||||
}
|
||||
|
||||
public void addRestock(final int[] buffer, final int destination, final int limit) {
|
||||
this.transfers.add(new Restock(this.getMachine(), buffer, destination, limit));
|
||||
Restock restock = new Restock(this.getMachine(), buffer, destination, limit);
|
||||
this.transfers.add(restock);
|
||||
}
|
||||
|
||||
public void addRestock(final int[] buffer, final int destination) {
|
||||
this.transfers.add(new Restock(this.getMachine(), buffer, destination));
|
||||
Restock restock = new Restock(this.getMachine(), buffer, destination);
|
||||
this.transfers.add(restock);
|
||||
}
|
||||
|
||||
public void addStorage(final int source, final int[] destination) {
|
||||
this.transfers.add(new Storage(this.getMachine(), source, destination));
|
||||
Storage storage = new Storage(this.getMachine(), source, destination);
|
||||
this.transfers.add(storage);
|
||||
}
|
||||
|
||||
public void performTransfer(final int source, final int[] destination) {
|
||||
new Storage(this.getMachine(), source, destination).transfer(this.getMachine().getInterface(IInventoryMachine.class));
|
||||
IInventoryMachine inventoryMachine = this.getMachine().getInterface(IInventoryMachine.class);
|
||||
new Storage(this.getMachine(), source, destination).transfer(inventoryMachine);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,24 +46,27 @@ public class ComponentInventoryTransfer extends MachineComponent {
|
||||
}
|
||||
|
||||
public void addStorage(final int source, final int[] destination, final Condition condition) {
|
||||
this.transfers.add(new Storage(this.getMachine(), source, destination).setCondition(condition));
|
||||
Storage storage = new Storage(this.getMachine(), source, destination);
|
||||
Transfer transfer = storage.setCondition(condition);
|
||||
this.transfers.add(transfer);
|
||||
}
|
||||
|
||||
public abstract class Transfer {
|
||||
@Nullable
|
||||
protected Condition condition;
|
||||
protected IMachine machine;
|
||||
protected final IMachine machine;
|
||||
|
||||
private Transfer(final IMachine machine) {
|
||||
this.machine = machine;
|
||||
}
|
||||
|
||||
public final void transfer(final IInventory inv) {
|
||||
if (this.condition == null || this.fufilled(inv)) {
|
||||
if (this.condition == null || this.fulfilled(inv)) {
|
||||
this.doTransfer(inv);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean fufilled(final IInventory inv) {
|
||||
protected boolean fulfilled(final IInventory inv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -119,21 +127,25 @@ public class ComponentInventoryTransfer extends MachineComponent {
|
||||
|
||||
@Override
|
||||
protected void doTransfer(final IInventory inv) {
|
||||
if (inv.getStackInSlot(this.source) != null) {
|
||||
inv.setInventorySlotContents(this.source, new TransferRequest(inv.getStackInSlot(this.source), inv).setTargetSlots(this.destination).ignoreValidation().transfer(true));
|
||||
ItemStack stackInSlot = inv.getStackInSlot(this.source);
|
||||
if (stackInSlot != null) {
|
||||
TransferRequest transferRequest = new TransferRequest(stackInSlot, inv).setTargetSlots(this.destination).ignoreValidation();
|
||||
ItemStack transfer = transferRequest.transfer(true);
|
||||
inv.setInventorySlotContents(this.source, transfer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean fufilled(final IInventory inv) {
|
||||
protected boolean fulfilled(final IInventory inv) {
|
||||
final ItemStack stack = inv.getStackInSlot(this.source);
|
||||
return stack != null && this.condition.fufilled(stack);
|
||||
return stack != null && (this.condition == null || this.condition.fulfilled(stack));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class Condition {
|
||||
@Nullable
|
||||
public Transfer transfer;
|
||||
|
||||
public abstract boolean fufilled(final ItemStack p0);
|
||||
public abstract boolean fulfilled(final ItemStack p0);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,10 @@ import binnie.core.BinnieCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class InventorySlot extends BaseSlot<ItemStack> {
|
||||
@Nullable
|
||||
private ItemStack itemStack;
|
||||
private Type type;
|
||||
|
||||
@@ -16,19 +19,22 @@ public class InventorySlot extends BaseSlot<ItemStack> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getContent() {
|
||||
return this.itemStack;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getItemStack() {
|
||||
return this.getContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContent(final ItemStack itemStack) {
|
||||
public void setContent(@Nullable final ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack decrStackSize(final int amount) {
|
||||
if (this.itemStack == null) {
|
||||
return null;
|
||||
@@ -92,7 +98,7 @@ public class InventorySlot extends BaseSlot<ItemStack> {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "gui.slot." + this.unlocName);
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "gui.slot." + this.unlocName);
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TankSlot extends BaseSlot<FluidStack> {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.instance, "gui.slot." + this.unlocName);
|
||||
return Binnie.LANGUAGE.localise(BinnieCore.getInstance(), "gui.slot." + this.unlocName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.inventory;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.network;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -74,13 +74,13 @@ public abstract class ComponentProcessIndefinate extends MachineComponent implem
|
||||
|
||||
@Override
|
||||
public ErrorState canWork() {
|
||||
return (this.actionCancelTask == 0.0f) ? null : new ErrorState(BinnieCore.proxy.localise("machine.errors.task.cancelled.desc"), BinnieCore.proxy.localise("machine.errors.task.cancelled.info"));
|
||||
return (this.actionCancelTask == 0.0f) ? null : new ErrorState(BinnieCore.getBinnieProxy().localise("machine.errors.task.cancelled.desc"), BinnieCore.getBinnieProxy().localise("machine.errors.task.cancelled.info"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorState canProgress() {
|
||||
if (this.actionPauseProcess != 0.0f) {
|
||||
return new ErrorState(BinnieCore.proxy.localise("machine.errors.task.process.paused.desc"), BinnieCore.proxy.localise("machine.errors.task.process.paused.info"));
|
||||
return new ErrorState(BinnieCore.getBinnieProxy().localise("machine.errors.task.process.paused.desc"), BinnieCore.getBinnieProxy().localise("machine.errors.task.process.paused.info"));
|
||||
}
|
||||
return (this.getPower().getInterface().getEnergy(PowerSystem.RF) < this.getEnergyPerTick()) ? new ErrorState.InsufficientPower() : null;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public abstract class ComponentProcessIndefinate extends MachineComponent implem
|
||||
|
||||
@Override
|
||||
public String getTooltip() {
|
||||
return BinnieCore.proxy.localise("machine.tooltips.processing");
|
||||
return BinnieCore.getBinnieProxy().localise("machine.tooltips.processing");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.power;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -35,7 +35,7 @@ enum Compartment implements IMachineType {
|
||||
}
|
||||
|
||||
public ItemStack get(final int i) {
|
||||
return new ItemStack(BinnieCore.packageCompartment.getBlock(), i, this.ordinal());
|
||||
return new ItemStack(BinnieCore.getPackageCompartment().getBlock(), i, this.ordinal());
|
||||
}
|
||||
|
||||
public abstract static class PackageCompartment extends MachinePackage {
|
||||
|
||||
@@ -20,6 +20,6 @@ class ComponentBinnieCoreGUI extends MachineComponent implements IInteraction.Ri
|
||||
|
||||
@Override
|
||||
public void onRightClick(final World world, final EntityPlayer player, final BlockPos pos) {
|
||||
BinnieCore.proxy.openGui(this.id, player, pos);
|
||||
BinnieCore.getBinnieProxy().openGui(this.id, player, pos);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class MachineRendererCompartment {
|
||||
GlStateManager.translate(x + 0.5, y + 1.5, z + 0.5);
|
||||
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
BinnieCore.proxy.bindTexture(texture);
|
||||
BinnieCore.getBinnieProxy().bindTexture(texture);
|
||||
this.model.render(null, (float) x, (float) y, (float) z, 0.0625f, 0.0625f, 0.0625f);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
@@ -13,7 +13,9 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
public class ModuleStorage implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
(BinnieCore.packageCompartment = new MachineGroup(BinnieCore.instance, "storage", "storage", Compartment.values())).setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
MachineGroup machineGroup = new MachineGroup(BinnieCore.getInstance(), "storage", "storage", Compartment.values());
|
||||
BinnieCore.setPackageCompartment(machineGroup);
|
||||
machineGroup.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -102,7 +102,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
final int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24);
|
||||
final int compartmentHeight = compartmentPageHeight;
|
||||
final Control controlCompartment = new Control(this, x, y, compartmentWidth, compartmentHeight);
|
||||
final ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0, 0, 24, compartmentPageHeight, Position.Left) {
|
||||
final ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0, 0, 24, compartmentPageHeight, Position.Left, Arrays.asList(tabs1)) {
|
||||
@Override
|
||||
public ControlTab<Integer> createTab(final int x, final int y, final int w, final int h, final Integer value) {
|
||||
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
|
||||
@@ -130,8 +130,6 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
};
|
||||
final String[] tabHelp = {"Compartment Tab", "Tabs that divide the inventory into sections. Each one can be labelled seperately."};
|
||||
tab.addHelp(tabHelp);
|
||||
tab.setValues(Arrays.asList(tabs1));
|
||||
tab.setValue(0);
|
||||
tab.addEventHandler(new EventValueChanged.Handler() {
|
||||
@Override
|
||||
public void onEvent(final EventValueChanged event) {
|
||||
@@ -169,7 +167,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
x += compartmentPageWidth;
|
||||
if (tabs2.length > 0) {
|
||||
final ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0, 24, compartmentPageHeight, Position.Right) {
|
||||
final ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0, 24, compartmentPageHeight, Position.Right, Arrays.asList(tabs2)) {
|
||||
@Override
|
||||
public ControlTab<Integer> createTab(final int x, final int y, final int w, final int h, final Integer value) {
|
||||
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
|
||||
@@ -195,8 +193,6 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
};
|
||||
}
|
||||
};
|
||||
tab2.setValues(Arrays.asList(tabs2));
|
||||
tab2.setValue(0);
|
||||
tab2.addHelp(tabHelp);
|
||||
tab2.addEventHandler(new EventValueChanged.Handler() {
|
||||
@Override
|
||||
@@ -428,7 +424,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return BinnieCore.instance;
|
||||
return BinnieCore.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class WindowTest extends WindowMachine {
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return BinnieCore.instance;
|
||||
return BinnieCore.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.storage;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -222,7 +222,7 @@ public class TransferRequest {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ItemStack transferToTank(@Nonnull final ItemStack itemStack, @Nonnull final IInventory origin, @Nonnull final ITankMachine destination, final int tankID, final boolean doAdd) {
|
||||
public static ItemStack transferToTank(final ItemStack itemStack, final IInventory origin, final ITankMachine destination, final int tankID, final boolean doAdd) {
|
||||
Preconditions.checkNotNull(itemStack);
|
||||
Preconditions.checkArgument(itemStack.stackSize >= 1);
|
||||
|
||||
@@ -267,7 +267,7 @@ public class TransferRequest {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static ItemStack transferFromTank(@Nonnull ItemStack itemStack, @Nonnull final IInventory origin, @Nonnull final ITankMachine destination, final int tankID, final boolean doAdd) {
|
||||
private static ItemStack transferFromTank(ItemStack itemStack, final IInventory origin, final ITankMachine destination, final int tankID, final boolean doAdd) {
|
||||
Preconditions.checkNotNull(itemStack);
|
||||
Preconditions.checkArgument(itemStack.stackSize >= 1);
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.machines.transfer;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
Loaded 100 of 330 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user