Jump to content

simwir

Members
  • Posts

    5
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

simwir's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. So i want it to be so that when you right click the block with a item, it prints the fluid inside the tank to the chat. I have got it so that it prints it to the chat, but it prints it twice. }else if(heldtItem.isItemEqual(new ItemStack(CompactTanks.meter))){ //checks if it's the right item Debug.consoleln("Fluid Meter found"); //Everything prefixed with Debug just prints to the console if(tileSmallTank.isTankEmpty()){ ChatHandler.sendToPlayer("The tank is empty", par5EntityPlayer);//the text that gets printed twice }else{ ChatHandler.sendToPlayer("Current fluid in tank: " + tileSmallTank.getFluidName(), par5EntityPlayer);//the text that gets printed twice ChatHandler.sendToPlayer("Amount of fluid in tank: " + tileSmallTank.getFluidAmount(), par5EntityPlayer);//the text that gets printed twice return true; } } The code in the ChatHandler looks like this: public class ChatHandler { public static void sendToPlayer(String par1Message, EntityPlayer par2Player){ if(par1Message.length() > 0){ par2Player.addChatMessage(new ChatComponentTranslation(par1Message)); } } } and the isTankEmpty code looks lige this: public boolean isTankEmpty(){ if(tank.getFluid() == null){ return true; }else{ return false; } } All the code can be found here: https://github.com/simwir/Compact-Tanks/tree/Tank and the files in question are: ChatHandler - https://github.com/simwir/Compact-Tanks/blob/Tank/main/java/simwir/ct/handler/ChatHandler.java BlockSmallTank - https://github.com/simwir/Compact-Tanks/blob/Tank/main/java/simwir/ct/blocks/BlockSmallTank.java TileSmallTank - https://github.com/simwir/Compact-Tanks/blob/Tank/main/java/simwir/ct/tile/TileSmallTank.java
  2. You can do it in the onBlockActivated in the block class you just check if there where right clicked with a bucket. you can find a example on pretty much what you are looking for in my mod: https://github.com/simwir/Creative-supplier/blob/1.7/main/java/simwir/cs/blocks/BlockFluidSupplier.java or mayby if you're looking for a block that only can fill one type of fluid you might want to look at my other mod: https://github.com/simwir/Compact-Tanks/blob/master/main/java/simwir/ct/blocks/BlockWaterSource.java
  3. Have you tried looking at the forge tutorials? http://www.minecraftforge.net/wiki/Create_a_Fluid
  4. So i'm making a tank, but can't quite make it work. I think i need to implement the IFluidTank, but can't find out where to implement it. The source code https://github.com/simwir/Creative-supplier/tree/TileEntity The class it's all about is https://github.com/simwir/Creative-supplier/blob/TileEntity/common/simwir/cs/blocks/BlockLavaSupplier.java and the tile entity for it: https://github.com/simwir/Creative-supplier/blob/TileEntity/common/simwir/cs/tileentities/TileEntityLavaSupplier.java
×
×
  • Create New...

Important Information

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