@Override public void checkMove(MoveData inData) { if(inData.isValid()) return; if(inData.getAboveBlock().getType() == Material.FENCE_GATE) { Gate g = (Gate)inData.getAboveBlock().getState().getData(); if(g.isOpen()) inData.setValid(true); } else if(inData.getAboveBlock().getType() == Material.WOOD_DOOR || (!this.m_ironDoor && inData.getAboveBlock().getType() == Material.IRON_DOOR_BLOCK)) { Door d = (Door)inData.getAboveBlock().getState().getData(); if(d.isOpen()) inData.setValid(true); } }
@Override public void checkMove(MoveData inData) { if(!inData.isValid()) return; if(inData.getYDiff() == 1) { if(inData.getXDiff() == 0 && inData.getZDiff() == 0 && !Pathfinder.isLiquid(inData.getFrom().getBlock())) { inData.setValid(false); return; } Block aboveHead = inData.getFrom().getBlock().getRelative(BlockFace.UP, 3); if(!Pathfinder.isTransparent(aboveHead)) { inData.setValid(false); return; } Block to = inData.getTo().getBlock(); if(to.getType() == Material.FENCE || (to.getType() == Material.FENCE_GATE && !((Gate)to.getState().getData()).isOpen())) inData.setValid(false); } }
/** * checks if this block would give a reaction if you click on it without * shifting, e.g. opening a chest or switching a lever */ public static boolean isInteractiveBlock(Block b) { if (b == null || b.getState() == null) { return false; } if (b.getType() == Material.WORKBENCH || b.getType() == Material.ENCHANTMENT_TABLE || b.getType() == Material.ANVIL || b.getType() == Material.BREWING_STAND || b.getState() instanceof InventoryHolder || b.getState() instanceof NoteBlock) { return true; } if (b.getState().getData() instanceof Button || b.getState().getData() instanceof Lever || b.getState().getData() instanceof Door || b.getState().getData() instanceof TrapDoor || b.getState().getData() instanceof Gate || b.getState().getData() instanceof Comparator) { if (b.getType() != Material.IRON_DOOR && b.getType() != Material.IRON_DOOR_BLOCK && b.getType() != Material.IRON_TRAPDOOR) { return true; } } return false; }
public Gate() { }
public Gate(int type, byte data) { }
public Gate(byte data) { }
public Gate clone() { return null; }
/** * @param type the material * @return true if the material is a fence-gate. */ public static boolean isFenceGate(Material type) { return type.getData() == Gate.class; }