merged blast furnace recipe handling, BF explosion crash fix, textures

This commit is contained in:
Boblet 2022-08-12 11:50:02 +02:00
parent 9ca2845bef
commit a9d7f9ca20
22 changed files with 438 additions and 628 deletions

View File

@ -45,7 +45,7 @@ public class ExplosionBalefire
lastposZ = nbt.getInteger(name + "lastposZ");
radius = nbt.getInteger(name + "radius");
radius2 = nbt.getInteger(name + "radius2");
n = nbt.getInteger(name + "n");
n = Math.max(nbt.getInteger(name + "n"), 1); //prevents invalid read operation
nlimit = nbt.getInteger(name + "nlimit");
shell = nbt.getInteger(name + "shell");
leg = nbt.getInteger(name + "leg");
@ -66,11 +66,16 @@ public class ExplosionBalefire
this.nlimit = this.radius2 * 4;
}
public boolean update()
{
public boolean update() {
if(n == 0) return true;
breakColumn(this.lastposX, this.lastposZ);
this.shell = (int) Math.floor((Math.sqrt(n) + 1) / 2);
int shell2 = this.shell * 2;
if(shell2 == 0) return true;
this.leg = (int) Math.floor((this.n - (shell2 - 1) * (shell2 - 1)) / shell2);
this.element = (this.n - (shell2 - 1) * (shell2 - 1)) - shell2 * this.leg - this.shell + 1;
this.lastposX = this.leg == 0 ? this.shell : this.leg == 1 ? -this.element : this.leg == 2 ? -this.shell : this.element;

View File

@ -19,6 +19,7 @@ import com.hbm.entity.projectile.EntityRainbow;
import com.hbm.entity.projectile.EntityRocket;
import com.hbm.entity.projectile.EntityRubble;
import com.hbm.entity.projectile.EntitySchrab;
import com.hbm.interfaces.Spaghetti;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorRegistry;
@ -42,6 +43,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Spaghetti("no")
public class ExplosionChaos {
private final static Random random = new Random();

View File

@ -0,0 +1,81 @@
package com.hbm.handler.imc;
import java.util.ArrayList;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.util.Tuple.Triplet;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
/**
* @author UFFR
*/
public class IMCBlastFurnace extends IMCHandler {
public static final ArrayList<Triplet<Object, Object, ItemStack>> buffer = new ArrayList<>();
@Override
public void process(IMCMessage message) {
final NBTTagCompound data = message.getNBTValue();
final NBTTagCompound outputData = data.getCompoundTag("output");
final ItemStack output = ItemStack.loadItemStackFromNBT(outputData);
if(output == null) {
printError(message, "Output stack could not be read!");
return;
}
final Object input1;
final Object input2;
switch(data.getString("inputType1")) {
case "ore":
input1 = data.getString("input1");
break;
case "orelist":
final NBTTagList list = data.getTagList("input1", 8);
final ArrayList<String> ores = new ArrayList<String>(list.tagCount());
for(int i = 0; i < list.tagCount(); i++)
ores.add(list.getStringTagAt(i));
input1 = ores;
break;
case "itemstack":
input1 = new ComparableStack(ItemStack.loadItemStackFromNBT(data.getCompoundTag("input1")));
break;
default:
printError(message, "Unhandled input type!");
return;
}
switch(data.getString("inputType2")) {
case "ore":
input2 = data.getString("input2");
break;
case "orelist":
final NBTTagList list = data.getTagList("input2", 9);
final ArrayList<String> ores = new ArrayList<String>(list.tagCount());
for(int i = 0; i < list.tagCount(); i++)
ores.add(list.getStringTagAt(i));
input2 = ores;
break;
case "itemstack":
input2 = new ComparableStack(ItemStack.loadItemStackFromNBT(data.getCompoundTag("input2")));
break;
default:
printError(message, "Unhandled input type!");
return;
}
buffer.add(new Triplet<Object, Object, ItemStack>(input1, input2, output));
}
}

View File

@ -5,8 +5,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.hbm.inventory.gui.GUITestDiFurnace;
import com.hbm.inventory.recipes.BlastFurnaceRecipes;
import com.hbm.inventory.recipes.MachineRecipes;
import codechicken.nei.NEIServerUtils;
@ -17,48 +19,44 @@ import net.minecraft.item.ItemStack;
public class AlloyFurnaceRecipeHandler extends TemplateRecipeHandler {
public static ArrayList<Fuel> fuels;
public static ArrayList<Fuel> fuels;
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe
{
PositionedStack input1;
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
PositionedStack input1;
PositionedStack input2;
PositionedStack result;
public SmeltingSet(ItemStack input1, ItemStack input2, ItemStack result) {
input1.stackSize = 1;
input2.stackSize = 1;
this.input1 = new PositionedStack(input1, 75, 7);
this.input2 = new PositionedStack(input2, 75, 43);
this.result = new PositionedStack(result, 129, 25);
}
PositionedStack result;
@Override
public SmeltingSet(List<ItemStack> list, List<ItemStack> list2, ItemStack result) {
this.input1 = new PositionedStack(list, 75, 7);
this.input2 = new PositionedStack(list2, 75, 43);
this.result = new PositionedStack(result, 129, 25);
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 48, Arrays.asList(new PositionedStack[] {input1, input2}));
}
return getCycledIngredients(cycleticks / 48, Arrays.asList(new PositionedStack[] { input1, input2 }));
}
@Override
@Override
public PositionedStack getOtherStack() {
return fuels.get((cycleticks / 48) % fuels.size()).stack;
}
return fuels.get((cycleticks / 48) % fuels.size()).stack;
}
@Override
@Override
public PositionedStack getResult() {
return result;
}
}
return result;
}
}
public static class Fuel
{
public Fuel(ItemStack ingred) {
this.stack = new PositionedStack(ingred, 3, 25, false);
}
public static class Fuel {
public Fuel(ItemStack ingred) {
this.stack = new PositionedStack(ingred, 3, 25, false);
}
public PositionedStack stack;
}
public PositionedStack stack;
}
@Override
public String getRecipeName() {
return "Blast Furnace";
@ -68,13 +66,13 @@ public class AlloyFurnaceRecipeHandler extends TemplateRecipeHandler {
public String getGuiTexture() {
return GUITestDiFurnace.texture.toString();
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if ((outputId.equals("alloysmelting")) && getClass() == AlloyFurnaceRecipeHandler.class) {
Map<Object[], Object> recipes = MachineRecipes.instance().getAlloyRecipes();
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
if((outputId.equals("alloysmelting")) && getClass() == AlloyFurnaceRecipeHandler.class) {
Map<List<ItemStack>[], ItemStack> recipes = BlastFurnaceRecipes.getRecipesForNEI();
for(Entry<List<ItemStack>[], ItemStack> recipe : recipes.entrySet()) {
this.arecipes.add(new SmeltingSet(recipe.getKey()[0], recipe.getKey()[1], recipe.getValue()));
}
} else {
super.loadCraftingRecipes(outputId, results);
@ -83,16 +81,16 @@ public class AlloyFurnaceRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
Map<Object[], Object> recipes = MachineRecipes.instance().getAlloyRecipes();
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue(), result))
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
Map<List<ItemStack>[], ItemStack> recipes = BlastFurnaceRecipes.getRecipesForNEI();
for(Entry<List<ItemStack>[], ItemStack> recipe : recipes.entrySet()) {
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result))
this.arecipes.add(new SmeltingSet(recipe.getKey()[0], recipe.getKey()[1], recipe.getValue()));
}
}
@Override
public void loadUsageRecipes(String inputId, Object... ingredients) {
if ((inputId.equals("alloysmelting")) && getClass() == AlloyFurnaceRecipeHandler.class) {
if((inputId.equals("alloysmelting")) && getClass() == AlloyFurnaceRecipeHandler.class) {
loadCraftingRecipes("alloysmelting", new Object[0]);
} else {
super.loadUsageRecipes(inputId, ingredients);
@ -101,41 +99,43 @@ public class AlloyFurnaceRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
Map<Object[], Object> recipes = MachineRecipes.instance().getAlloyRecipes();
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[0]) || NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[1]))
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
Map<List<ItemStack>[], ItemStack> recipes = BlastFurnaceRecipes.getRecipesForNEI();
for(Entry<List<ItemStack>[], ItemStack> recipe : recipes.entrySet()) {
List<ItemStack> combined = new ArrayList<ItemStack>();
combined.addAll(recipe.getKey()[0]);
combined.addAll(recipe.getKey()[1]);
for(ItemStack combinedStack : combined)
if(NEIServerUtils.areStacksSameType(ingredient, combinedStack) || NEIServerUtils.areStacksSameType(ingredient, combinedStack))
this.arecipes.add(new SmeltingSet(recipe.getKey()[0], recipe.getKey()[1], recipe.getValue()));
}
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GUITestDiFurnace.class;
}
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(96, 25, 24, 18), "alloysmelting"));
}
@Override
public Class<? extends GuiContainer> getGuiClass() {
return GUITestDiFurnace.class;
}
@Override
public void drawExtras(int recipe) {
drawProgressBar(57, 26, 176, 0, 14, 14, 48, 7);
drawProgressBar(96, 24, 176, 14, 24, 16, 48, 0);
@Override
public void loadTransferRects() {
transferRects.add(new RecipeTransferRect(new Rectangle(96, 25, 24, 18), "alloysmelting"));
}
drawProgressBar(39, 7, 201, 0, 16, 52, 480, 7);
}
@Override
public void drawExtras(int recipe) {
drawProgressBar(57, 26, 176, 0, 14, 14, 48, 7);
@Override
public TemplateRecipeHandler newInstance() {
if (fuels == null || fuels.isEmpty())
fuels = new ArrayList<Fuel>();
for(ItemStack i : MachineRecipes.instance().getAlloyFuels())
{
fuels.add(new Fuel(i));
}
return super.newInstance();
}
drawProgressBar(96, 24, 176, 14, 24, 16, 48, 0);
drawProgressBar(39, 7, 201, 0, 16, 52, 480, 7);
}
@Override
public TemplateRecipeHandler newInstance() {
if(fuels == null || fuels.isEmpty())
fuels = new ArrayList<Fuel>();
for(ItemStack i : MachineRecipes.instance().getAlloyFuels()) {
fuels.add(new Fuel(i));
}
return super.newInstance();
}
}

