Filters now work with gutters

This commit is contained in:
Calclavia 2014-02-25 22:45:50 +08:00
parent 7ba79db7d7
commit a2338c043a
3 changed files with 62 additions and 39 deletions

View file

@ -113,7 +113,9 @@ public class RenderPipe implements ISimpleItemRenderer
public void renderInventoryItem(ItemStack itemStack)
{
GL11.glPushMatrix();
render(itemStack.getItemDamage(), Byte.parseByte("000011", 2));
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
render(itemStack.getItemDamage(), Byte.parseByte("001100", 2));
GL11.glPopMatrix();
}
}

View file

@ -6,6 +6,10 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import resonantinduction.api.recipe.MachineRecipes;
import resonantinduction.api.recipe.MachineRecipes.RecipeType;
import resonantinduction.api.recipe.RecipeResource;
@ -50,10 +54,18 @@ public class BlockFilter extends BlockTile
Block bAbove = Block.blocksList[checkAbove.getBlockID(world)];
Block bBelow = Block.blocksList[checkAbove.getBlockID(world)];
if (bAbove instanceof BlockFluidMixture && world.isAirBlock(checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()))
if (bAbove instanceof BlockFluidMixture && (world.isAirBlock(checkBelow.intX(), checkBelow.intY(), checkBelow.intZ()) || checkBelow.getTileEntity(world) instanceof IFluidHandler))
{
world.spawnParticle("dripWater", x + 0.5, y, z + 0.5, 0, 0, 0);
if (checkBelow.getTileEntity(world) instanceof IFluidHandler)
{
IFluidHandler handler = ((IFluidHandler) checkBelow.getTileEntity(world));
if (handler.fill(ForgeDirection.UP, new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), false) <= 0)
return;
}
/**
* Leak the fluid down.
*/
@ -68,7 +80,7 @@ public class BlockFilter extends BlockTile
InventoryUtility.dropItemStack(world, checkAbove.clone().add(0.5), resoure.getItemStack().copy());
}
//TODO: Check if this is correct?
// TODO: Check if this is correct?
int remaining = amount - 2;
/**
@ -80,7 +92,15 @@ public class BlockFilter extends BlockTile
/**
* Add liquid to bottom.
*/
checkBelow.setBlock(world, Block.waterMoving.blockID);
if (checkBelow.getTileEntity(world) instanceof IFluidHandler)
{
IFluidHandler handler = ((IFluidHandler) checkBelow.getTileEntity(world));
handler.fill(ForgeDirection.UP, new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), true);
}
else
{
checkBelow.setBlock(world, Block.waterMoving.blockID);
}
}
}

View file

@ -18,40 +18,33 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public abstract class RITemplateRecipeHandler extends TemplateRecipeHandler
{
int[][] inputSlots = new int[][] {
{11, 5}, {29, 5},
{11, 23}, {29, 23},
{11, 41}, {29, 41}
};
int[][] outputSlots = new int[][] {
{121, 5}, {139, 5},
{121, 23}, {139, 23},
{121, 41}, {139, 41}
};
int[][] inputSlots = new int[][] { { 11, 5 }, { 29, 5 }, { 11, 23 }, { 29, 23 }, { 11, 41 }, { 29, 41 } };
int[][] outputSlots = new int[][] { { 121, 5 }, { 139, 5 }, { 121, 23 }, { 139, 23 }, { 121, 41 }, { 139, 41 } };
@Override
public abstract String getRecipeName();
public abstract MachineRecipes.RecipeType getMachine();
@Override
public String getOverlayIdentifier()
{
return getMachine().name().toLowerCase();
}
@Override
public String getOverlayIdentifier()
{
return getMachine().name().toLowerCase();
}
@Override
public void loadTransferRects()
{
//transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(57, 26, 52, 22), getMachine().name().toLowerCase(), new Object[0]));
// transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(57, 26, 52,
// 22), getMachine().name().toLowerCase(), new Object[0]));
// No point, there is no GUI class to use it... :(
}
@Override
public int recipiesPerPage()
{
return 1;
}
@Override
public int recipiesPerPage()
{
return 1;
}
@Override
public String getGuiTexture()
@ -114,12 +107,15 @@ public abstract class RITemplateRecipeHandler extends TemplateRecipeHandler
if (output instanceof ItemStackResource)
{
this.outputs.add(new PositionedStack(((ItemStackResource) output).itemStack, outputSlots[i][0], outputSlots[i++][1]));
} else if (output instanceof OreDictResource)
}
else if (output instanceof OreDictResource)
{
this.outputs.add(new PositionedStack(OreDictionary.getOres(((OreDictResource) output).name), outputSlots[i][0], outputSlots[i++][1]));
} else if (output instanceof FluidStackResource)
}
else if (output instanceof FluidStackResource)
{
//this.inputs.add(new PositionedStack(((FluidStackResource) output), outputSlots[i][0], outputSlots[i++][1]));
// this.inputs.add(new PositionedStack(((FluidStackResource) output),
// outputSlots[i][0], outputSlots[i++][1]));
// TODO fluidstack compatibility
}
this.outputs.get(this.outputs.size() - 1).generatePermutations();
@ -140,15 +136,20 @@ public abstract class RITemplateRecipeHandler extends TemplateRecipeHandler
if (input instanceof ItemStackResource)
{
this.inputs.add(new PositionedStack(((ItemStackResource) input).itemStack, inputSlots[i][0], inputSlots[i++][1]));
} else if (input instanceof OreDictResource)
}
else if (input instanceof OreDictResource)
{
this.inputs.add(new PositionedStack(OreDictionary.getOres(((OreDictResource) input).name), inputSlots[i][0], inputSlots[i++][1]));
} else if (input instanceof FluidStackResource)
}
else if (input instanceof FluidStackResource)
{
//this.inputs.add(new PositionedStack(((FluidStackResource) input), inputSlots[i][0], inputSlots[i++][1]));
// this.inputs.add(new PositionedStack(((FluidStackResource) input),
// inputSlots[i][0], inputSlots[i++][1]));
// TODO fluidstack compatibility
}
this.inputs.get(this.inputs.size() - 1).generatePermutations();
if (this.inputs.size() > 0)
this.inputs.get(this.inputs.size() - 1).generatePermutations();
}
return inputs;
}
@ -171,7 +172,7 @@ public abstract class RITemplateRecipeHandler extends TemplateRecipeHandler
boolean canProduce = false;
this.getOtherStacks();
for (int i = 0; i < this.outputResources.length; i ++)
for (int i = 0; i < this.outputResources.length; i++)
{
RecipeResource rStack = this.outputResources[i];
if (rStack.equals(product))