Jump to content

Re: Anyone know how to make an inventory tank? [UNSOLVED]


TheEpicTekkit

Recommended Posts

Sorry, but in my other thread, for some reason I cant see any replys after reply 24, I dont know why this happened, but it has also happened to one of my other threads

 

So I have decided to re create the thread (old thread: http://www.minecraftforge.net/forum/index.php/topic,22938.0.html

 

Yes it will. And yes, by direction i mean the ForgeDirection passed, which is the side the block is that inputs the fluid into the tank. If it's a multiblock structure, you can just get the tank from the master, and call the methods in the master TileEntity.

 

What if I wanted a specific block in the structure that I pump into and out of?

 

I want to pump into the master block (on any side) This is the only input for liquid. I then want to have 5 different blocks that can be pumped out of from any side (not 5 of the same block, but 5 different blocks, one for each liquid)

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

In each of the TileEntites of the output blocks, get the masters TileEntity and then the tank you need to get, and cll those methods on that tank. For the input it is almosdt the same.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

So... how would I fill out something like these two methods to work with a certain block in the structure?

    @Override
    public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
    {
    	return tankInput.fill(resource, doFill);
    }

    @Override
    public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
    {
        if (resource == null || !resource.isFluidEqual(tankInput.getFluid()))
        {
            return null;
        }
        return tankInput.drain(resource.amount, doDrain);
    }

 

And this block can be anywhere on the structure, would that cause problems?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Drawing the fluids is the difficult part. Here's some code that you can use (don'tcopy/paste, you won't learn from it then):

 

In the drawGuiContainerBackgroundLayer method:

FluidStack fluid = tileentity.getTankInfo(null)[0].fluid;
        if (fluid != null)
        {
            TextureManager manager = Minecraft.getMinecraft().renderEngine;
            manager.bindTexture(manager.getResourceLocation(0));
            int fluidAmount = (int) (((float) fluid.amount / tileentity.tank.getCapacity()) * 60);
            drawFluid(guiLeft + xSize - 24, guiTop + 8 + 60 - fluidAmount, fluid.getFluid().getIcon(fluid), 16, fluidAmount);
        }

the drawFluid method:

private void drawFluid(int x, int y, IIcon icon, int width, int height)
    {
        int i = 0;
        int j = 0;
        
        int drawHeight = 0;
        int drawWidth = 0;
        
        for (i = 0; i < width; i += 16)
        {
            for (j = 0; j < height; j += 16)
            {
                drawWidth = Math.min(width - i, 16);
                drawHeight = Math.min(height - j, 16);
                drawScaledTexturedModelRectFromIcon(x + i, y + j, icon, drawWidth, drawHeight);
            }
        }
    }

and the drawScaledTexturedModelRectFromIcon method:

private void drawScaledTexturedModelRectFromIcon(int x, int y, IIcon icon, int width, int height)
    {
        if (icon == null)
        {
            return;
        }
        double minU = icon.getMinU();
        double maxU = icon.getMaxU();
        double minV = icon.getMinV();
        double maxV = icon.getMaxV();
        
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(x + 0, y + height, this.zLevel, minU, minV + (maxV - minV) * height / 16.0D);
        tessellator.addVertexWithUV(x + width, y + height, this.zLevel, minU + (maxU - minU) * width / 16.0D, minV + (maxV - minV) * height / 16.0D);
        tessellator.addVertexWithUV(x + width, y + 0, this.zLevel, minU + (maxU - minU) * width / 16.0D, minV);
        tessellator.addVertexWithUV(x + 0, y + 0, this.zLevel, minU, minV);
        tessellator.draw();
    }

 

By the way, I don't quite understand how this works, can you please explain it in a bit more detail? what numbers do I have to customize to for example suite the hight of the tank in my inventory?

 

You have just given me a bunch of code that does stuff I want, but without an explanation of how it does what it does, I would like to learn how this work's and what I need to change.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Also, it hasnt worked... (yet) but I think that is because my gui isnt accepting the fluid, it just deletes it, I am adding fluid to it by right clicking on it with a universal fluid cell from ic2. What do I need to do to make the gui not delete the fluid (im not sure if it is, but that seems like what it is doing, if you cen see that it isnt, or why it is, please point it out to me)

 

My code in the tileentity (only the tank code):

    @Override
    public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
    {
    	return tankInput.fill(resource, doFill);
    }

    @Override
    public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
    {
        if (resource == null || !resource.isFluidEqual(tankInput.getFluid()))
        {
            return null;
        }
        return tankInput.drain(resource.amount, doDrain);
    }

    @Override
    public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
    {
        return tankInput.drain(maxDrain, doDrain);
    }

    @Override
    public boolean canFill(ForgeDirection from, Fluid fluid)
    {
        return true;
    }

    @Override
    public boolean canDrain(ForgeDirection from, Fluid fluid)
    {
        return true;
    }

    @Override
    public FluidTankInfo[] getTankInfo(ForgeDirection from)
    {
        return new FluidTankInfo[] {
        		tankInput.getInfo()
        		};
    }

 

What do I need to change?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

In each of the TileEntites of the output blocks, get the masters TileEntity and then the tank you need to get, and cll those methods on that tank. For the input it is almosdt the same.

 

How do I get an instance of the masters tileentity from the valve tileentity?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Also, how can I get the distance from the master block the valve is? would it be possible to make the valve access one tank if it is 2 blocks above the master, access the second tank if it is 4 blocks above, access the third tank if it is 6 blocks above etc.

 

The reason I would like to do this is because my multiblock will output 4 fluids, 2 gases and 2 liquids, now logic says the gases are going to rise, and the liquids are going to sink (obviously this wont really happen in the game, but it is what would happen in real life), so the I want to be able to access a tank based on the height in the structure the valve is, the dense fluids output from the bottom valve and the low density fluids output from the top

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Slow down: how are you telling the tank to fill? From gui like put cell in slot and it gets eaten up? Then when you eat it up do the tank#.fill(..).

To get the master tile just do world#.getTileEntity(x, y, z) and, if you are sure it's a master tile entity, cast MasterTile to it: MasterTile tile2 = (MasterTile) world.get...

Just do some math for the height (tileValve#.y-tileMaster#.y>6 then A, else if >4 then B, else if >2 then C...)

Check out my blog!

http://www.whov.altervista.org

Link to comment
Share on other sites

Okay, so I just right click on the master block with a fluid cell from ic2, and it seems to use up the fluid cell, and turn it into an empty cell, I am not putting anything in any slots in the gui to fill it. I am not entirely sure if it is actually filling though... If I click on the master with a bucket of my fluid, but that doesnt seem to do anything, rather just dump the bucket of fluid in the world.

 

I suspect that it is deleting the fluid in the tank because I have done something wrong somewhere, but I cant be sure of that because I have no way of telling. I have tried System.out.println(tankInput.getFluid().toString()); but that seems to throe a nullPointerException I have also tried instead of .toString(), .fluidId() and some other integer values of the fluid.

 

Here is my code if you can see what I have done wrong:

 

 

ONLY the IFluidHandler methids in the tileentity:

 

 

        public FluidTank tankInput = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 48);
public FluidTank tankOutput1 = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 12);
public FluidTank tankOutput2 = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 12);
public FluidTank tankOutput3 = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 12);
public FluidTank tankOutput4 = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 12);
public FluidTank tankBiproduct = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * ;

