Started some rework on the mixer
This commit is contained in:
parent
5dbc7e1cb5
commit
19b7c37a84
7 changed files with 37 additions and 38 deletions
|
@ -108,7 +108,7 @@ public class TileFirebox extends TileElectricalInventory implements IPacketSende
|
||||||
{
|
{
|
||||||
String name = ((TileMaterial) dustTile).name;
|
String name = ((TileMaterial) dustTile).name;
|
||||||
// TODO: Make refined dust yield more molten fluid than normal dust.
|
// TODO: Make refined dust yield more molten fluid than normal dust.
|
||||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, ResonantInduction.blockFluidMaterial.get(ResourceGenerator.materialNames.indexOf(name)).blockID, worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
worldObj.setBlock(xCoord, yCoord + 1, zCoord, ResonantInduction.blockFluidMaterials.get(ResourceGenerator.materialNames.indexOf(name)).blockID, worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
|
||||||
TileEntity tile = worldObj.getBlockTileEntity(xCoord, yCoord + 1, zCoord);
|
TileEntity tile = worldObj.getBlockTileEntity(xCoord, yCoord + 1, zCoord);
|
||||||
|
|
||||||
if (tile instanceof TileMaterial)
|
if (tile instanceof TileMaterial)
|
||||||
|
|
|
@ -81,12 +81,12 @@ public class ResonantInduction
|
||||||
public static ItemOreResource itemDust;
|
public static ItemOreResource itemDust;
|
||||||
public static ItemOreResource itemRefinedDust;
|
public static ItemOreResource itemRefinedDust;
|
||||||
public static Block blockDust;
|
public static Block blockDust;
|
||||||
public static Block blockFluidMixture;
|
public static List<Block> blockFluidMixtures = new ArrayList<Block>();
|
||||||
public static List<Block> blockFluidMaterial = new ArrayList<Block>();
|
public static List<Block> blockFluidMaterials = new ArrayList<Block>();
|
||||||
public static Block blockGas;
|
public static Block blockGas;
|
||||||
|
|
||||||
public static Fluid fluidMixture;
|
public static List<Fluid> fluidMixtures = new ArrayList<Fluid>();
|
||||||
public static List<Fluid> fluidMaterial = new ArrayList<Fluid>();
|
public static List<Fluid> fluidMaterials = new ArrayList<Fluid>();
|
||||||
|
|
||||||
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, ID);
|
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, ID);
|
||||||
|
|
||||||
|
@ -105,10 +105,6 @@ public class ResonantInduction
|
||||||
MinecraftForge.EVENT_BUS.register(ResourceGenerator.INSTANCE);
|
MinecraftForge.EVENT_BUS.register(ResourceGenerator.INSTANCE);
|
||||||
MinecraftForge.EVENT_BUS.register(new FluidEventHandler());
|
MinecraftForge.EVENT_BUS.register(new FluidEventHandler());
|
||||||
|
|
||||||
fluidMixture = new Fluid("water");
|
|
||||||
FluidRegistry.registerFluid(fluidMixture);
|
|
||||||
blockFluidMixture = contentRegistry.createTile(BlockFluidMixture.class, TileFluidMixture.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Melting dusts
|
* Melting dusts
|
||||||
*/
|
*/
|
||||||
|
@ -166,7 +162,7 @@ public class ResonantInduction
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void postTextureHook(TextureStitchEvent.Post event)
|
public void postTextureHook(TextureStitchEvent.Post event)
|
||||||
{
|
{
|
||||||
for (Fluid fluid : fluidMaterial)
|
for (Fluid fluid : fluidMaterials)
|
||||||
fluid.setIcons(loadedIconMap.get(Reference.PREFIX + "molten_flow"));
|
fluid.setIcons(loadedIconMap.get(Reference.PREFIX + "molten_flow"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
import resonantinduction.core.ResonantInduction;
|
import resonantinduction.core.ResonantInduction;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
@ -29,7 +30,8 @@ public class FluidEventHandler
|
||||||
{
|
{
|
||||||
if (event.map.textureType == 0)
|
if (event.map.textureType == 0)
|
||||||
{
|
{
|
||||||
registerIcon(Reference.PREFIX + "mixture", event);
|
registerIcon(Reference.PREFIX + "mixture_flow", event);
|
||||||
|
registerIcon(Reference.PREFIX + "molten_flow", event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +39,9 @@ public class FluidEventHandler
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void textureHook(TextureStitchEvent.Post event)
|
public void textureHook(TextureStitchEvent.Post event)
|
||||||
{
|
{
|
||||||
ResonantInduction.fluidMixture.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture"));
|
for (Fluid f : ResonantInduction.fluidMixtures)
|
||||||
|
f.setIcons(fluidIconMap.get(Reference.PREFIX + "mixture_flow"));
|
||||||
|
for (Fluid f : ResonantInduction.fluidMaterials)
|
||||||
|
f.setIcons(fluidIconMap.get(Reference.PREFIX + "molten_flow"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import resonantinduction.api.recipe.OreDetectionBlackList;
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
import resonantinduction.core.ResonantInduction;
|
import resonantinduction.core.ResonantInduction;
|
||||||
import resonantinduction.core.resource.fluid.BlockFluidMaterial;
|
import resonantinduction.core.resource.fluid.BlockFluidMaterial;
|
||||||
|
import resonantinduction.core.resource.fluid.BlockFluidMixture;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -90,7 +91,16 @@ public class ResourceGenerator
|
||||||
FluidRegistry.registerFluid(fluidMaterial);
|
FluidRegistry.registerFluid(fluidMaterial);
|
||||||
Block blockFluidMaterial = new BlockFluidMaterial(fluidMaterial);
|
Block blockFluidMaterial = new BlockFluidMaterial(fluidMaterial);
|
||||||
GameRegistry.registerBlock(blockFluidMaterial, "molten" + nameCaps);
|
GameRegistry.registerBlock(blockFluidMaterial, "molten" + nameCaps);
|
||||||
ResonantInduction.blockFluidMaterial.add(blockFluidMaterial);
|
ResonantInduction.blockFluidMaterials.add(blockFluidMaterial);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate dust mixture fluids
|
||||||
|
*/
|
||||||
|
Fluid fluidMixture = new Fluid("mixture" + nameCaps);
|
||||||
|
FluidRegistry.registerFluid(fluidMixture);
|
||||||
|
Block blockFluidMixture = new BlockFluidMixture(fluidMixture);
|
||||||
|
GameRegistry.registerBlock(blockFluidMixture, "mixture" + nameCaps);
|
||||||
|
ResonantInduction.blockFluidMaterials.add(blockFluidMixture);
|
||||||
|
|
||||||
if (OreDictionary.getOres("ore" + nameCaps).size() > 0)
|
if (OreDictionary.getOres("ore" + nameCaps).size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,9 +24,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
*/
|
*/
|
||||||
public class BlockFluidMixture extends BlockFluidFinite implements ITileEntityProvider
|
public class BlockFluidMixture extends BlockFluidFinite implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
public BlockFluidMixture()
|
public BlockFluidMixture(Fluid fluid)
|
||||||
{
|
{
|
||||||
super(Settings.CONFIGURATION.get(Configuration.CATEGORY_BLOCK, "fluidMixture", Settings.getNextBlockID()).getInt(), ResonantInduction.fluidMixture, Material.water);
|
super(Settings.CONFIGURATION.get(Configuration.CATEGORY_BLOCK, "fluidMixture", Settings.getNextBlockID()).getInt(), fluid, Material.water);
|
||||||
setTextureName(Reference.PREFIX + "mixture_flow");
|
setTextureName(Reference.PREFIX + "mixture_flow");
|
||||||
this.setUnlocalizedName(Reference.PREFIX + "fluidMixture");
|
this.setUnlocalizedName(Reference.PREFIX + "fluidMixture");
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ public class BlockFluidMixture extends BlockFluidFinite implements ITileEntityPr
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(World world, int x, int y, int z, boolean doDrain)
|
public FluidStack drain(World world, int x, int y, int z, boolean doDrain)
|
||||||
{
|
{
|
||||||
TileFluidMixture tileFluid = (TileFluidMixture) world.getBlockTileEntity(x, y, z);
|
FluidStack stack = new FluidStack(getFluid(), (int) (FluidContainerRegistry.BUCKET_VOLUME * this.getFilledPercentage(world, x, y, z)));
|
||||||
FluidStack stack = new FluidStack(ResonantInduction.fluidMixture, (int) (FluidContainerRegistry.BUCKET_VOLUME * this.getFilledPercentage(world, x, y, z)));
|
if (doDrain)
|
||||||
tileFluid.writeFluidToNBT(stack.tag != null ? stack.tag : new NBTTagCompound());
|
world.setBlockToAir(x, y, z);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,13 +62,13 @@ public class BlockFilter extends BlockRI implements ITileEntityProvider
|
||||||
/**
|
/**
|
||||||
* Leak the fluid down.
|
* Leak the fluid down.
|
||||||
*/
|
*/
|
||||||
BlockFluidMixture fluidBlock = (BlockFluidMixture) ResonantInduction.blockFluidMixture;
|
BlockFluidMixture fluidBlock = (BlockFluidMixture) ResonantInduction.blockFluidMixtures;
|
||||||
int amount = fluidBlock.getQuantaValue(world, x, y, z);
|
int amount = fluidBlock.getQuantaValue(world, x, y, z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All fluid is filtered out, spawn all the items.
|
* All fluid is filtered out, spawn all the items.
|
||||||
*/
|
*/
|
||||||
if (amount <= 1)
|
if (amount <= 1)
|
||||||
{
|
{
|
||||||
System.out.println("filter dropped");
|
System.out.println("filter dropped");
|
||||||
for (ItemStack itemStack : ((TileFluidMixture) tileAbove).items)
|
for (ItemStack itemStack : ((TileFluidMixture) tileAbove).items)
|
||||||
|
@ -98,7 +98,7 @@ public class BlockFilter extends BlockRI implements ITileEntityProvider
|
||||||
/**
|
/**
|
||||||
* Add liquid to bottom.
|
* Add liquid to bottom.
|
||||||
*/
|
*/
|
||||||
if (checkBelow.getBlockID(world) == ResonantInduction.blockFluidMixture.blockID)
|
if (Block.blocksList[checkBelow.getBlockID(world)] instanceof BlockFluidMixture)
|
||||||
{
|
{
|
||||||
fluidBlock.setQuanta(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ(), fluidBlock.getQuantaValue(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()) + 1);
|
fluidBlock.setQuanta(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ(), fluidBlock.getQuantaValue(world, checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()) + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,22 +54,6 @@ public class TileMixer extends TileMechanical
|
||||||
{
|
{
|
||||||
boolean didWork = false;
|
boolean didWork = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Transform all water blocks into mixture blocks
|
|
||||||
*/
|
|
||||||
for (int x = -1; x < 1; x++)
|
|
||||||
{
|
|
||||||
for (int z = -1; z < 1; z++)
|
|
||||||
{
|
|
||||||
Vector3 checkVector = new Vector3(this).translate(x, 0, z);
|
|
||||||
|
|
||||||
if (checkVector.getBlockID(worldObj) == Block.waterStill.blockID || checkVector.getBlockID(worldObj) == Block.waterMoving.blockID)
|
|
||||||
{
|
|
||||||
checkVector.setBlock(worldObj, ResonantInduction.blockFluidMixture.blockID, 8, 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for an item to "process"
|
// Search for an item to "process"
|
||||||
AxisAlignedBB aabb = AxisAlignedBB.getAABBPool().getAABB(this.xCoord - 1, this.yCoord, this.zCoord - 1, this.xCoord + 2, this.yCoord + 1, this.zCoord + 2);
|
AxisAlignedBB aabb = AxisAlignedBB.getAABBPool().getAABB(this.xCoord - 1, this.yCoord, this.zCoord - 1, this.xCoord + 2, this.yCoord + 1, this.zCoord + 2);
|
||||||
List<Entity> entities = this.worldObj.getEntitiesWithinAABB(Entity.class, aabb);
|
List<Entity> entities = this.worldObj.getEntitiesWithinAABB(Entity.class, aabb);
|
||||||
|
@ -159,13 +143,17 @@ public class TileMixer extends TileMechanical
|
||||||
if (tileEntity instanceof TileFluidMixture)
|
if (tileEntity instanceof TileFluidMixture)
|
||||||
{
|
{
|
||||||
ItemStack itemStack = entity.getEntityItem().copy();
|
ItemStack itemStack = entity.getEntityItem().copy();
|
||||||
|
|
||||||
if (((TileFluidMixture) tileEntity).mix(itemStack))
|
if (((TileFluidMixture) tileEntity).mix(itemStack))
|
||||||
{
|
{
|
||||||
System.out.println("MIXED");
|
|
||||||
worldObj.notifyBlocksOfNeighborChange(mixPosition.intX(), mixPosition.intY(), mixPosition.intZ(), mixPosition.getBlockID(worldObj));
|
worldObj.notifyBlocksOfNeighborChange(mixPosition.intX(), mixPosition.intY(), mixPosition.intZ(), mixPosition.getBlockID(worldObj));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mixPosition.setBlock(worldObj, ResonantInduction.blockFluidMixtures.get(entity.getEntityItem().getItemDamage()).blockID);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue