Updates for 1.11. Running but missing textures.

This commit is contained in:
mezz committed 2017-02-09 01:41:06 -08:00
1 parent 424fdaaf48
commit f660f213f6
185 files changed
+959 -783

No files matched your search

@@ -2,16 +2,21 @@ package binnie.extratrees.api;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public interface IDesignSystem {
@Nullable
@SideOnly(Side.CLIENT)
TextureAtlasSprite getPrimarySprite(final IPattern pattern);
@Nullable
@SideOnly(Side.CLIENT)
TextureAtlasSprite getSecondarySprite(final IPattern pattern);
@SideOnly(Side.CLIENT)
void registerSprites();
IDesignMaterial getDefaultMaterial();
@@ -287,7 +287,6 @@ public class BlockETDoor extends BlockDoor implements IBlockMetadata {
// }
@Override
@Nullable
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return BlockMetadata.getPickBlock(world, pos);
}
@@ -102,6 +102,6 @@ public class ItemETDoor extends ItemMetadata {
// @Override
// @SideOnly(Side.CLIENT)
// public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) {
// return WoodManager.getPlankType((par1ItemStack == null) ? 0 : (par1ItemStack.getItemDamage() & 0xFF)).getColour();
// return WoodManager.getPlankType((par1ItemStack.isEmpty()) ? 0 : (par1ItemStack.getItemDamage() & 0xFF)).getColour();
// }
}
@@ -282,7 +282,7 @@ public class ModuleBlocks implements IInitializable {
final ItemStack doorSolid = WoodManager.getDoor(plank2, DoorType.Solid);
final ItemStack doorSplit = WoodManager.getDoor(plank2, DoorType.Double);
final ItemStack doorFull = WoodManager.getDoor(plank2, DoorType.Full);
if (planks2 != null && gate != null) {
if (!planks2.isEmpty() && !gate.isEmpty()) {
gate.setCount(1);
GameRegistry.addRecipe(gate.copy(), "fpf", 'f', fenceNormal.copy(), 'p', planks2.copy());
fenceNormal.setCount(4);
@@ -299,7 +299,7 @@ public class ModuleBlocks implements IInitializable {
public void addSqueezer(final IWoodType log, final ILiquidType liquid, final int amount, final float pulpChance) {
final FluidStack liquidStack = liquid.get(amount);
ItemStack logStack = TreeManager.woodAccess.getStack(log, WoodBlockKind.LOG, false);
RecipeManagers.squeezerManager.addRecipe(10, logStack, liquidStack, Mods.Forestry.stack("woodPulp"), (int) (100.0f * pulpChance));
RecipeManagers.squeezerManager.addRecipe(10, logStack, liquidStack, Mods.Forestry.stack("wood_pulp"), (int) (100.0f * pulpChance));
}
public void addSqueezer(final IWoodType log, final ILiquidType liquid, final int amount) {
@@ -107,7 +107,7 @@ public class WoodManager {
public static ItemStack getFence(final IPlankType plank, final IPlankType plank2, final FenceType type, final int amount) {
if (plank instanceof IFenceProvider && plank == plank2 && type.isPlain()) {
final ItemStack original = ((IFenceProvider) plank).getFence();
if (original != null) {
if (!original.isEmpty()) {
original.setCount(amount);
return original;
}
@@ -129,7 +129,6 @@ public class BlockETFenceGate extends BlockFenceGate implements IBlockMetadata {
}
@Override
@Nullable
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return BlockMetadata.getPickBlock(world, pos);
}
@@ -172,7 +172,6 @@ public class BlockFence extends net.minecraft.block.BlockFence implements IBlock
// }
@Override
@Nullable
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return BlockMetadata.getPickBlock(world, pos);
}
@@ -14,8 +14,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class MultiFenceRecipeEmbedded implements IRecipe {
@Nullable
private ItemStack cached;
private ItemStack cached = ItemStack.EMPTY;
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
@@ -25,18 +24,16 @@ public class MultiFenceRecipeEmbedded implements IRecipe {
final ItemStack a = inv.getStackInSlot(row * 3);
final ItemStack b = inv.getStackInSlot(row * 3 + 1);
final ItemStack c = inv.getStackInSlot(row * 3 + 2);
if (a != null && b != null) {
if (c != null) {
type = WoodManager.getFenceType(a);
final FenceType type2 = WoodManager.getFenceType(c);
if (type != null && type2 != null) {
if (type.equals(type2)) {
final IPlankType pType = WoodManager.get(b);
FenceDescription fenceDescription = WoodManager.getFenceDescription(a);
if (fenceDescription != null && fenceDescription.getPlankType() == pType) {
this.cached = WoodManager.getFence(fenceDescription.getPlankType(), fenceDescription.getSecondaryPlankType(), new FenceType(type.size, type.solid, true), 2);
return true;
}
if (!a.isEmpty() && !b.isEmpty() && !c.isEmpty()) {
type = WoodManager.getFenceType(a);
final FenceType type2 = WoodManager.getFenceType(c);
if (type != null && type2 != null) {
if (type.equals(type2)) {
final IPlankType pType = WoodManager.get(b);
FenceDescription fenceDescription = WoodManager.getFenceDescription(a);
if (fenceDescription != null && fenceDescription.getPlankType() == pType) {
this.cached = WoodManager.getFence(fenceDescription.getPlankType(), fenceDescription.getSecondaryPlankType(), new FenceType(type.size, type.solid, true), 2);
return true;
}
}
}
@@ -57,7 +54,7 @@ public class MultiFenceRecipeEmbedded implements IRecipe {
@Override
public ItemStack getRecipeOutput() {
return (this.cached == null) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
return (this.cached.isEmpty()) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
}
@Override
@@ -16,8 +16,7 @@ import java.util.ArrayList;
import java.util.List;
public class MultiFenceRecipeSize implements IRecipe {
@Nullable
private ItemStack cached;
private ItemStack cached = ItemStack.EMPTY;
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
@@ -44,7 +43,7 @@ public class MultiFenceRecipeSize implements IRecipe {
if (types.isEmpty()) {
return false;
}
ItemStack fence = null;
ItemStack fence = ItemStack.EMPTY;
if (pattern.contains("0100 0 ")) {
fence = WoodManager.getFence(types.get(0), types.get(1), new FenceType(0, false, false), 4);
} else if (pattern.contains("0000 0 ")) {
@@ -59,7 +58,7 @@ public class MultiFenceRecipeSize implements IRecipe {
fence = WoodManager.getFence(types.get(0), types.get(0), new FenceType(2, false, false), 4);
}
this.cached = fence;
return fence != null;
return !fence.isEmpty();
}
@Override
@@ -74,7 +73,7 @@ public class MultiFenceRecipeSize implements IRecipe {
@Override
public ItemStack getRecipeOutput() {
return (this.cached == null) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
return (this.cached.isEmpty()) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
}
// TODO: what is this?
@@ -13,8 +13,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class MultiFenceRecipeSolid implements IRecipe {
@Nullable
private ItemStack cached;
private ItemStack cached = ItemStack.EMPTY;
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
@@ -32,8 +31,11 @@ public class MultiFenceRecipeSolid implements IRecipe {
if (type != null && type2 != null && type3 != null && type.equals(type2)) {
if (type.equals(type3)) {
FenceDescription fenceDescription = WoodManager.getFenceDescription(a);
this.cached = WoodManager.getFence(fenceDescription.getPlankType(), fenceDescription.getSecondaryPlankType(), new FenceType(type.size, true, type.solid), 2);
return true;
if (fenceDescription != null) {
FenceType fenceType = new FenceType(type.size, true, type.solid);
this.cached = WoodManager.getFence(fenceDescription.getPlankType(), fenceDescription.getSecondaryPlankType(), fenceType, 2);
return true;
}
}
}
}
@@ -54,7 +56,7 @@ public class MultiFenceRecipeSolid implements IRecipe {
@Override
public ItemStack getRecipeOutput() {
return (this.cached == null) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
return (this.cached.isEmpty()) ? new ItemStack(Blocks.OAK_FENCE) : this.cached;
}
@Override
@@ -17,6 +17,6 @@ public class TreeTypePredicate implements Predicate<ETTreeDefinition> {
@Override
public boolean apply(@Nullable ETTreeDefinition treeDefinition) {
return treeDefinition.getMetadata() >= minMeta && treeDefinition.getMetadata() <= maxMeta;
return treeDefinition != null && treeDefinition.getMetadata() >= minMeta && treeDefinition.getMetadata() <= maxMeta;
}
}
@@ -65,7 +65,7 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo
}
final BlockDesign blockC = (BlockDesign) world.getBlockState(pos).getBlock();
final ItemStack item = player.getHeldItemMainhand();
if (item == null) {
if (item.isEmpty()) {
return;
}
if (!(item.getItem() instanceof IToolHammer)) {
@@ -12,6 +12,8 @@ import forestry.core.render.TextureManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
import java.util.HashMap;
@@ -138,6 +140,7 @@ public enum DesignSystem implements IDesignSystem {
@Override
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getPrimarySprite(final IPattern pattern) {
if (pattern instanceof EnumPattern) {
return this.primary.get(((EnumPattern) pattern).ordinal());
@@ -147,6 +150,7 @@ public enum DesignSystem implements IDesignSystem {
@Override
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSecondarySprite(final IPattern pattern) {
if (pattern instanceof EnumPattern) {
return this.secondary.get(((EnumPattern) pattern).ordinal());
@@ -155,6 +159,7 @@ public enum DesignSystem implements IDesignSystem {
}
@Override
@SideOnly(Side.CLIENT)
public void registerSprites() {
for (final EnumPattern pattern : EnumPattern.values()) {
this.primary.put(pattern.ordinal(), TextureManager.registerSprite(new ResourceLocation(getMod().getModID(), "blocks/" + getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0")));
@@ -5,6 +5,8 @@ import binnie.core.resource.BinnieResource;
import binnie.core.resource.IBinnieTexture;
import binnie.core.resource.ResourceType;
import binnie.extratrees.ExtraTrees;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public enum ExtraTreeTexture implements IBinnieTexture {
Gui(ResourceType.GUI, "gui"),
@@ -28,6 +30,7 @@ public enum ExtraTreeTexture implements IBinnieTexture {
}
@Override
@SideOnly(Side.CLIENT)
public BinnieResource getTexture() {
return Binnie.RESOURCE.getPNG(ExtraTrees.instance, this.type, this.texture);
}
@@ -222,7 +222,7 @@ public enum ButterflySpecies implements IAlleleButterflySpecies {
@Override
public float getResearchSuitability(final ItemStack itemstack) {
if (itemstack == null) {
if (itemstack.isEmpty()) {
return 0.0f;
}
if (itemstack.getItem() == Items.GLASS_BOTTLE) {
@@ -238,13 +238,13 @@ public enum ButterflySpecies implements IAlleleButterflySpecies {
return 1.0f;
}
}
if (itemstack.getItem() == Mods.Forestry.item("honeyDrop")) {
if (itemstack.getItem() == Mods.Forestry.item("honey_drop")) {
return 0.5f;
}
if (itemstack.getItem() == Mods.Forestry.item("honeydew")) {
return 0.7f;
}
if (itemstack.getItem() == Mods.Forestry.item("beeComb")) {
if (itemstack.getItem() == Mods.Forestry.item("bee_comb")) {
return 0.4f;
}
if (AlleleManager.alleleRegistry.isIndividual(itemstack)) {
@@ -1,12 +1,14 @@
package binnie.extratrees.genetics;
import binnie.Binnie;
import com.google.common.base.Preconditions;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.arboriculture.ITreeMutation;
import forestry.api.arboriculture.ITreeRoot;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
@@ -128,16 +130,16 @@ public class ExtraTreeMutation implements ITreeMutation {
new ExtraTreeMutation(ETTreeDefinition.Hazel.getSpecies(), ETTreeDefinition.Alder.getSpecies(), ETTreeDefinition.DwarfHazel.getSpecies(), 10);
}
public static IAllele getVanilla(final String uid) {
final IAllele allele = AlleleManager.alleleRegistry.getAllele("forestry.tree" + uid);
if (allele == null) {
throw new RuntimeException("No forestry species with id " + uid);
}
return allele;
public static IAlleleSpecies getVanilla(final String uid) {
String forestryUid = "forestry.tree" + uid;
final IAllele allele = AlleleManager.alleleRegistry.getAllele(forestryUid);
Preconditions.checkArgument(allele != null);
Preconditions.checkArgument(allele instanceof IAlleleSpecies, "No Forestry species with uid: %s", forestryUid);
return (IAlleleSpecies) allele;
}
public ExtraTreeMutation(final IAllele allele0, final IAllele allele1, final IAllele result, final int chance) {
this(allele0, allele1, Binnie.GENETICS.getTreeRoot().getTemplate(result.getUID()), chance);
public ExtraTreeMutation(final IAlleleSpecies allele0, final IAlleleSpecies allele1, final IAlleleSpecies result, final int chance) {
this(allele0, allele1, Binnie.GENETICS.getTreeRoot().getTemplate(result), chance);
}
public ExtraTreeMutation(final IAllele allele0, final IAllele allele1, final IAllele[] template, final int chance) {
@@ -133,7 +133,7 @@ public class ModuleItems implements IInitializable {
GameRegistry.addRecipe(ExtraTreeItems.GrainCorn.get(3), " s ", " s", " s ", 's', ExtraTreeItems.GrainWheat.get(1));
GameRegistry.addRecipe(ExtraTreeItems.GrainRye.get(3), " ", "s s", " s ", 's', ExtraTreeItems.GrainWheat.get(1));
GameRegistry.addRecipe(ExtraTreeItems.Hops.get(3), " s ", "sps", " s ", 's', Items.WHEAT_SEEDS, 'p', Items.APPLE);
GameRegistry.addRecipe(ExtraTreeItems.ProvenGear.get(1), " s ", "s s", " s ", 's', Mods.Forestry.stack("oakStick"));
GameRegistry.addRecipe(ExtraTreeItems.ProvenGear.get(1), " s ", "s s", " s ", 's', Mods.Forestry.stack("oak_stick"));
GameRegistry.addRecipe(ExtraTreeItems.GlassFitting.get(6), "s s", " i ", "s s", 'i', Items.IRON_INGOT, 's', Items.STICK);
GameRegistry.addSmelting(ExtraTreeItems.GrainWheat.get(1), ExtraTreeItems.GrainRoasted.get(1), 0.0f);
GameRegistry.addSmelting(ExtraTreeItems.GrainRye.get(1), ExtraTreeItems.GrainRoasted.get(1), 0.0f);
@@ -144,12 +144,12 @@ public class ModuleItems implements IInitializable {
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(Food.PAPAYIMAR.get(1), minium, "cropPapaya"));
} catch (Exception ex) {
}
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), null, new ItemStack(items.itemDictionary), "X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', "ingotCopper", 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD);
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), null, new ItemStack(items.itemDictionaryLepi), "X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', "ingotBronze", 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD);
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), ItemStack.EMPTY, new ItemStack(items.itemDictionary), "X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', "ingotCopper", 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD);
RecipeManagers.carpenterManager.addRecipe(100, Binnie.LIQUID.getFluidStack("water", 2000), ItemStack.EMPTY, new ItemStack(items.itemDictionaryLepi), "X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', "ingotBronze", 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD);
RecipeManagers.stillManager.addRecipe(25, ExtraTreeLiquid.Resin.get(5), ExtraTreeLiquid.Turpentine.get(3));
RecipeManagers.carpenterManager.addRecipe(25, ExtraTreeLiquid.Turpentine.get(50), null, items.itemMisc.getStack(ExtraTreeItems.WoodWax, 4), "x", 'x', Mods.Forestry.stack("beeswax"));
RecipeManagers.carpenterManager.addRecipe(25, ExtraTreeLiquid.Turpentine.get(50), ItemStack.EMPTY, items.itemMisc.getStack(ExtraTreeItems.WoodWax, 4), "x", 'x', Mods.Forestry.stack("beeswax"));
if (Binnie.LIQUID.getFluidStack("Creosote Oil", 100) != null) {
RecipeManagers.carpenterManager.addRecipe(25, Binnie.LIQUID.getFluidStack("Creosote Oil", 50), null, items.itemMisc.getStack(ExtraTreeItems.WoodWax, 1), "x", 'x', Mods.Forestry.stack("beeswax"));
RecipeManagers.carpenterManager.addRecipe(25, Binnie.LIQUID.getFluidStack("Creosote Oil", 50), ItemStack.EMPTY, items.itemMisc.getStack(ExtraTreeItems.WoodWax, 1), "x", 'x', Mods.Forestry.stack("beeswax"));
}
FuelManager.bronzeEngineFuel.put(ExtraTreeLiquid.Sap.get(1).getFluid(), new EngineBronzeFuel(ExtraTreeLiquid.Sap.get(1).getFluid(), 20, 10000, 1));
@@ -10,6 +10,10 @@ import binnie.core.resource.ResourceType;
import binnie.extratrees.ExtraTrees;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public enum KitchenMachine implements IMachineType {
// TODO implement
@@ -17,9 +21,10 @@ public enum KitchenMachine implements IMachineType {
Cupboard(null),
BottleRack(BottleRack.PackageBottleRack.class);
@Nullable
Class<? extends MachinePackage> clss;
KitchenMachine(final Class<? extends MachinePackage> clss) {
KitchenMachine(@Nullable final Class<? extends MachinePackage> clss) {
this.clss = clss;
}
@@ -60,6 +65,7 @@ public enum KitchenMachine implements IMachineType {
}
@Override
@SideOnly(Side.CLIENT)
public void renderMachine(Machine machine, double x, double y, double z, float partialTicks, int destroyStage) {
MachineRendererKitchen.instance.renderMachine(machine, textureName, x, y, z, partialTicks);
}
@@ -14,6 +14,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
@@ -46,6 +48,7 @@ public class ControlFluidDisplay extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
if (this.fluidStack == null) {
return;
@@ -78,7 +81,7 @@ public class ControlFluidDisplay extends Control implements ITooltip {
}
}
public void setFluidStack(final FluidStack fluidStack) {
public void setFluidStack(@Nullable final FluidStack fluidStack) {
this.fluidStack = fluidStack;
}
@@ -12,16 +12,21 @@ import binnie.craftgui.core.renderer.RenderUtil;
import binnie.craftgui.events.EventWidget;
import binnie.craftgui.resource.minecraft.CraftGUITexture;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nullable;
public class ControlSlotFluid extends Control implements ITooltip {
ControlFluidDisplay itemDisplay;
@Nullable
FluidStack fluidStack;
public ControlSlotFluid(final IWidget parent, final int x, final int y, final FluidStack fluid) {
public ControlSlotFluid(final IWidget parent, final int x, final int y, @Nullable final FluidStack fluid) {
this(parent, x, y, 18, fluid);
}
public ControlSlotFluid(final IWidget parent, final int x, final int y, final int size, final FluidStack fluid) {
public ControlSlotFluid(final IWidget parent, final int x, final int y, final int size, @Nullable final FluidStack fluid) {
super(parent, x, y, size, size);
this.addAttribute(Attribute.MouseOver);
this.itemDisplay = new ControlFluidDisplay(this, 1, 1, size - 2);
@@ -29,9 +34,7 @@ public class ControlSlotFluid extends Control implements ITooltip {
this.addSelfEventHandler(new EventWidget.ChangeSize.Handler() {
@Override
public void onEvent(final EventWidget.ChangeSize event) {
if (ControlSlotFluid.this.itemDisplay != null) {
ControlSlotFluid.this.itemDisplay.setSize(ControlSlotFluid.this.getSize().sub(new IPoint(2, 2)));
}
ControlSlotFluid.this.itemDisplay.setSize(ControlSlotFluid.this.getSize().sub(new IPoint(2, 2)));
}
});
}
@@ -46,6 +49,7 @@ public class ControlSlotFluid extends Control implements ITooltip {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
super.onUpdateClient();
this.itemDisplay.setFluidStack(this.getFluidStack());
@@ -60,6 +64,7 @@ public class ControlSlotFluid extends Control implements ITooltip {
tooltip.add(item.getFluid().getLocalizedName(item));
}
@Nullable
public FluidStack getFluidStack() {
return this.fluidStack;
}
@@ -5,6 +5,8 @@ import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.events.EventMouse;
import binnie.craftgui.minecraft.Window;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlTankSlot extends ControlSlotFluid {
int tankID;
@@ -26,6 +28,7 @@ public class ControlTankSlot extends ControlSlotFluid {
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
this.fluidStack = Window.get(this).getContainer().getTankInfo(this.tankID).liquid;
final int height = 16 * (((this.fluidStack == null) ? 0 : this.fluidStack.amount) / 1000);
@@ -96,16 +96,15 @@ public abstract class Designer {
@Override
public boolean isRecipe() {
return this.getProduct() != null;
return !this.getProduct().isEmpty();
}
@Override
@Nullable
public ItemStack getProduct() {
final ItemStack plank1 = this.getUtil().getStack(Designer.design1Slot);
final ItemStack plank2 = this.getUtil().getStack(Designer.design2Slot);
if (plank1 == null || plank2 == null) {
return null;
if (plank1.isEmpty() || plank2.isEmpty()) {
return ItemStack.EMPTY;
}
final IDesignMaterial type1 = this.type.getSystem().getMaterial(plank1);
final IDesignMaterial type2 = this.type.getSystem().getMaterial(plank2);
@@ -114,18 +113,17 @@ public abstract class Designer {
}
@Override
@Nullable
public ItemStack doRecipe(final boolean takeItem) {
if (!this.isRecipe()) {
return null;
return ItemStack.EMPTY;
}
if (this.canWork() != null) {
return null;
return ItemStack.EMPTY;
}
final ItemStack product = this.getProduct();
if (takeItem) {
final ItemStack a = this.getUtil().decreaseStack(Designer.design1Slot, 1);
if (a == null) {
if (a.isEmpty()) {
this.getUtil().decreaseStack(Designer.design2Slot, 1);
} else if (this.design != EnumDesign.Blank) {
this.getUtil().decreaseStack(Designer.design2Slot, 1);
@@ -144,8 +142,8 @@ public abstract class Designer {
if (name.equals("recipe")) {
final InventoryPlayer playerInv = player.inventory;
final ItemStack recipe = this.doRecipe(false);
if (recipe != null) {
if (playerInv.getItemStack() == null) {
if (!recipe.isEmpty()) {
if (playerInv.getItemStack().isEmpty()) {
playerInv.setItemStack(this.doRecipe(true));
} else if (playerInv.getItemStack().isItemEqual(recipe) && ItemStack.areItemStackTagsEqual(playerInv.getItemStack(), recipe)) {
final int fit = recipe.getMaxStackSize() - (recipe.getCount() + playerInv.getItemStack().getCount());
@@ -37,13 +37,13 @@ public class ModuleMachine implements IInitializable {
@Override
public void postInit() {
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Lumbermill.get(1), "gAg", "GsG", "gPg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'A', Items.IRON_AXE, 's', Mods.Forestry.stack("sturdyMachine"), 'P', "gearBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Press.get(1), "iGi", "tSt", "tPt", 'i', "ingotIron", 'G', Blocks.GLASS, 't', "ingotTin", 'S', Mods.Forestry.stack("sturdyMachine"), 'P', "gearBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Brewery.get(1), "bGb", "iSi", "bPb", 'i', "ingotIron", 'G', Blocks.GLASS, 'b', "gearBronze", 'S', Mods.Forestry.stack("sturdyMachine"), 'P', "gearBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Distillery.get(1), "rGr", "iSi", "rPr", 'i', "ingotIron", 'G', Blocks.GLASS, 'r', "dustRedstone", 'S', Mods.Forestry.stack("sturdyMachine"), 'P', "gearBronze"));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Woodworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Blocks.PLANKS, 's', Mods.Forestry.stack("impregnatedCasing")));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Panelworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Blocks.WOODEN_SLAB, 's', Mods.Forestry.stack("impregnatedCasing")));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Glassworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Blocks.GLASS, 's', Mods.Forestry.stack("impregnatedCasing")));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Tileworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Items.CLAY_BALL, 's', Mods.Forestry.stack("impregnatedCasing")));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Lumbermill.get(1), "gAg", "GsG", "gPg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'A', Items.IRON_AXE, 's', Mods.Forestry.stack("sturdy_machine"), 'P', "gearBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Press.get(1), "iGi", "tSt", "tPt", 'i', "ingotIron", 'G', Blocks.GLASS, 't', "ingotTin", 'S', Mods.Forestry.stack("sturdy_machine"), 'P', "gearBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Brewery.get(1), "bGb", "iSi", "bPb", 'i', "ingotIron", 'G', Blocks.GLASS, 'b', "gearBronze", 'S', Mods.Forestry.stack("sturdy_machine"), 'P', "gearBronze"));
GameRegistry.addRecipe(new ShapedOreRecipe(ExtraTreeMachine.Distillery.get(1), "rGr", "iSi", "rPr", 'i', "ingotIron", 'G', Blocks.GLASS, 'r', "dustRedstone", 'S', Mods.Forestry.stack("sturdy_machine"), 'P', "gearBronze"));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Woodworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Blocks.PLANKS, 's', Mods.Forestry.stack("impregnated_casing")));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Panelworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Blocks.WOODEN_SLAB, 's', Mods.Forestry.stack("impregnated_casing")));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Glassworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Blocks.GLASS, 's', Mods.Forestry.stack("impregnated_casing")));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(ExtraTreeMachine.Tileworker.get(1), "wGw", "GsG", "ggg", 'G', Blocks.GLASS, 'g', ExtraTreeItems.ProvenGear.get(1), 'w', Items.CLAY_BALL, 's', Mods.Forestry.stack("impregnated_casing")));
}
}
@@ -35,7 +35,7 @@ public class Validators {
@Override
public boolean isValid(final ItemStack itemStack) {
final IDesignMaterial mat = this.type.getSystem().getMaterial(itemStack);
return itemStack != null && mat != null;
return !itemStack.isEmpty() && mat != null;
}
@Override
@@ -22,22 +22,18 @@ public class BrewedGrainRecipe implements IBreweryRecipe {
private final ItemStack yeast;
public BrewedGrainRecipe(Alcohol output, int grainOreId) {
this(output, grainOreId, null, null);
this(output, grainOreId, null, ExtraTreeItems.Yeast.get(1));
}
public BrewedGrainRecipe(Alcohol output, int grainOreId, Integer ingredientOreId) {
this(output, grainOreId, ingredientOreId, null);
this(output, grainOreId, ingredientOreId, ExtraTreeItems.Yeast.get(1));
}
public BrewedGrainRecipe(Alcohol output, int grainOreId, @Nullable Integer ingredientOreId, @Nullable ItemStack specificYeast) {
public BrewedGrainRecipe(Alcohol output, int grainOreId, @Nullable Integer ingredientOreId, ItemStack specificYeast) {
this.output = output.get(Fluid.BUCKET_VOLUME);
this.grainOreId = grainOreId;
this.ingredientOreId = ingredientOreId;
if (specificYeast != null) {
this.yeast = specificYeast;
} else {
this.yeast = ExtraTreeItems.Yeast.get(1);
}
this.yeast = specificYeast;
}
@Override
@@ -72,8 +68,8 @@ public class BrewedGrainRecipe implements IBreweryRecipe {
}
@Override
public boolean isIngredient(@Nullable ItemStack itemstack) {
if (itemstack == null) {
public boolean isIngredient(ItemStack itemstack) {
if (itemstack.isEmpty()) {
return ingredientOreId == null;
}
return ingredientOreId != null && OreDictionaryUtil.hasOreId(itemstack, ingredientOreId);
@@ -1,6 +1,5 @@
package binnie.extratrees.machines.brewery;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -12,12 +11,10 @@ public class BreweryCrafting implements INbtWritable {
@Nullable
public FluidStack inputFluid;
public ItemStack[] inputGrains;
@Nullable
public ItemStack ingredient;
@Nullable
public ItemStack yeast;
public BreweryCrafting(@Nullable final FluidStack inputFluid, @Nullable final ItemStack ingredient, @Nullable final ItemStack[] inputGrains, final @Nullable ItemStack yeast) {
public BreweryCrafting(@Nullable final FluidStack inputFluid, final ItemStack ingredient, @Nullable final ItemStack[] inputGrains, final ItemStack yeast) {
this.inputFluid = inputFluid;
this.inputGrains = ((inputGrains == null) ? new ItemStack[3] : inputGrains);
this.ingredient = ingredient;
@@ -51,8 +48,8 @@ public class BreweryCrafting implements INbtWritable {
return nbt;
}
private NBTTagCompound getNBT(@Nullable final ItemStack ingr) {
if (ingr == null) {
private NBTTagCompound getNBT(final ItemStack ingr) {
if (ingr.isEmpty()) {
return new NBTTagCompound();
}
final NBTTagCompound nbt = new NBTTagCompound();
@@ -5,6 +5,7 @@ import binnie.core.machines.network.INetwork;
import binnie.core.machines.power.ComponentProcessSetCost;
import binnie.core.machines.power.ErrorState;
import binnie.core.machines.power.IProcess;
import com.google.common.base.Preconditions;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -66,6 +67,7 @@ public class BreweryLogic extends ComponentProcessSetCost implements IProcess, I
@Override
protected void onFinishTask() {
Preconditions.checkState(this.currentCrafting != null);
FluidStack output = BreweryRecipes.getOutput(this.currentCrafting);
if (output != null) {
this.getUtil().fillTank(BreweryMachine.TANK_OUTPUT, output);
@@ -15,17 +15,13 @@ public class BreweryRecipe implements IBreweryRecipe {
private final ItemStack yeast;
public BreweryRecipe(final FluidStack input, final FluidStack output) {
this(input, output, null);
this(input, output, ExtraTreeItems.Yeast.get(1));
}
public BreweryRecipe(final FluidStack input, final FluidStack output, @Nullable final ItemStack specificYeast) {
public BreweryRecipe(final FluidStack input, final FluidStack output, final ItemStack specificYeast) {
this.input = input;
this.output = output;
if (specificYeast != null) {
this.yeast = specificYeast;
} else {
this.yeast = ExtraTreeItems.Yeast.get(1);
}
this.yeast = specificYeast;
}
@Override
@@ -40,7 +40,7 @@ public class BreweryRecipes {
@Nullable
public static FluidStack getOutput(final FluidStack stack) {
final BreweryCrafting crafting = new BreweryCrafting(stack, null, null, null);
final BreweryCrafting crafting = new BreweryCrafting(stack, ItemStack.EMPTY, null, ItemStack.EMPTY);
for (final IBreweryRecipe recipe : recipes) {
FluidStack output = recipe.getOutput(crafting);
if (output != null) {
@@ -52,7 +52,7 @@ public class BreweryRecipes {
@Nullable
public static FluidStack getOutput(final BreweryCrafting crafting) {
if (crafting.inputFluid != null && crafting.yeast != null) {
if (crafting.inputFluid != null && !crafting.yeast.isEmpty()) {
for (final IBreweryRecipe recipe : recipes) {
FluidStack output = recipe.getOutput(crafting);
if (output != null) {
@@ -17,6 +17,8 @@ import binnie.extratrees.machines.distillery.DistilleryLogic;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlDistilleryProgress extends ControlProgressBase {
public static final Texture DISTILLERY_BASE = new StandardTexture(43, 0, 58, 66, ExtraTreeTexture.Gui);
@@ -41,6 +43,7 @@ public class ControlDistilleryProgress extends ControlProgressBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
DistilleryLogic distilleryLogic = Machine.getInterface(DistilleryLogic.class, Window.get(this).getInventory());
if (distilleryLogic != null) {
@@ -20,6 +20,8 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ControlFruitPressProgress extends ControlProgressBase {
private static final Texture PressTexture = new StandardTexture(6, 0, 24, 52, ExtraTreeTexture.Gui);
@@ -35,7 +37,7 @@ public class ControlFruitPressProgress extends ControlProgressBase {
return;
}
final ItemStack input = slotFromInventory.getStack();
if (input == null || FruitPressRecipes.getOutput(input) == null) {
if (input.isEmpty() || FruitPressRecipes.getOutput(input) == null) {
return;
}
FluidStack fluid = FruitPressRecipes.getOutput(input);
@@ -44,6 +46,7 @@ public class ControlFruitPressProgress extends ControlProgressBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
GlStateManager.enableBlend();
CraftGUI.render.texture(ControlFruitPressProgress.PressTexture, new IPoint(0, Math.round(16 * this.progress)));
@@ -17,6 +17,8 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
public class ControlLumbermillProgress extends ControlProgressBase {
@@ -35,12 +37,13 @@ public class ControlLumbermillProgress extends ControlProgressBase {
}
@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
GlStateManager.disableLighting();
final int sawX = (int) (63 * this.progress);
CraftGUI.render.texture(ControlLumbermillProgress.Saw, new IPoint(sawX, -8 + Math.round(6 * (float) Math.sin(this.animation))));
final ItemStack item = Window.get(this).getInventory().getStackInSlot(LumbermillMachine.SLOT_LOG);
if (item == null) {
if (item.isEmpty()) {
return;
}
GlStateManager.disableLighting();
@@ -31,12 +31,11 @@ public class ControlRecipeSlot extends ControlSlotBase {
}
@Override
@Nullable
public ItemStack getItemStack() {
final IComponentRecipe recipe = Machine.getInterface(IComponentRecipe.class, Window.get(this).getInventory());
if (recipe != null && recipe.isRecipe()) {
return recipe.getProduct();
}
return null;
return ItemStack.EMPTY;
}
}
@@ -24,6 +24,8 @@ import binnie.extratrees.carpentry.EnumDesign;
import binnie.extratrees.machines.Designer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.HashMap;
@@ -62,6 +64,7 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
}
@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
super.onUpdateClient();
final TileEntityMachine tile = (TileEntityMachine) Window.get(this).getInventory();
@@ -36,15 +36,15 @@ public class PagePlanksOverview extends PageAbstract<ItemStack> {
final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
final ItemStack gate = WoodManager.getGate(type);
final ItemStack door = WoodManager.getDoor(type, DoorType.Standard);
if (fence != null) {
if (!fence.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(fence);
x += 22;
}
if (gate != null) {
if (!gate.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(gate);
x += 22;
}
if (door != null) {
if (!door.isEmpty()) {
new ControlItemDisplay(this, x, 48).setItemStack(door);
x += 22;
}
@@ -39,9 +39,6 @@ public class PageSpeciesTreeGenome extends PageSpecies {
return;
}
final ITree tree = Binnie.GENETICS.getTreeRoot().templateAsIndividual(template);
if (tree == null) {
return;
}
final ITreeGenome genome = tree.getGenome();
final IAlleleTreeSpecies treeSpecies = genome.getPrimary();
@@ -16,6 +16,7 @@ import binnie.extratrees.machines.fruitpress.FruitPressLogic;
import binnie.extratrees.machines.fruitpress.FruitPressMachine;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
@@ -65,7 +66,7 @@ public class WindowPress extends Window {
logic.alterProgress(2.0f);
} else if (name.equals("clear-fruit")) {
logic.setProgress(0.0f);
this.getInventory().setInventorySlotContents(FruitPressMachine.SLOT_CURRENT, null);
this.getInventory().setInventorySlotContents(FruitPressMachine.SLOT_CURRENT, ItemStack.EMPTY);
}
}
}
@@ -7,7 +7,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
@@ -16,13 +15,13 @@ public class FruitPressRecipes {
// Map<input fruit item, Pair<input fruit, output fluid>>
private static Multimap<Item, Pair<ItemStack, FluidStack>> pressRecipes = ArrayListMultimap.create();
public static boolean isInput(@Nullable final ItemStack itemstack) {
public static boolean isInput(final ItemStack itemstack) {
return getOutput(itemstack) != null;
}
@Nullable
public static FluidStack getOutput(@Nullable final ItemStack itemstack) {
if (itemstack == null) {
public static FluidStack getOutput(final ItemStack itemstack) {
if (itemstack.isEmpty()) {
return null;
}
@@ -19,7 +19,7 @@ public class LumbermillLogic extends ComponentProcessSetCost implements IProcess
@Override
public ErrorState canWork() {
ItemStack logStack = this.getUtil().getStack(LumbermillMachine.SLOT_LOG);
if (logStack == null) {
if (logStack.isEmpty()) {
return new ErrorState.NoItem("No Wood", LumbermillMachine.SLOT_LOG);
}
final ItemStack plankResult = LumbermillRecipes.getPlankProduct(logStack);
@@ -26,7 +26,6 @@ public class LumbermillRecipes {
// Map<input log item, Pair<input log, output planks>>
private static Multimap<Item, Pair<ItemStack, ItemStack>> recipes = ArrayListMultimap.create();
@Nullable
public static ItemStack getPlankProduct(final ItemStack logStack) {
if (recipes.isEmpty()) {
calculateLumbermillProducts();
@@ -38,7 +37,7 @@ public class LumbermillRecipes {
return entry.getValue().copy();
}
}
return null;
return ItemStack.EMPTY;
}
public static Collection<Pair<ItemStack, ItemStack>> getRecipes() {
@@ -66,7 +65,7 @@ public class LumbermillRecipes {
try {
ItemStack recipeOutput = craftingManager.findMatchingRecipe(fakeCraftingInventory, FakeCraftingWorld.getInstance());
if (recipeOutput != null) {
if (!recipeOutput.isEmpty()) {
if (OreDictionaryUtil.hasOreId(recipeOutput, plankOreId)) {
Item logItem = logCopy.getItem();
ItemStack outputCopy = recipeOutput.copy();
@@ -18,7 +18,10 @@ import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ProxyClient extends Proxy implements IExtraTreeProxy {
public static ModelManager modelManager = new ModelManager(Constants.EXTRA_TREES_MOD_ID);