OK, I tried out your code, but upon placement, I get this crash when placing my block:
net.minecraft.util.ReportedException: Exception ticking world
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:704) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:613) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:149) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65]
Caused by: java.lang.RuntimeException: class com.cjburkey.buildalt.block.tile.TileEntityPump is missing a mapping! This is a bug!
at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:81) ~[TileEntity.class:?]
at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:72) ~[TileEntity.class:?]
at net.minecraftforge.fluids.capability.TileFluidHandler.writeToNBT(TileFluidHandler.java:43) ~[TileFluidHandler.class:?]
at com.cjburkey.buildalt.block.tile.TileEntityPump.getUpdateTag(TileEntityPump.java:19) ~[TileEntityPump.class:?]
at com.cjburkey.buildalt.block.tile.TileEntityPump.getUpdatePacket(TileEntityPump.java:24) ~[TileEntityPump.class:?]
at net.minecraft.server.management.PlayerChunkMapEntry.sendBlockEntity(PlayerChunkMapEntry.java:287) ~[PlayerChunkMapEntry.class:?]
at net.minecraft.server.management.PlayerChunkMapEntry.update(PlayerChunkMapEntry.java:249) ~[PlayerChunkMapEntry.class:?]
at net.minecraft.server.management.PlayerChunkMap.tick(SourceFile:115) ~[PlayerChunkMap.class:?]
at net.minecraft.world.WorldServer.tick(WorldServer.java:221) ~[WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:698) ~[MinecraftServer.class:?]
... 4 more
[13:39:52] [Server thread/ERROR]: This crash report has been saved to: /Users/cjburkey/Documents/Files/Java/Modding/Forge/Workspace/BuildcraftAlt/run/./crash-reports/crash-2016-07-10_13.39.52-server.txt
[13:39:52] [Server thread/INFO]: Stopping server
[13:39:52] [Server thread/INFO]: Saving players
[13:39:52] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:560]: ---- Minecraft Crash Report ----
// Uh... Did I do that?
Time: 7/10/16 1:39 PM
Description: Exception ticking world
java.lang.RuntimeException: class com.cjburkey.buildalt.block.tile.TileEntityPump is missing a mapping! This is a bug!
at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:81)
at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:72)
at net.minecraftforge.fluids.capability.TileFluidHandler.writeToNBT(TileFluidHandler.java:43)
at com.cjburkey.buildalt.block.tile.TileEntityPump.getUpdateTag(TileEntityPump.java:19)
at com.cjburkey.buildalt.block.tile.TileEntityPump.getUpdatePacket(TileEntityPump.java:24)
at net.minecraft.server.management.PlayerChunkMapEntry.sendBlockEntity(PlayerChunkMapEntry.java:287)
at net.minecraft.server.management.PlayerChunkMapEntry.update(PlayerChunkMapEntry.java:249)
at net.minecraft.server.management.PlayerChunkMap.tick(SourceFile:115)
at net.minecraft.world.WorldServer.tick(WorldServer.java:221)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:698)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:613)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:149)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:471)
at java.lang.Thread.run(Thread.java:745)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.tileentity.TileEntity.writeInternal(TileEntity.java:81)
at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:72)
at net.minecraftforge.fluids.capability.TileFluidHandler.writeToNBT(TileFluidHandler.java:43)
at com.cjburkey.buildalt.block.tile.TileEntityPump.getUpdateTag(TileEntityPump.java:19)
at com.cjburkey.buildalt.block.tile.TileEntityPump.getUpdatePacket(TileEntityPump.java:24)
at net.minecraft.server.management.PlayerChunkMapEntry.sendBlockEntity(PlayerChunkMapEntry.java:287)
at net.minecraft.server.management.PlayerChunkMapEntry.update(PlayerChunkMapEntry.java:249)
at net.minecraft.server.management.PlayerChunkMap.tick(SourceFile:115)
at net.minecraft.world.WorldServer.tick(WorldServer.java:221)
Here's the code:
package com.cjburkey.buildalt.block.tile;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.capability.TileFluidHandler;
public class TileEntityPump extends TileFluidHandler {
public static final int CAP = 5 * Fluid.BUCKET_VOLUME;
public TileEntityPump() {
this.tank = new FluidTankWithTile(this, CAP);
}
public NBTTagCompound getUpdateTag() {
return this.writeToNBT(new NBTTagCompound());
}
@Nullable
public SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(this.getPos(), 0, this.getUpdateTag());
}
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.getNbtCompound());
}
}
Hello, I'm working on a tank-like block. So far, I've got a TileEntity implementing IFluidHandler, which is great, but I have no way of testing whether or not this thing will actually store fluid. How would I implement a "right click with a bucket to fill block" system?
I'm very impatient, and I don't want to wait for Buildcraft for upgrade lol. Sure, RF Tools has a quarry thing, and I'm using that now, but a dedicated quarry would be nice. Also, a fluid pump is quite necessary in my opinion. Anyway, that's just my 2043¢.
I thought a simple html hex would suffice, do I have to add a number in front to tell the alpha? Sorry for my "noobiness", I'm new to any color system other than simple RGB.
EDIT: Would 0xFF800000 work?
Ok, I got it figured out now, thank you very much for your help
Hello, I've created a custom container GUI, and so far, it works fine. The only issue is that I cannot use the drawRect method for some reason. Iv'e tried it in the background and foreground render but it still refuses to work. Am I used it correctly?
For some reason, my tile entity has no texture or model in game. Do I have to create a special renderer to render my tile entity now? If so, how would I go about making it look like any other block?
0
So, I'm able to check if a block is a fluid, but how can I get an instance of "Fluid" from that?
Edit: Think I've got it. Thanks!
If anyone needs it:
0
Just a simple question, how would I check if a certain block in the world is a fluid? If it is, how would I get the FluidStack?
0
My god I'm stupid. I forgot to register it. Thanks for your help!
0
OK, I tried out your code, but upon placement, I get this crash when placing my block:
Here's the code:
0
Hello, I'm working on a tank-like block. So far, I've got a TileEntity implementing IFluidHandler, which is great, but I have no way of testing whether or not this thing will actually store fluid. How would I implement a "right click with a bucket to fill block" system?
0
I'm very impatient, and I don't want to wait for Buildcraft for upgrade lol. Sure, RF Tools has a quarry thing, and I'm using that now, but a dedicated quarry would be nice. Also, a fluid pump is quite necessary in my opinion. Anyway, that's just my 2043¢.
0
Ditto.
0
I thought a simple html hex would suffice, do I have to add a number in front to tell the alpha? Sorry for my "noobiness", I'm new to any color system other than simple RGB.
EDIT: Would 0xFF800000 work?
Ok, I got it figured out now, thank you very much for your help
This is what I used:
0
Hello, I've created a custom container GUI, and so far, it works fine. The only issue is that I cannot use the drawRect method for some reason. Iv'e tried it in the background and foreground render but it still refuses to work. Am I used it correctly?
0
Ok, thank you
0
Which methods would I override?
0
I ended up implementing the ITileEntityProvider(I think) class. Either way, I didn't have to do that.
0
If I do that, will I have to write all the render code, or can I just override it and give it a texture?
EDIT: I looked into the furnace tile entity, and it doesn't create its own renderer, is that because it's a sided inventory?
0
For some reason, my tile entity has no texture or model in game. Do I have to create a special renderer to render my tile entity now? If so, how would I go about making it look like any other block?
0
Shift right click?