@Override protected void transformMovingParts(Collection<CCModel> transformedGroups, EnumFacing frontFacing, float[] rotations, IExtendedBlockState state) { float outR = rotations[frontFacing.getIndex()]; transformedGroups.addAll(rotateModels(outputGear, frontFacing, new Rotation(outR, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 8d / 16d)))); } }
@Override public Object getRotation(int i, int j) { return Rotation.sideOrientation(i, j); }
@Override public Object getRotation(double d, int i, int j, int k) { return new Rotation(d, i, j, k); }
@Override public void doRenderLayer(AbstractClientPlayer entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (uuid1.equals(entity.getUniqueID()) || uuid2.equals(entity.getUniqueID()) || uuid3.equals(entity.getUniqueID()) || uuid4.equals(entity.getUniqueID())) { GlStateManager.pushMatrix(); Matrix4 matrix4 = new Matrix4(); matrix4.apply(new Rotation(MathHelper.torad * 180, new Vector3(1, 0, 0))); matrix4.apply(new Scale(0.5)); matrix4.glApply(); if (entity.isSneaking()) { GlStateManager.translate(0, -0.5, 0); } if (entity.isElytraFlying()) { headPitch = -45; } GlStateManager.rotate(netHeadYaw, 0, -1, 0); GlStateManager.rotate(headPitch, 1, 0, 0); GlStateManager.translate(0, 1, 0); RenderTileEnderTank.renderTank(CCRenderState.instance(), 0, (float) (MathHelper.torad * 90F), new Frequency(), -0.5, 0, -0.5, 0); FluidStack fluidStack = FluidUtils.water.copy(); float bob = 0.45F + RenderUtils.getPearlBob(ClientUtils.getRenderTime()) * 2; fluidStack.amount = (int) MathHelper.map(bob, 0.2, 0.6, 1000, 14000); RenderTileEnderTank.renderLiquid(fluidStack, -0.5, 0, -0.5); GlStateManager.popMatrix(); } }
@Override protected void transformMovingParts(Collection<CCModel> transformedGroups, EnumFacing frontFacing, float[] rotations, IExtendedBlockState state) { float inR = rotations[EnumFacing.UP.getIndex()]; float outR = rotations[frontFacing.getIndex()]; transformedGroups.addAll(rotateModels(outputGear, frontFacing, new Rotation(outR, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 8d / 16d)))); transformedGroups.addAll(rotateModels(inputGear, frontFacing, new Rotation(inR, 0, 1, 0).at(new Vector3(8d / 16d, 10.5d / 16d, 11.5d / 16d)))); } }
Matrix4 pearlMat = RenderUtils.getMatrix(new Vector3(x + 0.5, y + 0.2 + lidAngle * -0.5 + RenderUtils.getPearlBob(time), z + 0.5), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04);
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))); }
@Override protected void transformMovingParts(Collection<CCModel> transformedGroups, EnumFacing frontFacing, float[] rotations, @Nullable IExtendedBlockState state) { float outputRotation = 0; float inputRotation = 0; float flywheelRotation = 0; if (state != null) { outputRotation = state.getValue(AutomationProperties.ROTATIONS[frontFacing.ordinal()]); inputRotation = outputRotation; flywheelRotation = state.getValue(BlockFlywheelController.FLYWHEEL_ROTATION); if (state.getValue(AutomationProperties.USE_INPUT)) { inputRotation = state.getValue(AutomationProperties.INPUT_ROTATION); } } transformedGroups.addAll(rotateModels(controlInput, frontFacing, new Rotation(inputRotation, 0, 0, 1).at(Vector3.center))); transformedGroups.addAll(rotateModels(controlOutput, frontFacing, new Rotation(outputRotation, 0, 0, 1).at(Vector3.center))); transformedGroups.addAll(rotateModels(controlSpindle, frontFacing, new Rotation(flywheelRotation, 0, 1, 0).at(Vector3.center))); }
@Override protected void transformMovingParts(Collection<CCModel> transformedGroups, EnumFacing frontFacing, float[] rotations, @Nullable IExtendedBlockState state) { float wheelR = rotations[frontFacing.getOpposite().getIndex()]; float outR = rotations[frontFacing.getIndex()]; transformedGroups.addAll(rotateModels(outputGear, frontFacing, new Rotation(outR, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 8d / 16d)))); if (state != null && state.getValue(BlockWaterwheelGenerator.VALID_SETUP)) { transformedGroups.addAll(rotateModels(waterwheel, frontFacing, new Rotation(wheelR, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 16d / 16d)))); } } }
@Override protected void transformMovingParts(Collection<CCModel> transformedGroups, EnumFacing frontFacing, float[] rotations, @Nullable IExtendedBlockState state) { float rotation = rotations[frontFacing.ordinal()]; transformedGroups.addAll(rotateModels(shaft, frontFacing, new Rotation(rotation, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 8d / 16d)))); boolean hasPrevious = state != null && state.getValue(BlockTorqueTransportShaft.HAS_PREVIOUS); boolean useInput = state != null && state.getValue(AutomationProperties.USE_INPUT); boolean hasNext = state != null && state.getValue(BlockTorqueTransportShaft.HAS_NEXT); if (!hasNext) { transformedGroups.addAll(rotateModels(outputHead, frontFacing, new Rotation(rotation, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 8d / 16d)))); } if (!hasPrevious) { if (useInput) { rotation = state.getValue(AutomationProperties.INPUT_ROTATION); } transformedGroups.addAll(rotateModels(inputHead, frontFacing, new Rotation(rotation, 0, 0, 1).at(new Vector3(8d / 16d, 8d / 16d, 8d / 16d)))); } }
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; }
protected CCModel rotateFacing(CCModel group, EnumFacing frontFacing) { double angle = Math.PI / 2d * (frontFacing.getAxis() == EnumFacing.Axis.Y ? frontFacing.getFrontOffsetY() : -((frontFacing.getHorizontalIndex() + 2) & 3)); return group.apply(new Rotation(angle, frontFacing.getAxis() == EnumFacing.Axis.Y ? 1 : 0, frontFacing.getAxis() != EnumFacing.Axis.Y ? 1 : 0, 0).at(Vector3.center)); } }
private CCModel rotateShaftPart(CCModel part, EnumFacing facing, float rotation) { return part.copy().apply(new Rotation((facing.ordinal() % 2 == 0) ? rotation : -rotation, facing.getAxis() == EnumFacing.Axis.X ? 1 : 0, facing.getAxis() == EnumFacing.Axis.Y ? 1 : 0, facing.getAxis() == EnumFacing.Axis.Z ? 1 : 0).at(Vector3.center)); }
ccrs.startDrawing(4, POSITION_TEX_COLOR_NORMAL); tankModel.render(ccrs); valveModel.render(ccrs, new Rotation(valve, new Vector3(0, 0, 1)).at(new Vector3(0, 0.4165, 0)), new UVTranslation(0, freq.hasOwner() ? 13 / 64D : 0)); ccrs.draw(); Matrix4 pearlMat = RenderUtils.getMatrix(new Vector3(x + 0.5, y + 0.45 + RenderUtils.getPearlBob(time) * 2, z + 0.5), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04);