List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D
public Vector3D(double x, double y, double z)
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity entity) {// w w w . j a v a 2 s . com Block blockInstance = getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); blockInstance.components.getOp(Collider.class).ifPresent(collider -> { Set<Cuboid> boxes = collider.occlusionBoxes .apply(Optional.ofNullable(entity != null ? Game.natives().toNova(entity) : null)); list.addAll(boxes.stream().map(c -> c.add(new Vector3D(pos.getX(), pos.getY(), pos.getZ()))) .filter(c -> c.intersects((Cuboid) Game.natives().toNova(mask))) .map(cuboid -> Game.natives().toNative(cuboid)).collect(Collectors.toList())); }); }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public int getLightValue(IBlockAccess access, BlockPos pos) { Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); Optional<LightEmitter> opEmitter = blockInstance.components.getOp(LightEmitter.class); if (opEmitter.isPresent()) { return Math.round(opEmitter.get().emittedLevel.get() * 15.0F); } else {/*from w w w .ja v a 2 s .com*/ return 0; } }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public boolean canConnectRedstone(IBlockAccess access, BlockPos pos, EnumFacing side) { Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); WrapperEvent.RedstoneConnect event = new WrapperEvent.RedstoneConnect(blockInstance.world(), blockInstance.position(), Direction.fromOrdinal(side.ordinal())); Game.events().publish(event);// w w w . ja v a 2 s. com return event.canConnect; }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public int isProvidingWeakPower(IBlockAccess access, BlockPos pos, IBlockState state, EnumFacing side) { Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); WrapperEvent.WeakRedstone event = new WrapperEvent.WeakRedstone(blockInstance.world(), blockInstance.position(), Direction.fromOrdinal(side.ordinal())); Game.events().publish(event);//from w w w . j a v a 2 s. c o m return event.power; }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public int isProvidingStrongPower(IBlockAccess access, BlockPos pos, IBlockState state, EnumFacing side) { Block blockInstance = getBlockInstance(access, new Vector3D(pos.getX(), pos.getY(), pos.getZ())); WrapperEvent.StrongRedstone event = new WrapperEvent.StrongRedstone(blockInstance.world(), blockInstance.position(), Direction.fromOrdinal(side.ordinal())); Game.events().publish(event);//from w ww. ja va2 s . c om return event.power; }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) { // TODO: Maybe do something withPriority these parameters. return (float) getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())).getResistance() * 30;/*from www . j a v a2 s. co m*/ }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWBlock.java
@Override public float getBlockHardness(World world, BlockPos pos) { return (float) getBlockInstance(world, new Vector3D(pos.getX(), pos.getY(), pos.getZ())).getHardness() * 2; }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.block.forward.FWTile.java
@Override public void validate() { super.validate(); block.components.getOrAdd(new MCBlockTransform(block, Game.natives().toNova(getWorld()), new Vector3D(pos.getX(), pos.getY(), pos.getZ()))); if (cacheData != null && block instanceof Storable) { ((Storable) block).load(cacheData); cacheData = null;//from w w w . j av a 2 s . c o m } block.events.publish(new Stateful.LoadEvent()); }
From source file:nova.core.wrapper.mc.forge.v18.wrapper.VectorConverter.java
@Override public Vector3D toNova(BlockPos pos) { return new Vector3D(pos.getX(), pos.getY(), pos.getZ()); }
From source file:org.forYoink.math.CommonsVector3D.java
public CommonsVector3D(double x, double y, double z) { this.internalVector = new Vector3D(x, y, z); }