//Some irrelevant code....

        private FluidStack[] tanks = new FluidStack[6];

//More irrelevant code....

//All the IFluidHandler methods....

        @Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
	return tankInput.drain(maxDrain, doDrain);
}

@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
	if (resource == null) {
		return null;
	} if (tankInput.getFluid() == resource) {
		return tankInput.drain(resource.amount, doDrain);
	}
	return null;
}

@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
	return true;
}

@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
	if (resource == null || resource.getFluid() == null) {
		return 0;
	}
	return tankInput.fill(resource, doFill);
}

@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
	return true;
}

@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
	return new FluidTankInfo[] { tankInput.getInfo() };
}

//Custom method used in the gui to get the fluid to draw (not necessary)
public FluidStack getTankInput() {
	return tankInput.getFluid();
}

 

 

 

My gui class for the distillation chamber:

 

 

package net.theepictekkit.generator.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.theepictekkit.generator.Reference;
import net.theepictekkit.generator.common.container.ContainerDistillationChamber;
import net.theepictekkit.generator.common.tileentity.TileEntityDistillationChamberFrame;
import net.theepictekkit.generator.utils.RenderUtils;


public class GuiDistillationChamber extends GuiContainer {

private TileEntityDistillationChamberFrame tileEntity;

private final String modid = Reference.MODID;
private final ResourceLocation texture = new ResourceLocation (modid + ":" + "textures/gui/guiDistillationChamber.png");

public GuiDistillationChamber(InventoryPlayer invPlayer, TileEntityDistillationChamberFrame tileEntityDistillationChamberFrame) {
	super(new ContainerDistillationChamber(invPlayer, tileEntityDistillationChamberFrame));

	this.tileEntity = tileEntityDistillationChamberFrame;

	this.xSize = 256; //276
	this.ySize = 183; //183
}

@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {

	fontRendererObj.drawString("Distillation Chamber", 8, 3, 0, false);
	fontRendererObj.drawString("Inventory", 8, 90, 0, false);

	FluidStack fluidStack = tileEntity.getTankInfo(null)[0].fluid;
	String str = "";

	if (tileEntity.getTankInput() != null && tileEntity.getTankInput().getFluid() != null) {
	str = tileEntity.getTankInput().toString() + ", " + tileEntity.getTankInput().amount;
	} else {
		str = "No fluid stored!";
	}
	fontRendererObj.drawString("Current Fluid Stored: " + str, 180, 100, 0, false);
}

