mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Extra alternative
- Rename AnimatedKinetics#defaultBlockElement to AnimatedKinetics#blockElement - Add static alternative to AnimatedKinetics#blockElement meant to be used outside of subclasses
This commit is contained in:
parent
28d9df16f2
commit
0c3696dd21
12 changed files with 55 additions and 42 deletions
|
@ -10,7 +10,6 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
|
@ -75,17 +74,15 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 24;
|
||||
|
||||
GuiGameElement.of(AllBlockPartials.ENCASED_FAN_INNER)
|
||||
AnimatedKinetics.defaultBlockElement(AllBlockPartials.ENCASED_FAN_INNER)
|
||||
.rotateBlock(180, 0, AnimatedKinetics.getCurrentAngle() * 16)
|
||||
.scale(scale)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
GuiGameElement.of(AllBlocks.ENCASED_FAN.getDefaultState())
|
||||
AnimatedKinetics.defaultBlockElement(AllBlocks.ENCASED_FAN.getDefaultState())
|
||||
.rotateBlock(0, 180, 0)
|
||||
.atLocal(0, 0, 0)
|
||||
.scale(scale)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
renderAttachedBlock(matrixStack);
|
||||
|
|
|
@ -26,14 +26,14 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 23;
|
||||
|
||||
defaultBlockElement(AllBlocks.BLAZE_BURNER.getDefaultState())
|
||||
blockElement(AllBlocks.BLAZE_BURNER.getDefaultState())
|
||||
.atLocal(0, 1.65, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
float offset = (MathHelper.sin(AnimationTickHolder.getRenderTime() / 16f) + 0.5f) / 16f;
|
||||
PartialModel blaze = AllBlockPartials.BLAZES.get(heatLevel);
|
||||
defaultBlockElement(blaze)
|
||||
blockElement(blaze)
|
||||
.atLocal(1, 1.65 + offset, 1)
|
||||
.rotate(0, 180, 0)
|
||||
.scale(scale)
|
||||
|
|
|
@ -19,12 +19,12 @@ public class AnimatedCrafter extends AnimatedKinetics {
|
|||
.rotateY(-22.5f);
|
||||
int scale = 22;
|
||||
|
||||
defaultBlockElement(cogwheel())
|
||||
blockElement(cogwheel())
|
||||
.rotateBlock(90, 0, getCurrentAngle())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.MECHANICAL_CRAFTER.getDefaultState())
|
||||
blockElement(AllBlocks.MECHANICAL_CRAFTER.getDefaultState())
|
||||
.rotateBlock(0, 180, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
|
@ -20,12 +20,12 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(-22.5f));
|
||||
int scale = 22;
|
||||
|
||||
defaultBlockElement(wheel)
|
||||
blockElement(wheel)
|
||||
.rotateBlock(0, 90, -getCurrentAngle())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(wheel)
|
||||
blockElement(wheel)
|
||||
.rotateBlock(0, 90, getCurrentAngle())
|
||||
.atLocal(2, 0, 0)
|
||||
.scale(scale)
|
||||
|
|
|
@ -20,12 +20,12 @@ public class AnimatedDeployer extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 20;
|
||||
|
||||
defaultBlockElement(shaft(Axis.Z))
|
||||
blockElement(shaft(Axis.Z))
|
||||
.rotateBlock(0, 0, getCurrentAngle())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.DEPLOYER.getDefaultState()
|
||||
blockElement(AllBlocks.DEPLOYER.getDefaultState()
|
||||
.setValue(DeployerBlock.FACING, Direction.DOWN)
|
||||
.setValue(DeployerBlock.AXIS_ALONG_FIRST_COORDINATE, false))
|
||||
.scale(scale)
|
||||
|
@ -37,18 +37,18 @@ public class AnimatedDeployer extends AnimatedKinetics {
|
|||
matrixStack.pushPose();
|
||||
|
||||
matrixStack.translate(0, offset * 17, 0);
|
||||
defaultBlockElement(AllBlockPartials.DEPLOYER_POLE)
|
||||
blockElement(AllBlockPartials.DEPLOYER_POLE)
|
||||
.rotateBlock(90, 0, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
defaultBlockElement(AllBlockPartials.DEPLOYER_HAND_HOLDING)
|
||||
blockElement(AllBlockPartials.DEPLOYER_HAND_HOLDING)
|
||||
.rotateBlock(90, 0, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.popPose();
|
||||
|
||||
defaultBlockElement(AllBlocks.DEPOT.getDefaultState())
|
||||
blockElement(AllBlocks.DEPOT.getDefaultState())
|
||||
.atLocal(0, 2, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
|
@ -27,7 +27,7 @@ public class AnimatedItemDrain extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 20;
|
||||
|
||||
defaultBlockElement(AllBlocks.ITEM_DRAIN.getDefaultState())
|
||||
blockElement(AllBlocks.ITEM_DRAIN.getDefaultState())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
|
|
|
@ -22,6 +22,24 @@ public abstract class AnimatedKinetics implements IDrawable {
|
|||
.secondLightRotation(-20.0f, 50.0f)
|
||||
.build();
|
||||
|
||||
/**
|
||||
* <b>Only use this method outside of subclasses.</b>
|
||||
* Use {@link #blockElement(BlockState)} if calling from inside a subclass.
|
||||
*/
|
||||
public static GuiGameElement.GuiRenderBuilder defaultBlockElement(BlockState state) {
|
||||
return GuiGameElement.of(state)
|
||||
.lighting(DEFAULT_LIGHTING);
|
||||
}
|
||||
|
||||
/**
|
||||
* <b>Only use this method outside of subclasses.</b>
|
||||
* Use {@link #blockElement(PartialModel)} if calling from inside a subclass.
|
||||
*/
|
||||
public static GuiGameElement.GuiRenderBuilder defaultBlockElement(PartialModel partial) {
|
||||
return GuiGameElement.of(partial)
|
||||
.lighting(DEFAULT_LIGHTING);
|
||||
}
|
||||
|
||||
public static float getCurrentAngle() {
|
||||
return (AnimationTickHolder.getRenderTime() * 4f) % 360;
|
||||
}
|
||||
|
@ -34,14 +52,12 @@ public abstract class AnimatedKinetics implements IDrawable {
|
|||
return AllBlockPartials.SHAFTLESS_COGWHEEL;
|
||||
}
|
||||
|
||||
protected GuiGameElement.GuiRenderBuilder defaultBlockElement(BlockState state) {
|
||||
return GuiGameElement.of(state)
|
||||
.lighting(DEFAULT_LIGHTING);
|
||||
protected GuiGameElement.GuiRenderBuilder blockElement(BlockState state) {
|
||||
return defaultBlockElement(state);
|
||||
}
|
||||
|
||||
protected GuiGameElement.GuiRenderBuilder defaultBlockElement(PartialModel partial) {
|
||||
return GuiGameElement.of(partial)
|
||||
.lighting(DEFAULT_LIGHTING);
|
||||
protected GuiGameElement.GuiRenderBuilder blockElement(PartialModel partial) {
|
||||
return defaultBlockElement(partial);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,12 +15,12 @@ public class AnimatedMillstone extends AnimatedKinetics {
|
|||
matrixStack.translate(-2, 18, 0);
|
||||
int scale = 22;
|
||||
|
||||
defaultBlockElement(AllBlockPartials.MILLSTONE_COG)
|
||||
blockElement(AllBlockPartials.MILLSTONE_COG)
|
||||
.rotateBlock(22.5, getCurrentAngle() * 2, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.MILLSTONE.getDefaultState())
|
||||
blockElement(AllBlocks.MILLSTONE.getDefaultState())
|
||||
.rotateBlock(22.5, 22.5, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
|
@ -18,31 +18,31 @@ public class AnimatedMixer extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 23;
|
||||
|
||||
defaultBlockElement(cogwheel())
|
||||
blockElement(cogwheel())
|
||||
.rotateBlock(0, getCurrentAngle() * 2, 0)
|
||||
.atLocal(0, 0, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.MECHANICAL_MIXER.getDefaultState())
|
||||
blockElement(AllBlocks.MECHANICAL_MIXER.getDefaultState())
|
||||
.atLocal(0, 0, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
float animation = ((MathHelper.sin(AnimationTickHolder.getRenderTime() / 32f) + 1) / 5) + .5f;
|
||||
|
||||
defaultBlockElement(AllBlockPartials.MECHANICAL_MIXER_POLE)
|
||||
blockElement(AllBlockPartials.MECHANICAL_MIXER_POLE)
|
||||
.atLocal(0, animation, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlockPartials.MECHANICAL_MIXER_HEAD)
|
||||
blockElement(AllBlockPartials.MECHANICAL_MIXER_HEAD)
|
||||
.rotateBlock(0, getCurrentAngle() * 4, 0)
|
||||
.atLocal(0, animation, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.BASIN.getDefaultState())
|
||||
blockElement(AllBlocks.BASIN.getDefaultState())
|
||||
.atLocal(0, 1.65, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
|
@ -24,22 +24,22 @@ public class AnimatedPress extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = basin ? 23 : 24;
|
||||
|
||||
defaultBlockElement(shaft(Axis.Z))
|
||||
blockElement(shaft(Axis.Z))
|
||||
.rotateBlock(0, 0, getCurrentAngle())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.MECHANICAL_PRESS.getDefaultState())
|
||||
blockElement(AllBlocks.MECHANICAL_PRESS.getDefaultState())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlockPartials.MECHANICAL_PRESS_HEAD)
|
||||
blockElement(AllBlockPartials.MECHANICAL_PRESS_HEAD)
|
||||
.atLocal(0, -getAnimatedHeadOffset(), 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
if (basin)
|
||||
defaultBlockElement(AllBlocks.BASIN.getDefaultState())
|
||||
blockElement(AllBlocks.BASIN.getDefaultState())
|
||||
.atLocal(0, 1.65, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
|
@ -21,18 +21,18 @@ public class AnimatedSaw extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f + 90));
|
||||
int scale = 25;
|
||||
|
||||
defaultBlockElement(shaft(Axis.X))
|
||||
blockElement(shaft(Axis.X))
|
||||
.rotateBlock(-getCurrentAngle(), 0, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlocks.MECHANICAL_SAW.getDefaultState()
|
||||
blockElement(AllBlocks.MECHANICAL_SAW.getDefaultState()
|
||||
.setValue(SawBlock.FACING, Direction.UP))
|
||||
.rotateBlock(0, 0, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
defaultBlockElement(AllBlockPartials.SAW_BLADE_VERTICAL_ACTIVE)
|
||||
blockElement(AllBlockPartials.SAW_BLADE_VERTICAL_ACTIVE)
|
||||
.rotateBlock(0, -90, -90)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class AnimatedSpout extends AnimatedKinetics {
|
|||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 20;
|
||||
|
||||
defaultBlockElement(AllBlocks.SPOUT.getDefaultState())
|
||||
blockElement(AllBlocks.SPOUT.getDefaultState())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
|
@ -42,22 +42,22 @@ public class AnimatedSpout extends AnimatedKinetics {
|
|||
|
||||
matrixStack.pushPose();
|
||||
|
||||
defaultBlockElement(AllBlockPartials.SPOUT_TOP)
|
||||
blockElement(AllBlockPartials.SPOUT_TOP)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
matrixStack.translate(0, -3 * squeeze / 32f, 0);
|
||||
defaultBlockElement(AllBlockPartials.SPOUT_MIDDLE)
|
||||
blockElement(AllBlockPartials.SPOUT_MIDDLE)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
matrixStack.translate(0, -3 * squeeze / 32f, 0);
|
||||
defaultBlockElement(AllBlockPartials.SPOUT_BOTTOM)
|
||||
blockElement(AllBlockPartials.SPOUT_BOTTOM)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
matrixStack.translate(0, -3 * squeeze / 32f, 0);
|
||||
|
||||
matrixStack.popPose();
|
||||
|
||||
defaultBlockElement(AllBlocks.DEPOT.getDefaultState())
|
||||
blockElement(AllBlocks.DEPOT.getDefaultState())
|
||||
.atLocal(0, 2, 0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
|
Loading…
Reference in a new issue