net.minecraft.dispenser.IBlockSource Java Examples
The following examples show how to use
net.minecraft.dispenser.IBlockSource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DispenserBehaviourLingeringPotion.java From Et-Futurum with The Unlicense | 6 votes |
@Override public ItemStack dispense(IBlockSource block, final ItemStack stack) { return new BehaviorProjectileDispense() { @Override protected IProjectile getProjectileEntity(World world, IPosition pos) { return new EntityLingeringPotion(world, pos.getX(), pos.getY(), pos.getZ(), stack.copy()); } @Override protected float func_82498_a() { return super.func_82498_a() * 0.5F; } @Override protected float func_82500_b() { return super.func_82500_b() * 1.25F; } }.dispense(block, stack); }
Example #2
Source File: ItemFukumame.java From TofuCraftReload with MIT License | 5 votes |
@Override public ItemStack dispenseStack(IBlockSource source, ItemStack stack) { if (stack.getItemDamage() >= stack.getMaxDamage()) return stack; EnumFacing enumfacing = source.getBlockState().getValue(BlockDispenser.FACING); // getFacing World world = source.getWorld(); double d0 = source.getX() + (double) ((float) enumfacing.getFrontOffsetX() * 1.125F); double d1 = source.getY() + (double) ((float) enumfacing.getFrontOffsetY() * 1.125F); double d2 = source.getZ() + (double) ((float) enumfacing.getFrontOffsetZ() * 1.125F); for (int i = 0; i < 8; i++) { EntityFukumame fukumame = new EntityFukumame(world, d0, d1, d2); fukumame.shoot(enumfacing.getFrontOffsetX(), (enumfacing.getFrontOffsetY()), enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy()); applyEffect(fukumame, stack); if (!world.isRemote) { world.spawnEntity(fukumame); } } if (stack.isItemStackDamageable()) { stack.getItem(); stack.attemptDamageItem(1, Item.itemRand, null); } source.getWorld().playEvent(1000, source.getBlockPos(), 0); return stack; }
Example #3
Source File: BehaviorDispenseTicket.java From Signals with GNU General Public License v3.0 | 5 votes |
@Override protected ItemStack dispenseStack(IBlockSource source, ItemStack stack){ EnumFacing facing = source.getBlockState().getValue(BlockDispenser.FACING); AxisAlignedBB aabb = new AxisAlignedBB(source.getBlockPos().offset(facing)); List<EntityMinecart> carts = source.getWorld().getEntitiesWithinAABB(EntityMinecart.class, aabb); carts.forEach(cart -> ItemTicket.applyDestinations(cart, stack)); return stack; }
Example #4
Source File: DispenserBehaviourSpawnEgg.java From Et-Futurum with The Unlicense | 5 votes |
@Override public ItemStack dispenseStack(IBlockSource block, ItemStack stack) { EnumFacing enumfacing = BlockDispenser.func_149937_b(block.getBlockMetadata()); double d0 = block.getX() + enumfacing.getFrontOffsetX(); double d1 = block.getYInt() + 0.2F; double d2 = block.getZ() + enumfacing.getFrontOffsetZ(); Entity entity = ItemEntityEgg.spawnEntity(block.getWorld(), stack.getItemDamage(), d0, d1, d2); if (entity instanceof EntityLivingBase && stack.hasDisplayName()) ((EntityLiving) entity).setCustomNameTag(stack.getDisplayName()); stack.splitStack(1); return stack; }
Example #5
Source File: DispenserBehaviourTippedArrow.java From Et-Futurum with The Unlicense | 5 votes |
@Override public ItemStack dispenseStack(IBlockSource block, final ItemStack stack) { return new BehaviorProjectileDispense() { @Override protected IProjectile getProjectileEntity(World world, IPosition pos) { EntityTippedArrow entity = new EntityTippedArrow(world, pos.getX(), pos.getY(), pos.getZ()); entity.canBePickedUp = 1; entity.setEffect(TippedArrow.getEffect(stack)); return entity; } }.dispense(block, stack); }
Example #6
Source File: DispenserBehaviourTippedArrow.java From Et-Futurum with The Unlicense | 4 votes |
@Override protected void playDispenseSound(IBlockSource block) { block.getWorld().playAuxSFX(1002, block.getXInt(), block.getYInt(), block.getZInt(), 0); }