Target block to chest

Discussion in 'Plugin Development' started by MrGriefer_HGTech, Dec 21, 2014.

Thread Status:
Not open for further replies.
  1. Hello!

    So, I saw someone maked just like this:
    Code:
    Block target = p.getTargetBlock(null, 10);
    But I want to make like the target thingy is a chest block not a p.getTargetBlock(); thing how can I make that.
    I tried to make Block target = (Chest); but it did not work please help!

    Note!
    Sorry for my bad English I am not English.

    Thanks MrGriefer [tnt]
     
  2. Offline

    Skionz

    @MrGriefer_HGTech Um, what? Check if the target block is a chest? I'm not sure what you want.
     
  3. Offline

    teej107

  4. Code:java
    1. if (target.getType() == Material.CHEST) {

    was that so hard?!
     
  5. Offline

    kps1796

    @FisheyLP I think he wanted to cast the Block to a Chest object:
    Code:
    Block target = p.getTargetBlock(null, 10);
    Chest chest = (Chest) target.getBlockState();
     
    Last edited: Dec 21, 2014
  6. Offline

    teej107

    @kps1796 you forgot getBlockState();
     
    kps1796 likes this.
  7. Offline

    kps1796

  8. @Skionz I want I want is instead of Block target = p.getTargetBlock(null, 10); I want to make the target to be Chest block not a p.getTargetBlock(null, 10);
     
  9. Personally I voted for "________________", not sure about you guys.


    @MrGriefer_HGTech Have you followed this advice?
     
  10. Deleted useless poll.
     
Thread Status:
Not open for further replies.

Share This Page