Filled Pumpkin Carving!

Discussion in 'Archived: Plugin Requests' started by LordDarthBob, Mar 26, 2014.

  1. Offline

    LordDarthBob

    Plugin category: Mechanics

    Suggested name: PumpkinCarving

    What I want: In vanilla minecraft, pumpkins grow with carved faces. This is a strange mechanic; I believe it would make more sense to grow faceless pumpkins and be able to right-click them with an axe to "Carve" them and add a carved face.

    A way to accomplish this is to replace pumpkins, when they first grow, with pumpkins with a meta-id value of 4. This makes them faceless. As pumpkin:4 cannot exist as an inventory item when it is broken and dropped, instead of dropping a normal pumpkin, it drops a pumpkin with a lore attribute specifying "Uncarved". This marks it as an uncarved pumpkin. When a pumpkin with this lore is placed, it will be replaced with pumpkin:4.

    When a pumpkin of meta-id 4 id right-clicked with any axe, it will turn into a normal pumpkin, taking 1 durability point or whatever from the axe. When it is broken, it just drops a regular, un-lored, normal meta-value pumpkin that behaves exactly as in vanilla.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: None needed

    When I'd like it by: Whenever
     
  2. Offline

    scarabcoder

    Looks interesting. I'll give it a go. You are saying that there is a pumpkin block with a data that can make it so there is no face?
     
  3. Offline

    Onlineids

  4. Offline

    scarabcoder

    Sorry, this won't work. It only appears to have no face in the inventory, not when it is placed on the ground.
     
  5. Offline

    LordDarthBob

    scarabcoder Onlineids
    Not to be harsh or proesumtuous, but did you read the whole post?

    This is what I meant, and yes it is possible.



    Faceless pumpkins do exist.

    Faceless pumpkins do not exist in your inventory as items, when you attempt to put them in your inventory, they are normal pumpkin items instead (as far as I know). When placed from your inventory they are normal pumpkin blocks.

    When a pumpkin grows naturally, it should replace the newly grown pumpkin (86:0-3) with a faceless pumpkin (86:4).

    When a pumpkin block is broken, the plugin should check to see if the broken pumpkin is a faceless pumpkin (86:4) rather than a regular pumpkin (86:0-3)(the :0-3 specifies which side of the pumpkin the face is on when placed).

    If it is, it should drop a normal pumpkin item (86:0) with a lore attribute reading "Uncarved".

    If it is not, it should just drop a regular pumpkin item (86:0)

    The plugin should check to see if the normal pumpkin item has lore reading "Uncarved" when a pumpkin item is placed.

    If this is true, the placed pumpkin block (86:0) will be replaced with the faceless pumpkin block (86:4)

    If this is false, the placed pumpkin will be a normal pumpkin (86:0).

    When a pumpkin is right-clicked with any axe, the plugin should check to see if the clicked pumpkin is a faceless pumpkin (86:4) rather than a regular pumpkin (86:0-3).

    If it is, it should turn the faceless pumpkin block(86:4) into a face pumpkin block(86:0) and take 1 durability from the axe.

    If it isn't, it doesn't do anything.
     
  6. Offline

    scarabcoder

    A block with the data 4 does still have a face when placed...
     
  7. Offline

    Serilum

    OnblockPlace, check the block placed. If pumpkin remove that block and replace it with the uncarved pumpkin. Interesting.

    Let me give this a shot

    Unfortunately I can't see to change the direction of the pumpkin via code. I thought it would work but it did not. My thought process for those interested:

    Code:java
    1. @EventHandler
    2. public void onBlockPlace(BlockPlaceEvent event) {
    3. Block block = event.getBlock();
    4. if(block.getType() == Material.PUMPKIN) {
    5. Pumpkin pump = (Pumpkin)block.getState().getData();
    6. pump.setFacingDirection(BlockFace.DOWN);
    7. block.getState().setData(pump);
    8. }
    9. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    Serilum

  10. Offline

    timtower Administrator Administrator Moderator

  11. Offline

    Serilum

    timtower Can you post the code? I'll try to get it working including the axe part.
     
  12. Offline

    LordDarthBob

    scarabcoder
    "A block with the data 4 does still have a face when placed..."

    You placed it by hand... from your inventory...

    Like I said; "Faceless pumpkins do not (and Cannot) exist in your inventory as items, when you attempt to put them in your inventory (Or store them in any inventory at all), they are (they become) normal pumpkin items instead (as far as I know). When (the pumpkin item is) placed from your inventory they are normal pumpkin blocks(, not faceless. They are 86:0, not 86:4)."

    I used an ingame map editing plugin called WorldGuard to place the faceless pumpkin. I selected a 1x1x1 block area with the wooden axe in the video, and typed the command "//set 86:4" which filled the space with faceless pumpkins, in this case 1. A map editor or /setblock is needed to place them. Despite the fact that I used Worldedit for the video, please do not hook into it with a plugin for the purpose of placing faceless pumpkins even if this is at all possible. It is easier with straight Bukkit API, as Timtower has shown in code above.

    timtower

    "@LordDarthBob Without the axe part: Link broken"

    What?

    You do know what I'm getting at when I talk about right clicking with any axe on a pumpkin and checking to see if the pumpkin is 86:4 or 86: (1-3), right? That is really a crucial part of this plugin; if people for some reason don't understand me, please tell me.

    That, or I'm really bad at understanding everyone else, one of the two. :p
     
  13. Offline

    Serilum

    LordDarthBob We get you, I just couldn't get it to work with the .setData((byte)4). Waiting for Tim to supply the code. I'll base the rest of the plugin on that, as the right-clicking is quite easy
     
  14. Offline

    LordDarthBob

  15. Offline

    SGrayMe

    I decided to give this shot as well. Actually started last night, but had to go offline before I had anything worth commenting about. xD

    I also found setting the data on placement to be tricky. setData does not work from inside the event, even when the event is cancelled. The simplest solution I found is scheduling a task to change the pumpkin at the location. The pumpkin does flicker as a result of initially showing the face, then not, but the desired result is achieved.

    I don't know what was contained at the defunct link... was gone before I checked the thread again. But I've made progress on my version.

    There are a couple things I want to tweak to be a little better, but you can try out the plugin already.

    Latest Build
    https://sgray.ci.cloudbees.com/job/PumpkinCarving/lastSuccessfulBuild/

    Source
    https://bitbucket.org/sgray/pumpkincarving/src/
     
  16. Offline

    timtower Administrator Administrator Moderator

    There was a download link there without the axe functionality. Somebody blocked it though.
     
  17. Offline

    LordDarthBob

    timtower
    Oh. Ok, I understand now.

    SGrayMe
    The current version of your plugin (0.0.1) seems to function, except that the stone axe does not "carve" the pumpkin and take 1 durability, it doesn't do anything. All of the other axes do what they're supposed to.

    Another small bug you may want to check on is that faceless pumpkins will drop pumpkin items, regular pumpkin items at that, when broken in creative mode.

    Other than that, it's looking great so far!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  18. Offline

    SGrayMe

  19. Offline

    LordDarthBob

Share This Page