View File

@ -0,0 +1,171 @@
package com.hbm.inventory.recipes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
import static com.hbm.inventory.OreDictManager.*;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.handler.imc.IMCBlastFurnace;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.util.Tuple.Triplet;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
* Magic!
*
* @author UFFR
*/
public class BlastFurnaceRecipes {
private static final ArrayList<Triplet<Object, Object, ItemStack>> blastFurnaceRecipes = new ArrayList<Triplet<Object, Object, ItemStack>>();
private static final ArrayList<ItemStack> hiddenRecipes = new ArrayList<ItemStack>();
private static void addRecipe(Object in1, Object in2, ItemStack out) {
blastFurnaceRecipes.add(new Triplet<Object, Object, ItemStack>(in1, in2, out));
}
static {
addRecipe(IRON, COAL, new ItemStack(ModItems.ingot_steel, 2));
addRecipe(IRON, ANY_COKE, new ItemStack(ModItems.ingot_steel, 2));
addRecipe(CU, REDSTONE, new ItemStack(ModItems.ingot_red_copper, 2));
addRecipe(STEEL, MINGRADE, new ItemStack(ModItems.ingot_advanced_alloy, 2));
addRecipe(W, COAL, new ItemStack(ModItems.neutron_reflector, 2));
addRecipe(W, ANY_COKE, new ItemStack(ModItems.neutron_reflector, 2));
addRecipe(ModItems.canister_fuel, "slimeball", new ItemStack(ModItems.canister_napalm));
addRecipe(STEEL, CO, new ItemStack(ModItems.ingot_dura_steel, 2));
addRecipe(STEEL, W, new ItemStack(ModItems.ingot_dura_steel, 2));
addRecipe(STEEL, U238, new ItemStack(ModItems.ingot_ferrouranium));
addRecipe(W, SA326.nugget(), new ItemStack(ModItems.ingot_magnetized_tungsten));
addRecipe(STEEL, TC99.nugget(), new ItemStack(ModItems.ingot_tcalloy));
addRecipe(GOLD.plate(), ModItems.plate_mixed, new ItemStack(ModItems.plate_paa, 2));
addRecipe(BIGMT, ModItems.powder_meteorite, new ItemStack(ModItems.ingot_starmetal, 2));
addRecipe(CO, ModBlocks.block_meteor, new ItemStack(ModItems.ingot_meteorite));
addRecipe(ModItems.meteorite_sword_hardened, CO, new ItemStack(ModItems.meteorite_sword_alloyed));
addRecipe(ModBlocks.block_meteor, CO, new ItemStack(ModItems.ingot_meteorite));
if(GeneralConfig.enableLBSMSimpleChemsitry)
addRecipe(ModItems.canister_empty, COAL, new ItemStack(ModItems.canister_oil));
if(!IMCBlastFurnace.buffer.isEmpty()) {
blastFurnaceRecipes.addAll(IMCBlastFurnace.buffer);
MainRegistry.logger.info("Fetched " + IMCBlastFurnace.buffer.size() + " IMC blast furnace recipes!");
IMCBlastFurnace.buffer.clear();
}
hiddenRecipes.add(new ItemStack(ModItems.meteorite_sword_alloyed));
}
@CheckForNull
public static ItemStack getOutput(ItemStack in1, ItemStack in2) {
for(Triplet<Object, Object, ItemStack> recipe : blastFurnaceRecipes) {
final AStack[] recipeItem1 = getRecipeStacks(recipe.getX());
final AStack[] recipeItem2 = getRecipeStacks(recipe.getY());
if((doStacksMatch(recipeItem1, in1) && doStacksMatch(recipeItem2, in2)) || (doStacksMatch(recipeItem2, in1) && doStacksMatch(recipeItem1, in2)))
return recipe.getZ().copy();
else
continue;
}
return null;
}
private static boolean doStacksMatch(AStack[] recipe, ItemStack in) {
boolean flag = false;
byte i = 0;
while(!flag && i < recipe.length) {
flag = recipe[i].matchesRecipe(in, true);
i++;
}
return flag;
}
private static AStack[] getRecipeStacks(Object in) {
final AStack[] recipeItem1;
if(in instanceof DictFrame) {
DictFrame recipeItem = (DictFrame) in;
recipeItem1 = new AStack[] { new OreDictStack(recipeItem.ingot()), new OreDictStack(recipeItem.dust()), new OreDictStack(recipeItem.plate()), new OreDictStack(recipeItem.gem()) };
} else if(in instanceof AStack)
recipeItem1 = new AStack[] { (AStack) in };
else if(in instanceof String)
recipeItem1 = new AStack[] { new OreDictStack((String) in) };
else if(in instanceof Block)
recipeItem1 = new AStack[] { new ComparableStack((Block) in) };
else if(in instanceof List<?>) {
List<?> oreList = (List<?>) in;
recipeItem1 = new AStack[oreList.size()];
for(int i = 0; i < oreList.size(); i++)
recipeItem1[i] = new OreDictStack((String) oreList.get(i));
} else
recipeItem1 = new AStack[] { new ComparableStack((Item) in) };
return recipeItem1;
}
public static Map<List<ItemStack>[], ItemStack> getRecipesForNEI() {
final HashMap<List<ItemStack>[], ItemStack> recipes = new HashMap<>();
for(Triplet<Object, Object, ItemStack> recipe : blastFurnaceRecipes) {
if(!hiddenRecipes.contains(recipe.getZ())) {
final ItemStack nothing = new ItemStack(ModItems.nothing).setStackDisplayName("If you're reading this, an error has occured! Check the console.");
final List<ItemStack> in1 = new ArrayList<ItemStack>();
final List<ItemStack> in2 = new ArrayList<ItemStack>();
in1.add(nothing);
in2.add(nothing);
for(AStack stack : getRecipeStacks(recipe.getX())) {
if(stack.extractForNEI().isEmpty())
continue;
else {
in1.remove(nothing);
in1.addAll(stack.extractForNEI());
break;
}
}
if(in1.contains(nothing)) {
MainRegistry.logger.error("Blast furnace cannot compile recipes for NEI: apparent nonexistent item #1 in recipe for item: " + recipe.getZ().getDisplayName());
}
for(AStack stack : getRecipeStacks(recipe.getY())) {
if(stack.extractForNEI().isEmpty()) {
continue;
} else {
in2.remove(nothing);
in2.addAll(stack.extractForNEI());
break;
}
}
if(in2.contains(nothing)) {
MainRegistry.logger.error("Blast furnace cannot compile recipes for NEI: apparent nonexistent item #2 in recipe for item: " + recipe.getZ().getDisplayName());
}
final List<ItemStack>[] inputs = new List[2];
inputs[0] = in1;
inputs[1] = in2;
recipes.put(inputs, recipe.getZ());
}
}
return ImmutableMap.copyOf(recipes);
}
public static List<Triplet<AStack[], AStack[], ItemStack>> getRecipes() {
final List<Triplet<AStack[], AStack[], ItemStack>> subRecipes = new ArrayList<>();
for(Triplet<Object, Object, ItemStack> recipe : blastFurnaceRecipes)
subRecipes.add(new Triplet<AStack[], AStack[], ItemStack>(getRecipeStacks(recipe.getX()), getRecipeStacks(recipe.getY()), recipe.getZ()));
return ImmutableList.copyOf(subRecipes);
}
}

