y -= vec.getY() * this.thickness; z -= vec.getZ() * this.thickness; vertex.vec[0] = x;
public static BlockPos getRandomPositionInArea(Random random, Vec3i area) { int x = random.nextInt(area.getX()); int y = random.nextInt(area.getY()); int z = random.nextInt(area.getZ()); return new BlockPos(x, y, z); }
private static BlockPos transform(Vec3i pos, Vec3i vec3i, Vec3i vec3i1, Vec3i vec3i2) { return new BlockPos( vec3i1.getX() * -pos.getY() + vec3i2.getX() * pos.getZ() + vec3i.getX() * pos.getX(), vec3i1.getY() * -pos.getY() + vec3i2.getY() * pos.getZ() + vec3i.getY() * pos.getX(), vec3i1.getZ() * -pos.getY() + vec3i2.getZ() * pos.getZ() + vec3i.getZ() * pos.getX() ); }
@Override public boolean validatePlacement(World world, int x, int y, int z, EnumFacing face, StructureTemplate template, StructureBB bb) { if (y - template.offset.getY() <= 0) { AncientWarfareStructure.LOG.debug("Ground isn't deep enough for the structure- required: {}, found: {}", Math.abs(bb.min.getY()), y); return false; } int minY = getMinY(template, bb); int maxY = getMaxY(template, bb); return validateBorderBlocks(world, bb, minY, maxY, false); }
@Override public int getAdjustedSpawnY(World world, int x, int y, int z, EnumFacing face, StructureTemplate template, StructureBB bb) { int range = getMaxGenerationDepth() - getMinGenerationDepth() + 1; int tHeight = (template.getSize().getY() - template.getOffset().getY()); return WorldStructureGenerator.getTargetY(world, x, z, true) - getMinOverfill() - world.rand.nextInt(range) - tHeight; }
public static BlockPos add(Vec3i... vects) { int x = 0; int y = 0; int z = 0; for (Vec3i vect : vects) { x += vect.getX(); y += vect.getY(); z += vect.getZ(); } return new BlockPos(x, y, z); }
public static EntityItem ejectItemInDirection(World world, double x, double y, double z, EnumFacing direction, @Nonnull ItemStack stack) { EntityItem item = BlockUtils.dropItemStackInWorld(world, x, y, z, stack); final Vec3i v = direction.getDirectionVec(); item.motionX = v.getX() / 5F; item.motionY = v.getY() / 5F; item.motionZ = v.getZ() / 5F; return item; }
int getMinY(StructureTemplate template, StructureBB bb) { int minY = bb.min.getY() - getMaxFill() - 1; if (getBorderSize() > 0) { minY += template.getOffset().getY(); } return minY; }
public NonNullList<ItemStack> getResourceList() { if (resourceList == null) { NonNullList<ItemStack> stacks = NonNullList.create(); MathUtils.getAllVecsInBox(Vec3i.NULL_VECTOR, new Vec3i(size.getX() - 1, size.getY() - 1, size.getZ() - 1)) .forEach(pos -> getRuleAt(pos).ifPresent(r -> r.addResources(stacks))); resourceList = InventoryTools.compactStackList(stacks); } return resourceList; }
@Override public void onImpactWorld(World world, float x, float y, float z, MissileBase missile, RayTraceResult hit) { if (!world.isRemote) { Vec3i dirVec = hit.sideHit.getDirectionVec(); Vec3d hitVec = hit.hitVec.addVector(dirVec.getX() * 0.2d, dirVec.getY() * 0.2d, dirVec.getZ() * 0.2d); createExplosion(world, missile, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, 0.6f); } }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { if (pos.getY() < bb.min.getY() + template.getOffset().getY()) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); } else { super.handleClearAction(world, pos, template, bb); } } }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { if (pos.getY() >= bb.min.getY() + template.getOffset().getY()) { super.handleClearAction(world, pos, template, bb); } else { world.setBlockState(pos, Blocks.WATER.getDefaultState()); } }
@Override public void handleClearAction(World world, BlockPos pos, StructureTemplate template, StructureBB bb) { int maxWaterY = bb.min.getY() + template.getOffset().getY() - 1; if (pos.getY() <= maxWaterY) { world.setBlockState(pos, Blocks.WATER.getDefaultState()); } else { super.handleClearAction(world, pos, template, bb); } }
public float getPercentDoneWithPass() { float max = (float) template.getSize().getX() * template.getSize().getZ() * template.getSize().getY(); float current = (float) curTempPos.getY() * (template.getSize().getX() * template.getSize().getZ());//add layers done current += curTempPos.getZ() * template.getSize().getX();//add rows done current += curTempPos.getX();//add blocks done return current / max; }
void addVecWithUV(BufferBuilder tes, Vector3d vec, double u, double v, float cm, EnumFacing normal) { tes.pos(vec.x, vec.y, vec.z).tex(u, v).color(cm, cm, cm, 1) .normal(normal.getDirectionVec().getX(), normal.getDirectionVec().getY(), normal.getDirectionVec().getZ()).endVertex(); }
@Override public Iterator<BlockPos.MutableBlockPos> getAreaIterator(IBeeHousing beeHousing, IBee bee) { IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing); Vec3i area = getArea(bee.getGenome(), beeModifier); BlockPos minPos = beeHousing.getCoordinates().add(-area.getX() / 2, -area.getY() / 2, -area.getZ() / 2); BlockPos maxPos = minPos.add(area); World world = beeHousing.getWorldObj(); return VectUtil.getAllInBoxFromCenterMutable(world, minPos, beeHousing.getCoordinates(), maxPos); }
public static DoubleCoordinates add(DoubleCoordinates coords, EnumFacing direction, double times) { coords.setXCoord(coords.getXCoord() + direction.getDirectionVec().getX() * times); coords.setYCoord(coords.getYCoord() + direction.getDirectionVec().getY() * times); coords.setZCoord(coords.getZCoord() + direction.getDirectionVec().getZ() * times); return coords; }
public static IntegerCoordinates add(IntegerCoordinates coords, EnumFacing direction, int times) { coords.setXCoord(coords.getXCoord() + direction.getDirectionVec().getX() * times); coords.setYCoord(coords.getYCoord() + direction.getDirectionVec().getY() * times); coords.setZCoord(coords.getZCoord() + direction.getDirectionVec().getZ() * times); return coords; }