Renamed caster into casting mold

This commit is contained in:
Calclavia 2014-02-25 18:12:38 +08:00
parent 98d4ba7dbb
commit cc92a5e29b
10 changed files with 74 additions and 98 deletions

View file

@ -19,9 +19,9 @@ import resonantinduction.archaic.firebox.TileFirebox;
import resonantinduction.archaic.firebox.TileHotPlate;
import resonantinduction.archaic.imprint.BlockImprinter;
import resonantinduction.archaic.imprint.TileImprinter;
import resonantinduction.archaic.process.BlockCast;
import resonantinduction.archaic.process.BlockCastingMold;
import resonantinduction.archaic.process.BlockMillstone;
import resonantinduction.archaic.process.TileCast;
import resonantinduction.archaic.process.TileCastingMold;
import resonantinduction.archaic.process.TileMillstone;
import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction;
@ -95,7 +95,7 @@ public class Archaic
blockFirebox = contentRegistry.createBlock(BlockFirebox.class, ItemBlockMetadata.class, TileFirebox.class);
blockHotPlate = contentRegistry.createTile(BlockHotPlate.class, TileHotPlate.class);
blockMillstone = contentRegistry.createTile(BlockMillstone.class, TileMillstone.class);
blockCast = contentRegistry.createTile(BlockCast.class, TileCast.class);
blockCast = contentRegistry.createTile(BlockCastingMold.class, TileCastingMold.class);
blockChannel = contentRegistry.createTile(BlockChannel.class, TileChannel.class);
itemImprint = contentRegistry.createItem(ItemImprint.class);

View file

