mold recipes, casting basin automation

This commit is contained in:
Bob 2022-09-28 22:31:58 +02:00
parent 4ee7e680fb
commit 1f2937c666
9 changed files with 185 additions and 44 deletions

View File

@ -121,8 +121,12 @@ public class FoundryChannel extends BlockContainer implements ICrucibleAcceptor
return false;
Block b = world.getBlock(x + dir.offsetX, y, z + dir.offsetZ);
int meta = world.getBlockMetadata(x + dir.offsetX, y, z + dir.offsetZ);
return b == ModBlocks.foundry_channel || b == ModBlocks.foundry_mold || b == ModBlocks.foundry_outlet;
if(b == ModBlocks.foundry_outlet && meta == dir.ordinal())
return true;
return b == ModBlocks.foundry_channel || b == ModBlocks.foundry_mold;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();

View File

@ -75,10 +75,10 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor {
AxisAlignedBB aabb = null;
int meta = world.getBlockMetadata(x, y, z);
if(meta == 2) aabb = AxisAlignedBB.getBoundingBox(x + 0.625D, y, z + 0.3125D, x + 1D, y + 0.5D, z + 0.6875D);
if(meta == 3) aabb = AxisAlignedBB.getBoundingBox(x + 0D, y, z + 0.3125D, x + 0.375D, y + 0.5D, z + 0.6875D);
if(meta == 4) aabb = AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z + 0.625D, x + 0.6875D, y + 0.5D, z + 1D);
if(meta == 5) aabb = AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z + 0D, x + 0.6875D, y + 0.5D, z + 0.375D);
if(meta == 4) aabb = AxisAlignedBB.getBoundingBox(x + 0.625D, y, z + 0.3125D, x + 1D, y + 0.5D, z + 0.6875D);
if(meta == 5) aabb = AxisAlignedBB.getBoundingBox(x + 0D, y, z + 0.3125D, x + 0.375D, y + 0.5D, z + 0.6875D);
if(meta == 2) aabb = AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z + 0.625D, x + 0.6875D, y + 0.5D, z + 1D);
if(meta == 3) aabb = AxisAlignedBB.getBoundingBox(x + 0.3125D, y, z + 0D, x + 0.6875D, y + 0.5D, z + 0.375D);
if(aabb != null && entityBounding.intersectsWith(aabb)) {
list.add(aabb);
@ -96,10 +96,10 @@ public class FoundryOutlet extends BlockContainer implements ICrucibleAcceptor {
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if(meta == 2) this.setBlockBounds(0.625F, 0F, 0.3125F, 1F, 0.5F, 0.6875F);
if(meta == 3) this.setBlockBounds(0F, 0F, 0.3125F, 0.375F, 0.5F, 0.6875F);
if(meta == 4) this.setBlockBounds(0.3125F, 0F, 0.625F, 0.6875F, 0.5F, 1F);
if(meta == 5) this.setBlockBounds(0.3125F, 0F, 0F, 0.6875F, 0.5F, 0.375F);
if(meta == 4) this.setBlockBounds(0.625F, 0F, 0.3125F, 1F, 0.5F, 0.6875F);
if(meta == 5) this.setBlockBounds(0F, 0F, 0.3125F, 0.375F, 0.5F, 0.6875F);
if(meta == 2) this.setBlockBounds(0.3125F, 0F, 0.625F, 0.6875F, 0.5F, 1F);
if(meta == 3) this.setBlockBounds(0.3125F, 0F, 0F, 0.6875F, 0.5F, 0.375F);
}
@Override public boolean canAcceptPartialPour(World world, int x, int y, int z, double dX, double dY, double dZ, ForgeDirection side, MaterialStack stack) { return false; }

View File

@ -67,6 +67,56 @@ public class AnvilRecipes {
smithingRecipes.add(new AnvilSmithingRecipe(1916169, new ItemStack(ModItems.wings_murk, 1), new ComparableStack(ModItems.wings_limp), new ComparableStack(ModItems.particle_tachyon)));
smithingRecipes.add(new AnvilSmithingRecipe(4, new ItemStack(ModItems.flask_infusion, 1, EnumInfusion.SHIELD.ordinal()), new ComparableStack(ModItems.gem_alexandrite), new ComparableStack(ModItems.bottle_nuka)));
smithingRecipes.add(new AnvilSmithingMold(0, new OreDictStack(GOLD.nugget()), new OreDictStack("nugget")));
smithingRecipes.add(new AnvilSmithingMold(1, new OreDictStack(U.billet()), new OreDictStack("billet")));
smithingRecipes.add(new AnvilSmithingMold(2, new OreDictStack(IRON.ingot()), new OreDictStack("ingot")));
smithingRecipes.add(new AnvilSmithingMold(3, new OreDictStack(IRON.plate()), new OreDictStack("plate")));
smithingRecipes.add(new AnvilSmithingMold(4, new ComparableStack(ModItems.wire_aluminium, 8), new ItemStack[] {
new ItemStack(ModItems.wire_advanced_alloy, 8),
new ItemStack(ModItems.wire_aluminium, 8),
new ItemStack(ModItems.wire_copper, 8),
new ItemStack(ModItems.wire_gold, 8),
new ItemStack(ModItems.wire_magnetized_tungsten, 8),
new ItemStack(ModItems.wire_red_copper, 8),
new ItemStack(ModItems.wire_schrabidium, 8),
new ItemStack(ModItems.wire_tungsten, 8)
}));
smithingRecipes.add(new AnvilSmithingMold(5, new ComparableStack(ModItems.blade_titanium), new ItemStack[] {
new ItemStack(ModItems.blade_titanium),
new ItemStack(ModItems.blade_tungsten)
}));
smithingRecipes.add(new AnvilSmithingMold(6, new ComparableStack(ModItems.blades_iron), new ItemStack[] {
new ItemStack(ModItems.blades_gold),
new ItemStack(ModItems.blades_aluminium),
new ItemStack(ModItems.blades_iron),
new ItemStack(ModItems.blades_steel),
new ItemStack(ModItems.blades_titanium),
new ItemStack(ModItems.blades_advanced_alloy),
new ItemStack(ModItems.blades_combine_steel),
new ItemStack(ModItems.blades_schrabidium)
}));
smithingRecipes.add(new AnvilSmithingMold(7, new ComparableStack(ModItems.stamp_iron_flat), new ItemStack[] {
new ItemStack(ModItems.stamp_stone_flat),
new ItemStack(ModItems.stamp_iron_flat),
new ItemStack(ModItems.stamp_steel_flat),
new ItemStack(ModItems.stamp_titanium_flat),
new ItemStack(ModItems.stamp_obsidian_flat),
new ItemStack(ModItems.stamp_schrabidium_flat)
}));
smithingRecipes.add(new AnvilSmithingMold(8, new ComparableStack(ModItems.hull_small_steel), new ItemStack[] {
new ItemStack(ModItems.hull_small_aluminium),
new ItemStack(ModItems.hull_small_steel)
}));
smithingRecipes.add(new AnvilSmithingMold(9, new ComparableStack(ModItems.hull_big_steel), new ItemStack[] {
new ItemStack(ModItems.hull_big_steel),
new ItemStack(ModItems.hull_big_aluminium),
new ItemStack(ModItems.hull_big_titanium)
}));
smithingRecipes.add(new AnvilSmithingMold(10, new OreDictStack(IRON.ingot(), 9), new OreDictStack("ingot", 9)));
smithingRecipes.add(new AnvilSmithingMold(11, new OreDictStack(IRON.plate(), 9), new OreDictStack("plate", 9)));
smithingRecipes.add(new AnvilSmithingMold(12, new OreDictStack(IRON.block()), new OreDictStack("block")));
smithingRecipes.add(new AnvilSmithingMold(13, new ComparableStack(ModItems.pipes_steel), new ItemStack[] {new ItemStack(ModItems.pipes_steel)}));
smithingRecipes.add(new AnvilSmithingCyanideRecipe());
smithingRecipes.add(new AnvilSmithingRenameRecipe());
}

View File

@ -1,6 +1,5 @@
package com.hbm.inventory.recipes.anvil;
import com.hbm.inventory.RecipesCommon;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;

View File

@ -0,0 +1,61 @@
package com.hbm.inventory.recipes.anvil;
import java.util.List;
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.util.ItemStackUtil;
import net.minecraft.item.ItemStack;
public class AnvilSmithingMold extends AnvilSmithingRecipe {
OreDictStack matchesPrefix;
ItemStack[] matchesStack;
public AnvilSmithingMold(int meta, AStack demo, Object o) {
super(1, new ItemStack(ModItems.mold, 1, meta), demo, new ComparableStack(ModItems.mold_base));
if(o instanceof OreDictStack)
matchesPrefix = (OreDictStack) o;
if(o instanceof ItemStack[])
matchesStack = (ItemStack[]) o;
}
@Override
public boolean matches(ItemStack left, ItemStack right) {
if(!doesStackMatch(right, this.right)) return false;
if(matchesPrefix != null && left.stackSize == matchesPrefix.stacksize) {
List<String> names = ItemStackUtil.getOreDictNames(left);
for(String name : names) {
if(name.startsWith(matchesPrefix.name)) {
return true;
}
}
}
if(matchesStack != null) {
for(ItemStack stack : matchesStack) {
if(left.getItem() == stack.getItem() && left.getItemDamage() == stack.getItemDamage() && left.stackSize == stack.stackSize) {
return true;
}
}
}
return false;
}
@Override
public int matchesInt(ItemStack left, ItemStack right) {
return matches(left, right) ? 0 : -1;
}
public int amountConsumed(int index, boolean mirrored) {
return index;
}
}

View File

@ -29,8 +29,12 @@ public class ItemMold extends Item {
public HashMap<Integer, Mold> moldById = new HashMap(); //molds by their static ID -> stack item damage
public ItemMold() {
this.setHasSubtypes(true);
this.setMaxDamage(0);
int S = 0;
int L = 0;
int L = 1;
registerMold(new MoldShape( 0, S, "nugget", MaterialShapes.NUGGET));
registerMold(new MoldShape( 1, S, "billet", MaterialShapes.BILLET));
registerMold(new MoldShape( 2, S, "ingot", MaterialShapes.INGOT));
@ -51,7 +55,7 @@ public class ItemMold extends Item {
Mats.MAT_CMB, new ItemStack(ModItems.blades_combine_steel),
Mats.MAT_SCHRABIDIUM, new ItemStack(ModItems.blades_schrabidium)));
registerMold(new MoldMulti( 7, S, "blades", MaterialShapes.INGOT.q(4),
registerMold(new MoldMulti( 7, S, "stamp", MaterialShapes.INGOT.q(4),
Mats.MAT_STONE, new ItemStack(ModItems.stamp_stone_flat),
Mats.MAT_IRON, new ItemStack(ModItems.stamp_iron_flat),
Mats.MAT_STEEL, new ItemStack(ModItems.stamp_steel_flat),
@ -110,12 +114,6 @@ public class ItemMold extends Item {
return this.icons[0];
}
/*@Override
public String getUnlocalizedName(ItemStack stack) {
int meta = Math.abs(stack.getItemDamage() % molds.size());
return super.getUnlocalizedName(stack) + "_" + molds.get(meta).name;
}*/
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
Mold mold = getMold(stack);
@ -152,8 +150,8 @@ public class ItemMold extends Item {
public class MoldShape extends Mold {
MaterialShapes shape;
int amount;
public MaterialShapes shape;
public int amount;
public MoldShape(int id, int size, String name, MaterialShapes shape) {
this(id, size, name, shape, 1);
@ -224,9 +222,9 @@ public class ItemMold extends Item {
/* because why not */
public class MoldSingle extends Mold {
ItemStack out;
NTMMaterial mat;
int amount;
public ItemStack out;
public NTMMaterial mat;
public int amount;
public MoldSingle(int id, int size, String name, ItemStack out, NTMMaterial mat, int amount) {
super(id, size, name);
@ -247,15 +245,16 @@ public class ItemMold extends Item {
@Override
public String getTitle() {
return out.getDisplayName() + " x" + this.amount;
return out.getDisplayName() + " x" + this.out.stackSize;
}
}
/* not so graceful but it does the job and it does it well */
public class MoldMulti extends Mold {
HashMap<NTMMaterial, ItemStack> map = new HashMap();
int amount;
public HashMap<NTMMaterial, ItemStack> map = new HashMap();
public int amount;
public int stacksize;
public MoldMulti(int id, int size, String name, int amount, Object... inputs) {
super(id, size, name);
@ -263,6 +262,8 @@ public class ItemMold extends Item {
for(int i = 0; i < inputs.length; i += 2) {
map.put((NTMMaterial) inputs[i], (ItemStack) inputs[i + 1]);
if(i == 0) stacksize = (((ItemStack) inputs[i + 1])).stackSize;
}
}
@ -283,7 +284,7 @@ public class ItemMold extends Item {
@Override
public String getTitle() {
return I18nUtil.resolveKey("shape." + name) + " x" + this.amount;
return I18nUtil.resolveKey("shape." + name) + " x" + this.stacksize;
}
}
}

View File

@ -7,6 +7,7 @@ import com.hbm.items.machine.ItemMold.Mold;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@ -18,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection;
* @author hbm
*
*/
public abstract class TileEntityFoundryCastingBase extends TileEntityFoundryBase implements IInventory {
public abstract class TileEntityFoundryCastingBase extends TileEntityFoundryBase implements ISidedInventory {
public ItemStack slots[] = new ItemStack[2];
public int cooloff = 100;
@ -198,4 +199,19 @@ public abstract class TileEntityFoundryCastingBase extends TileEntityFoundryBase
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] { 1 };
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side) {
return false;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side) {
return slot == 1;
}
}

View File

@ -2997,16 +2997,21 @@ rbmk.rod.xenon=Xenonvergiftung: %s
rbmk.rod.coreTemp=Kerntemperatur: %s
rbmk.rod.skinTemp=Außentemperatur: %s / %s
shape.quantum=Quantum
shape.nugget=Nugget
shape.dusttiny=Winziger Haufen
shape.wire=Draht
shape.billet=Billet
shape.ingot=Barren
shape.dust=Haufen
shape.plate=Platte
shape.quart=Viertel Block
shape.blade=Turbinenblatt
shape.blades=Sägeblatt
shape.block=Block
shape.dust=Haufen
shape.dusttiny=Winziger Haufen
shape.hull_big=Große Hülle
shape.hull_small=Kleine Hülle
shape.ingot=Barren
shape.nugget=Nugget
shape.quantum=Quantum
shape.quart=Viertel Block
shape.plate=Platte
shape.stamp=Stempel
shape.wire=Draht
soundCategory.ntmMachines=NTM Maschinen

View File

@ -3442,16 +3442,21 @@ rbmk.screen.rod=Control: %s
rbmk.screen.temp=Temp: %s
rbmk.screen.xenon=Xenon: %s
shape.quantum=Quantum
shape.nugget=Nugget
shape.dusttiny=Tiny Dust
shape.wire=Wire
shape.billet=Billet
shape.ingot=Ingot
shape.dust=Dust
shape.plate=Plate
shape.quart=Quarter Block
shape.blade=Blade
shape.blades=Shredder Blades
shape.block=Block
shape.dust=Dust
shape.dusttiny=Tiny Dust
shape.hull_big=Big Shell
shape.hull_small=Small Shell
shape.ingot=Ingot
shape.nugget=Nugget
shape.quantum=Quantum
shape.quart=Quarter Block
shape.plate=Plate
shape.stamp=Press Stamp
shape.wire=Wire
soundCategory.ntmMachines=NTM Machines