mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Timewarp
- Added user view mode for editors to hide coordinates - Ponder now pauses the game in SP - Ponder elements now use a separate timer and separate partial ticks - Fixed virtual funnels not flapping - Fixed ponder buttons having hover highlights when not clickable - Fixed ponder button mouse hitbox - Addressed strange render state bleed with identify mode highlighting
This commit is contained in:
parent
ea90196250
commit
d1e96c3b4b
26 changed files with 209 additions and 123 deletions
|
@ -58,7 +58,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
||||||
float time = AnimationTickHolder.getRenderTime();
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||||
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
|
float angle = ((time * te.getSpeed() * 3f / 10 + offset) % 360) / 180 * (float) Math.PI;
|
||||||
return angle;
|
return angle;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.LightType;
|
import net.minecraft.world.LightType;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntity> {
|
public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntity> {
|
||||||
|
|
||||||
|
@ -36,7 +37,8 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
BlockState blockState = te.getBlockState();
|
BlockState blockState = te.getBlockState();
|
||||||
SuperByteBuffer superBuffer = AllBlockPartials.HARVESTER_BLADE.renderOn(blockState);
|
SuperByteBuffer superBuffer = AllBlockPartials.HARVESTER_BLADE.renderOn(blockState);
|
||||||
transform(blockState.get(HarvesterBlock.HORIZONTAL_FACING), superBuffer, te.manuallyAnimatedSpeed);
|
transform(te.getWorld(), blockState.get(HarvesterBlock.HORIZONTAL_FACING), superBuffer,
|
||||||
|
te.manuallyAnimatedSpeed);
|
||||||
superBuffer.light(light)
|
superBuffer.light(light)
|
||||||
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
|
.renderInto(ms, buffer.getBuffer(RenderType.getCutoutMipped()));
|
||||||
}
|
}
|
||||||
|
@ -70,17 +72,17 @@ public class HarvesterRenderer extends SafeTileEntityRenderer<HarvesterTileEntit
|
||||||
if (context.contraption.stalled)
|
if (context.contraption.stalled)
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
|
||||||
transform(facing, superBuffer, speed);
|
transform(context.world, facing, superBuffer, speed);
|
||||||
|
|
||||||
superBuffer.light(msLocal.peek()
|
superBuffer.light(msLocal.peek()
|
||||||
.getModel(), ContraptionRenderDispatcher.getLightOnContraption(context))
|
.getModel(), ContraptionRenderDispatcher.getLightOnContraption(context))
|
||||||
.renderInto(ms, buffers.getBuffer(RenderType.getCutoutMipped()));
|
.renderInto(ms, buffers.getBuffer(RenderType.getCutoutMipped()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void transform(Direction facing, SuperByteBuffer superBuffer, float speed) {
|
public static void transform(World world, Direction facing, SuperByteBuffer superBuffer, float speed) {
|
||||||
float originOffset = 1 / 16f;
|
float originOffset = 1 / 16f;
|
||||||
Vec3d rotOffset = new Vec3d(0, -2 * originOffset, originOffset).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
Vec3d rotOffset = new Vec3d(0, -2 * originOffset, originOffset).add(VecHelper.getCenterOf(BlockPos.ZERO));
|
||||||
float time = AnimationTickHolder.getRenderTime() / 20;
|
float time = AnimationTickHolder.getRenderTime(world) / 20;
|
||||||
float angle = (time * speed) % 360;
|
float angle = (time * speed) % 360;
|
||||||
|
|
||||||
superBuffer.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing)))
|
superBuffer.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing)))
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||||
ms.translate(0, isBlockItem ? 9 / 16f : 11 / 16f, 0);
|
ms.translate(0, isBlockItem ? 9 / 16f : 11 / 16f, 0);
|
||||||
ms.scale(scale, scale, scale);
|
ms.scale(scale, scale, scale);
|
||||||
transform = TransformType.GROUND;
|
transform = TransformType.GROUND;
|
||||||
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(AnimationTickHolder.getRenderTime()));
|
ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(AnimationTickHolder.getRenderTime(te.getWorld())));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
float scale = punching ? .75f : isBlockItem ? .75f - 1 / 64f : .5f;
|
float scale = punching ? .75f : isBlockItem ? .75f - 1 / 64f : .5f;
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer {
|
||||||
SuperByteBuffer fanInner =
|
SuperByteBuffer fanInner =
|
||||||
AllBlockPartials.ENCASED_FAN_INNER.renderOnDirectionalSouth(te.getBlockState(), direction.getOpposite());
|
AllBlockPartials.ENCASED_FAN_INNER.renderOnDirectionalSouth(te.getBlockState(), direction.getOpposite());
|
||||||
|
|
||||||
float time = AnimationTickHolder.getRenderTime();
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
float speed = te.getSpeed() * 5;
|
float speed = te.getSpeed() * 5;
|
||||||
if (speed > 0)
|
if (speed > 0)
|
||||||
speed = MathHelper.clamp(speed, 80, 64 * 20);
|
speed = MathHelper.clamp(speed, 80, 64 * 20);
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
|
||||||
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, pos);
|
int packedLightmapCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), blockState, pos);
|
||||||
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
|
||||||
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
|
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
|
||||||
float time = AnimationTickHolder.getRenderTime();
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
float angle = ((time * speed * 6 / 10f) % 360) / 180 * (float) Math.PI;
|
float angle = ((time * speed * 6 / 10f) % 360) / 180 * (float) Math.PI;
|
||||||
|
|
||||||
SuperByteBuffer poleRender = AllBlockPartials.MECHANICAL_MIXER_POLE.renderOn(blockState);
|
SuperByteBuffer poleRender = AllBlockPartials.MECHANICAL_MIXER_POLE.renderOn(blockState);
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class GantryCarriageRenderer extends KineticTileEntityRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
public static float getAngleForTe(KineticTileEntity te, final BlockPos pos, Axis axis) {
|
||||||
float time = AnimationTickHolder.getRenderTime();
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
float offset = getRotationOffsetForPosition(te, pos, axis);
|
float offset = getRotationOffsetForPosition(te, pos, axis);
|
||||||
return ((time * te.getSpeed() * 3f / 20 + offset) % 360) / 180 * (float) Math.PI;
|
return ((time * te.getSpeed() * 3f / 20 + offset) % 360) / 180 * (float) Math.PI;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class RotationIndicatorParticle extends SimpleAnimatedParticle {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void move(double x, double y, double z) {
|
public void move(double x, double y, double z) {
|
||||||
float time = AnimationTickHolder.getTicks();
|
float time = AnimationTickHolder.getTicks(world);
|
||||||
float angle = (float) ((time * speed) % 360) - (speed / 2 * age * (((float) age) / maxAge));
|
float angle = (float) ((time * speed) % 360) - (speed / 2 * age * (((float) age) / maxAge));
|
||||||
if (speed < 0 && axis.isVertical())
|
if (speed < 0 && axis.isVertical())
|
||||||
angle += 180;
|
angle += 180;
|
||||||
|
|
|
@ -72,8 +72,9 @@ public class BasinRenderer extends SmartTileEntityRenderer<BasinTileEntity> {
|
||||||
|
|
||||||
if (fluidLevel > 0) {
|
if (fluidLevel > 0) {
|
||||||
ms.translate(0,
|
ms.translate(0,
|
||||||
(MathHelper.sin(AnimationTickHolder.getRenderTime() / 12f + anglePartition * itemCount) + 1.5f) * 1
|
(MathHelper.sin(
|
||||||
/ 32f,
|
AnimationTickHolder.getRenderTime(basin.getWorld()) / 12f + anglePartition * itemCount) + 1.5f)
|
||||||
|
* 1 / 32f,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class BlazeBurnerRenderer extends SafeTileEntityRenderer<BlazeBurnerTileE
|
||||||
if (heatLevel == HeatLevel.NONE)
|
if (heatLevel == HeatLevel.NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float renderTick = AnimationTickHolder.getRenderTime() + (te.hashCode() % 13) * 16f;
|
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld()) + (te.hashCode() % 13) * 16f;
|
||||||
float offset = (MathHelper.sin((float) ((renderTick / 16f) % (2 * Math.PI))) + .5f) / 16f;
|
float offset = (MathHelper.sin((float) ((renderTick / 16f) % (2 * Math.PI))) + .5f) / 16f;
|
||||||
|
|
||||||
AllBlockPartials blazeModel = AllBlockPartials.BLAZES.get(heatLevel);
|
AllBlockPartials blazeModel = AllBlockPartials.BLAZES.get(heatLevel);
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
|
||||||
MatrixStack localTransforms = new MatrixStack();
|
MatrixStack localTransforms = new MatrixStack();
|
||||||
MatrixStacker msr = MatrixStacker.of(localTransforms);
|
MatrixStacker msr = MatrixStacker.of(localTransforms);
|
||||||
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
|
||||||
float renderTick = AnimationTickHolder.getRenderTime();
|
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
|
|
||||||
msr.centre();
|
msr.centre();
|
||||||
msr.rotateY(AngleHelper.horizontalAngle(facing) + (upward ? 180 : 0) + (sideways ? 270 : 0));
|
msr.rotateY(AngleHelper.horizontalAngle(facing) + (upward ? 180 : 0) + (sideways ? 270 : 0));
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
|
||||||
Block block = te.getBlockState().getBlock();
|
Block block = te.getBlockState().getBlock();
|
||||||
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());
|
||||||
final BlockPos pos = te.getPos();
|
final BlockPos pos = te.getPos();
|
||||||
float time = AnimationTickHolder.getRenderTime();
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
|
|
||||||
for (Direction direction : Iterate.directions) {
|
for (Direction direction : Iterate.directions) {
|
||||||
Axis axis = direction.getAxis();
|
Axis axis = direction.getAxis();
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
|
final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
|
||||||
final BlockPos pos = te.getPos();
|
final BlockPos pos = te.getPos();
|
||||||
float time = AnimationTickHolder.getRenderTime();
|
float time = AnimationTickHolder.getRenderTime(te.getWorld());
|
||||||
|
|
||||||
for (Direction direction : Iterate.directions) {
|
for (Direction direction : Iterate.directions) {
|
||||||
final Axis axis = direction.getAxis();
|
final Axis axis = direction.getAxis();
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class ArmInstance extends SingleRotatingInstance implements ITickableInst
|
||||||
float headAngle = arm.headAngle.get(pt);
|
float headAngle = arm.headAngle.get(pt);
|
||||||
|
|
||||||
if (rave) {
|
if (rave) {
|
||||||
float renderTick = AnimationTickHolder.getRenderTime() + (tile.hashCode() % 64);
|
float renderTick = AnimationTickHolder.getRenderTime(arm.getWorld()) + (tile.hashCode() % 64);
|
||||||
baseAngle = (renderTick * 10) % 360;
|
baseAngle = (renderTick * 10) % 360;
|
||||||
lowerArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 4) + 1) / 2, -45, 15);
|
lowerArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 4) + 1) / 2, -45, 15);
|
||||||
upperArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 8) + 1) / 4, -45, 95);
|
upperArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 8) + 1) / 4, -45, 95);
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class ArmRenderer extends KineticTileEntityRenderer {
|
||||||
float headAngle = arm.headAngle.get(pt);
|
float headAngle = arm.headAngle.get(pt);
|
||||||
|
|
||||||
boolean rave = arm.phase == Phase.DANCING;
|
boolean rave = arm.phase == Phase.DANCING;
|
||||||
float renderTick = AnimationTickHolder.getRenderTime() + (te.hashCode() % 64);
|
float renderTick = AnimationTickHolder.getRenderTime(te.getWorld()) + (te.hashCode() % 64);
|
||||||
if (rave) {
|
if (rave) {
|
||||||
baseAngle = (renderTick * 10) % 360;
|
baseAngle = (renderTick * 10) % 360;
|
||||||
lowerArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 4) + 1) / 2, -45, 15);
|
lowerArmAngle = MathHelper.lerp((MathHelper.sin(renderTick / 4) + 1) / 2, -45, 15);
|
||||||
|
|
|
@ -122,7 +122,8 @@ public class AllIcons implements IScreenRenderable {
|
||||||
I_MTD_CLOSE = next(),
|
I_MTD_CLOSE = next(),
|
||||||
I_MTD_RIGHT = next(),
|
I_MTD_RIGHT = next(),
|
||||||
I_MTD_SCAN = next(),
|
I_MTD_SCAN = next(),
|
||||||
I_MTD_REPLAY = next();
|
I_MTD_REPLAY = next(),
|
||||||
|
I_MTD_USER_MODE = next();
|
||||||
|
|
||||||
public AllIcons(int x, int y) {
|
public AllIcons(int x, int y) {
|
||||||
iconX = x * 16;
|
iconX = x * 16;
|
||||||
|
|
|
@ -95,7 +95,8 @@ public class PonderTooltipHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addToTooltip(List<ITextComponent> toolTip, ItemStack stack) {
|
public static void addToTooltip(List<ITextComponent> toolTip, ItemStack stack) {
|
||||||
float renderPartialTicks = AnimationTickHolder.getPartialTicks();
|
float renderPartialTicks = Minecraft.getInstance()
|
||||||
|
.getRenderPartialTicks();
|
||||||
if (lastHoveredStack != stack)
|
if (lastHoveredStack != stack)
|
||||||
return;
|
return;
|
||||||
ITextComponent component = subject ? Lang.createTranslationTextComponent(SUBJECT)
|
ITextComponent component = subject ? Lang.createTranslationTextComponent(SUBJECT)
|
||||||
|
|
|
@ -38,6 +38,7 @@ import net.minecraft.client.GameSettings;
|
||||||
import net.minecraft.client.MainWindow;
|
import net.minecraft.client.MainWindow;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.widget.Widget;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
@ -55,6 +56,9 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
public class PonderUI extends AbstractSimiScreen {
|
public class PonderUI extends AbstractSimiScreen {
|
||||||
|
|
||||||
|
public static int ponderTicks;
|
||||||
|
public static float ponderPartialTicksPaused;
|
||||||
|
|
||||||
public static final String PONDERING = PonderLocalization.LANG_PREFIX + "pondering";
|
public static final String PONDERING = PonderLocalization.LANG_PREFIX + "pondering";
|
||||||
public static final String IDENTIFY_MODE = PonderLocalization.LANG_PREFIX + "identify_mode";
|
public static final String IDENTIFY_MODE = PonderLocalization.LANG_PREFIX + "identify_mode";
|
||||||
public static final String IN_CHAPTER = PonderLocalization.LANG_PREFIX + "in_chapter";
|
public static final String IN_CHAPTER = PonderLocalization.LANG_PREFIX + "in_chapter";
|
||||||
|
@ -68,6 +72,7 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
ItemStack stack;
|
ItemStack stack;
|
||||||
PonderChapter chapter = null;
|
PonderChapter chapter = null;
|
||||||
|
|
||||||
|
private boolean userViewMode;
|
||||||
private boolean identifyMode;
|
private boolean identifyMode;
|
||||||
private ItemStack hoveredTooltipItem;
|
private ItemStack hoveredTooltipItem;
|
||||||
private BlockPos hoveredBlockPos;
|
private BlockPos hoveredBlockPos;
|
||||||
|
@ -79,7 +84,7 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
private PonderTag referredToByTag;
|
private PonderTag referredToByTag;
|
||||||
|
|
||||||
private PonderButton left, right, scan, chap;
|
private PonderButton left, right, scan, chap, userMode;
|
||||||
|
|
||||||
public static PonderUI of(ItemStack item) {
|
public static PonderUI of(ItemStack item) {
|
||||||
return new PonderUI(PonderRegistry.compile(item.getItem()
|
return new PonderUI(PonderRegistry.compile(item.getItem()
|
||||||
|
@ -165,10 +170,19 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
if (!identifyMode)
|
if (!identifyMode)
|
||||||
scenes.get(index)
|
scenes.get(index)
|
||||||
.deselect();
|
.deselect();
|
||||||
|
else
|
||||||
|
ponderPartialTicksPaused = minecraft.getRenderPartialTicks();
|
||||||
}).showing(AllIcons.I_MTD_SCAN)
|
}).showing(AllIcons.I_MTD_SCAN)
|
||||||
.shortcut(bindings.keyBindDrop)
|
.shortcut(bindings.keyBindDrop)
|
||||||
.fade(0, -1));
|
.fade(0, -1));
|
||||||
|
|
||||||
|
if (PonderIndex.EDITOR_MODE) {
|
||||||
|
widgets.add(userMode = new PonderButton(31, bY, () -> {
|
||||||
|
userViewMode = !userViewMode;
|
||||||
|
}).showing(AllIcons.I_MTD_USER_MODE)
|
||||||
|
.fade(0, -1));
|
||||||
|
}
|
||||||
|
|
||||||
bX += 50 + spacing;
|
bX += 50 + spacing;
|
||||||
widgets.add(left = new PonderButton(bX, bY, () -> this.scroll(false)).showing(AllIcons.I_MTD_LEFT)
|
widgets.add(left = new PonderButton(bX, bY, () -> this.scroll(false)).showing(AllIcons.I_MTD_LEFT)
|
||||||
.shortcut(bindings.keyBindLeft)
|
.shortcut(bindings.keyBindLeft)
|
||||||
|
@ -215,8 +229,10 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
PonderScene activeScene = scenes.get(index);
|
PonderScene activeScene = scenes.get(index);
|
||||||
if (!identifyMode)
|
if (!identifyMode) {
|
||||||
|
ponderTicks++;
|
||||||
activeScene.tick();
|
activeScene.tick();
|
||||||
|
}
|
||||||
sceneProgress.chase(activeScene.getSceneProgress(), .5f, Chaser.EXP);
|
sceneProgress.chase(activeScene.getSceneProgress(), .5f, Chaser.EXP);
|
||||||
lazyIndex.tickChaser();
|
lazyIndex.tickChaser();
|
||||||
fadeIn.tickChaser();
|
fadeIn.tickChaser();
|
||||||
|
@ -295,8 +311,8 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
renderVisibleScenes(mouseX, mouseY, identifyMode ? 0 : partialTicks);
|
renderVisibleScenes(mouseX, mouseY, identifyMode ? ponderPartialTicksPaused : partialTicks);
|
||||||
renderWidgets(mouseX, mouseY, identifyMode ? 0 : partialTicks);
|
renderWidgets(mouseX, mouseY, identifyMode ? ponderPartialTicksPaused : partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderVisibleScenes(int mouseX, int mouseY, float partialTicks) {
|
protected void renderVisibleScenes(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
@ -310,7 +326,7 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
|
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
|
||||||
PonderScene story = scenes.get(i);
|
PonderScene story = scenes.get(i);
|
||||||
MatrixStack ms = new MatrixStack();
|
MatrixStack ms = new MatrixStack();
|
||||||
double value = lazyIndex.getValue(AnimationTickHolder.getPartialTicks());
|
double value = lazyIndex.getValue(AnimationTickHolder.getPartialTicks(story.world));
|
||||||
double diff = i - value;
|
double diff = i - value;
|
||||||
double slide = MathHelper.lerp(diff * diff, 200, 600) * diff;
|
double slide = MathHelper.lerp(diff * diff, 200, 600) * diff;
|
||||||
|
|
||||||
|
@ -326,7 +342,7 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
buffer.draw();
|
buffer.draw();
|
||||||
|
|
||||||
// coords for debug
|
// coords for debug
|
||||||
if (PonderIndex.EDITOR_MODE) {
|
if (PonderIndex.EDITOR_MODE && !userViewMode) {
|
||||||
MutableBoundingBox bounds = story.getBounds();
|
MutableBoundingBox bounds = story.getBounds();
|
||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
|
@ -388,6 +404,10 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
PonderScene activeScene = scenes.get(index);
|
PonderScene activeScene = scenes.get(index);
|
||||||
int textColor = 0xeeeeee;
|
int textColor = 0xeeeeee;
|
||||||
|
|
||||||
|
boolean noWidgetsHovered = true;
|
||||||
|
for (Widget widget : widgets)
|
||||||
|
noWidgetsHovered &= !widget.isMouseOver(mouseX, mouseY);
|
||||||
|
|
||||||
{
|
{
|
||||||
// Chapter title
|
// Chapter title
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
|
@ -433,34 +453,43 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (identifyMode) {
|
if (identifyMode) {
|
||||||
RenderSystem.pushMatrix();
|
if (noWidgetsHovered) {
|
||||||
RenderSystem.translated(mouseX, mouseY, 100);
|
RenderSystem.pushMatrix();
|
||||||
if (hoveredTooltipItem.isEmpty()) {
|
RenderSystem.translated(mouseX, mouseY, 100);
|
||||||
String tooltip = Lang
|
if (hoveredTooltipItem.isEmpty()) {
|
||||||
.createTranslationTextComponent(IDENTIFY_MODE,
|
String tooltip = Lang
|
||||||
new StringTextComponent(minecraft.gameSettings.keyBindDrop.getKeyBinding()
|
.createTranslationTextComponent(IDENTIFY_MODE,
|
||||||
.getLocalizedName()).applyTextStyle(TextFormatting.WHITE))
|
new StringTextComponent(minecraft.gameSettings.keyBindDrop.getKeyBinding()
|
||||||
.applyTextStyle(TextFormatting.GRAY)
|
.getLocalizedName()).applyTextStyle(TextFormatting.WHITE))
|
||||||
.getFormattedText();
|
.applyTextStyle(TextFormatting.GRAY)
|
||||||
renderTooltip(font.listFormattedStringToWidth(tooltip, width / 3), 0, 0);
|
|
||||||
} else
|
|
||||||
renderTooltip(hoveredTooltipItem, 0, 0);
|
|
||||||
if (hoveredBlockPos != null && PonderIndex.EDITOR_MODE) {
|
|
||||||
RenderSystem.translated(0, -15, 0);
|
|
||||||
boolean copied = copiedBlockPos != null && hoveredBlockPos.equals(copiedBlockPos);
|
|
||||||
String coords = new StringTextComponent(
|
|
||||||
hoveredBlockPos.getX() + ", " + hoveredBlockPos.getY() + ", " + hoveredBlockPos.getZ())
|
|
||||||
.applyTextStyles(copied ? TextFormatting.GREEN : TextFormatting.GOLD)
|
|
||||||
.getFormattedText();
|
.getFormattedText();
|
||||||
renderTooltip(coords, 0, 0);
|
renderTooltip(font.listFormattedStringToWidth(tooltip, width / 3), 0, 0);
|
||||||
|
} else
|
||||||
|
renderTooltip(hoveredTooltipItem, 0, 0);
|
||||||
|
if (hoveredBlockPos != null && PonderIndex.EDITOR_MODE && !userViewMode) {
|
||||||
|
RenderSystem.translated(0, -15, 0);
|
||||||
|
boolean copied = copiedBlockPos != null && hoveredBlockPos.equals(copiedBlockPos);
|
||||||
|
String coords = new StringTextComponent(
|
||||||
|
hoveredBlockPos.getX() + ", " + hoveredBlockPos.getY() + ", " + hoveredBlockPos.getZ())
|
||||||
|
.applyTextStyles(copied ? TextFormatting.GREEN : TextFormatting.GOLD)
|
||||||
|
.getFormattedText();
|
||||||
|
renderTooltip(coords, 0, 0);
|
||||||
|
}
|
||||||
|
RenderSystem.popMatrix();
|
||||||
}
|
}
|
||||||
RenderSystem.popMatrix();
|
|
||||||
|
|
||||||
scan.flash();
|
scan.flash();
|
||||||
} else {
|
} else {
|
||||||
scan.dim();
|
scan.dim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PonderIndex.EDITOR_MODE) {
|
||||||
|
if (userViewMode)
|
||||||
|
userMode.flash();
|
||||||
|
else
|
||||||
|
userMode.dim();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Scene overlay
|
// Scene overlay
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
|
@ -777,8 +806,25 @@ public class PonderUI extends AbstractSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shareContextWith(AbstractSimiScreen other) {
|
public void shareContextWith(AbstractSimiScreen other) {
|
||||||
if (other instanceof PonderUI)
|
if (other instanceof PonderUI) {
|
||||||
((PonderUI) other).referredToByTag = referredToByTag;
|
PonderUI ponderUI = (PonderUI) other;
|
||||||
|
ponderUI.referredToByTag = referredToByTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getPartialTicks() {
|
||||||
|
if (Minecraft.getInstance().currentScreen instanceof PonderUI) {
|
||||||
|
PonderUI ui = (PonderUI) Minecraft.getInstance().currentScreen;
|
||||||
|
if (ui.identifyMode)
|
||||||
|
return ponderPartialTicksPaused;
|
||||||
|
}
|
||||||
|
return Minecraft.getInstance()
|
||||||
|
.getRenderPartialTicks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPauseScreen() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,7 +525,7 @@ public class SceneBuilder {
|
||||||
return;
|
return;
|
||||||
behaviour.handleInsertion(stack, insertionSide.getOpposite(), false);
|
behaviour.handleInsertion(stack, insertionSide.getOpposite(), false);
|
||||||
});
|
});
|
||||||
flapFunnels(scene.getSceneBuildingUtil().select.position(location.up()), true);
|
flapFunnel(location.up(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementLink<BeltItemElement> createItemOnBelt(BlockPos beltLocation, Direction insertionSide,
|
public ElementLink<BeltItemElement> createItemOnBelt(BlockPos beltLocation, Direction insertionSide,
|
||||||
|
@ -553,9 +553,8 @@ public class SceneBuilder {
|
||||||
scene.linkElement(tracker, link);
|
scene.linkElement(tracker, link);
|
||||||
return TransportedResult.doNothing();
|
return TransportedResult.doNothing();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
flapFunnels(scene.getSceneBuildingUtil().select.position(beltLocation.up()), true);
|
flapFunnel(beltLocation.up(), true);
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,11 +632,8 @@ public class SceneBuilder {
|
||||||
}, reDrawBlocks));
|
}, reDrawBlocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flapFunnels(Selection selection, boolean outward) {
|
public void flapFunnel(BlockPos position, boolean outward) {
|
||||||
addInstruction(new TileEntityDataInstruction(selection, FunnelTileEntity.class, nbt -> {
|
modifyTileEntity(position, FunnelTileEntity.class, funnel -> funnel.flap(!outward));
|
||||||
nbt.putInt("Flap", outward ? -1 : 1);
|
|
||||||
return nbt;
|
|
||||||
}, false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,11 @@ public class FunnelScenes {
|
||||||
BlockPos entryBeltPos = util.grid.at(3, 1, 2);
|
BlockPos entryBeltPos = util.grid.at(3, 1, 2);
|
||||||
BlockPos exitBeltPos = util.grid.at(1, 1, 2);
|
BlockPos exitBeltPos = util.grid.at(1, 1, 2);
|
||||||
ItemStack itemStack = AllBlocks.BRASS_BLOCK.asStack();
|
ItemStack itemStack = AllBlocks.BRASS_BLOCK.asStack();
|
||||||
Selection exitFunnel = util.select.position(exitBeltPos.up());
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
scene.idle(8);
|
scene.idle(8);
|
||||||
scene.world.removeItemsFromBelt(exitBeltPos);
|
scene.world.removeItemsFromBelt(exitBeltPos);
|
||||||
scene.world.flapFunnels(exitFunnel, false);
|
scene.world.flapFunnel(exitBeltPos.up(), false);
|
||||||
if (i == 2)
|
if (i == 2)
|
||||||
scene.rotateCameraY(70);
|
scene.rotateCameraY(70);
|
||||||
if (i < 6)
|
if (i < 6)
|
||||||
|
@ -94,7 +93,7 @@ public class FunnelScenes {
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
scene.idle(8);
|
scene.idle(8);
|
||||||
scene.world.flapFunnels(outputFunnel, false);
|
scene.world.flapFunnel(util.grid.at(1, 2, 4), false);
|
||||||
scene.world.createItemEntity(sideItemSpawn, util.vector.of(-.05, 0, 0), itemStack);
|
scene.world.createItemEntity(sideItemSpawn, util.vector.of(-.05, 0, 0), itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +197,7 @@ public class FunnelScenes {
|
||||||
|
|
||||||
scene.idle(20);
|
scene.idle(20);
|
||||||
|
|
||||||
scene.world.flapFunnels(sideFunnelSelection, true);
|
scene.world.flapFunnel(sideFunnel, true);
|
||||||
itemLink = scene.world.createItemEntity(sideCenter.subtract(0, .45, 0), util.vector.of(0, 0, -0.1), itemStack);
|
itemLink = scene.world.createItemEntity(sideCenter.subtract(0, .45, 0), util.vector.of(0, 0, -0.1), itemStack);
|
||||||
scene.idle(60);
|
scene.idle(60);
|
||||||
scene.world.hideSection(sideFunnelSelection, Direction.UP);
|
scene.world.hideSection(sideFunnelSelection, Direction.UP);
|
||||||
|
@ -233,7 +232,7 @@ public class FunnelScenes {
|
||||||
scene.idle(35);
|
scene.idle(35);
|
||||||
|
|
||||||
scene.world.removeItemsFromBelt(beltPos);
|
scene.world.removeItemsFromBelt(beltPos);
|
||||||
scene.world.flapFunnels(beltFunnelSetup, false);
|
scene.world.flapFunnel(util.grid.at(2, 2, 2), false);
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
scene.idle(50);
|
scene.idle(50);
|
||||||
|
@ -374,7 +373,7 @@ public class FunnelScenes {
|
||||||
scene.idle(10);
|
scene.idle(10);
|
||||||
scene.world.createItemOnBeltLike(andesiteFunnel.down()
|
scene.world.createItemOnBeltLike(andesiteFunnel.down()
|
||||||
.north(), Direction.SOUTH, itemStack);
|
.north(), Direction.SOUTH, itemStack);
|
||||||
scene.world.flapFunnels(util.select.position(andesiteFunnel), true);
|
scene.world.flapFunnel(andesiteFunnel, true);
|
||||||
scene.idle(60);
|
scene.idle(60);
|
||||||
|
|
||||||
scene.overlay.showText(60)
|
scene.overlay.showText(60)
|
||||||
|
@ -384,7 +383,7 @@ public class FunnelScenes {
|
||||||
scene.idle(10);
|
scene.idle(10);
|
||||||
scene.world.createItemOnBeltLike(brassFunnel.down()
|
scene.world.createItemOnBeltLike(brassFunnel.down()
|
||||||
.north(), Direction.SOUTH, ItemHandlerHelper.copyStackWithSize(itemStack, 64));
|
.north(), Direction.SOUTH, ItemHandlerHelper.copyStackWithSize(itemStack, 64));
|
||||||
scene.world.flapFunnels(util.select.position(brassFunnel), true);
|
scene.world.flapFunnel(brassFunnel, true);
|
||||||
scene.idle(60);
|
scene.idle(60);
|
||||||
|
|
||||||
AxisAlignedBB filterSlot = new AxisAlignedBB(brassFunnel).grow(-.35, -.35, -.35)
|
AxisAlignedBB filterSlot = new AxisAlignedBB(brassFunnel).grow(-.35, -.35, -.35)
|
||||||
|
@ -421,7 +420,7 @@ public class FunnelScenes {
|
||||||
|
|
||||||
if (i > 0 && (i < 3 || i % 3 == 0)) {
|
if (i > 0 && (i < 3 || i % 3 == 0)) {
|
||||||
scene.world.removeItemsFromBelt(brassFunnel.down());
|
scene.world.removeItemsFromBelt(brassFunnel.down());
|
||||||
scene.world.flapFunnels(util.select.position(brassFunnel), false);
|
scene.world.flapFunnel(brassFunnel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.world.modifyEntities(ItemEntity.class, e -> {
|
scene.world.modifyEntities(ItemEntity.class, e -> {
|
||||||
|
|
|
@ -49,43 +49,39 @@ public class PonderIndexScreen extends AbstractSimiScreen {
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
//populate lists
|
// populate lists
|
||||||
widgets.clear();
|
widgets.clear();
|
||||||
|
|
||||||
chapters.clear();
|
chapters.clear();
|
||||||
//chapters.addAll(PonderRegistry.chapters.getAllChapters());
|
// chapters.addAll(PonderRegistry.chapters.getAllChapters());
|
||||||
|
|
||||||
items.clear();
|
items.clear();
|
||||||
PonderRegistry.all.keySet()
|
PonderRegistry.all.keySet()
|
||||||
.stream()
|
.stream()
|
||||||
.map(key -> {
|
.map(key -> {
|
||||||
Item item = ForgeRegistries.ITEMS.getValue(key);
|
Item item = ForgeRegistries.ITEMS.getValue(key);
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
Block b = ForgeRegistries.BLOCKS.getValue(key);
|
Block b = ForgeRegistries.BLOCKS.getValue(key);
|
||||||
if (b != null)
|
if (b != null)
|
||||||
item = b.asItem();
|
item = b.asItem();
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
})
|
})
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(PonderIndexScreen::exclusions)
|
.filter(PonderIndexScreen::exclusions)
|
||||||
.forEach(items::add);
|
.forEach(items::add);
|
||||||
|
|
||||||
boolean hasChapters = !chapters.isEmpty();
|
boolean hasChapters = !chapters.isEmpty();
|
||||||
|
|
||||||
//setup chapters
|
// setup chapters
|
||||||
LayoutHelper layout = LayoutHelper.centeredHorizontal(
|
LayoutHelper layout = LayoutHelper.centeredHorizontal(chapters.size(),
|
||||||
chapters.size(),
|
MathHelper.clamp((int) Math.ceil(chapters.size() / 4f), 1, 4), 200, 38, 16);
|
||||||
MathHelper.clamp((int) Math.ceil(chapters.size() / 4f), 1, 4),
|
|
||||||
200,
|
|
||||||
38,
|
|
||||||
16
|
|
||||||
);
|
|
||||||
chapterArea = layout.getArea();
|
chapterArea = layout.getArea();
|
||||||
int chapterCenterX = (int) (width * chapterXmult);
|
int chapterCenterX = (int) (width * chapterXmult);
|
||||||
int chapterCenterY = (int) (height * chapterYmult);
|
int chapterCenterY = (int) (height * chapterYmult);
|
||||||
|
|
||||||
//todo at some point pagination or horizontal scrolling may be needed for chapters/items
|
// todo at some point pagination or horizontal scrolling may be needed for
|
||||||
|
// chapters/items
|
||||||
for (PonderChapter chapter : chapters) {
|
for (PonderChapter chapter : chapters) {
|
||||||
ChapterLabel label = new ChapterLabel(chapter, chapterCenterX + layout.getX(),
|
ChapterLabel label = new ChapterLabel(chapter, chapterCenterX + layout.getX(),
|
||||||
chapterCenterY + layout.getY(), (mouseX, mouseY) -> {
|
chapterCenterY + layout.getY(), (mouseX, mouseY) -> {
|
||||||
|
@ -97,44 +93,40 @@ public class PonderIndexScreen extends AbstractSimiScreen {
|
||||||
layout.next();
|
layout.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
//setup items
|
// setup items
|
||||||
if (!hasChapters) {
|
if (!hasChapters) {
|
||||||
itemYmult = 0.5;
|
itemYmult = 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxItemRows = hasChapters ? 4 : 7;
|
int maxItemRows = hasChapters ? 4 : 7;
|
||||||
layout = LayoutHelper.centeredHorizontal(
|
layout = LayoutHelper.centeredHorizontal(items.size(),
|
||||||
items.size(),
|
MathHelper.clamp((int) Math.ceil(items.size() / 11f), 1, maxItemRows), 28, 28, 8);
|
||||||
MathHelper.clamp((int) Math.ceil(items.size() / 11f), 1, maxItemRows),
|
|
||||||
28,
|
|
||||||
28,
|
|
||||||
8
|
|
||||||
);
|
|
||||||
itemArea = layout.getArea();
|
itemArea = layout.getArea();
|
||||||
int itemCenterX = (int) (width * itemXmult);
|
int itemCenterX = (int) (width * itemXmult);
|
||||||
int itemCenterY = (int) (height * itemYmult);
|
int itemCenterY = (int) (height * itemYmult);
|
||||||
|
|
||||||
for (Item item : items) {
|
for (Item item : items) {
|
||||||
PonderButton button = new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, (x, y) -> {
|
PonderButton button =
|
||||||
if (!PonderRegistry.all.containsKey(item.getRegistryName()))
|
new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, (x, y) -> {
|
||||||
return;
|
if (!PonderRegistry.all.containsKey(item.getRegistryName()))
|
||||||
|
return;
|
||||||
|
|
||||||
centerScalingOn(x, y);
|
centerScalingOn(x, y);
|
||||||
ScreenOpener.transitionTo(PonderUI.of(new ItemStack(item)));
|
ScreenOpener.transitionTo(PonderUI.of(new ItemStack(item)));
|
||||||
}).showing(new ItemStack(item));
|
}).showing(new ItemStack(item));
|
||||||
|
|
||||||
button.fade(1);
|
button.fade(1);
|
||||||
widgets.add(button);
|
widgets.add(button);
|
||||||
layout.next();
|
layout.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean exclusions(Item item) {
|
private static boolean exclusions(Item item) {
|
||||||
if (item instanceof BlockItem) {
|
if (item instanceof BlockItem) {
|
||||||
Block block = ((BlockItem) item).getBlock();
|
Block block = ((BlockItem) item).getBlock();
|
||||||
if (block instanceof ValveHandleBlock && !AllBlocks.COPPER_VALVE_HANDLE.is(item)) return false;
|
if (block instanceof ValveHandleBlock && !AllBlocks.COPPER_VALVE_HANDLE.is(item))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -143,6 +135,7 @@ public class PonderIndexScreen extends AbstractSimiScreen {
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
PonderUI.ponderTicks++;
|
||||||
|
|
||||||
hoveredItem = ItemStack.EMPTY;
|
hoveredItem = ItemStack.EMPTY;
|
||||||
MainWindow w = minecraft.getWindow();
|
MainWindow w = minecraft.getWindow();
|
||||||
|
@ -224,4 +217,9 @@ public class PonderIndexScreen extends AbstractSimiScreen {
|
||||||
public ItemStack getHoveredTooltipItem() {
|
public ItemStack getHoveredTooltipItem() {
|
||||||
return hoveredItem;
|
return hoveredItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPauseScreen() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,16 @@ public class PonderTagScreen extends AbstractSimiScreen {
|
||||||
int itemCenterY = getItemsY();
|
int itemCenterY = getItemsY();
|
||||||
|
|
||||||
for (Item i : items) {
|
for (Item i : items) {
|
||||||
|
final boolean canClick = PonderRegistry.all.containsKey(i.getRegistryName());
|
||||||
PonderButton button =
|
PonderButton button =
|
||||||
new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, (mouseX, mouseY) -> {
|
new PonderButton(itemCenterX + layout.getX() + 4, itemCenterY + layout.getY() + 4, (mouseX, mouseY) -> {
|
||||||
if (!PonderRegistry.all.containsKey(i.getRegistryName()))
|
if (!canClick)
|
||||||
return;
|
return;
|
||||||
centerScalingOn(mouseX, mouseY);
|
centerScalingOn(mouseX, mouseY);
|
||||||
ScreenOpener.transitionTo(PonderUI.of(new ItemStack(i), tag));
|
ScreenOpener.transitionTo(PonderUI.of(new ItemStack(i), tag));
|
||||||
}).showing(new ItemStack(i));
|
}).showing(new ItemStack(i));
|
||||||
|
if (!canClick)
|
||||||
|
button.noClickEvent();
|
||||||
|
|
||||||
button.fade(1);
|
button.fade(1);
|
||||||
widgets.add(button);
|
widgets.add(button);
|
||||||
|
@ -92,18 +95,20 @@ public class PonderTagScreen extends AbstractSimiScreen {
|
||||||
|
|
||||||
if (!tag.getMainItem()
|
if (!tag.getMainItem()
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
|
final boolean canClick = PonderRegistry.all.containsKey(tag.getMainItem()
|
||||||
|
.getItem()
|
||||||
|
.getRegistryName());
|
||||||
PonderButton button =
|
PonderButton button =
|
||||||
new PonderButton(itemCenterX - layout.getTotalWidth() / 2 - 42, itemCenterY - 10, (mouseX, mouseY) -> {
|
new PonderButton(itemCenterX - layout.getTotalWidth() / 2 - 42, itemCenterY - 10, (mouseX, mouseY) -> {
|
||||||
if (!PonderRegistry.all.containsKey(tag.getMainItem()
|
if (!canClick)
|
||||||
.getItem()
|
|
||||||
.getRegistryName()))
|
|
||||||
return;
|
return;
|
||||||
centerScalingOn(mouseX, mouseY);
|
centerScalingOn(mouseX, mouseY);
|
||||||
ScreenOpener.transitionTo(PonderUI.of(tag.getMainItem(), tag));
|
ScreenOpener.transitionTo(PonderUI.of(tag.getMainItem(), tag));
|
||||||
}).showing(tag.getMainItem());
|
}).showing(tag.getMainItem());
|
||||||
|
if (!canClick)
|
||||||
|
button.noClickEvent();
|
||||||
|
|
||||||
button.fade(1);
|
button.fade(1);
|
||||||
// button.flash();
|
|
||||||
widgets.add(button);
|
widgets.add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +138,7 @@ public class PonderTagScreen extends AbstractSimiScreen {
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
PonderUI.ponderTicks++;
|
||||||
|
|
||||||
hoveredItem = ItemStack.EMPTY;
|
hoveredItem = ItemStack.EMPTY;
|
||||||
MainWindow w = minecraft.getWindow();
|
MainWindow w = minecraft.getWindow();
|
||||||
|
@ -291,5 +297,10 @@ public class PonderTagScreen extends AbstractSimiScreen {
|
||||||
return tag == ((PonderTagScreen) other).tag;
|
return tag == ((PonderTagScreen) other).tag;
|
||||||
return super.isEquivalentTo(other);
|
return super.isEquivalentTo(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPauseScreen() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.foundation.ponder.PonderScene;
|
import com.simibubi.create.foundation.ponder.PonderScene;
|
||||||
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
import com.simibubi.create.foundation.ponder.PonderWorld;
|
import com.simibubi.create.foundation.ponder.PonderWorld;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
import net.minecraft.client.MainWindow;
|
import net.minecraft.client.MainWindow;
|
||||||
|
@ -170,7 +170,7 @@ public class ParrotElement extends AnimatedSceneElement {
|
||||||
.length();
|
.length();
|
||||||
entity.onGround = false;
|
entity.onGround = false;
|
||||||
double phase = Math.min(length * 15, 8);
|
double phase = Math.min(length * 15, 8);
|
||||||
float f = (float) ((AnimationTickHolder.getTicks() % 100) * phase);
|
float f = (float) ((PonderUI.ponderTicks % 100) * phase);
|
||||||
entity.flapSpeed = MathHelper.sin(f) + 1;
|
entity.flapSpeed = MathHelper.sin(f) + 1;
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
entity.flapSpeed = 0;
|
entity.flapSpeed = 0;
|
||||||
|
|
|
@ -313,10 +313,9 @@ public class WorldSectionElement extends AnimatedSceneElement {
|
||||||
transformMS(ms, pt);
|
transformMS(ms, pt);
|
||||||
RenderSystem.disableTexture();
|
RenderSystem.disableTexture();
|
||||||
WorldRenderer.drawBox(ms, buffer.getBuffer(RenderType.getLines()), shape.getBoundingBox()
|
WorldRenderer.drawBox(ms, buffer.getBuffer(RenderType.getLines()), shape.getBoundingBox()
|
||||||
.offset(selectedBlock), 1, 1, 1, 1);
|
.offset(selectedBlock), 1, 1, 1, 0.6f);
|
||||||
if (buffer instanceof SuperRenderTypeBuffer)
|
// if (buffer instanceof SuperRenderTypeBuffer)
|
||||||
((SuperRenderTypeBuffer) buffer).draw(RenderType.getLines());
|
// ((SuperRenderTypeBuffer) buffer).draw(RenderType.getLines());
|
||||||
RenderSystem.enableTexture();
|
|
||||||
ms.pop();
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||||
import com.simibubi.create.foundation.gui.IScreenRenderable;
|
import com.simibubi.create.foundation.gui.IScreenRenderable;
|
||||||
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
||||||
import com.simibubi.create.foundation.ponder.PonderUI;
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.LerpedFloat;
|
||||||
|
|
||||||
|
@ -26,6 +25,7 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
private float fade;
|
private float fade;
|
||||||
private KeyBinding shortcut;
|
private KeyBinding shortcut;
|
||||||
private LerpedFloat flash;
|
private LerpedFloat flash;
|
||||||
|
private boolean noClickEvent;
|
||||||
|
|
||||||
public static final int SIZE = 20;
|
public static final int SIZE = 20;
|
||||||
|
|
||||||
|
@ -54,6 +54,11 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PonderButton noClickEvent() {
|
||||||
|
this.noClickEvent = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public PonderButton shortcut(KeyBinding key) {
|
public PonderButton shortcut(KeyBinding key) {
|
||||||
this.shortcut = key;
|
this.shortcut = key;
|
||||||
return this;
|
return this;
|
||||||
|
@ -86,7 +91,7 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
if (fade < .1f)
|
if (fade < .1f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height && fade > .75f;
|
isHovered = isMouseOver(mouseX, mouseY) && fade > .75f;
|
||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
|
@ -95,11 +100,13 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
|
|
||||||
float flashValue = flash.getValue(partialTicks);
|
float flashValue = flash.getValue(partialTicks);
|
||||||
if (flashValue > .1f)
|
if (flashValue > .1f)
|
||||||
fade *= 3 * flashValue + Math.sin((AnimationTickHolder.getTicks() + partialTicks) / 6);
|
fade *= 3 * flashValue + Math.sin((PonderUI.ponderTicks + partialTicks) / 6);
|
||||||
|
|
||||||
int backgroundColor = ColorHelper.applyAlpha(0xdd000000, fade);
|
int backgroundColor = ColorHelper.applyAlpha(0xdd000000, fade);
|
||||||
int borderColorStart = ColorHelper.applyAlpha(isHovered ? 0x70ffffff : 0x40aa9999, fade);
|
int borderColorStart =
|
||||||
int borderColorEnd = ColorHelper.applyAlpha(isHovered ? 0x30ffffff : 0x20aa9999, fade);
|
ColorHelper.applyAlpha(noClickEvent ? 0x70984500 : isHovered ? 0x70ffffff : 0x40aa9999, fade);
|
||||||
|
int borderColorEnd =
|
||||||
|
ColorHelper.applyAlpha(noClickEvent ? 0x70692400 : isHovered ? 0x30ffffff : 0x20aa9999, fade);
|
||||||
|
|
||||||
PonderUI.renderBox(x, y, width, height, backgroundColor, borderColorStart, borderColorEnd);
|
PonderUI.renderBox(x, y, width, height, backgroundColor, borderColorStart, borderColorEnd);
|
||||||
RenderSystem.translated(0, 0, 800);
|
RenderSystem.translated(0, 0, 800);
|
||||||
|
@ -153,4 +160,13 @@ public class PonderButton extends AbstractSimiWidget {
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMouseOver(double x, double y) {
|
||||||
|
double m = 4;
|
||||||
|
x = Math.floor(x);
|
||||||
|
y = Math.floor(y);
|
||||||
|
return active && visible
|
||||||
|
&& !(x < this.x - m || x > this.x + width + m - 1 || y < this.y - m || y > this.y + height + m - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package com.simibubi.create.foundation.utility;
|
package com.simibubi.create.foundation.utility;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
|
import com.simibubi.create.foundation.ponder.PonderWorld;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
|
|
||||||
public class AnimationTickHolder {
|
public class AnimationTickHolder {
|
||||||
|
|
||||||
|
@ -15,6 +19,10 @@ public class AnimationTickHolder {
|
||||||
ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision
|
ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getTicks() {
|
||||||
|
return ticks;
|
||||||
|
}
|
||||||
|
|
||||||
public static float getRenderTime() {
|
public static float getRenderTime() {
|
||||||
return getTicks() + getPartialTicks();
|
return getTicks() + getPartialTicks();
|
||||||
|
@ -24,8 +32,16 @@ public class AnimationTickHolder {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
return (mc.isGamePaused() ? mc.renderPartialTicksPaused : mc.getRenderPartialTicks());
|
return (mc.isGamePaused() ? mc.renderPartialTicksPaused : mc.getRenderPartialTicks());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getTicks() {
|
public static int getTicks(IWorld world) {
|
||||||
return ticks;
|
return world instanceof PonderWorld ? PonderUI.ponderTicks : getTicks();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getRenderTime(IWorld world) {
|
||||||
|
return getTicks(world) + getPartialTicks(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float getPartialTicks(IWorld world) {
|
||||||
|
return world instanceof PonderWorld ? PonderUI.getPartialTicks() : getPartialTicks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Loading…
Reference in a new issue