@ -15,13 +15,9 @@ import calclavia.lib.utility.inventory.InventoryUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCast extends BlockTile
public class BlockCastingMold extends BlockTile
{
Icon topIcon;
Icon side1Icon;
Icon side2Icon;
public BlockCast(int id)
public BlockCastingMold(int id)
{
super(id, Material.iron);
setTextureName(Reference.PREFIX + "material_metal_side");
@ -46,30 +42,6 @@ public class BlockCast extends BlockTile
return false;
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconReg)
{
topIcon = iconReg.registerIcon(Reference.PREFIX + "metalCast_top");
side1Icon = iconReg.registerIcon(Reference.PREFIX + "metalCast_side_1");
side2Icon = iconReg.registerIcon(Reference.PREFIX + "metalCast_side_2");
super.registerIcons(iconReg);
}
/** Returns the block texture based on the side being looked at. Args: side */
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
if (side == 0)
return blockIcon;
if (side == 1)
return topIcon;
return side % 2 == 0 ? side1Icon : side2Icon;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int blockID)
{
@ -86,9 +58,9 @@ public class BlockCast extends BlockTile
{
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof TileCast)
if (te instanceof TileCastingMold)
{
TileCast tile = (TileCast) te;
TileCastingMold tile = (TileCastingMold) te;
ItemStack output = tile.getStackInSlot(0);
@ -109,9 +81,9 @@ public class BlockCast extends BlockTile
{
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof TileCast)
if (te instanceof TileCastingMold)
{
TileCast tile = (TileCast) te;
TileCastingMold tile = (TileCastingMold) te;
tile.updateEntity();
ItemStack current = player.inventory.getCurrentItem();
@ -131,6 +103,6 @@ public class BlockCast extends BlockTile
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileCast();
return new TileCastingMold();
}
}

View file

@ -14,23 +14,23 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderCast extends RenderItemOverlayTile
public class RenderCastingMold extends RenderItemOverlayTile
{
public static RenderCast INSTANCE = new RenderCast();
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "cast.tcn");
public static RenderCastingMold INSTANCE = new RenderCastingMold();
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "castingMold.tcn");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
{
if (tileEntity instanceof TileCast)
if (tileEntity instanceof TileCastingMold)
{
TileCast tile = (TileCast) tileEntity;
TileCastingMold tile = (TileCastingMold) tileEntity;
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
GL11.glTranslated(0, -0.25, 0);
GL11.glScalef(0.5f, 0.5f, 0.5f);
RenderUtility.bind(Reference.DOMAIN, Reference.MODEL_PATH + "cast.png");
RenderUtility.bind(Reference.DOMAIN, Reference.MODEL_PATH + "castingMold.png");
MODEL.renderAll();
GL11.glPopMatrix();

View file

@ -13,12 +13,16 @@ import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.oredict.OreDictionary;
import resonantinduction.api.recipe.MachineRecipes;
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
import resonantinduction.api.recipe.RecipeResource;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.resource.fluid.BlockFluidMaterial;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.prefab.tile.TileExternalInventory;
import calclavia.lib.utility.LanguageUtility;
import com.google.common.io.ByteArrayDataInput;
@ -31,7 +35,7 @@ import com.google.common.io.ByteArrayDataInput;
* @author Calclavia
*
*/
public class TileCast extends TileExternalInventory implements IFluidHandler, IPacketReceiver
public class TileCastingMold extends TileExternalInventory implements IFluidHandler, IPacketReceiver
{
protected FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
private final int amountPerIngot = 100;
@ -100,17 +104,14 @@ public class TileCast extends TileExternalInventory implements IFluidHandler, IP
*/
if (tank.getFluidAmount() > amountPerIngot)
{
String fluidName = tank.getFluid().getFluid().getName();
String materialName = fluidName.replace("molten", "");
String nameCaps = materialName.substring(0, 1).toUpperCase() + materialName.substring(1);
String ingotName = "ingot" + nameCaps;
RecipeResource[] outputs = MachineRecipes.INSTANCE.getOutput(RecipeType.SMELTER, tank.getFluid());
if (OreDictionary.getOres(ingotName).size() > 0)
for (RecipeResource output : outputs)
{
ItemStack stack = OreDictionary.getOres(ingotName).get(0);
incrStackSize(0, stack);
tank.drain(amountPerIngot, true);
incrStackSize(0, output.getItemStack());
}
tank.drain(amountPerIngot, true);
}
}

View file

@ -7,6 +7,8 @@ import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import resonantinduction.api.recipe.RecipeResource.FluidStackResource;
import resonantinduction.api.recipe.RecipeResource.ItemStackResource;
import resonantinduction.api.recipe.RecipeResource.OreDictResource;
@ -29,36 +31,41 @@ public final class MachineRecipes
}
}
public RecipeResource getResourceFromObject(Object obj)
{
if (obj instanceof String)
return new OreDictResource((String) obj);
if (obj instanceof ItemStack)
return new ItemStackResource((ItemStack) obj);
if (obj instanceof FluidStack)
return new FluidStackResource((FluidStack) obj);
return null;
}
public void addRecipe(RecipeType machine, RecipeResource[] input, RecipeResource[] output)
{
this.recipes.get(machine).put(input, output);
}
public void addRecipe(RecipeType machine, ItemStack input, ItemStack output)
public void addRecipe(RecipeType machine, Object inputObj, Object... outputObj)
{
this.addRecipe(machine, new ItemStackResource[] { new ItemStackResource(input) }, new ItemStackResource[] { new ItemStackResource(output) });
}
public void addRecipe(RecipeType machine, String input, ItemStack output)
{
this.addRecipe(machine, new OreDictResource[] { new OreDictResource(input) }, new ItemStackResource[] { new ItemStackResource(output) });
}
public void addRecipe(RecipeType machine, String input, String... oreNameOutputs)
{
OreDictResource[] outputs = new OreDictResource[oreNameOutputs.length];
RecipeResource input = getResourceFromObject(inputObj);
RecipeResource[] outputs = new RecipeResource[outputObj.length];
for (int i = 0; i < outputs.length; i++)
{
outputs[i] = new OreDictResource(oreNameOutputs[i]);
RecipeResource output = getResourceFromObject(outputObj[i]);
if (input == null || output == null)
throw new RuntimeException("Resonant Induction tried to add invalid machine recipe: " + input + " => " + output);
outputs[i] = output;
}
addRecipe(machine, new OreDictResource[] { new OreDictResource(input) }, outputs);
}
public void addRecipe(RecipeType machine, String input, OreDictResource... output)
{
this.addRecipe(machine, new OreDictResource[] { new OreDictResource(input) }, output);
addRecipe(machine, new RecipeResource[] { input }, outputs);
}
public void removeRecipe(RecipeType machine, RecipeResource[] input)
@ -93,27 +100,15 @@ public final class MachineRecipes
return new RecipeResource[] {};
}
public RecipeResource[] getOutput(RecipeType machine, ItemStack... inputs)
public RecipeResource[] getOutput(RecipeType machine, Object... inputs)
{
RecipeResource[] resourceInputs = new RecipeResource[inputs.length];
for (int i = 0; i < inputs.length; i++)
{
resourceInputs[i] = new ItemStackResource(inputs[i]);
resourceInputs[i] = getResourceFromObject(inputs[i]);
}
return this.getOutput(machine, resourceInputs);
}
public RecipeResource[] getOutput(RecipeType machine, String... oreDictNames)
{
RecipeResource[] resourceInputs = new RecipeResource[oreDictNames.length];
for (int i = 0; i < oreDictNames.length; i++)
{
resourceInputs[i] = new OreDictResource(oreDictNames[i]);
}
return this.getOutput(machine, resourceInputs);
return getOutput(machine, resourceInputs);
}
}

