From 448e1c947cdf836fde9f2cd36eb7b0ce90cf3664 Mon Sep 17 00:00:00 2001 From: Boblet Date: Fri, 26 Aug 2022 15:13:02 +0200 Subject: [PATCH] jar tooltip test texture, scene offset actions --- .../java/com/hbm/wiaj/GuiWorldInAJar.java | 30 ++++++++------- src/main/java/com/hbm/wiaj/JarScript.java | 19 +++++++-- .../com/hbm/wiaj/actions/ActionOffsetBy.java | 36 ++++++++++++++++++ ...{ActionRotate.java => ActionRotateBy.java} | 9 ++++- .../com/hbm/wiaj/actors/ActorFancyPanel.java | 36 ++++++++++++++++++ .../assets/hbm/textures/gui/gui_utility.png | Bin 1014 -> 3247 bytes 6 files changed, 111 insertions(+), 19 deletions(-) create mode 100644 src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java rename src/main/java/com/hbm/wiaj/actions/{ActionRotate.java => ActionRotateBy.java} (62%) create mode 100644 src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java diff --git a/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java b/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java index b9080b70c..5afb45c20 100644 --- a/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java +++ b/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java @@ -1,7 +1,6 @@ package com.hbm.wiaj; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; @@ -14,7 +13,7 @@ import com.hbm.blocks.ModBlocks; import com.hbm.items.ModItems; import com.hbm.render.tileentity.RenderStirling; import com.hbm.wiaj.actions.ActionCreateActor; -import com.hbm.wiaj.actions.ActionRotate; +import com.hbm.wiaj.actions.ActionRotateBy; import com.hbm.wiaj.actions.ActionSetActorData; import com.hbm.wiaj.actions.ActionSetBlock; import com.hbm.wiaj.actions.ActionUpdateActor; @@ -92,7 +91,7 @@ public class GuiWorldInAJar extends GuiScreen { startingScene.add(new ActionSetBlock(5, 1, 10, ModBlocks.conveyor, 4)); startingScene.add(new ActionWait(5)); - startingScene.add(new ActionRotate(90, 0, 10)); + startingScene.add(new ActionRotateBy(90, 0, 10)); JarScene brickScene = new JarScene(testScript); @@ -105,11 +104,11 @@ public class GuiWorldInAJar extends GuiScreen { brickScene.add(new ActionWait(2)); } - brickScene.add(new ActionRotate(-90, 0, 10)); + brickScene.add(new ActionRotateBy(-90, 0, 10)); brickScene.add(new ActionWait(20)); - brickScene.add(new ActionRotate(45, 30, 10)); + brickScene.add(new ActionRotateBy(45, 30, 10)); brickScene.add(new ActionWait(20)); - brickScene.add(new ActionRotate(-45, -30, 10)); + brickScene.add(new ActionRotateBy(-45, -30, 10)); brickScene.add(new ActionWait(20)); brickScene.add(new ActionCreateActor(0, new ActorTileEntity(new RenderStirling()))); @@ -122,10 +121,17 @@ public class GuiWorldInAJar extends GuiScreen { brickScene.add(new ActionSetActorData(0, stirling)); brickScene.add(new ActionWait(20)); brickScene.add(new ActionUpdateActor(0, "speed", 5F)); - brickScene.add(new ActionWait(20)); + brickScene.add(new ActionWait(10)); brickScene.add(new ActionUpdateActor(0, "speed", 10F)); - brickScene.add(new ActionWait(20)); + brickScene.add(new ActionWait(10)); brickScene.add(new ActionUpdateActor(0, "speed", 15F)); + brickScene.add(new ActionWait(10)); + brickScene.add(new ActionUpdateActor(0, "speed", 20F)); + brickScene.add(new ActionWait(10)); + brickScene.add(new ActionUpdateActor(0, "speed", 25F)); + brickScene.add(new ActionWait(10)); + brickScene.add(new ActionUpdateActor(0, "hasCog", false)); + brickScene.add(new ActionUpdateActor(0, "speed", 5F)); brickScene.add(new ActionWait(20)); brickScene.add(new ActionCreateActor(1, new ActorBasicPanel(0, 0, new Object[]{ new ItemStack(ModItems.ammo_arty, 1, 5)," shit *and* piss" }))); @@ -209,12 +215,10 @@ public class GuiWorldInAJar extends GuiScreen { GL11.glScaled(scale, scale, scale); GL11.glScaled(1, 1, 0.5); //incredible flattening power - double pitch = testScript.lastRotationPitch + (testScript.rotationPitch - testScript.lastRotationPitch) * testScript.interp; - double yaw = testScript.lastRotationYaw + (testScript.rotationYaw - testScript.lastRotationYaw) * testScript.interp; - - GL11.glRotated(pitch, 1, 0, 0); - GL11.glRotated(yaw, 0, 1, 0); + GL11.glRotated(testScript.pitch(), 1, 0, 0); + GL11.glRotated(testScript.yaw(), 0, 1, 0); GL11.glTranslated(testScript.world.sizeX / -2D, -testScript.world.sizeY / 2D , testScript.world.sizeZ / -2D); + GL11.glTranslated(testScript.offsetX(), testScript.offsetY(), testScript.offsetZ()); } @Override diff --git a/src/main/java/com/hbm/wiaj/JarScript.java b/src/main/java/com/hbm/wiaj/JarScript.java index ce9672076..d5592e816 100644 --- a/src/main/java/com/hbm/wiaj/JarScript.java +++ b/src/main/java/com/hbm/wiaj/JarScript.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; +import com.hbm.util.BobMathUtil; import com.hbm.wiaj.actors.ISpecialActor; import net.minecraft.util.MathHelper; @@ -17,10 +18,11 @@ public class JarScript { private JarScene currentScene; private int sceneNumber = 0; - public double lastRotationYaw = -45D; - public double lastRotationPitch = -30D; - public double rotationYaw = -45D; - public double rotationPitch = -30D; + public double lastRotationYaw = -45D, rotationYaw = -45D; + public double lastRotationPitch = -30D, rotationPitch = -30D; + public double lastOffsetX = 0, offsetX = 0; + public double lastOffsetY = 0, offsetY = 0; + public double lastOffsetZ = 0, offsetZ = 0; public float interp = 0F; @@ -69,6 +71,9 @@ public class JarScript { this.lastRotationPitch = this.rotationPitch; this.lastRotationYaw = this.rotationYaw; + this.lastOffsetX = this.offsetX; + this.lastOffsetY = this.offsetY; + this.lastOffsetZ = this.offsetZ; if(this.currentScene != null) { @@ -112,4 +117,10 @@ public class JarScript { public boolean isPaused() { return this.isPaused; } + + public double yaw() { return BobMathUtil.interp(this.lastRotationYaw, this.rotationYaw, interp); } + public double pitch() { return BobMathUtil.interp(this.lastRotationPitch, this.rotationPitch, interp); } + public double offsetX() { return BobMathUtil.interp(this.lastOffsetX, this.offsetX, interp); } + public double offsetY() { return BobMathUtil.interp(this.lastOffsetY, this.offsetY, interp); } + public double offsetZ() { return BobMathUtil.interp(this.lastOffsetZ, this.offsetZ, interp); } } diff --git a/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java b/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java new file mode 100644 index 000000000..814c1ac09 --- /dev/null +++ b/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java @@ -0,0 +1,36 @@ +package com.hbm.wiaj.actions; + +import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; + +/** + * Static action for moving the scene around + * To move the scene along with another action, create a special actor that moves the scene + * @author hbm + */ +public class ActionOffsetBy implements IJarAction { + + int time; + double motionX; + double motionY; + double motionZ; + + public ActionOffsetBy(double x, double y, double z, int time) { + this.motionX = x / (time + 1); + this.motionY = y / (time + 1); + this.motionZ = z / (time + 1); + this.time = time; + } + + @Override + public int getDuration() { + return this.time; + } + + @Override + public void act(WorldInAJar world, JarScene scene) { + scene.script.offsetX += this.motionX; + scene.script.offsetY += this.motionY; + scene.script.offsetZ += this.motionZ; + } +} diff --git a/src/main/java/com/hbm/wiaj/actions/ActionRotate.java b/src/main/java/com/hbm/wiaj/actions/ActionRotateBy.java similarity index 62% rename from src/main/java/com/hbm/wiaj/actions/ActionRotate.java rename to src/main/java/com/hbm/wiaj/actions/ActionRotateBy.java index f859e1164..99277ef6d 100644 --- a/src/main/java/com/hbm/wiaj/actions/ActionRotate.java +++ b/src/main/java/com/hbm/wiaj/actions/ActionRotateBy.java @@ -3,13 +3,18 @@ package com.hbm.wiaj.actions; import com.hbm.wiaj.JarScene; import com.hbm.wiaj.WorldInAJar; -public class ActionRotate implements IJarAction { +/** + * Static action for rotating the scene around + * To rotate the scene along with another action, create a special actor that rotates the scene + * @author hbm + */ +public class ActionRotateBy implements IJarAction { int time; double velYaw; double velPitch; - public ActionRotate(double yaw, double pitch, int time) { + public ActionRotateBy(double yaw, double pitch, int time) { this.velYaw = yaw / (time + 1); this.velPitch = pitch / (time + 1); this.time = time; diff --git a/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java b/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java new file mode 100644 index 000000000..8b87888ff --- /dev/null +++ b/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java @@ -0,0 +1,36 @@ +package com.hbm.wiaj.actors; + +import com.hbm.wiaj.JarScene; + +import net.minecraft.nbt.NBTTagCompound; + +public class ActorFancyPanel implements ISpecialActor { + + public ActorFancyPanel() { + + } + + @Override + public void drawForegroundComponent(int w, int h, int ticks, float interp) { } + + @Override + public void drawBackgroundComponent(int ticks, float interp) { } + + @Override + public void updateActor(JarScene scene) { } + + @Override + public void setActorData(NBTTagCompound data) { } + + @Override + public void setDataPoint(String tag, Object o) { } + + /** where the arrow should be or if the box should be centered around the home position */ + public static enum Orientation { + TOP, + BOTTOM, + LEFT, + RIGHT, + CENTER + } +} diff --git a/src/main/resources/assets/hbm/textures/gui/gui_utility.png b/src/main/resources/assets/hbm/textures/gui/gui_utility.png index e36d0f1cc5c3d422993c796b200ad0a31cacdcbf..8cb3cbc26eb1968c0266890f54f7cd7caf2e3fea 100644 GIT binary patch delta 3007 zcmV;w3qbVt2d^2BGk*+bNklsCL*%Bx=QT=y|$PDT!TD8 z`}_N|>2x~(og{!hdu!pZo8ngOcl~_E^Krdr`Yb*8MMS34>AW@o^wC@8AL)i{@GH~l zR5mv^qfG+)`+xg0k`(IV*97ovGPw2&^bO4w)a^6@RH?@6%T!1Ndey&)L@=FB<@orx z{tX3UYOat35Yn*hI{owC8)~1|#jE{)Zrp79|Jt={$plVWb7eA_B=cPmx1osn4BTXZ z`e>q!Je^L1B#{vNTDFc*`-<*c=mSszpJLlQ?~EBz$baU8&At|GuWb30nmTCLLIQ9K z{F|BI9s2?F+Qsv6n50uj!Czip4!%wizkM|=Ti3p#yQOJH|)#!sKdkev>|84r+h3oZs+x-rKu>-I*6iKVMziJiN6y&BvV4E0h zuFw1Iw-3e+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