Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Delfil

Members
  • Posts

    15
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

Delfil's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I already found this, but it did look like it also blocks block placement when I used it. But I left the useItem on the default value. Now I used e.useItem = Result.ALLOW, and now it does work. Thank you very much! So this blocks both, placement & block interactions: public void onPlayerInteract(PlayerInteractEvent e) { e.useBlock = Result.DENY; e.useItem = Result.DEFAULT; } but using e.useItem = Result.ALLOW allows it to place blocks when useBlock is denied.
  2. "I want to cancel the PlayerInteractEvent only when a player tries to activate a block" Canceling PlayerInteractEvent will also cancel block placement.
  3. All blocks where I can interact with, like opening a gui for a chest or crafting table, or using a block like a repeater. (lever, button, anvil, ..)
  4. For blocks of other mods. I don't know which other mods the user of my mod is using. If you know a way to filter out all blocks who can be used like repeaters & levers are used or opening gui's way from other mods, that would solve my problem.
  5. Hi, I want to cancel the PlayerInteractEvent only when a player tries to activate a block, like opening a gui for a chest or crafting table, or using a block like a repeater. I could do this by just checking the block I'm clicking (clickedBlock.equals(Blocks.Repeater)), but I can only do this for vanilla minecraft blocks. I can't use the gui event, because I've to know the result at the end of the PlayerInteractEvent. I want to do this server-side and I 'll need the player object & block location later on. Any idea how I could do this? (I'm using Forge 1.7.10-10.13.0.1180) Solution to cancel block interactions only: e.useBlock = Result.DENY; e.useItem = Result.ALLOW;
  6. GL11.glEnable(GL11.GL_LIGHTING) / disable & RenderHelper.disableStandardItemLighting(); Work both to solve this problem. Thank you!
  7. Hi, The lighting on my custom rendered block is weird at a certain angle of view. It gets dark when I look up a bit. I made a short video where I show what happens. Does anyone have an idea about what goes wrong and/or how to solve it? Video: http://youtu.be/63D854gBDIM Version: 1.7.10 - 10.13.0.1180 Block: Material: Material.rock getRenderType() : -1 renderAsNormalBlock() : false isOpaqueCube() : false BlockBounds: - minX: O - minY: -2*O - minZ: O - maxX: I - maxY: O - maxZ: I Constants: O = 0.125 I = 1 - O U = -0.5 D = -0.25 Render code in my render class, extending TileEntitySpecialRenderer: public void renderTileEntityAt(TileEntity _tile, double x, double y, double z, float d) { GL11.glPushMatrix(); GL11.glTranslated(x, y + D, z); Tessellator t = Tessellator.instance; this.bindTexture(texture); t.startDrawing(GL11.GL_QUADS); // Top t.addVertexWithUV(O, U, O, 0, 0); t.addVertexWithUV(O, U, I, 0, 0.5); t.addVertexWithUV(I, U, I, 0.25, 0.5); t.addVertexWithUV(I, U, O, 0.25, 0); // Bottom t.addVertexWithUV(I, 0, O, 0.25, 0.5); t.addVertexWithUV(I, 0, I, 0.25, 1); t.addVertexWithUV(O, 0, I, 0, 1); t.addVertexWithUV(O, 0, O, 0, 0.5); // Side I t.addVertexWithUV(O, 0, O, 0.5, 0.5); t.addVertexWithUV(O, U, O, 0.5, 0.1875); t.addVertexWithUV(I, U, O, 0.75, 0.1875); t.addVertexWithUV(I, 0, O, 0.75, 0.5); // Side II t.addVertexWithUV(I, 0, I, 1, 0.5); t.addVertexWithUV(I, U, I, 1, 0.1875); t.addVertexWithUV(O, U, I, 0.75, 0.1875); t.addVertexWithUV(O, 0, I, 0.75, 0.5); // Side III t.addVertexWithUV(I, 0, O, 0.5, 1); t.addVertexWithUV(I, U, O, 0.5, 0.5 + 0.1875); t.addVertexWithUV(I, U, I, 0.75, 0.5 + 0.1875); t.addVertexWithUV(I, 0, I, 0.75, 1); // Side IIII t.addVertexWithUV(O, 0, I, 1, 1); t.addVertexWithUV(O, U, I, 1, 0.5 + 0.1875); t.addVertexWithUV(O, U, O, 0.75, 0.5 + 0.1875); t.addVertexWithUV(O, 0, O, 0.75, 1); t.draw(); GL11.glPopMatrix(); }
  8. While it seems strange that RIGHT_CLICK_AIR causes block placement, because right clicking in the air normally won't place any blocks, I tried it out: // Test in method who handles the PlayerInteractEvent: if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR){ System.out.println("RIGHT_CLICK_AIR"); e.setCanceled(true); } And it seems like placing blocks on blocks wont post any PlayerInteractEvent with the value action set to PlayerInteractEvent.Action.RIGHT_CLICK_AIR. However, right clicking without selecting the air does.
  9. I haven't tried event.useItem = Result.DENY; yet, because I was expecting it would be done with event.useBlock, since it is about blocks This works indeed for only cancelling block placement, and leaving events for opening gui's alone. However this isn't a way to detect the difference between placing blocks and using blocks, this did solve my problem, so thank you very much A way to detect the difference between block placing and block using would still help me out.
  10. y, Im having trouble with that part. (See the post before yours.) I want to detect the difference between placing blocks and using a block within the PlayerInteractEvent event.
  11. "Think about it a bit. You know the player involved. Hint - look for what is in his hand." I think I went off track here, my apology's. I'm now trying to write a function to find out if the current selected itemstack is able to place a block, which isn't relevant to the original question. The question was: "I want to handle placing blocks and using a block with right clicking (like opening a chest) differently, but I can't find out how to do this." I'll explain this a bit more. What I basically want, is to know if not-cancelling this event results in a block placement or an interaction with a block (like opening the gui from a chest or crafting table). Maybe I can make my question more clear this way: Lets say I want to implement the following method: /** * given that: * event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK * * returns: * true if the event results in a block placement. * false if the event does not results in a block placement, but in results in a block interaction. **/ boolean doesEventCauseBlockPlacement(PlayerInteractEvent event); Then I want to ask, how do I implement this?
  12. Thanks again for your response, I already got the zones implemented, so that wont be a problem. This isn't the case, indeed. I want to be able to block all blocks, also from Minecraft and other mods. I guess you are suggesting event.entityPlayer.getItemInUse() But I forgot to tell, this is a server side mod, and this method is a client side method. Do you got a suggestion to find the current equipped item? I also wonder about how you exclude all items and blocks who can be used to place blocks, could you point me to the methods you got in mind to implement this? I tried something like: if (Block.getBlockById(Item.getIdFromItem(p.ENTITY.getItemInUse().getItem()))!=null){ System.out.println("This is a block?"); } else { System.out.println("This is an item?"); // Check here if this is an item who can place a block by right clicking. } But this won't work on the server.
  13. Thanks for your responses. For example, I want to cancel all block placements in a certain area, but I still want players inside this area to be able to use chests, or the inverted case. When I use: event.useBlock = Result.DENY; The player can't place blocks any more, but the player also can't use blocks like chests and crafting tables any more. I want to be able to disable or block placing, or inventory opening or both. When I look for the item in the players hand, I've to check if it is a block or an item what can place a block, if the block the player is clicking isn't a block with a GUI and if the player isn't shift clicking the block. And this for each possible mod.. There must be an easier way.
  14. Hi, I want to detect if the event is placing blocks or using the clicked block (like opening a chest), but I can't find out how to do this. I'm now using the PlayerInteractEvent where I check for (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) But I can't find out if the player is placing a block or using a block. Any idea how to do this? (Im using Forge 1.7.2) Edit: this part of the mod is serverside only.
  15. I had the same problem with the 'recompMinecraft' exception. I don't know what went wrong, but I solved it by deinstalling all my java versions & installing 1.7.0_55 (jre & jdk) & setting up my path & JAVA_HOME correctly.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.