jar tooltip test texture, scene offset actions

This commit is contained in:
Boblet 2022-08-26 15:13:02 +02:00
parent e0e50226d8
commit 448e1c947c
6 changed files with 111 additions and 19 deletions

View File

@ -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

View File

@ -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); }
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1014 B

After

Width:  |  Height:  |  Size: 3.2 KiB