        public void drawFluid(FluidStack fluid, int x, int y, int width, int height, int maxCapacity) {
	if (fluid == null || fluid.getFluid() == null) {
		return;
	}
	IIcon icon = fluid.getFluid().getIcon(fluid);
	mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
	RenderUtils.setGLColorFromInt(fluid.getFluid().getColor(fluid));
	int fullX = width / 16;
	int fullY = height / 16;
	int lastX = width - fullX * 16;
	int lastY = height - fullY * 16;
	int level = fluid.amount * height / maxCapacity;
	int fullLvl = (height - level) / 16;
	int lastLvl = (height - level) - fullLvl * 16;
	for (int i = 0; i < fullX; i++) {
		for (int j = 0; j < fullY; j++) {
			if (j >= fullLvl) {
				drawScaledTextureRectFromIcon(icon, x + i * 16, y + j * 16, 16, 16, j == fullLvl ? lastLvl : 0);
			}
		}
	}
	for (int i = 0; i < fullX; i++) {
		drawScaledTextureRectFromIcon(icon, x + i * 16, y + fullY * 16, 16, lastY, fullLvl == fullY ? lastLvl : 0);
	}
	for (int i = 0; i < fullY; i++) {
		if (i >= fullLvl) {
			drawScaledTextureRectFromIcon(icon, x + fullX * 16, y + i * 16, lastX, 16, i == fullLvl ? lastLvl : 0);
		}
	}
	drawScaledTextureRectFromIcon(icon, x + fullX * 16, y + fullY * 16, lastX, lastY, fullLvl == fullY ? lastLvl : 0);
}

private void drawScaledTextureRectFromIcon(IIcon icon, int x, int y, int width, int height, int cut) {
	Tessellator tess = Tessellator.instance;
	tess.startDrawingQuads();
	tess.addVertexWithUV(x, y + height, zLevel, icon.getMinU(), icon.getInterpolatedV(height));
	tess.addVertexWithUV(x + width, y + height, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(height));
	tess.addVertexWithUV(x + width, y + cut, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(cut));
	tess.addVertexWithUV(x, y + cut, zLevel, icon.getMinU(), icon.getInterpolatedV(cut));
	tess.draw();
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
                Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
	drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
	//int i = this.tileEntityDistillationChamberFrame.getPowerScaled(57);
	//drawTexturedModalRect(guiLeft + 144, guiTop + 14 + 57 - i, 176, 57 - i, 16, i);

	this.drawFluid(tileEntity.getTankInput(), guiLeft + 15, guiTop + 70, 16, 56, tileEntity.tankInput.getCapacity());
}
}

 

 

 

 

 

Now im not sure where the problem is, I dont know if it is an issue with the gui, or the tileentity. Please help me locate the issue.

 

Anyone know any mods on github that can give a clear example of drawing fluids in a gui (without some fance guiFluidHandler, or something like that that I saw in buildcrafts github)

 

I would also like to know how to add a tooltip displaying the fluid name, and the amound, when the player mouses over the tank in the gui. (But to be honest, I would really like to solve actually getting the fluid in the inventory first, so this can come after that is working)

 

Thanks.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Okay, so I have now added some code in the onBlockActivated method that takes the fluid from a bucket in the players hand, and puts it into the gui, and visa versa

 

This is that code:

 

 

