mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Merge branch 'mc1.15/dev' into mc1.16/dev
This commit is contained in:
commit
24c306df90
1 changed files with 26 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.logistics.block.depot;
|
package com.simibubi.create.content.logistics.block.depot;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
@ -17,6 +19,8 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance {
|
||||||
|
|
||||||
protected final InstanceKey<ModelData> plate;
|
protected final InstanceKey<ModelData> plate;
|
||||||
|
|
||||||
|
private float lastProgress = Float.NaN;
|
||||||
|
|
||||||
public EjectorInstance(InstancedTileRenderer<?> dispatcher, EjectorTileEntity tile) {
|
public EjectorInstance(InstancedTileRenderer<?> dispatcher, EjectorTileEntity tile) {
|
||||||
super(dispatcher, tile);
|
super(dispatcher, tile);
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
|
@ -29,21 +33,12 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beginFrame() {
|
public void beginFrame() {
|
||||||
|
float lidProgress = getLidProgress();
|
||||||
|
|
||||||
if (tile.lidProgress.settled()) return;
|
if (MathHelper.epsilonEquals(lidProgress, lastProgress)) return;
|
||||||
|
|
||||||
pivotPlate();
|
pivotPlate(lidProgress);
|
||||||
}
|
lastProgress = lidProgress;
|
||||||
|
|
||||||
private void pivotPlate() {
|
|
||||||
float lidProgress = tile.getLidProgress(AnimationTickHolder.getPartialTicks());
|
|
||||||
float angle = lidProgress * 70;
|
|
||||||
|
|
||||||
MatrixStack ms = new MatrixStack();
|
|
||||||
|
|
||||||
EjectorRenderer.applyLidAngle(tile, angle, MatrixStacker.of(ms).translate(getInstancePosition()));
|
|
||||||
|
|
||||||
plate.getInstance().setTransform(ms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,4 +52,22 @@ public class EjectorInstance extends ShaftInstance implements IDynamicInstance {
|
||||||
super.remove();
|
super.remove();
|
||||||
plate.delete();
|
plate.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pivotPlate() {
|
||||||
|
pivotPlate(getLidProgress());
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getLidProgress() {
|
||||||
|
return tile.getLidProgress(AnimationTickHolder.getPartialTicks());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pivotPlate(float lidProgress) {
|
||||||
|
float angle = lidProgress * 70;
|
||||||
|
|
||||||
|
MatrixStack ms = new MatrixStack();
|
||||||
|
|
||||||
|
EjectorRenderer.applyLidAngle(tile, angle, MatrixStacker.of(ms).translate(getInstancePosition()));
|
||||||
|
|
||||||
|
plate.getInstance().setTransform(ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue