mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-17 02:55:13 +00:00
Fix several broken ItemStacks and recipes
This commit is contained in:
1 parent
775b4109a9
commit
697ccabf53
5 files changed
+57
-34
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package binnie.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -27,7 +28,7 @@ public class Mods {
|
||||
private static Item findItem(final String modId, final String name) {
|
||||
final Item stack = Item.REGISTRY.getObject(new ResourceLocation(modId, name));
|
||||
if (stack == null && Mods.WARN && Objects.equals(modId, "forestry")) {
|
||||
//throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
|
||||
return stack;
|
||||
@@ -35,18 +36,18 @@ public class Mods {
|
||||
|
||||
private static ItemStack findItemStack(final String modId, final String name, final int stackSize) {
|
||||
final ItemStack stack = GameRegistry.makeItemStack(modId + ":" + name, 0, stackSize, null);
|
||||
if (stack == null && Mods.WARN && Objects.equals(modId, "forestry")) {
|
||||
//throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
if ((stack == null || stack.getItem() == null) && Mods.WARN && Objects.equals(modId, "forestry")) {
|
||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static Block findBlock(final String modId, final String name) {
|
||||
final Block stack = Block.REGISTRY.getObject(new ResourceLocation(modId + ":" + name));
|
||||
if (stack == null && Mods.WARN && Objects.equals(modId, "forestry")) {
|
||||
//throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
final Block block = Block.REGISTRY.getObject(new ResourceLocation(modId + ":" + name));
|
||||
if (block == Blocks.AIR && Mods.WARN && Objects.equals(modId, "forestry")) {
|
||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
return block;
|
||||
}
|
||||
|
||||
public static class Mod {
|
||||
|
||||
@@ -5,7 +5,13 @@ import binnie.core.Mods;
|
||||
import binnie.genetics.item.GeneticsItems;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum FluidContainer {
|
||||
Capsule,
|
||||
@@ -47,26 +53,42 @@ public enum FluidContainer {
|
||||
public ItemStack getEmpty() {
|
||||
switch (this) {
|
||||
case Can: {
|
||||
return Mods.Forestry.stack("canEmpty");
|
||||
return Mods.Forestry.stack("can");
|
||||
}
|
||||
case Capsule: {
|
||||
return Mods.Forestry.stack("waxCapsule");
|
||||
return Mods.Forestry.stack("capsule");
|
||||
}
|
||||
case Glass: {
|
||||
return new ItemStack(Items.GLASS_BOTTLE, 1, 0);
|
||||
}
|
||||
case Refractory: {
|
||||
return Mods.Forestry.stack("refractoryEmpty");
|
||||
return Mods.Forestry.stack("refractory");
|
||||
}
|
||||
case Cylinder: {
|
||||
return GeneticsItems.Cylinder.get(1);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
throw new IllegalArgumentException("Unknown container: " + this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getFilled(Fluid fluid) {
|
||||
ItemStack stack = getEmpty();
|
||||
if (stack != null) {
|
||||
stack = stack.copy();
|
||||
IFluidHandler fluidHandler = FluidUtil.getFluidHandler(stack);
|
||||
if (fluidHandler != null) {
|
||||
int fill = fluidHandler.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
|
||||
if (fill > 0) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerContainerData(final IFluidType fluid) {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
@@ -63,13 +64,17 @@ public class ModuleApiary implements IInitializable {
|
||||
@Override
|
||||
public void postInit() {
|
||||
EnumHiveFrame.init();
|
||||
GameRegistry.addRecipe(AlvearyMachine.Mutator.get(1), "g g", " a ", "t t", 'g', Items.GOLD_INGOT, 'a', Mods.Forestry.block("alveary"), 't', new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 5));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Frame.get(1), "iii", "tat", " t ", 'i', Items.IRON_INGOT, 'a', Mods.Forestry.block("alveary"), 't', new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.RainShield.get(1), " b ", "bab", "t t", 'b', Items.BRICK, 'a', Mods.Forestry.block("alveary"), 't', new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Lighting.get(1), "iii", "iai", " t ", 'i', Items.GLOWSTONE_DUST, 'a', Mods.Forestry.block("alveary"), 't', new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Stimulator.get(1), "kik", "iai", " t ", 'i', Items.GOLD_NUGGET, 'a', Mods.Forestry.block("alveary"), 't', new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 4), 'k', new ItemStack(Mods.Forestry.item("chipsets"), 1, 2));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Hatchery.get(1), "i i", " a ", "iti", 'i', Blocks.GLASS_PANE, 'a', Mods.Forestry.block("alveary"), 't', new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, 5));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(AlvearyMachine.Transmission.get(1), " t ", "tat", " t ", 'a', Mods.Forestry.block("alveary"), 't', "gearTin"));
|
||||
Block alveary = Mods.Forestry.block("alveary.plain");
|
||||
Item thermionicTubes = Mods.Forestry.item("thermionicTubes");
|
||||
Item chipsets = Mods.Forestry.item("chipsets");
|
||||
|
||||
GameRegistry.addRecipe(AlvearyMachine.Mutator.get(1), "g g", " a ", "t t", 'g', Items.GOLD_INGOT, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 5));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Frame.get(1), "iii", "tat", " t ", 'i', Items.IRON_INGOT, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.RainShield.get(1), " b ", "bab", "t t", 'b', Items.BRICK, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Lighting.get(1), "iii", "iai", " t ", 'i', Items.GLOWSTONE_DUST, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Stimulator.get(1), "kik", "iai", " t ", 'i', Items.GOLD_NUGGET, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 4), 'k', new ItemStack(chipsets, 1, 2));
|
||||
GameRegistry.addRecipe(AlvearyMachine.Hatchery.get(1), "i i", " a ", "iti", 'i', Blocks.GLASS_PANE, 'a', alveary, 't', new ItemStack(thermionicTubes, 1, 5));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(AlvearyMachine.Transmission.get(1), " t ", "tat", " t ", 'a', alveary, 't', "gearTin"));
|
||||
for (final AlvearyStimulator.CircuitType type : AlvearyStimulator.CircuitType.values()) {
|
||||
type.createCircuit(this.stimulatorLayout);
|
||||
}
|
||||
|
||||
@@ -53,17 +53,8 @@ public class ModuleMachine implements IInitializable {
|
||||
final String diamondGear = !OreDictionary.getOres("gearDiamond").isEmpty() ? "gearIron" : "ingotIron";
|
||||
for (final Object circuit : standardCircuit) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Incubator.get(1), "gFg", "cCc", "aPa", 'C', GeneticsItems.LaboratoryCasing.get(1), 'F', Blocks.FURNACE, 'c', circuit, 'g', Blocks.GLASS_PANE, 'P', "gearBronze", 'a', ironGear));
|
||||
Item alyzer = null;
|
||||
if (BinnieCore.isApicultureActive()) {
|
||||
alyzer = Mods.Forestry.item("beealyzer");
|
||||
} else if (BinnieCore.isArboricultureActive()) {
|
||||
alyzer = Mods.Forestry.item("treealyzer");
|
||||
} else if (BinnieCore.isArboricultureActive()) {
|
||||
alyzer = Mods.Forestry.item("flutterlyzer");
|
||||
}
|
||||
if (alyzer != null) {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Analyser.get(1), "gBg", "cCc", "aPa", 'C', GeneticsItems.LaboratoryCasing.get(1), 'B', alyzer, 'c', circuit, 'g', Blocks.GLASS_PANE, 'P', "gearBronze", 'a', GeneticsItems.DNADye.get(1)));
|
||||
}
|
||||
Item alyzer = Mods.Forestry.item("portableAlyzer");
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Analyser.get(1), "gBg", "cCc", "aPa", 'C', GeneticsItems.LaboratoryCasing.get(1), 'B', alyzer, 'c', circuit, 'g', Blocks.GLASS_PANE, 'P', "gearBronze", 'a', GeneticsItems.DNADye.get(1)));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Genepool.get(1), "gBg", "cCc", "aPa", 'C', GeneticsItems.LaboratoryCasing.get(1), 'B', "gearBronze", 'c', circuit, 'g', Blocks.GLASS_PANE, 'P', "gearBronze", 'a', Blocks.GLASS));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(LaboratoryMachine.Acclimatiser.get(1), "gBg", "cCc", "aPa", 'C', GeneticsItems.LaboratoryCasing.get(1), 'B', Items.LAVA_BUCKET, 'c', circuit, 'g', Blocks.GLASS_PANE, 'P', "gearBronze", 'a', Items.WATER_BUCKET));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
@@ -14,6 +15,9 @@ import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -100,11 +104,11 @@ public class Acclimatiser {
|
||||
addTemperatureItem(new ItemStack(Blocks.ICE), -0.75f);
|
||||
addHumidityItem(new ItemStack(Items.WATER_BUCKET), 0.75f);
|
||||
addHumidityItem(new ItemStack(Blocks.SAND), -0.15f);
|
||||
addTemperatureItem(Mods.Forestry.stack("canLava"), 0.75f);
|
||||
addTemperatureItem(Mods.Forestry.stack("refractoryLava"), 0.75f);
|
||||
addHumidityItem(Mods.Forestry.stack("canWater"), 0.75f);
|
||||
addHumidityItem(Mods.Forestry.stack("refractoryWater"), 0.75f);
|
||||
addHumidityItem(Mods.Forestry.stack("waxCapsuleWater"), 0.75f);
|
||||
addTemperatureItem(FluidContainer.Can.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addTemperatureItem(FluidContainer.Refractory.getFilled(FluidRegistry.LAVA), 0.75f);
|
||||
addHumidityItem(FluidContainer.Can.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainer.Refractory.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
addHumidityItem(FluidContainer.Capsule.getFilled(FluidRegistry.WATER), 0.75f);
|
||||
}
|
||||
|
||||
public static boolean canAcclimatise(final ItemStack stack, final List<ItemStack> acclimatisers) {
|
||||
|
||||
Reference in new issue
Block a user