ItemStack itemStack = player.inventory.getCurrentItem();

	if (itemStack != null) {
		FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(itemStack);
		TileEntity tileEntity1 = world.getTileEntity(x, y, z);

		if (tileEntity1 instanceof TileEntityDistillationChamberFrame) {
			TileEntityDistillationChamberFrame master = (TileEntityDistillationChamberFrame) tileEntity1;

			if (fluid != null && master.checkMultiBlockForm()) {
				int amount = master.fill(ForgeDirection.UNKNOWN, fluid, true);

				if (amount != 0 && !player.capabilities.isCreativeMode) {
					player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(itemStack));
				}
			} else {
				FluidStack fluid1 = master.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;

				if (fluid1 != null) {
					ItemStack itemStack1 = FluidContainerRegistry.fillFluidContainer(fluid1, itemStack);
					fluid = FluidContainerRegistry.getFluidForFilledItem(itemStack1);

					if (fluid != null) {
						if (!player.capabilities.isCreativeMode) {
							if (itemStack.stackSize > 1) {
								if (!player.inventory.addItemStackToInventory(itemStack1)) {
									return false;
								} else {
									player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(itemStack));
								}
							} else {
								player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(itemStack));
								player.inventory.setInventorySlotContents(player.inventory.currentItem, itemStack1);
							}
						}
						master.drain(ForgeDirection.UNKNOWN, fluid1.amount, true);
						return true;
					}
				}
			}
		}
	}
        return false;
//Some irrelevant code here for opening the gui and checking if the structure is formed...

        }

 

 

 

And now when I open the gui there is a crash:

 

 

These are the lines that interest me (not the whole crash report)

java.lang.NullPointerException: Rendering screen
at net.theepictekkit.generator.client.gui.GuiDistillationChamber.drawScaledTextureRectFromIcon(GuiDistillationChamber.java:123)
at net.theepictekkit.generator.client.gui.GuiDistillationChamber.drawFluid(GuiDistillationChamber.java:110)
at net.theepictekkit.generator.client.gui.GuiDistillationChamber.drawGuiContainerBackgroundLayer(GuiDistillationChamber.java:148)

 

 

Now I am fairly sure that my code to fill the tank works, because the crash report points to the gui, not the block class.

 

These are the lines of code in the gui that it points to:

 

 

at net.theepictekkit.generator.client.gui.GuiDistillationChamber.drawScaledTextureRectFromIcon(GuiDistillationChamber.java:123)

	tess.addVertexWithUV(x, y + height, zLevel, icon.getMinU(), icon.getInterpolatedV(height));

 

at net.theepictekkit.generator.client.gui.GuiDistillationChamber.drawFluid(GuiDistillationChamber.java:110)

		drawScaledTextureRectFromIcon(icon, x + i * 16, y + fullY * 16, 16, lastY, fullLvl == fullY ? lastLvl : 0);

 

at net.theepictekkit.generator.client.gui.GuiDistillationChamber.drawGuiContainerBackgroundLayer(GuiDistillationChamber.java:148)

	this.drawFluid(tileEntity.getTankInput(), guiLeft + 15, guiTop + 70, 16, 56, tileEntity.tankInput.getCapacity());

 

And here is all of the gui class:

 

 

package net.theepictekkit.generator.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.theepictekkit.generator.Reference;
import net.theepictekkit.generator.common.container.ContainerDistillationChamber;
import net.theepictekkit.generator.common.tileentity.TileEntityDistillationChamberFrame;
import net.theepictekkit.generator.utils.RenderUtils;


