diff --git a/common/src/main/java/rearth/oritech/client/ui/UpgradableMachineScreen.java b/common/src/main/java/rearth/oritech/client/ui/UpgradableMachineScreen.java index e2ee3537..c4b08689 100644 --- a/common/src/main/java/rearth/oritech/client/ui/UpgradableMachineScreen.java +++ b/common/src/main/java/rearth/oritech/client/ui/UpgradableMachineScreen.java @@ -159,7 +159,7 @@ public void remove() { var relativePos = MultiblockMachineEntity.worldToRelativePos(handler.blockPos, addonBlockPos, facing); holoPreviewContainer.child( - new BlockPreviewComponent(addonBlock, addonBlockEntity, relativePos, rotationSpeed, 20) + new BlockPreviewComponent(addonBlock, addonBlockEntity, relativePos, rotationSpeed) .sizing(Sizing.fixed(20)) .positioning(Positioning.absolute(previewX, previewY)) ); @@ -206,7 +206,7 @@ public void remove() { var dummyBlock = BlockContent.ADDON_INDICATOR_BLOCK.getDefaultState(); holoPreviewContainer.child( - new BlockPreviewComponent(dummyBlock, null, relativePos, rotationSpeed, 20) + new BlockPreviewComponent(dummyBlock, null, relativePos, rotationSpeed) .sizing(Sizing.fixed(20)) .positioning(Positioning.absolute(previewX, previewY)) ); @@ -218,7 +218,7 @@ public void remove() { // machine itself holoPreviewContainer.child( - new BlockPreviewComponent(handler.machineBlock, handler.blockEntity, new Vec3i(0, 0, 0), rotationSpeed, 20) + new BlockPreviewComponent(handler.machineBlock, handler.blockEntity, new Vec3i(0, 0, 0), rotationSpeed) .sizing(Sizing.fixed(20)) .positioning(Positioning.absolute(previewX, previewY)) ); diff --git a/common/src/main/java/rearth/oritech/client/ui/components/BlockPreviewComponent.java b/common/src/main/java/rearth/oritech/client/ui/components/BlockPreviewComponent.java index 9b142b51..39ece900 100644 --- a/common/src/main/java/rearth/oritech/client/ui/components/BlockPreviewComponent.java +++ b/common/src/main/java/rearth/oritech/client/ui/components/BlockPreviewComponent.java @@ -22,43 +22,24 @@ public class BlockPreviewComponent extends BaseComponent { private final @Nullable BlockEntity entity; private final Vec3i offset; private final float mouseRotationSpeed; - private final float blockSizing; private float mouseRotation; - public BlockPreviewComponent(BlockState state, @Nullable BlockEntity entity, Vec3i offset, float blockSizing) { - this(state, entity, offset, 0, blockSizing); - } - - public BlockPreviewComponent(BlockState state, @Nullable BlockEntity entity, Vec3i offset, float mouseRotationSpeed, float blockSizing) { + public BlockPreviewComponent(BlockState state, @Nullable BlockEntity entity, Vec3i offset, float mouseRotationSpeed) { this.state = state; this.entity = entity; this.offset = offset; this.mouseRotationSpeed = mouseRotationSpeed; - this.blockSizing = blockSizing; - } - - @Override - public boolean shouldDrawTooltip(double mouseX, double mouseY) { - if (!super.shouldDrawTooltip(mouseX, mouseY)) return false; - - var offsetX = mouseX - this.x; - var offsetY = mouseY - this.y; - - System.out.println(offsetX + " " + offsetY + " | " + x + " " + offset.getX() + " " + blockSizing); - // no idea how to properly do this - - return true; } @Override public void draw(OwoUIDrawContext context, int mouseX, int mouseY, float partialTicks, float delta) { context.getMatrices().push(); - context.getMatrices().translate(x + this.blockSizing / 2f, y + this.blockSizing / 2f, 2000); - context.getMatrices().scale(40 * this.blockSizing / 64f, -40 * this.blockSizing / 64f, 40); + context.getMatrices().translate(x + this.width / 2f, y + this.height / 2f, 400); + context.getMatrices().scale(40 * this.width / 64f, -40 * this.height / 64f, 40); - context.getMatrices().multiply(RotationAxis.POSITIVE_X.rotationDegrees(35)); + context.getMatrices().multiply(RotationAxis.POSITIVE_X.rotationDegrees(30)); context.getMatrices().multiply(RotationAxis.POSITIVE_Y.rotationDegrees(45 + 180 + mouseRotation)); mouseRotation += mouseRotationSpeed;