@Override public ArrayList<ItemStack> getDrops(Block block) { ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); if (block.getSource() instanceof Entity) { if (((Entity) block.getSource()).getInventory().getCurrentItem().getMaterial() instanceof Spade) { drops.add(new ItemStack(VanillaMaterials.SNOWBALL, 1)); } } return drops; }
@Override public ArrayList<ItemStack> getDrops(Block block) { ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); if (block.getSource() instanceof Entity) { ItemStack held = ((Entity) block.getSource()).getInventory().getCurrentItem(); if (held != null && held.getMaterial() .equals(VanillaMaterials.IRON_PICKAXE, VanillaMaterials.DIAMOND_PICKAXE)) { drops.add(new ItemStack(this, 1)); } } return drops; }
@Override public ArrayList<ItemStack> getDrops(Block block) { ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); ItemStack held = VanillaPlayerUtil.getCurrentItem(block.getSource()); if (held != null && held.getMaterial() instanceof Pickaxe) { drops.add(new ItemStack(this, 1)); } return drops; }
@Override public void setAttachedFace(Block block, BlockFace attachedFace) { if (attachedFace == BlockFace.BOTTOM) { Source source = block.getSource(); short data = 0; if (source instanceof Entity) { Vector3 direction = block.getPosition().subtract(((Entity) source).getTransform().getPosition()); float rotation = direction.rotationTo(Vector3.RIGHT).getYaw(); rotation = rotation / 360f * 16f; data = (short) rotation; } block.setMaterial(VanillaMaterials.SIGN_POST, data).queueUpdate(EffectRange.THIS); } else { // get the data for this face short data = (short) (BlockFaces.NSWE.indexOf(attachedFace, 0) + 2); block.setMaterial(VanillaMaterials.WALL_SIGN, data).queueUpdate(EffectRange.THIS); } }
public SpoutBlock(Block source) { this(source.getWorld(), source.getX(), source.getY(), source.getZ(), source.getSource()); if (source instanceof SpoutBlock) { this.chunk = ((SpoutBlock) source).chunk; } }