public class GuiDistillationChamber extends GuiContainer {

private TileEntityDistillationChamberFrame tileEntity;

private final String modid = Reference.MODID;
private final ResourceLocation texture = new ResourceLocation (modid + ":" + "textures/gui/guiDistillationChamber.png");

public GuiDistillationChamber(InventoryPlayer invPlayer, TileEntityDistillationChamberFrame tileEntityDistillationChamberFrame) {
	super(new ContainerDistillationChamber(invPlayer, tileEntityDistillationChamberFrame));

	this.tileEntity = tileEntityDistillationChamberFrame;

	this.xSize = 256; //276
	this.ySize = 183; //183
}

@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {

	fontRendererObj.drawString("Distillation Chamber", 8, 3, 0, false);
	fontRendererObj.drawString("Inventory", 8, 90, 0, false);

	FluidStack fluidStack = tileEntity.getTankInfo(null)[0].fluid;
	String str = "";

	if (tileEntity.getTankInput() != null && tileEntity.getTankInput().getFluid() != null) {
	str = tileEntity.getTankInput().toString() + ", " + tileEntity.getTankInput().amount;
	} else {
		str = "No fluid stored!";
	}
	fontRendererObj.drawString("Current Fluid Stored: " + str, 180, 100, 0, false);
}

public void drawFluid(FluidStack fluid, int x, int y, int width, int height, int maxCapacity) {
	if (fluid == null || fluid.getFluid() == null) {
		return;
	}
	IIcon icon = fluid.getFluid().getIcon(fluid);
	mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
	RenderUtils.setGLColorFromInt(fluid.getFluid().getColor(fluid));
	int fullX = width / 16;
	int fullY = height / 16;
	int lastX = width - fullX * 16;
	int lastY = height - fullY * 16;
	int level = fluid.amount * height / maxCapacity;
	int fullLvl = (height - level) / 16;
	int lastLvl = (height - level) - fullLvl * 16;
	for (int i = 0; i < fullX; i++) {
		for (int j = 0; j < fullY; j++) {
			if (j >= fullLvl) {
				drawScaledTextureRectFromIcon(icon, x + i * 16, y + j * 16, 16, 16, j == fullLvl ? lastLvl : 0);
			}
		}
	}
	for (int i = 0; i < fullX; i++) {
		drawScaledTextureRectFromIcon(icon, x + i * 16, y + fullY * 16, 16, lastY, fullLvl == fullY ? lastLvl : 0);
	}
	for (int i = 0; i < fullY; i++) {
		if (i >= fullLvl) {
			drawScaledTextureRectFromIcon(icon, x + fullX * 16, y + i * 16, lastX, 16, i == fullLvl ? lastLvl : 0);
		}
	}
	drawScaledTextureRectFromIcon(icon, x + fullX * 16, y + fullY * 16, lastX, lastY, fullLvl == fullY ? lastLvl : 0);
}

private void drawScaledTextureRectFromIcon(IIcon icon, int x, int y, int width, int height, int cut) {
	Tessellator tess = Tessellator.instance;
	tess.startDrawingQuads();
	tess.addVertexWithUV(x, y + height, zLevel, icon.getMinU(), icon.getInterpolatedV(height));
	tess.addVertexWithUV(x + width, y + height, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(height));
	tess.addVertexWithUV(x + width, y + cut, zLevel, icon.getInterpolatedU(width), icon.getInterpolatedV(cut));
	tess.addVertexWithUV(x, y + cut, zLevel, icon.getMinU(), icon.getInterpolatedV(cut));
	tess.draw();
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
	drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

	this.drawFluid(tileEntity.getTankInput(), guiLeft + 15, guiTop + 70, 16, 56, tileEntity.tankInput.getCapacity());
}
}

 

 

 

 

 

So this means that there isnt anything wrong with my block class or tileentity (yet... as far as I can tell), instead, it is a problem with the way I am drawing the fluid in the gui

 

I am not so great at debugging (I can figure out basic problems) this is really complicated, and I dont know where to start.

 

Please tell me if you can see the problem, or if you have a better / correct way of drawing fluids in the gui. untill then, I am going to attempt to figure this out also.

 

Thanks for your help.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

I think I am registering my textures wrong... I put my crude oil fluid into a fluid transposer from te, and the fluid in the tank was invisible. I probably also registered the name wrong because it was fluid.fluidCrudeOil when I mouse over it. What is the proper way of registering fluid textures and names? this might have been the problem, the tank worked all along, but I didn't know because the fluid was invisible.... and there was no tooltip, because I dont know how to do that.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Now Im even more confused, I have no idea where I am going wrong. The tileentity class, the gui class, the block class.... really confused.

 

Also, there isnt any tutorials on fluids in guis there needs to a be a tutorial on this somewhere.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

I had that problem too where the fluid was invisible in tanks. If you have a block implementation (for it to be placed in the world) with correct textures, you need to set

YourFluid#setIcons(stillIcon,flowingIcon)

so it has the proper textures.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

You probably have a static instance of the fluid, use that to call the

setIcons(stillIcon,flowingIcon)

method.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Ah, now I understand.

 

I added into the block class:

FluidHandler.fluidCrudeOil.setIcons(iconStationary, iconFlowing);

 

So I am registering the icon for the fluid not the block, but from the block class.

 

And yes, I do have a static instance of the fluid.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

Link to comment
Share on other sites

Where have you placed that? I did in the registerBlockIcons method after the initialization of the icons.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.