public static BlockVector3 adapt(BlockPos pos) { return BlockVector3.at(pos.getX(), pos.getY(), pos.getZ()); }
@Override public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { if(rand.nextBoolean()) Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6); }
@Override public void addCollisionBoxToList(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB par5AxisAlignedBB, @Nonnull List<AxisAlignedBB> stacks, Entity par7Entity, boolean isActualState) { PlatformVariant variant = state.getValue(BotaniaStateProps.PLATFORM_VARIANT); if(variant == PlatformVariant.INFRANGIBLE || variant == PlatformVariant.ABSTRUSE && par7Entity != null && par7Entity.posY > pos.getY() + 0.9 && (!(par7Entity instanceof EntityPlayer) || !par7Entity.isSneaking())) super.addCollisionBoxToList(state, world, pos, par5AxisAlignedBB, stacks, par7Entity, isActualState); }
@Override public void recieveMana(int mana) { if(mana > 0) for(int i = 0; i < 10; i++) Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.2F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5); }
public void rotate(double angle) { double x = relPos.getX(); double z = relPos.getZ(); double sin = Math.sin(angle); double cos = Math.cos(angle); double xn = x * cos - z * sin; double zn = x * sin + z * cos; relPos = new BlockPos((int) Math.round(xn), relPos.getY(), (int) Math.round(zn)); }
private void blockParticle(AlfPortalState state) { int i = world.rand.nextInt(AIR_POSITIONS.length); double[] pos = new double[] { AIR_POSITIONS[i].getX() + 0.5F, AIR_POSITIONS[i].getY() + 0.5F, AIR_POSITIONS[i].getZ() + 0.5F }; if(state == AlfPortalState.ON_X) pos = CONVERTER_X_Z_FP.apply(pos); float motionMul = 0.2F; Botania.proxy.wispFX(getPos().getX() + pos[0], getPos().getY() + pos[1], getPos().getZ() + pos[2], (float) (Math.random() * 0.25F), (float) (Math.random() * 0.5F + 0.5F), (float) (Math.random() * 0.25F), (float) (Math.random() * 0.15F + 0.1F), (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul); }
private boolean inRange(BlockPos pos, BlockPos srcPos, int range, double heightscale, boolean pointy) { if(pos.getY() >= srcPos.getY()) return MathHelper.pointDistanceSpace(pos.getX(), 0, pos.getZ(), srcPos.getX(), 0, srcPos.getZ()) < range; else if(!pointy) return MathHelper.pointDistanceSpace(pos.getX(), pos.getY() / heightscale, pos.getZ(), srcPos.getX(), srcPos.getY() / heightscale, srcPos.getZ()) < range; else return MathHelper.pointDistanceSpace(pos.getX(), 0, pos.getZ(), srcPos.getX(), 0, srcPos.getZ()) < range - (srcPos.getY() - pos.getY()) / heightscale; }
@Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { state = getActualState(state, world, pos); int hex = state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1).getColorValue(); int r = (hex & 0xFF0000) >> 16; int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency) Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5); }
@Override public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TileEntity tile = world.getTileEntity(pos); if(!(tile instanceof TileSpreader)) return; TileSpreader inv = (TileSpreader) tile; if(inv.paddingColor != -1) { net.minecraft.inventory.InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Blocks.WOOL, 1, inv.paddingColor)); } InventoryHelper.dropInventory(inv, world, state, pos); super.breakBlock(world, pos, state); }
@Override @SideOnly(Side.CLIENT) public BlockPos getBinding() { return Minecraft.getMinecraft().player.isSneaking() && bindPos.getY() != -1 ? bindPos : super.getBinding(); }
@Override public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos); if(!enchanter.itemToEnchant.isEmpty()) { world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant)); } world.updateComparatorOutputLevel(pos, state.getBlock()); super.breakBlock(world, pos, state); }
@Override protected void writeEntityToNBT(@Nonnull NBTTagCompound cmp) { BlockPos exit = getExitPos(); cmp.setInteger(TAG_EXIT_X, exit.getX()); cmp.setInteger(TAG_EXIT_Y, exit.getY()); cmp.setInteger(TAG_EXIT_Z, exit.getZ()); }
private void keepInsideArena(EntityPlayer player) { if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= ARENA_RANGE) { Vector3 sourceVector = new Vector3(source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5); Vector3 playerVector = Vector3.fromEntityCenter(player); Vector3 motion = sourceVector.subtract(playerVector).normalize(); player.motionX = motion.x; player.motionY = 0.2; player.motionZ = motion.z; player.velocityChanged = true; } }
@Override public void writePacketNBT(NBTTagCompound cmp) { cmp.setInteger(TAG_BIND_X, bindPos.getX()); cmp.setInteger(TAG_BIND_Y, bindPos.getY()); cmp.setInteger(TAG_BIND_Z, bindPos.getZ()); }
/** * Returns the multiblock component for the coordinates, adjusted based on the anchor */ private MultiblockComponent getComponent(BlockPos pos) { return multiblock.getComponentForLocation(pos.add(new BlockPos(-anchorPos.getX(), -anchorPos.getY(), -anchorPos.getZ()))); } }
@Override public RadiusDescriptor getRadius() { AxisAlignedBB aabb = aabbForOrientation(); aabb = new AxisAlignedBB(aabb.minX, supertile.getPos().getY(), aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ); return new RadiusDescriptor.Rectangle(toBlockPos(), aabb); }
public long getSortValue() { final TileEntity te = this.iHost.getTileEntity(); return ( te.getPos().getZ() << 24 ) ^ ( te.getPos().getX() << 8 ) ^ te.getPos().getY(); }
public static void dropInventory(TileSimpleInventory inv, World world, IBlockState state, BlockPos pos) { if(inv != null) { for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) { ItemStack itemstack = inv.getItemHandler().getStackInSlot(j1); if(!itemstack.isEmpty()) { net.minecraft.inventory.InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemstack); } } world.updateComparatorOutputLevel(pos, state.getBlock()); } }