View file

@ -73,7 +73,7 @@ public abstract class RecipeResource
@Override
public String toString()
{
return "[ItemStackResource {" + itemStack.toString() + "}]";
return "[ItemStackResource: " + itemStack.toString() + "]";
}
}
@ -133,7 +133,7 @@ public abstract class RecipeResource
@Override
public String toString()
{
return "[OreDictResource {" + name.toString() + "}]";
return "[OreDictResource: " + name + "]";
}
}
@ -164,5 +164,11 @@ public abstract class RecipeResource
{
return null;
}
@Override
public String toString()
{
return "[FluidStackResource: " + fluidStack.getFluid().getName() + "]";
}
}
}

View file

@ -21,7 +21,9 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
import resonantinduction.api.recipe.MachineRecipes;
@ -99,12 +101,12 @@ public class ResourceGenerator
/**
* Generate molten fluids
*/
Fluid fluidMaterial = new Fluid("molten" + nameCaps);
fluidMaterial.setDensity(7);
fluidMaterial.setViscosity(5000);
fluidMaterial.setTemperature(273 + 1538);
FluidRegistry.registerFluid(fluidMaterial);
Block blockFluidMaterial = new BlockFluidMaterial(fluidMaterial);
Fluid fluidMolten = new Fluid("molten" + nameCaps);
fluidMolten.setDensity(7);
fluidMolten.setViscosity(5000);
fluidMolten.setTemperature(273 + 1538);
FluidRegistry.registerFluid(fluidMolten);
Block blockFluidMaterial = new BlockFluidMaterial(fluidMolten);
GameRegistry.registerBlock(blockFluidMaterial, "molten" + nameCaps);
ResonantInduction.blockFluidMaterials.add(blockFluidMaterial);
@ -126,7 +128,7 @@ public class ResourceGenerator
MachineRecipes.INSTANCE.addRecipe(RecipeType.CRUSHER, "ore" + nameCaps, "rubble" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, "rubble" + nameCaps, "dust" + nameCaps, "dust" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, "dust" + nameCaps, "dustRefined" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, "dustRefined" + nameCaps, "ingot" + nameCaps);
MachineRecipes.INSTANCE.addRecipe(RecipeType.SMELTER, new FluidStack(fluidMolten, FluidContainerRegistry.BUCKET_VOLUME), "ingot" + nameCaps);
ItemStack dust = ResonantInduction.itemDust.getStackFromMaterial(materialName);
FurnaceRecipes.smelting().addSmelting(dust.itemID, dust.getItemDamage(), OreDictionary.getOres("ingot" + nameCaps).get(0).copy(), 0.7f);

View file

@ -38,8 +38,8 @@ item.resonantinduction\:imprint.name=Imprint
item.resonantinduction\:hammer.name=Hammer
## Machines
tile.resonantinduction\:cast.name=Metal Caster
tile.resonantinduction\:cast.tooltip=Pour molten metal into the cast to form an ingot.
tile.resonantinduction\:castingMold.name=Metal Caster
tile.resonantinduction\:castingMold.tooltip=Pour molten metal into the cast to form an ingot.
tile.resonantinduction\:millstone.name=Millstone
tile.resonantinduction\:millstone.tooltip=Put some rubble in the millstone and start configuring to grind rubble into dust.
tile.resonantinduction\:imprinter.name=Imprinter

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB