Jump to content

larsgerrits

Members
  • Posts

    3462
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by larsgerrits

  1. Thats..... not how events work. You need to make a class and register it with MinecraftForge.EVENT_BUS.register(new YourClass()); . In that class make a method with the event as a parameter. Above the method, put the @SubscribeEvent annotation. Then you can do whatever you want with the event.
  2. PlayerInteractEvent is a Forge event, not a ForgeModLoader event. You need to register it using MinecraftForge.EVENT_BUS.register();
  3. If you think this needs to be implemented in Forge, make a pull request.
  4. The integer arrays are null. You need to initialize them.
  5. You are missing a @EventHandler above youe FMLPreInitialization method.
  6. BlockEvent.* are MinecraftForge events, not ForgeModLoader events. You need to register them using MinecraftForge.EVENT_BUS.register();
  7. 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.
  8. In the drawGuiContainerForegroundLayer method, the 2 integers that are passed in are the x and y-coordinate of the mouse. You can check if those coords are between certain coords, and if so, you can use the drawHoveringText() method.
  9. The drawTexturedModalRect only accepts textures of which is the full size 256x256. You need to make your own method (copy the vanilla method) and change f and f1 to 1/imageSize (in your case 512), and call that method.
  10. Somewhere in your gui code, you are using GL11.glScalef(). That messes stuff up.
  11. 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.
  12. 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(); }
  13. Here is a link to another post related to this (Hint: it's yours, don't make multiple threads for the same thing)
  14. You can't have multiple return statements. You need to take a tank based on the direction given.
  15. You only need to implements those if you want to create your own version of FluidTank, but else you can just use the already made FluidTank.
  16. You could, but that makes it so it only has a FluidTank which can store a bucket full of liquid. Your best bet is to copy it, rather then extending it, so you can make the tank bigger, and you can customize it further.
  17. The methods you need to implement by IFluidHandler are basicly wrapper methods for the IFluidTank class. You can just use the provided FluidTank class, which is already filled out, so you don't need to do that. As you can see in the TileFluidHandler class, most of the methods just call tank.aMethod(params), and more you don't need to know. If you really want to know how to fill these methods in, you need to study it yourself.
  18. Take a look at the forge-provided 'TileFluidHandler', it is a reference-implementation.
  19. MinecraftForge mods can't be run in a Bukkt environment, so you don't have to worry about that.
  20. In your getDescriptionPacket method, your writing twice to NBT. I don't know if that causes the issue, but you might want to fix it.
  21. The onBlockPlacedBy is called if a entity has placed the block, and onBlockAdded will always be called when to block places, so need both if you want the block to be rotated if a machines places it.
  22. You can use EntityPlayer#rayTrace(distance,1) to get a MovingObjectPosition which has the block coords of the block hit.
  23. You could probably make your own Gui class extending the vanilla class, and override the doesGuiPausGame() method. Than you need to subscribe the the [/code]GuiOpenEvent[/code] and in that methd you set the GuiScreen variable to a new instance of your Gui.
  24. That's not a actual Java thing, it is used on the forums here to indicate that you need to call that method from a instance of that class, instead of directly like it was a static method.
  25. You can store it in the ItemStacks stackTagCompound.
×
×
  • Create New...

Important Information

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