Replace crops 1.15.2

Discussion in 'Plugin Development' started by AlpacaKyle, Mar 12, 2020.

  1. Offline

    vildaberper

    Look into ItemStack, ItemMeta and maybe PlayerInterractEvent for adventure mode.
    ItemMeta represents a state so to apply it to an ItemStack you have to call setItemMeta(...).
     
  2. Offline

    AlpacaKyle

    Thanks! I found a bug though, with the code that you gave me before to replace the block, the player can glitch through the block during the tick that it is broken. Is there a way to either block the player from getting through, or replace it 0 ticks later instead of 1?
     
  3. Offline

    vildaberper

    Well, here is my approach in an upcoming plugin: Listen for right click block -> compare age -> call a new block break event -> remove one seed from the drops -> drop the items at the block.
    I'm not sure if what you are looking for is possible without cancelling the block break event, so maybe that is the solution here. Normally I would recommend not replanting when broken due to inconsistency; LMB to break, RMB to interract, which is what this is.
     
  4. Offline

    AlpacaKyle

    Thank you for your help. Is there a way to listen for block place event?
     
  5. Offline

    timtower Moderator Moderator

    BlockPlaceEvent ?
     
    BlaSfaiMe likes this.

Share This Page