View File

@ -2,22 +2,14 @@ package com.hbm.inventory.recipes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.FluidContainer;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.MainRegistry;
import com.hbm.util.EnchantmentUtil;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@ -26,138 +18,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
//TODO: clean this shit up
@Spaghetti("everything")
@Spaghetti("i cannot sleep well at night knowing that this class still exists")
public class MachineRecipes {
public MachineRecipes() {
}
public static MachineRecipes instance() {
return new MachineRecipes();
}
public static ItemStack getFurnaceProcessingResult(ItemStack item, ItemStack item2) {
return getFurnaceOutput(item, item2);
}
@Spaghetti("i am an affront to god and i desire to be cremated")
public static ItemStack getFurnaceOutput(ItemStack item, ItemStack item2) {
if(item == null || item2 == null)
return null;
if (GeneralConfig.enableDebugMode) {
if (item.getItem() == Items.iron_ingot && item2.getItem() == Items.quartz
|| item.getItem() == Items.quartz && item2.getItem() == Items.iron_ingot) {
return new ItemStack(ModBlocks.test_render, 1);
}
}
if (mODE(item, new String[] {"ingotTungsten", "dustTungsten"}) && mODE(item2, "gemCoal")
|| mODE(item, "gemCoal") && mODE(item2, new String[] {"ingotTungsten", "dustTungsten"})) {
return new ItemStack(ModItems.neutron_reflector, 2);
}
if (mODE(item, new String[] {"ingotIron", "dustIron"}) && mODE(item2, new String[] {"gemCoal", "dustCoal"})
|| mODE(item, new String[] {"gemCoal", "dustCoal"}) && mODE(item2, new String[] {"ingotIron", "dustIron"})) {
return new ItemStack(ModItems.ingot_steel, 2);
}
if (mODE(item, new String[] {"ingotCopper", "dustCopper"}) && item2.getItem() == Items.redstone
|| item.getItem() == Items.redstone && mODE(item2, new String[] {"ingotCopper", "dustCopper"})) {
return new ItemStack(ModItems.ingot_red_copper, 2);
}
if (item.getItem() == ModItems.canister_full && item.getItemDamage() == Fluids.DIESEL.getID() && item2.getItem() == Items.slime_ball
|| item.getItem() == Items.slime_ball && item2.getItem() == ModItems.canister_full && item2.getItemDamage() == Fluids.DIESEL.getID()) {
return new ItemStack(ModItems.canister_napalm, 1);
}
if (mODE(item, new String[] {"ingotMingrade", "dustMingrade"}) && mODE(item2, new String[] {"ingotSteel", "dustSteel"})
|| mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, new String[] {"ingotMingrade", "dustMingrade"})) {
return new ItemStack(ModItems.ingot_advanced_alloy, 2);
}
if (mODE(item, new String[] {"ingotTungsten", "dustTungsten"}) && mODE(item2, "nuggetSchrabidium")
|| mODE(item, "nuggetSchrabidium") && mODE(item2, new String[] {"ingotTungsten", "dustTungsten"})) {
return new ItemStack(ModItems.ingot_magnetized_tungsten, 1);
}
if (mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, new String[] {"nuggetTechnetium99", "tinyTc99"})
|| mODE(item, new String[] {"nuggetTechnetium99", "tinyTc99"}) && mODE(item2, new String[] {"ingotSteel", "dustSteel"})) {
return new ItemStack(ModItems.ingot_tcalloy, 1);
}
if (item.getItem() == ModItems.plate_mixed && mODE(item2, "plateGold")
|| mODE(item, "plateGold") && item2.getItem() == ModItems.plate_mixed) {
return new ItemStack(ModItems.plate_paa, 2);
}
if (mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, new String[] {"ingotTungsten", "dustTungsten"})
|| mODE(item, new String[] {"ingotTungsten", "dustTungsten"}) && mODE(item2, new String[] {"ingotSteel", "dustSteel"})) {
return new ItemStack(ModItems.ingot_dura_steel, 2);
}
if (mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, new String[] {"ingotCobalt", "dustCobalt"})
|| mODE(item, new String[] {"ingotCobalt", "dustCobalt"}) && mODE(item2, new String[] {"ingotSteel", "dustSteel"})) {
return new ItemStack(ModItems.ingot_dura_steel, 2);
}
if (mODE(item, new String[] {"ingotSaturnite", "dustSaturnite"}) && item2.getItem() == ModItems.powder_meteorite
|| item.getItem() == ModItems.powder_meteorite && mODE(item2, new String[] {"ingotSaturnite", "dustSaturnite"})) {
return new ItemStack(ModItems.ingot_starmetal, 2);
}
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleAlloy) {
if(mODE(item, new String[] { "gemCoal", "dustCoal" }) && item2.getItem() == ModItems.canister_empty
|| item.getItem() == ModItems.canister_empty && mODE(item2, new String[] { "gemCoal", "dustCoal" })) {
return new ItemStack(ModItems.canister_full, 1, Fluids.OIL.getID());
}
if(item.getItem() == Item.getItemFromBlock(ModBlocks.block_meteor_cobble) && mODE(item2, new String[] { "ingotSteel", "dustSteel" })
|| mODE(item, new String[] { "ingotSteel", "dustSteel" }) && item2.getItem() == Item.getItemFromBlock(ModBlocks.block_meteor_cobble)) {
return new ItemStack(ModItems.ingot_meteorite);
}
}
if (item.getItem() == Item.getItemFromBlock(ModBlocks.block_meteor) && mODE(item2, new String[] {"ingotCobalt", "dustCobalt"})
|| mODE(item, new String[] {"ingotCobalt", "dustCobalt"}) && item2.getItem() == Item.getItemFromBlock(ModBlocks.block_meteor)) {
return new ItemStack(ModItems.ingot_meteorite);
}
if (mODE(item, "ingotUranium238") && mODE(item2, new String[] {"ingotSteel", "dustSteel"})
|| mODE(item, new String[] {"ingotSteel", "dustSteel"}) && mODE(item2, "ingotUranium238")) {
return new ItemStack(ModItems.ingot_ferrouranium, 2);
}
if (item.getItem() == ModItems.meteorite_sword_hardened && mODE(item2, new String[] {"ingotCobalt", "dustCobalt"})
|| mODE(item, new String[] {"ingotCobalt", "dustCobalt"}) && item2.getItem() == ModItems.meteorite_sword_hardened) {
return new ItemStack(ModItems.meteorite_sword_alloyed, 1);
}
if(item.getItem() instanceof ItemGunBase && item2.getItem() == Items.enchanted_book) {
ItemStack result = item.copy();
Map mapright = EnchantmentHelper.getEnchantments(item2);
Iterator itr = mapright.keySet().iterator();
while (itr.hasNext()) {
int i = ((Integer)itr.next()).intValue();
int j = ((Integer)mapright.get(Integer.valueOf(i))).intValue();
Enchantment e = Enchantment.enchantmentsList[i];
EnchantmentUtil.removeEnchantment(result, e);
EnchantmentUtil.addEnchantment(result, e, j);
}
return result;
}
return null;
}
//return: FluidType, amount produced, amount required, heat required (°C * 100)
public static Object[] getBoilerOutput(FluidType type) {
@ -402,54 +268,6 @@ public class MachineRecipes {
return null;
}
public Map<Object[], Object> getAlloyRecipes() {
Map<Object[], Object> recipes = new HashMap<Object[], Object>();
if (GeneralConfig.enableDebugMode) {
recipes.put(new ItemStack[] { new ItemStack(Items.iron_ingot), new ItemStack(Items.quartz) },
new ItemStack(Item.getItemFromBlock(ModBlocks.test_render)));
}
try {
recipes.put(new ItemStack[] { new ItemStack(Items.iron_ingot), new ItemStack(Items.coal) },
getFurnaceOutput(new ItemStack(Items.iron_ingot), new ItemStack(Items.coal)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(Items.coal) },
getFurnaceOutput(new ItemStack(ModItems.ingot_tungsten), new ItemStack(Items.coal)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_copper), new ItemStack(Items.redstone) },
getFurnaceOutput(new ItemStack(ModItems.ingot_copper), new ItemStack(Items.redstone)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_red_copper), new ItemStack(ModItems.ingot_steel) },
getFurnaceOutput(new ItemStack(ModItems.ingot_red_copper), new ItemStack(ModItems.ingot_steel)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.canister_full, 1, Fluids.DIESEL.getID()), new ItemStack(Items.slime_ball) },
getFurnaceOutput(new ItemStack(ModItems.canister_full, 1, Fluids.DIESEL.getID()), new ItemStack(Items.slime_ball)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(ModItems.nugget_schrabidium) },
getFurnaceOutput(new ItemStack(ModItems.ingot_tungsten), new ItemStack(ModItems.nugget_schrabidium)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.plate_mixed), new ItemStack(ModItems.plate_gold) },
getFurnaceOutput(new ItemStack(ModItems.plate_mixed), new ItemStack(ModItems.plate_gold)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_tungsten) },
getFurnaceOutput(new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_tungsten)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_cobalt) },
getFurnaceOutput(new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_cobalt)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_saturnite), new ItemStack(ModItems.powder_meteorite) },
getFurnaceOutput(new ItemStack(ModItems.ingot_saturnite), new ItemStack(ModItems.powder_meteorite)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.nugget_technetium) },
getFurnaceOutput(new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.nugget_technetium)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_cobalt), new ItemStack(ModBlocks.block_meteor) },
getFurnaceOutput(new ItemStack(ModItems.ingot_cobalt), new ItemStack(ModBlocks.block_meteor)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_u238) },
getFurnaceOutput(new ItemStack(ModItems.ingot_steel), new ItemStack(ModItems.ingot_u238)).copy());
if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleAlloy) {
recipes.put(new ItemStack[] { new ItemStack(ModItems.canister_empty), new ItemStack(Items.coal) },
getFurnaceOutput(new ItemStack(ModItems.canister_empty), new ItemStack(Items.coal)).copy());
recipes.put(new ItemStack[] { new ItemStack(ModBlocks.block_meteor_cobble), new ItemStack(ModItems.ingot_steel) },
getFurnaceOutput(new ItemStack(ModBlocks.block_meteor_cobble), new ItemStack(ModItems.ingot_steel)).copy());
}
} catch (Exception x) {
MainRegistry.logger.error("Unable to register alloy recipes for NEI!");
}
return recipes;
}
public ArrayList<ItemStack> getAlloyFuels() {
ArrayList<ItemStack> fuels = new ArrayList<ItemStack>();
fuels.add(new ItemStack(Items.coal));
@ -465,20 +283,8 @@ public class MachineRecipes {
fuels.add(new ItemStack(ModItems.powder_coal));
return fuels;
}
public ArrayList<ItemStack> getCentrifugeFuels() {
ArrayList<ItemStack> fuels = new ArrayList<ItemStack>();
fuels.add(new ItemStack(Items.coal));
fuels.add(new ItemStack(Item.getItemFromBlock(Blocks.coal_block)));
fuels.add(new ItemStack(Items.lava_bucket));
fuels.add(new ItemStack(Items.redstone));
fuels.add(new ItemStack(Item.getItemFromBlock(Blocks.redstone_block)));
fuels.add(new ItemStack(Item.getItemFromBlock(Blocks.netherrack)));
fuels.add(new ItemStack(Items.blaze_rod));
fuels.add(new ItemStack(Items.blaze_powder));
return fuels;
}
@Spaghetti("why did i do this?")
public Map<Object[], Object> getCyclotronRecipes() {
Map<Object[], Object> recipes = new HashMap<Object[], Object>();
Item part = ModItems.part_lithium;
@ -796,240 +602,9 @@ public class MachineRecipes {
return recipes;
}
//keep this
//like in a museum or something
//this is a testament of my incompetence
//look at it
//look at how horrifying it is
//children, never do this
/*public class ShredderRecipe {
public ItemStack input;
public ItemStack output;
public void registerEverythingImSrs() {
String[] names = OreDictionary.getOreNames();
List<ItemStack> stacks = new ArrayList<ItemStack>();
for(int i = 0; i < names.length; i++) {
stacks.addAll(OreDictionary.getOres(names[i]));
}
for(int i = 0; i < stacks.size(); i++) {
int[] ids = OreDictionary.getOreIDs(stacks.get(i));
List<String> oreNames = new ArrayList<String>();
for(int j = 0; j < ids.length; j++) {
oreNames.add(OreDictionary.getOreName(ids[j]));
}
theWholeThing.add(new DictCouple(stacks.get(i), oreNames));
}
MainRegistry.logger.info("Added " + theWholeThing.size() + " elements from the Ore Dict!");
}
public boolean doesExist(ItemStack stack) {
for(DictCouple dic : theWholeThing) {
if(dic.item.getItem() == stack.getItem() && dic.item.getItemDamage() == stack.getItemDamage())
return true;
}
return false;
}
public void addRecipes() {
// Not very efficient, I know, but at least it works AND it's
// somewhat smart!
for(int i = 0; i < theWholeThing.size(); i++)
{
for(int j = 0; j < theWholeThing.get(i).list.size(); j++)
{
String s = theWholeThing.get(i).list.get(j);
if (s.length() > 5 && s.substring(0, 5).equals("ingot")) {
ItemStack stack = canFindDustByName(s.substring(5));
if (stack != null) {
setRecipe(theWholeThing.get(i).item, stack);
} else {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
}
} else if (s.length() > 3 && s.substring(0, 3).equals("ore")) {
ItemStack stack = canFindDustByName(s.substring(3));
if (stack != null) {
setRecipe(theWholeThing.get(i).item, new ItemStack(stack.getItem(), 2, stack.getItemDamage()));
} else {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
}
} else if (s.length() > 5 && s.substring(0, 5).equals("block")) {
ItemStack stack = canFindDustByName(s.substring(5));
if (stack != null) {
setRecipe(theWholeThing.get(i).item, new ItemStack(stack.getItem(), 9, stack.getItemDamage()));
} else {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
}
} else if (s.length() > 3 && s.substring(0, 3).equals("gem")) {
ItemStack stack = canFindDustByName(s.substring(3));
if (stack != null) {
setRecipe(theWholeThing.get(i).item, new ItemStack(stack.getItem(), 1, stack.getItemDamage()));
} else {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
}
} else if (s.length() > 4 && s.substring(0, 4).equals("dust")) {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.dust));
} else if (s.length() > 6 && s.substring(0, 6).equals("powder")) {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.dust));
} else {
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
}
}
if(theWholeThing.get(i).list.isEmpty())
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
if(!theWholeThing.get(i).list.isEmpty() && theWholeThing.get(i).list.get(0).equals("Unknown"))
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
}
MainRegistry.logger.info("Added " + recipesShredder.size() + " in total.");
MainRegistry.logger.info("Added " + dustCount + " ore dust recipes.");
}
public ItemStack canFindDustByName(String s) {
for(DictCouple d : theWholeThing)
{
for(String s1 : d.list)
{
if(s1.length() > 4 && s1.substring(0, 4).equals("dust") && s1.substring(4).equals(s))
{
dustCount++;
return d.item;
}
}
}
return null;
}
public void setRecipe(ItemStack inp, ItemStack outp) {
ShredderRecipe recipe = new ShredderRecipe();
recipe.input = inp;
recipe.output = outp;
recipesShredder.add(recipe);
}
public void overridePreSetRecipe(ItemStack inp, ItemStack outp) {
boolean flag = false;
for(int i = 0; i < recipesShredder.size(); i++)
{
if(recipesShredder.get(i) != null &&
recipesShredder.get(i).input != null &&
recipesShredder.get(i).output != null &&
inp != null &&
outp != null &&
recipesShredder.get(i).input.getItem() == inp.getItem() &&
recipesShredder.get(i).input.getItemDamage() == inp.getItemDamage()) {
recipesShredder.get(i).output = outp;
flag = true;
}
}
if(!flag) {
ShredderRecipe rec = new ShredderRecipe();
rec.input = inp;
rec.output = outp;
recipesShredder.add(rec);
}
}
public void removeDuplicates() {
List<ShredderRecipe> newList = new ArrayList<ShredderRecipe>();
for(ShredderRecipe piv : recipesShredder)
{
boolean flag = false;
if(newList.size() == 0)
{
newList.add(piv);
} else {
for(ShredderRecipe rec : newList) {
if(piv != null && rec != null && piv.input != null && rec.input != null && rec.input.getItem() != null && piv.input.getItem() != null && rec.input.getItemDamage() == piv.input.getItemDamage() && rec.input.getItem() == piv.input.getItem())
flag = true;
if(piv == null || rec == null || piv.input == null || rec.input == null)
flag = true;
}
}
if(!flag)
{
newList.add(piv);
}
}
}
public void PrintRecipes() {
MainRegistry.logger.debug("TWT: " + theWholeThing.size() + ", REC: " + recipesShredder.size());
}
}
public static class DictCouple {
public ItemStack item;
public List<String> list;
public DictCouple(ItemStack item, List<String> list) {
this.item = item;
this.list = list;
}
public static List<String> findWithStack(ItemStack stack) {
for(DictCouple couple : theWholeThing) {
if(couple.item == stack);
return couple.list;
}
return null;
}
}
public static List<ShredderRecipe> recipesShredder = new ArrayList<ShredderRecipe>();
public static List<DictCouple> theWholeThing = new ArrayList<DictCouple>();
public static int dustCount = 0;
public static ItemStack getShredderResult(ItemStack stack) {
for(ShredderRecipe rec : recipesShredder)
{
if(stack != null &&
rec.input.getItem() == stack.getItem() &&
rec.input.getItemDamage() == stack.getItemDamage())
return rec.output.copy();
}
return new ItemStack(ModItems.scrap);
}
public Map<Object, Object> getShredderRecipes() {
Map<Object, Object> recipes = new HashMap<Object, Object>();
for(int i = 0; i < MachineRecipes.recipesShredder.size(); i++) {
if(MachineRecipes.recipesShredder.get(i) != null && MachineRecipes.recipesShredder.get(i).output.getItem() != ModItems.scrap)
recipes.put(MachineRecipes.recipesShredder.get(i).input, getShredderResult(MachineRecipes.recipesShredder.get(i).input));
}
return recipes;
}*/
/*
* this is the smoldering crater where once the 2016 shredder recipe code was
*/
public Map<Object[], Object> getCMBRecipes() {
Map<Object[], Object> recipes = new HashMap<Object[], Object>();

View File

@ -48,7 +48,6 @@ import com.hbm.entity.EntityMappings;
import com.hbm.entity.grenade.*;
import com.hbm.entity.logic.*;
import com.hbm.entity.mob.siege.*;
import com.hbm.entity.qic.EntitySPV;
import com.hbm.handler.*;
import com.hbm.handler.imc.*;
import com.hbm.handler.radiation.ChunkRadiationManager;
@ -83,7 +82,6 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@ -744,6 +742,7 @@ public class MainRegistry {
BobmazonOfferFactory.init();
OreDictManager.registerOres();
IMCHandler.registerHandler("blastfurnace", new IMCBlastFurnace());
IMCHandler.registerHandler("crystallizer", new IMCCrystallizer());
IMCHandler.registerHandler("centrifuge", new IMCCentrifuge());
}

View File

@ -1,7 +1,7 @@
package com.hbm.tileentity.machine;
import com.hbm.blocks.machine.MachineDiFurnace;
import com.hbm.inventory.recipes.MachineRecipes;
import com.hbm.inventory.recipes.BlastFurnaceRecipes;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemRTGPellet;
import com.hbm.util.RTGUtil;
@ -19,18 +19,18 @@ import net.minecraft.tileentity.TileEntity;
public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
private ItemStack slots[];
public int dualCookTime;
public int dualPower;
public static final int maxPower = 12800;
public static final int processingSpeed = 400;
private static final int[] slots_top = new int[] {0};
private static final int[] slots_bottom = new int[] {3};
private static final int[] slots_side = new int[] {1};
private static final int[] slots_top = new int[] { 0 };
private static final int[] slots_bottom = new int[] { 3 };
private static final int[] slots_side = new int[] { 1 };
private String customName;
public TileEntityDiFurnace() {
slots = new ItemStack[4];
}
@ -47,21 +47,19 @@ public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
if(slots[i] != null) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
}
@ -75,7 +73,7 @@ public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@ -87,41 +85,42 @@ public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
} else {
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
}
//You scrubs aren't needed for anything (right now)
// You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
public void openInventory() {
}
@Override
public void closeInventory() {}
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
if(i == 3)
{
if(i == 3) {
return false;
}
return true;
}
public boolean hasItemPower(ItemStack itemStack) {
return getItemPower(itemStack) > 0;
}
//TODO: replace this terribleness
private static int getItemPower(ItemStack itemStack) {
if(itemStack == null)
{
if(itemStack == null) {
return 0;
}else{
} else {
Item item = itemStack.getItem();
if(item == Items.coal) return 200;
if(item == Item.getItemFromBlock(Blocks.coal_block)) return 2000;
if(item == Items.lava_bucket) return 12800;
@ -133,78 +132,70 @@ public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
if(item == ModItems.briquette_lignite) return 200;
if(item == ModItems.coke) return 400;
if(item == ModItems.solid_fuel) return 400;
return 0;
}
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
if(slots[i] != null) {
if(slots[i].stackSize <= j) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
if(slots[i].stackSize == 0) {
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
this.dualPower = nbt.getInteger("powerTime");
this.dualCookTime = nbt.getShort("cookTime");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
for(int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
if(b0 >= 0 && b0 < slots.length) {
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("powerTime", dualPower);
nbt.setShort("cookTime", (short) dualCookTime);
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
nbt1.setByte("slot", (byte) i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
@ -215,107 +206,97 @@ public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return true;
}
public int getDiFurnaceProgressScaled(int i) {
return (dualCookTime * i) / processingSpeed;
}
public int getPowerRemainingScaled(int i) {
return (dualPower * i) / maxPower;
}
public boolean canProcess() {
if(slots[0] == null || slots[1] == null)
{
if(slots[0] == null || slots[1] == null) {
return false;
}
ItemStack itemStack = MachineRecipes.getFurnaceProcessingResult(slots[0], slots[1]);
if(itemStack == null)
{
ItemStack itemStack = BlastFurnaceRecipes.getOutput(slots[0], slots[1]);
if(itemStack == null) {
return false;
}
if(slots[3] == null)
{
if(slots[3] == null) {
return true;
}
if(!slots[3].isItemEqual(itemStack)) {
return false;
}
if(slots[3].stackSize < getInventoryStackLimit() && slots[3].stackSize < slots[3].getMaxStackSize()) {
return true;
}else{
} else {
return slots[3].stackSize < itemStack.getMaxStackSize();
}
}
private void processItem() {
if(canProcess()) {
ItemStack itemStack = MachineRecipes.getFurnaceProcessingResult(slots[0], slots[1]);
if(slots[3] == null)
{
ItemStack itemStack = BlastFurnaceRecipes.getOutput(slots[0], slots[1]);
if(slots[3] == null) {
slots[3] = itemStack.copy();
}else if(slots[3].isItemEqual(itemStack)) {
} else if(slots[3].isItemEqual(itemStack)) {
slots[3].stackSize += itemStack.stackSize;
}
for(int i = 0; i < 2; i++)
{
if(slots[i].stackSize <= 0)
{
for(int i = 0; i < 2; i++) {
if(slots[i].stackSize <= 0) {
slots[i] = new ItemStack(slots[i].getItem().setFull3D());
}else{
} else {
slots[i].stackSize--;
}
if(slots[i].stackSize <= 0)
{
if(slots[i].stackSize <= 0) {
slots[i] = null;
}
}
}
}
public boolean hasPower() {
return dualPower > 0;
}
public boolean isProcessing() {
return this.dualCookTime > 0;
}
@Override
public void updateEntity() {
this.hasPower();
boolean flag1 = false;
if(hasPower() && isProcessing())
{
if(hasPower() && isProcessing()) {
this.dualPower = this.dualPower - 1;
if(this.dualPower < 0)
{
if(this.dualPower < 0) {
this.dualPower = 0;
}
}
if (this.hasItemPower(this.slots[2])
&& this.dualPower <= (TileEntityDiFurnace.maxPower - TileEntityDiFurnace.getItemPower(this.slots[2]))) {
if(this.hasItemPower(this.slots[2]) && this.dualPower <= (TileEntityDiFurnace.maxPower - TileEntityDiFurnace.getItemPower(this.slots[2]))) {
this.dualPower += getItemPower(this.slots[2]);
if (this.slots[2] != null) {
if(this.slots[2] != null) {
flag1 = true;
this.slots[2].stackSize--;
if (this.slots[2].stackSize == 0) {
if(this.slots[2].stackSize == 0) {
this.slots[2] = this.slots[2].getItem().getContainerItem(this.slots[2]);
}
}
}
if (hasPower() && canProcess()) {
if(hasPower() && canProcess()) {
dualCookTime++;
if (this.dualCookTime == TileEntityDiFurnace.processingSpeed) {
if(this.dualCookTime == TileEntityDiFurnace.processingSpeed) {
this.dualCookTime = 0;
this.processItem();
flag1 = true;
@ -324,30 +305,26 @@ public class TileEntityDiFurnace extends TileEntity implements ISidedInventory {
dualCookTime = 0;
}
if(!worldObj.isRemote)
{
if(!worldObj.isRemote) {
boolean trigger = true;
if(hasPower() && canProcess() && this.dualCookTime == 0)
{
if(hasPower() && canProcess() && this.dualCookTime == 0) {
trigger = false;
}
if (this.slots[2] != null && (this.slots[2].getItem() instanceof ItemRTGPellet)) {
if(this.slots[2] != null && (this.slots[2].getItem() instanceof ItemRTGPellet)) {
this.dualPower += RTGUtil.updateRTGs(slots, new int[] { 2 });
if(this.dualPower > maxPower)
this.dualPower = maxPower;
}
if(trigger)
{
flag1 = true;
MachineDiFurnace.updateBlockState(this.dualCookTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
if(trigger) {
flag1 = true;
MachineDiFurnace.updateBlockState(this.dualCookTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
if(flag1)
{
if(flag1) {
this.markDirty();
}
}

View File

@ -1,7 +1,7 @@
package com.hbm.tileentity.machine;
import com.hbm.blocks.machine.MachineDiFurnaceRTG;
import com.hbm.inventory.recipes.MachineRecipes;
import com.hbm.inventory.recipes.BlastFurnaceRecipes;
import com.hbm.util.RTGUtil;
import com.hbm.tileentity.TileEntityMachineBase;
@ -25,7 +25,7 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase
if ((slots[0] == null || slots[1] == null) && !hasPower())
return false;
ItemStack recipeResult = MachineRecipes.getFurnaceProcessingResult(slots[0], slots[1]);
ItemStack recipeResult = BlastFurnaceRecipes.getOutput(slots[0], slots[1]);
if (recipeResult == null)
return false;
else if (slots[2] == null)
@ -73,7 +73,7 @@ public class TileEntityDiFurnaceRTG extends TileEntityMachineBase
private void processItem() {
if(canProcess()) {
ItemStack recipeOut = MachineRecipes.getFurnaceProcessingResult(slots[0], slots[1]);
ItemStack recipeOut = BlastFurnaceRecipes.getOutput(slots[0], slots[1]);
if(slots[2] == null)
slots[2] = recipeOut.copy();
else if(slots[2].isItemEqual(recipeOut))

View File

@ -423,7 +423,7 @@ container.bombMulti=Multi Purpose Bomb
container.centrifuge=Centrifuge
container.chemplant=Chemical Plant
container.compactLauncher=Compact Launch Pad
container.craneExtractor=Conveyor Extractor
container.craneExtractor=Conveyor Ejector
container.craneInserter=Conveyor Inserter
container.crateDesh=Desh Crate
container.crateIron=Iron Crate

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B