@Override public List<IndexedCuboid6> getIndexedCuboids() { ArrayList<IndexedCuboid6> cuboids = new ArrayList<>(); cuboids.add(new IndexedCuboid6(0, new Cuboid6(0.15, 0, 0.15, 0.85, 0.916, 0.85))); for (int i = 0; i < 4; i++) { cuboids.add(new IndexedCuboid6(i + 1, selectionBoxes[i].copy().apply(Rotation.quarterRotations[rotation ^ 2].at(center)))); } return cuboids; }
public static void loadModel() { if (initialized) { return; } initialized = true; Map<String, CCModel> models = OBJParser.parseModels(new ResourceLocation("enderstorage", "models/endertank.obj"), new SwapYZ()); ArrayList<CCModel> tankParts = new ArrayList<>(); tankParts.add(models.get("Blazerod1")); tankParts.add(models.get("Blazerod2")); tankParts.add(models.get("Blazerod3")); tankParts.add(models.get("Blazerod4")); tankParts.add(models.get("Top")); tankParts.add(models.get("Top2")); tankParts.add(models.get("Base")); tankParts.add(models.get("Glass")); tankParts.add(models.get("Valvebase")); Transformation fix = new Translation(-0.0099 - 0.5, 0, -0.0027 - 0.5); tankModel = CCModel.combine(tankParts).apply(fix).computeNormals().shrinkUVs(0.004); valveModel = models.get("Valve").apply(fix).computeNormals(); buttons = new CCModel[3]; for (int i = 0; i < 3; i++) { buttons[i] = ButtonModelLibrary.button.copy().apply(TileEnderTank.buttonT[i].with(new Translation(-0.5, 0, -0.5))); } }
@Override public ITranslation inverse() { return new TransformationProxy(transformation.inverse()); }
private Set<CCModel> transformBlades(EnumFacing frontFacing, int height, float rotation) { Set<CCModel> transformedGroups = Sets.newHashSet(); Vector3 center = new Vector3(8d / 16d, 8d / 16d, 8d / 16d); Transformation baseRotation = new Rotation(rotation, 0, 0, 1).at(center); transformedGroups.addAll(rotateModels(windmillShaft, frontFacing, baseRotation)); for (int i = 0; i < 4; i++) { Transformation bladeTransform = new Rotation(((float) i) * Trig.PI / 2f, 0, 0, 1).at(center).with(baseRotation); if (i < 2) { transformedGroups.addAll(rotateModels(bladeShaft, frontFacing, bladeTransform)); } for (int k = 1; k < height; k++) { transformedGroups.addAll(rotateModels(blade, frontFacing, bladeTransform)); if (k == height - 1) { transformedGroups.addAll(rotateModels(bladeJoint, frontFacing, bladeTransform)); } else { bladeTransform = new Translation(0, 1, 0).with(bladeTransform); } } } return transformedGroups; }
static Cuboid6 getCoverPlateBox(EnumFacing side, double plateThickness, boolean offsetSide) { double offset = offsetSide ? 2.5 / 16.0 : 0.0; Cuboid6 coverPlateBox = new Cuboid6(offset, 0.0, offset, 1.0 - offset, plateThickness, 1.0 - offset); coverPlateBox.apply(Rotation.sideOrientation(side.getIndex(), 0).at(Vector3.center)); return coverPlateBox; }
@Override protected void transformMovingParts(Collection<CCModel> transformedGroups, EnumFacing frontFacing, float[] rotations, IExtendedBlockState state) { float rotation = rotations[frontFacing.getIndex()]; calculateArmAngle1(-rotation); calculateArmAngle2(-rotation - 90); Transformation flywheelRotation = new Rotation(rotation, 0, 0, 1).at(new Vector3(1d / 2d, 1d / 2d, 0)); transformedGroups.addAll(rotateModels(flywheel, frontFacing, flywheelRotation)); Transformation pistonCrankRotation = new Rotation(-rotation, 0, 0, 1).at(new Vector3(12d / 16d, 12d / 16d, 0d)); transformedGroups.addAll(rotateModels(pistonCrank, frontFacing, pistonCrankRotation)); transformedGroups.addAll(rotateModels(pistonCrank2, frontFacing, new Rotation(rotation, 0, 0, 1).at(new Vector3(12d / 16d, 11d / 16d, 0d)))); transformedGroups.addAll(rotateModels(flywheelArm, frontFacing, new Rotation(-rotation, 0, 0, 1).at(new Vector3(9d / 16d, 8d / 16d, 7.5d / 16d)).with(flywheelRotation))); transformedGroups.addAll(rotateModels(pistonArm, frontFacing, new Rotation(rotation + armAngle, 0, 0, 1).at(new Vector3(11d / 16d, 12d / 16d, 0d)).with(pistonCrankRotation))); transformedGroups.addAll(rotateModels(pistonArm2, frontFacing, new Rotation(rotation + armAngle2, 0, 0, 1).at(new Vector3(11d / 16d, 12d / 16d, 0d)).with(pistonCrankRotation))); }