mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
now kiss
This commit is contained in:
parent
1aba934d36
commit
6401ffde19
@ -18,6 +18,7 @@ public class HbmAnimations {
|
|||||||
//animation is playing, though this will cancel the animation entirely.
|
//animation is playing, though this will cancel the animation entirely.
|
||||||
public static final Animation[][] hotbar = new Animation[9][8]; //now with 8 parallel rails per slot! time to get railed!
|
public static final Animation[][] hotbar = new Animation[9][8]; //now with 8 parallel rails per slot! time to get railed!
|
||||||
|
|
||||||
|
/** Keyframe-based animation system primarily used for guns, not to be confused with Drillgon's animloader system. */
|
||||||
public static class Animation {
|
public static class Animation {
|
||||||
|
|
||||||
//the "name" of the animation slot. if the item has a different key than
|
//the "name" of the animation slot. if the item has a different key than
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.hbm.animloader.AnimationWrapper.EndResult;
|
|||||||
import com.hbm.animloader.AnimationWrapper.EndType;
|
import com.hbm.animloader.AnimationWrapper.EndType;
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
import com.hbm.render.loader.IModelCustomNamed;
|
import com.hbm.render.loader.IModelCustomNamed;
|
||||||
|
import com.hbm.render.tileentity.door.IRenderDoors;
|
||||||
import com.hbm.tileentity.DoorDecl;
|
import com.hbm.tileentity.DoorDecl;
|
||||||
import com.hbm.tileentity.TileEntityDoorGeneric;
|
import com.hbm.tileentity.TileEntityDoorGeneric;
|
||||||
|
|
||||||
@ -32,20 +33,28 @@ public class RenderDoorGeneric extends TileEntitySpecialRenderer {
|
|||||||
|
|
||||||
TileEntityDoorGeneric te = (TileEntityDoorGeneric) tile;
|
TileEntityDoorGeneric te = (TileEntityDoorGeneric) tile;
|
||||||
|
|
||||||
if(buf == null){
|
if(buf == null) buf = GLAllocation.createDirectByteBuffer(8*4).asDoubleBuffer();
|
||||||
buf = GLAllocation.createDirectByteBuffer(8*4).asDoubleBuffer();
|
|
||||||
}
|
|
||||||
DoorDecl door = te.getDoorType();
|
DoorDecl door = te.getDoorType();
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(x + 0.5, y, z+0.5);
|
GL11.glTranslated(x + 0.5, y, z+0.5);
|
||||||
|
|
||||||
switch(te.getBlockMetadata() - BlockDummyable.offset) {
|
switch(te.getBlockMetadata() - BlockDummyable.offset) {
|
||||||
case 2: GL11.glRotatef(0+90, 0F, 1F, 0F); break;
|
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||||
case 4: GL11.glRotatef(90+90, 0F, 1F, 0F); break;
|
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||||
case 3: GL11.glRotatef(180+90, 0F, 1F, 0F); break;
|
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||||
case 5: GL11.glRotatef(270+90, 0F, 1F, 0F); break;
|
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IRenderDoors sednaRenderer = door.getSEDNARenderer();
|
||||||
|
|
||||||
|
if(sednaRenderer != null) {
|
||||||
|
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
sednaRenderer.render(te, buf);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
|
||||||
|
} else {
|
||||||
door.doOffsetTransform();
|
door.doOffsetTransform();
|
||||||
|
|
||||||
double[][] clip = door.getClippingPlanes();
|
double[][] clip = door.getClippingPlanes();
|
||||||
@ -112,6 +121,8 @@ public class RenderDoorGeneric extends TileEntitySpecialRenderer {
|
|||||||
|
|
||||||
GL11.glDisable(GL11.GL_BLEND);
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
GL11.glShadeModel(GL11.GL_FLAT);
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
}
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,12 +131,9 @@ public class RenderDoorGeneric extends TileEntitySpecialRenderer {
|
|||||||
door.getOrigin(name, orig);
|
door.getOrigin(name, orig);
|
||||||
door.getRotation(name, openTicks, rot);
|
door.getRotation(name, openTicks, rot);
|
||||||
GL11.glTranslated(orig[0], orig[1], orig[2]);
|
GL11.glTranslated(orig[0], orig[1], orig[2]);
|
||||||
if(rot[0] != 0)
|
if(rot[0] != 0) GL11.glRotated(rot[0], 1, 0, 0);
|
||||||
GL11.glRotated(rot[0], 1, 0, 0);
|
if(rot[1] != 0) GL11.glRotated(rot[1], 0, 1, 0);
|
||||||
if(rot[1] != 0)
|
if(rot[2] != 0) GL11.glRotated(rot[2], 0, 0, 1);
|
||||||
GL11.glRotated(rot[1], 0, 1, 0);
|
|
||||||
if(rot[2] != 0)
|
|
||||||
GL11.glRotated(rot[2], 0, 0, 1);
|
|
||||||
GL11.glTranslated(-orig[0]+tran[0], -orig[1]+tran[1], -orig[2]+tran[2]);
|
GL11.glTranslated(-orig[0]+tran[0], -orig[1]+tran[1], -orig[2]+tran[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.hbm.render.tileentity.door;
|
||||||
|
|
||||||
|
import java.nio.DoubleBuffer;
|
||||||
|
|
||||||
|
import com.hbm.tileentity.TileEntityDoorGeneric;
|
||||||
|
|
||||||
|
public interface IRenderDoors {
|
||||||
|
|
||||||
|
public void render(TileEntityDoorGeneric door, DoubleBuffer buf);
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ import com.hbm.animloader.Animation;
|
|||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.main.ResourceManager;
|
import com.hbm.main.ResourceManager;
|
||||||
import com.hbm.render.loader.IModelCustomNamed;
|
import com.hbm.render.loader.IModelCustomNamed;
|
||||||
|
import com.hbm.render.tileentity.door.IRenderDoors;
|
||||||
import com.hbm.util.BobMathUtil;
|
import com.hbm.util.BobMathUtil;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -1209,4 +1210,8 @@ public abstract class DoorDecl {
|
|||||||
f[2] = z;
|
f[2] = z;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// keyframe animation system sneakily stitched into the door decl
|
||||||
|
public IRenderDoors getSEDNARenderer() { return null; }
|
||||||
|
public com.hbm.render.anim.HbmAnimations.Animation getSEDNAAnim(byte state) { return null; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.hbm.blocks.BlockDummyable;
|
|||||||
import com.hbm.blocks.generic.BlockDoorGeneric;
|
import com.hbm.blocks.generic.BlockDoorGeneric;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
|
import com.hbm.render.anim.HbmAnimations.Animation;
|
||||||
import com.hbm.sound.AudioWrapper;
|
import com.hbm.sound.AudioWrapper;
|
||||||
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
import com.hbm.tileentity.machine.TileEntityLockableBase;
|
||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
@ -23,6 +24,11 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
public class TileEntityDoorGeneric extends TileEntityLockableBase {
|
public class TileEntityDoorGeneric extends TileEntityLockableBase {
|
||||||
|
|
||||||
|
public static byte STATE_CLOSED = 0;
|
||||||
|
public static byte STATE_OPEN = 1;
|
||||||
|
public static byte STATE_CLOSING = 2;
|
||||||
|
public static byte STATE_OPENING = 3;
|
||||||
|
|
||||||
//0: closed, 1: open, 2: closing, 3: opening
|
//0: closed, 1: open, 2: closing, 3: opening
|
||||||
public byte state = 0;
|
public byte state = 0;
|
||||||
protected DoorDecl doorType;
|
protected DoorDecl doorType;
|
||||||
@ -37,6 +43,8 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase {
|
|||||||
private AudioWrapper audio;
|
private AudioWrapper audio;
|
||||||
private AudioWrapper audio2;
|
private AudioWrapper audio2;
|
||||||
|
|
||||||
|
public Animation currentAnimation;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if(state == 3) {
|
if(state == 3) {
|
||||||
@ -301,6 +309,10 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase {
|
|||||||
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
if(state > 1) animStartTime = System.currentTimeMillis();
|
if(state > 1) animStartTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if(state == STATE_OPENING || state == STATE_CLOSING) {
|
||||||
|
currentAnimation = this.doorType.getSEDNAAnim(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user