Merge remote-tracking branch 'HbmMods/master'

This commit is contained in:
Vaern 2022-02-05 09:38:30 -08:00
commit 01da3adc3f
92 changed files with 4748 additions and 516 deletions

View File

@ -0,0 +1,153 @@
package com.hbm.animloader;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.util.BobMathUtil;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.util.MathHelper;
public class AnimatedModel {
public static FloatBuffer auxGLMatrix = GLAllocation.createDirectFloatBuffer(16);
//Pointless...
public AnimationController controller;
public String name = "";
public float[] transform;
boolean hasGeometry = true;
boolean hasTransform = false;
public String geo_name = "";
public AnimatedModel parent;
public List<AnimatedModel> children = new ArrayList<AnimatedModel>();
int callList;
public AnimatedModel() {
}
public void renderAnimated(long sysTime) {
renderAnimated(sysTime, null);
}
public void renderAnimated(long sysTime, IAnimatedModelCallback c) {
if(controller.activeAnim == AnimationWrapper.EMPTY) {
render(c);
return;
}
AnimationWrapper activeAnim = controller.activeAnim;
int numKeyFrames = activeAnim.anim.numKeyFrames;
int diff = (int) (sysTime - activeAnim.startTime);
diff *= activeAnim.speedScale;
if(diff > activeAnim.anim.length) {
int diff2 = diff % activeAnim.anim.length;
switch(activeAnim.endResult.type) {
case END:
controller.activeAnim = AnimationWrapper.EMPTY;
render(c);
return;
case REPEAT:
activeAnim.startTime = sysTime - diff2;
break;
case REPEAT_REVERSE:
activeAnim.startTime = sysTime - diff2;
activeAnim.reverse = !activeAnim.reverse;
break;
case START_NEW:
activeAnim.cloneStats(activeAnim.endResult.next);
activeAnim.startTime = sysTime - diff2;
break;
case STAY:
activeAnim.startTime = sysTime - activeAnim.anim.length;
break;
}
}
diff = (int) (sysTime - activeAnim.startTime);
if(activeAnim.reverse)
diff = activeAnim.anim.length - diff;
diff *= activeAnim.speedScale;
float remappedTime = MathHelper.clamp_float(BobMathUtil.remap(diff, 0, activeAnim.anim.length, 0, numKeyFrames - 1), 0, numKeyFrames - 1);
float diffN = BobMathUtil.remap01_clamp(diff, 0, activeAnim.anim.length);
int index = (int) remappedTime;
int first = index;
int next;
if(index < numKeyFrames - 1) {
next = index + 1;
} else {
next = first;
}
renderWithIndex((float) fract(remappedTime), first, next, diffN, c);
controller.activeAnim.prevFrame = first;
}
protected void renderWithIndex(float inter, int firstIndex, int nextIndex, float diffN, IAnimatedModelCallback c) {
GL11.glPushMatrix();
boolean hidden = false;
if(hasTransform) {
Transform[] transforms = controller.activeAnim.anim.objectTransforms.get(name);
if(transforms != null) {
hidden = transforms[firstIndex].hidden;
transforms[firstIndex].interpolateAndApply(transforms[nextIndex], inter);
} else {
auxGLMatrix.put(transform);
auxGLMatrix.rewind();
GL11.glMultMatrix(auxGLMatrix);
}
}
if(c != null)
hidden |= c.onRender(controller.activeAnim.prevFrame, firstIndex, callList, diffN, name);
if(hasGeometry && !hidden) {
GL11.glCallList(callList);
}
if(c != null)
c.postRender(controller.activeAnim.prevFrame, firstIndex, callList, diffN, name);
for(AnimatedModel m : children) {
m.renderWithIndex(inter, firstIndex, nextIndex, diffN, c);
}
GL11.glPopMatrix();
}
public void render() {
render(null);
}
public void render(IAnimatedModelCallback c) {
GL11.glPushMatrix();
if(hasTransform) {
auxGLMatrix.put(transform);
auxGLMatrix.rewind();
GL11.glMultMatrix(auxGLMatrix);
}
boolean hidden = false;
if(c != null)
hidden = c.onRender(-1, -1, callList, -1, name);
if(hasGeometry && !hidden) {
GL11.glCallList(callList);
}
if(c != null)
c.postRender(-1, -1, callList, -1, name);
for(AnimatedModel m : children) {
m.render(c);
}
GL11.glPopMatrix();
}
private static float fract(float number) {
return (float) (number - Math.floor(number));
}
public static interface IAnimatedModelCallback {
//(prevFrame, currentFrame, model, diffN, modelName)
public boolean onRender(int prevFrame, int currentFrame, int model, float diffN, String modelName);
public default void postRender(int prevFrame, int currentFrame, int model, float diffN, String modelName){};
}
}

View File

@ -0,0 +1,22 @@
package com.hbm.animloader;
import java.util.HashMap;
import java.util.Map;
public class Animation {
public static final Animation EMPTY = createBlankAnimation();
public int length;
public int numKeyFrames;
public Map<String, Transform[]> objectTransforms = new HashMap<String, Transform[]>();
private static Animation createBlankAnimation(){
Animation anim = new Animation();
anim.numKeyFrames = 0;
anim.length = 0;
anim.objectTransforms = new HashMap<String, Transform[]>();
return anim;
}
}

View File

@ -0,0 +1,22 @@
package com.hbm.animloader;
public class AnimationController {
//Drillgon200: You know what? I'm pretty sure this class is entirely pointless and just acts as a stupid getter/setter for the wrapper.
//TODO delete
protected AnimationWrapper activeAnim = AnimationWrapper.EMPTY;
public void setAnim(AnimationWrapper w) {
activeAnim = w;
}
public void stopAnim() {
activeAnim = AnimationWrapper.EMPTY;
}
public AnimationWrapper getAnim() {
return activeAnim;
}
}

View File

@ -0,0 +1,87 @@
package com.hbm.animloader;
import javax.annotation.Nullable;
public class AnimationWrapper {
public static final AnimationWrapper EMPTY = new AnimationWrapper(Animation.EMPTY){
public AnimationWrapper onEnd(EndResult res) {
return this;
};
};
public Animation anim;
public long startTime;
public float speedScale = 1;
public boolean reverse;
public EndResult endResult = EndResult.END;
public int prevFrame = 0;
public AnimationWrapper(Animation a){
this.anim = a;
this.startTime = System.currentTimeMillis();
}
public AnimationWrapper(long startTime, Animation a){
this.anim = a;
this.startTime = startTime;
}
public AnimationWrapper(long startTime, float scale, Animation a){
this.anim = a;
this.speedScale = scale;
this.startTime = startTime;
}
public AnimationWrapper onEnd(EndResult res){
this.endResult = res;
return this;
}
public AnimationWrapper reverse(){
this.reverse = !reverse;
return this;
}
public AnimationWrapper cloneStats(AnimationWrapper other){
this.anim = other.anim;
this.startTime = other.startTime;
this.reverse = other.reverse;
this.endResult = other.endResult;
return this;
}
public AnimationWrapper cloneStatsWithoutTime(AnimationWrapper other){
this.anim = other.anim;
this.reverse = other.reverse;
this.endResult = other.endResult;
return this;
}
public enum EndType {
END,
REPEAT,
REPEAT_REVERSE,
START_NEW,
STAY;
}
public static class EndResult {
public static final EndResult END = new EndResult(EndType.END, null);
EndType type;
AnimationWrapper next;
public EndResult(EndType type) {
this(type, null);
}
public EndResult(EndType type, @Nullable AnimationWrapper next) {
this.type = type;
this.next = next;
}
}
}

View File

@ -0,0 +1,445 @@
package com.hbm.animloader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.GL11;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.IResource;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class ColladaLoader {
//Drillgon200: This code is only slightly less terrible than the first time. I hate XML.
/*
* My attempt at making a collada loader.
* Some things to note: You can't use child of constraints with it with complete accuracy,
* as this will break the linear interpolation and I don't know how to fix it
* To get around this, you can put multiple objects with different parents or origins and toggle their visibility.
* It's hacky, but it works, at least if you don't need an object affected by multiple bones at the same time.
*/
//Bob:
/*
* I walk to Burger King, then I walk back home from Burger King
* walk to Burger King, then I walk back home I walk back
* I walk, then I walk back home from Burger King
* I walk, then I walk back home from Burger King
* then I walk back home from Burger King
* I walk, I walk
* walk walk, walk walk
* I walk, I walk
* Burger King
*/
public static AnimatedModel load(ResourceLocation file) {
return load(file, false);
}
public static AnimatedModel load(ResourceLocation file, boolean flipV) {
IResource res;
try {
res = Minecraft.getMinecraft().getResourceManager().getResource(file);
Document doc;
try {
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(res.getInputStream());
return parse(doc.getDocumentElement(), flipV);
} catch(SAXException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
} catch(ParserConfigurationException e) {
e.printStackTrace();
}
} catch(IOException e) {
e.printStackTrace();
}
MainRegistry.logger.log(Level.ERROR, "FAILED TO LOAD MODEL: " + file);
return null;
}
//Model loading section
private static AnimatedModel parse(Element root, boolean flipV){
//Should get the first bone
Element scene = getFirstElement((Element)root.getElementsByTagName("library_visual_scenes").item(0));
AnimatedModel structure = new AnimatedModel(){
@Override
protected void renderWithIndex(float inter, int firstIndex, int nextIndex, float diffN, IAnimatedModelCallback c) {
for(AnimatedModel m : children){
m.renderWithIndex(inter, firstIndex, nextIndex, diffN, c);
}
}
@Override
public void render() {
for(AnimatedModel m : children){
m.render();
}
}
};
for(Element node : getChildElements(scene)){
if(node.getElementsByTagName("instance_geometry").getLength() > 0){
structure.children.add(parseStructure(node));
}
}
Map<String, Integer> geometry = parseGeometry((Element)root.getElementsByTagName("library_geometries").item(0), flipV);
addGeometry(structure, geometry);
setAnimationController(structure, new AnimationController());
return structure;
}
private static void setAnimationController(AnimatedModel model, AnimationController control){
model.controller = control;
for(AnimatedModel m : model.children)
setAnimationController(m, control);
}
private static Element getFirstElement(Node root){
NodeList nodes = root.getChildNodes();
for(int i = 0; i < nodes.getLength(); i ++){
Node node = nodes.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE){
return (Element)node;
}
}
return null;
}
private static List<Element> getElementsByName(Element e, String name){
List<Element> elements = new ArrayList<Element>();
NodeList n = e.getChildNodes();
for(int i = 0; i < n.getLength(); i ++){
Node node = n.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals(name)){
elements.add((Element) node);
}
}
return elements;
}
private static List<Element> getChildElements(Element e){
List<Element> elements = new ArrayList<Element>();
if(e == null)
return elements;
NodeList n = e.getChildNodes();
for(int i = 0; i < n.getLength(); i ++){
Node node = n.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE){
elements.add((Element) node);
}
}
return elements;
}
private static AnimatedModel parseStructure(Element root){
AnimatedModel model = new AnimatedModel();
model.name = root.getAttribute("name");
NodeList children = root.getChildNodes();
for(int i = 0; i < children.getLength(); i ++){
Node node = children.item(i);
if(node.getNodeType() != Node.ELEMENT_NODE)
continue;
Element ele = (Element) node;
if("transform".equals(ele.getAttribute("sid"))){
//Do I even need to flip the matrix here? No idea!
model.transform = flipMatrix(parseFloatArray(ele.getTextContent()));
model.hasTransform = true;
} else if("instance_geometry".equals(ele.getTagName())){
model.geo_name = ele.getAttribute("url").substring(1);
} else if(ele.getElementsByTagName("instance_geometry").getLength() > 0){
AnimatedModel childModel = parseStructure(ele);
childModel.parent = model;
model.children.add(childModel);
}
}
return model;
}
/*private static void addStructureChildren(Element root, AnimatedModel model){
NodeList children = root.getChildNodes();
for(int i = 0; i < children.getLength(); i ++){
Node node = children.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE){
Element element = (Element) node;if(getElementsByName(element, "instance_geometry").size() > 0){
addGeoNamesToModel(element, model);
} else if(getElementsByName(element, "node").size() > 0 && "JOINT".equals(((Element)getElementsByName(element, "node").get(0)).getAttribute("type"))){
AnimatedModel m = parseStructure(element);
model.children.add(m);
m.parent = model;
}
}
}
}
private static void addGeoNamesToModel(Element root, AnimatedModel model){
List<Element> geo_names = getElementsByName(root, "instance_geometry");
for(Element e : geo_names){
String name = e.getAttribute("url").substring(1);
model.geo_names.add(name);
}
}*/
//Geometry loading section
//Map of geometry name to display list id
private static Map<String, Integer> parseGeometry(Element root, boolean flipV){
Map<String, Integer> allGeometry = new HashMap<String, Integer>();
for(Element e : getElementsByName(root, "geometry")){
String name = e.getAttribute("id");
Element mesh = getElementsByName(e, "mesh").get(0);
float[] positions = new float[0];
float[] normals = new float[0];
float[] texCoords = new float[0];
int[] indices = new int[0];
for(Element section : getChildElements(mesh)){
String id = section.getAttribute("id");
if(id.endsWith("mesh-positions")){
positions = parsePositions(section);
} else if(id.endsWith("mesh-normals")){
normals = parseNormals(section);
} else if(id.endsWith("mesh-map-0")){
texCoords = parseTexCoords(section);
} else if(section.getNodeName().equals("triangles")){
indices = ArrayUtils.addAll(indices, parseIndices(section));
}
}
if(positions.length == 0)
continue;
int displayList = GL11.glGenLists(1);
GL11.glNewList(displayList, GL11.GL_COMPILE);
Tessellator tess = Tessellator.instance;
tess.startDrawing(GL11.GL_TRIANGLES);
if(indices.length > 0){
for(int i = 0; i < indices.length; i += 3){
float v = texCoords[indices[i + 2] * 2 + 1];
if(flipV){
v = 1 - v;
}
tess.setNormal(normals[indices[i + 1] * 3], normals[indices[i + 1] * 3 + 1], normals[indices[i + 1] * 3 + 2]);
tess.setTextureUV(texCoords[indices[i + 2] * 2], v);
tess.addVertex(positions[indices[i] * 3], positions[indices[i] * 3 + 1], positions[indices[i] * 3 + 2]);
}
}
//ORIGINAL:
/*BufferBuilder buf = Tessellator.getInstance().getBuffer();
buf.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_NORMAL);
if(indices.length > 0){
for(int i = 0; i < indices.length; i += 3){
float v = texCoords[indices[i+2]*2+1];
if(flipV){
v = 1-v;
}
buf.pos(positions[indices[i]*3], positions[indices[i]*3+1], positions[indices[i]*3+2])
.tex(texCoords[indices[i+2]*2], v)
.normal(normals[indices[i+1]*3], normals[indices[i+1]*3+1], normals[indices[i+1]*3+2])
.endVertex();
}
} else {
}*/
tess.draw();
GL11.glEndList();
allGeometry.put(name, displayList);
}
return allGeometry;
}
private static float[] parsePositions(Element root){
String content = root.getElementsByTagName("float_array").item(0).getTextContent();
return parseFloatArray(content);
}
private static float[] parseNormals(Element root){
String content = root.getElementsByTagName("float_array").item(0).getTextContent();
return parseFloatArray(content);
}
private static float[] parseTexCoords(Element root){
String content = root.getElementsByTagName("float_array").item(0).getTextContent();
return parseFloatArray(content);
}
private static int[] parseIndices(Element root){
String content = root.getElementsByTagName("p").item(0).getTextContent();
return parseIntegerArray(content);
}
private static float[] parseFloatArray(String s){
if(s.isEmpty()){
return new float[0];
}
String[] numbers = s.split(" ");
float[] arr = new float[numbers.length];
for(int i = 0; i < numbers.length; i ++){
arr[i] = Float.parseFloat(numbers[i]);
}
return arr;
}
private static int[] parseIntegerArray(String s){
String[] numbers = s.split(" ");
int[] arr = new int[numbers.length];
for(int i = 0; i < numbers.length; i ++){
arr[i] = Integer.parseInt(numbers[i]);
}
return arr;
}
private static void addGeometry(AnimatedModel m, Map<String, Integer> geometry){
if(!"".equals(m.geo_name) && geometry.containsKey(m.geo_name))
m.callList = geometry.get(m.geo_name);
else {
m.hasGeometry = false;
m.callList = -1;
}
for(AnimatedModel child : m.children){
addGeometry(child, geometry);
}
}
//Animation loading section
public static Animation loadAnim(int length, ResourceLocation file){
IResource res;
try {
res = Minecraft.getMinecraft().getResourceManager().getResource(file);
Document doc;
try {
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(res.getInputStream());
return parseAnim(doc.getDocumentElement(), length);
} catch(SAXException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
} catch(ParserConfigurationException e) {
e.printStackTrace();
}
} catch(IOException e) {
e.printStackTrace();
}
MainRegistry.logger.log(Level.ERROR, "FAILED TO LOAD MODEL: " + file);
return null;
}
private static Animation parseAnim(Element root, int length){
Element anim_section = (Element)root.getElementsByTagName("library_animations").item(0);
Animation anim = new Animation();
anim.length = length;
for(Element e : getChildElements(anim_section)){
if("animation".equals(e.getNodeName())){
String name = e.getAttribute("name");
Transform[] t = null;
List<Element> elements2 = getChildElements(e);
if(elements2.isEmpty()){
continue;
}
for(Element e2 : elements2){
if(e2.getAttribute("id").endsWith("transform")){
t = parseTransforms(e2);
} else if(e2.getAttribute("id").endsWith("hide_viewport")){
setViewportHiddenKeyframes(t, e2);
}
}
anim.objectTransforms.put(name, t);
anim.numKeyFrames = t.length;
}
}
return anim;
}
private static Transform[] parseTransforms(Element root){
String output = getOutputLocation(root);
for(Element e : getChildElements(root)){
if(e.getAttribute("id").equals(output)){
return parseTransformsFromText(e.getElementsByTagName("float_array").item(0).getTextContent());
}
}
System.out.println("Failed to parse transforms! This will not work!");
System.out.println("Node name: " + root.getTagName());
return null;
}
private static void setViewportHiddenKeyframes(Transform[] t, Element root){
String output = getOutputLocation(root);
for(Element e : getChildElements(root)){
if(e.getAttribute("id").equals(output)){
int[] hiddenFrames = parseIntegerArray(e.getElementsByTagName("float_array").item(0).getTextContent());
for(int i = 0; i < hiddenFrames.length; i ++){
t[i].hidden = hiddenFrames[i] > 0 ? true : false;
}
}
}
}
private static String getOutputLocation(Element root){
Element sampler = (Element) root.getElementsByTagName("sampler").item(0);
for(Element e : getChildElements(sampler)){
if("OUTPUT".equals(e.getAttribute("semantic"))){
return e.getAttribute("source").substring(1);
}
}
return null;
}
private static Transform[] parseTransformsFromText(String data){
float[] floats = parseFloatArray(data);
Transform[] transforms = new Transform[floats.length/16];
for(int i = 0; i < floats.length/16; i++){
float[] rawTransform = new float[16];
for(int j = 0; j < 16; j ++)
rawTransform[j] = floats[i*16 + j];
transforms[i] = new Transform(rawTransform);
}
return transforms;
}
private static float[] flipMatrix(float[] f){
if(f.length != 16){
System.out.println("Error flipping matrix: array length not 16. This will not work!");
System.out.println("Matrix: " + f);
}
return new float[]{
f[0], f[4], f[8], f[12],
f[1], f[5], f[9], f[13],
f[2], f[6], f[10], f[14],
f[3], f[7], f[11], f[15]
};
}
}

View File

@ -0,0 +1,133 @@
package com.hbm.animloader;
import java.nio.FloatBuffer;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Quaternion;
import com.hbm.util.BobMathUtil;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.util.Vec3;
public class Transform {
protected static FloatBuffer auxGLMatrix = GLAllocation.createDirectFloatBuffer(16);
Vec3 scale;
Vec3 translation;
Quaternion rotation;
boolean hidden = false;
public Transform(float[] matrix){
scale = getScaleFromMatrix(matrix);
auxGLMatrix.put(matrix);
auxGLMatrix.rewind();
rotation = new Quaternion().setFromMatrix((Matrix4f) new Matrix4f().load(auxGLMatrix));
translation = Vec3.createVectorHelper(matrix[0*4+3], matrix[1*4+3], matrix[2*4+3]);
auxGLMatrix.rewind();
}
private Vec3 getScaleFromMatrix(float[] matrix){
float scaleX = (float) Vec3.createVectorHelper(matrix[0], matrix[1], matrix[2]).lengthVector();
float scaleY = (float) Vec3.createVectorHelper(matrix[4], matrix[5], matrix[6]).lengthVector();
float scaleZ = (float) Vec3.createVectorHelper(matrix[8], matrix[9], matrix[10]).lengthVector();
matrix[0] = matrix[0]/scaleX;
matrix[1] = matrix[1]/scaleX;
matrix[2] = matrix[2]/scaleX;
matrix[4] = matrix[4]/scaleY;
matrix[5] = matrix[5]/scaleY;
matrix[6] = matrix[6]/scaleY;
matrix[8] = matrix[8]/scaleZ;
matrix[9] = matrix[9]/scaleZ;
matrix[10] = matrix[10]/scaleZ;
return Vec3.createVectorHelper(scaleX, scaleY, scaleZ);
}
public void interpolateAndApply(Transform other, float inter){
Vec3 trans = BobMathUtil.interpVec(this.translation, other.translation, inter); //ORIGINAL: translation.interpolate(other.translation, inter);
Vec3 scale = BobMathUtil.interpVec(this.scale, other.scale, inter); //ORIGINAL: this.scale.interpolate(other.scale, inter);
Quaternion rot = slerp(rotation, other.rotation, inter);
//GlStateManager.quatToGlMatrix(auxGLMatrix, rot); TODO: find implementation
scale(auxGLMatrix, scale);
auxGLMatrix.put(12, (float) trans.xCoord);
auxGLMatrix.put(13, (float) trans.yCoord);
auxGLMatrix.put(14, (float) trans.zCoord);
//for(int i = 0; i < 16; i ++){
//System.out.print(auxGLMatrix.get(i) + " ");
//}
//System.out.println();
//GlStateManager.multMatrix(auxGLMatrix); TODO: find implementation
}
private void scale(FloatBuffer matrix, Vec3 scale){
matrix.put(0, (float) (matrix.get(0)*scale.xCoord));
matrix.put(4, (float) (matrix.get(4)*scale.xCoord));
matrix.put(8, (float) (matrix.get(8)*scale.xCoord));
matrix.put(12, (float) (matrix.get(12)*scale.xCoord));
matrix.put(1, (float) (matrix.get(1)*scale.yCoord));
matrix.put(5, (float) (matrix.get(5)*scale.yCoord));
matrix.put(9, (float) (matrix.get(9)*scale.yCoord));
matrix.put(13, (float) (matrix.get(13)*scale.yCoord));
matrix.put(2, (float) (matrix.get(2)*scale.zCoord));
matrix.put(6, (float) (matrix.get(6)*scale.zCoord));
matrix.put(10, (float) (matrix.get(10)*scale.zCoord));
matrix.put(14, (float) (matrix.get(14)*scale.zCoord));
}
//Thanks, wikipedia
//God, I wish java had operator overloads. Those are one of my favorite things about c and glsl.
protected Quaternion slerp(Quaternion v0, Quaternion v1, float t) {
// Only unit quaternions are valid rotations.
// Normalize to avoid undefined behavior.
//Drillgon200: Any quaternions loaded from blender should be normalized already
//v0.normalise();
//v1.normalise();
// Compute the cosine of the angle between the two vectors.
double dot = Quaternion.dot(v0, v1);
// If the dot product is negative, slerp won't take
// the shorter path. Note that v1 and -v1 are equivalent when
// the negation is applied to all four components. Fix by
// reversing one quaternion.
if (dot < 0.0f) {
v1 = new Quaternion(-v1.x, -v1.y, -v1.z, -v1.w);
dot = -dot;
}
final double DOT_THRESHOLD = 0.9999999;
if (dot > DOT_THRESHOLD) {
// If the inputs are too close for comfort, linearly interpolate
// and normalize the result.
Quaternion result = new Quaternion(v0.x + t*v1.x,
v0.y + t*v1.y,
v0.z + t*v1.z,
v0.w + t*v1.w);
result.normalise();
return result;
}
// Since dot is in range [0, DOT_THRESHOLD], acos is safe
double theta_0 = Math.acos(dot); // theta_0 = angle between input vectors
double theta = theta_0*t; // theta = angle between v0 and result
double sin_theta = Math.sin(theta); // compute this value only once
double sin_theta_0 = Math.sin(theta_0); // compute this value only once
float s0 = (float) (Math.cos(theta) - dot * sin_theta / sin_theta_0); // == sin(theta_0 - theta) / sin(theta_0)
float s1 = (float) (sin_theta / sin_theta_0);
return new Quaternion(s0*v0.x + s1*v1.x,
s0*v0.y + s1*v1.y,
s0*v0.z + s1*v1.z,
s0*v0.w + s1*v1.w);
}
}

View File

@ -242,6 +242,22 @@ public abstract class BlockDummyable extends BlockContainer {
world.setBlock(x, y, z, this, meta + extra, 3);
this.safeRem = false;
}
public void removeExtra(World world, int x, int y, int z) {
if(world.getBlock(x, y, z) != this)
return;
int meta = world.getBlockMetadata(x, y, z);
if(meta <= 5 || meta >= 12)
return;
// world.setBlockMetadataWithNotify(x, y, z, meta + extra, 3);
this.safeRem = true;
world.setBlock(x, y, z, this, meta - extra, 3);
this.safeRem = false;
}
// checks if the dummy metadata is within the extra range
public boolean hasExtra(int meta) {

View File

@ -18,6 +18,7 @@ import com.hbm.items.special.ItemOreBlock;
import com.hbm.lib.ModDamageSource;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.DoorDecl;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
@ -512,6 +513,7 @@ public class ModBlocks {
public static Block vault_door;
public static Block blast_door;
public static Block transision_seal;
public static Block door_metal;
public static Block door_office;
@ -1918,6 +1920,7 @@ public class ModBlocks {
vault_door = new VaultDoor(Material.iron).setBlockName("vault_door").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vault_door");
blast_door = new BlastDoor(Material.iron).setBlockName("blast_door").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":blast_door");
transision_seal = new BlockDoorGeneric(Material.iron, DoorDecl.TRANSITION_SEAL).setBlockName("transission_seal").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":transission_seal");
door_metal = new BlockModDoor(Material.iron).setBlockName("door_metal").setHardness(5.0F).setResistance(5.0F).setBlockTextureName(RefStrings.MODID + ":door_metal");
door_office = new BlockModDoor(Material.iron).setBlockName("door_office").setHardness(10.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":door_office");
@ -2756,6 +2759,7 @@ public class ModBlocks {
//Vault Door
GameRegistry.registerBlock(vault_door, vault_door.getUnlocalizedName());
GameRegistry.registerBlock(blast_door, blast_door.getUnlocalizedName());
GameRegistry.registerBlock(transision_seal, transision_seal.getUnlocalizedName());
//Doors
GameRegistry.registerBlock(door_metal, door_metal.getUnlocalizedName());

View File

@ -0,0 +1,123 @@
package com.hbm.blocks.generic;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.DoorDecl;
import com.hbm.tileentity.TileEntityDoorGeneric;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockDoorGeneric extends BlockDummyable {
public DoorDecl type;
public BlockDoorGeneric(Material materialIn, DoorDecl type){
super(materialIn);
this.type = type;
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta){
if(meta >= 12)
return new TileEntityDoorGeneric();
return null;
}
@Override
public int[] getDimensions(){
return type.getDimensions();
}
@Override
public int getOffset(){
return 0;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer playerIn, int side, float hitX, float hitY, float hitZ){
if(!world.isRemote && !playerIn.isSneaking()) {
int[] pos1 = findCore(world, x, y, z);
if(pos1 == null)
return false;
TileEntityDoorGeneric door = (TileEntityDoorGeneric) world.getTileEntity(pos1[0], pos1[1], pos1[2]);
if(door != null) {
return door.tryToggle(playerIn);
}
}
if(!playerIn.isSneaking())
return true;
return false;
}
@Override
public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) {
TileEntity te = world.getTileEntity(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
boolean open = hasExtra(meta) || (te instanceof TileEntityDoorGeneric && ((TileEntityDoorGeneric)te).shouldUseBB);
return type.isLadder(open);
}
@Override
public void addCollisionBoxesToList(World worldIn, int x, int y, int z, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn) {
AxisAlignedBB box = getCollisionBoundingBoxFromPool(worldIn, x, y, z);
if(box.minY == 0 && box.maxY == 0)
return;
super.addCollisionBoxesToList( worldIn, x, y, z, entityBox, collidingBoxes, entityIn);
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block blockIn){
if(!world.isRemote){
int[] corePos = findCore(world, x, y, z);
if(corePos != null){
TileEntity core = world.getTileEntity(corePos[0], corePos[1], corePos[2]);
if(core instanceof TileEntityDoorGeneric){
TileEntityDoorGeneric door = (TileEntityDoorGeneric)core;
door.updateRedstonePower(x, y, z);
}
}
}
super.onNeighborBlockChange( world, x, y, z, blockIn);
}
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World source, int x, int y, int z) {
int meta = source.getBlockMetadata(x, y, z);
TileEntity te = source.getTileEntity(x, y, z);
int[] core = this.findCore(source, x, y, z);
boolean open = hasExtra(meta) || (te instanceof TileEntityDoorGeneric && ((TileEntityDoorGeneric)te).shouldUseBB);
if(core == null){
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}
TileEntity te2 = source.getTileEntity(core[0], core[1], core[2]);
ForgeDirection dir = ForgeDirection.getOrientation(te2.getBlockMetadata() - BlockDummyable.offset);
AxisAlignedBB box = type.getBlockBound(x - core[0], y - core[1], z - core[2], open ); //.rotate(dir.getBlockRotation().add(Rotation.COUNTERCLOCKWISE_90)), open); TODO: add rotation
//System.out.println(te2.getBlockMetadata()-offset);
switch(te2.getBlockMetadata()-offset){
case 2:
return AxisAlignedBB.getBoundingBox(1-box.minX, box.minY, 1-box.minZ, 1-box.maxX, box.maxY, 1-box.maxZ);
case 4:
return AxisAlignedBB.getBoundingBox(1-box.minZ, box.minY, box.minX, 1-box.maxZ, box.maxY, box.maxX);
case 3:
return AxisAlignedBB.getBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
case 5:
return AxisAlignedBB.getBoundingBox(box.minZ, box.minY, 1-box.minX, box.maxZ, box.maxY, 1-box.maxX);
}
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}
}

View File

@ -28,16 +28,9 @@ public class GUIHandler implements IGuiHandler {
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
if(entity instanceof TileEntityMachineLiquefactor) {
return new ContainerLiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
}
if(entity instanceof TileEntityMachineSolidifier) {
return new ContainerSolidifier(player.inventory, (TileEntityMachineSolidifier) entity);
}
if(entity instanceof TileEntityMachineRadiolysis) {
return new ContainerRadiolysis(player.inventory, (TileEntityMachineRadiolysis) entity);
}
if(entity instanceof TileEntityMachineLiquefactor) { return new ContainerLiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity); }
if(entity instanceof TileEntityMachineSolidifier) { return new ContainerSolidifier(player.inventory, (TileEntityMachineSolidifier) entity); }
if(entity instanceof TileEntityMachineRadiolysis) { return new ContainerRadiolysis(player.inventory, (TileEntityMachineRadiolysis) entity); }
switch(ID) {
case ModBlocks.guiID_test_difurnace: {
@ -875,16 +868,9 @@ public class GUIHandler implements IGuiHandler {
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
if(entity instanceof TileEntityMachineLiquefactor) {
return new GUILiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity);
}
if(entity instanceof TileEntityMachineSolidifier) {
return new GUISolidifier(player.inventory, (TileEntityMachineSolidifier) entity);
}
if(entity instanceof TileEntityMachineRadiolysis) {
return new GUIRadiolysis(player.inventory, (TileEntityMachineRadiolysis) entity);
}
if(entity instanceof TileEntityMachineLiquefactor) { return new GUILiquefactor(player.inventory, (TileEntityMachineLiquefactor) entity); }
if(entity instanceof TileEntityMachineSolidifier) { return new GUISolidifier(player.inventory, (TileEntityMachineSolidifier) entity); }
if(entity instanceof TileEntityMachineRadiolysis) { return new GUIRadiolysis(player.inventory, (TileEntityMachineRadiolysis) entity); }
switch(ID) {
case ModBlocks.guiID_test_difurnace: {

View File

@ -0,0 +1,11 @@
package com.hbm.handler.nei;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.SolidificationRecipes;
public class SolidificationHandler extends NEIUniversalHandler {
public SolidificationHandler() {
super("ntmSolidification", "Solidification", ModBlocks.machine_solidifier, SolidificationRecipes.getRecipes());
}
}

View File

@ -0,0 +1,6 @@
package com.hbm.interfaces;
public interface IAnimatedDoor extends IDoor {
public void handleNewState(byte state);
}

View File

@ -0,0 +1,20 @@
package com.hbm.interfaces;
public interface IDoor {
public void open();
public void close();
public DoorState getState();
public void toggle();
public default boolean setTexture(String tex) {
return false;
}
public default void setTextureState(byte tex) { };
public enum DoorState {
CLOSED,
OPEN,
CLOSING,
OPENING;
}
}

View File

@ -16,7 +16,9 @@ import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEFluidPacket;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@ -31,8 +33,6 @@ public class FluidTank {
int fluid;
int maxFluid;
public int index;
public static int x = 16;
public static int y = 100;
public FluidTank(FluidType type, int maxFluid, int index) {
this.type = type;
@ -93,7 +93,7 @@ public class FluidTank {
FluidType inType = Fluids.NONE;
if(slots[in] != null) {
//TODO: add IPartiallyFillable case for unloading
//TODO: add IPartiallyFillable case for unloading, useful for infinite tanks so they don't need to be hardcoded
inType = FluidContainerRegistry.getFluidType(slots[in]);
@ -251,16 +251,40 @@ public class FluidTank {
}
}
//Used in the GUI rendering, renders correct fluid type in container with progress
public void renderTank(GuiContainer gui, int x, int y, int tx, int ty, int width, int height) {
/**
* Renders the fluid texture into a GUI, with the height based on the fill state
* @param x the tank's left side
* @param y the tank's bottom side (convention from the old system, changing it now would be a pain in the ass)
* @param z the GUI's zLevel
* @param width
* @param height
*/
//TODO: add a directional parameter to allow tanks to grow horizontally
public void renderTank(int x, int y, double z, int width, int height) {
y -= height;
Minecraft.getMinecraft().getTextureManager().bindTexture(type.getTexture());
int i = (fluid * height) / maxFluid;
gui.drawTexturedModalRect(x, y - i, tx, ty - i, width, i);
}
public void renderTankInfo(GuiContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
if(gui instanceof GuiInfoContainer)
renderTankInfo((GuiInfoContainer)gui, mouseX, mouseY, x, y, width, height);
double minX = x;
double maxX = x + width;
double minY = y + (height - i);
double maxY = y + height;
double minV = 1D - i / 16D;
double maxV = 1D;
double minU = 0D;
double maxU = width / 16D;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(minX, maxY, z, minU, maxV);
tessellator.addVertexWithUV(maxX, maxY, z, maxU, maxV);
tessellator.addVertexWithUV(maxX, minY, z, maxU, minV);
tessellator.addVertexWithUV(minX, minY, z, minU, minV);
tessellator.draw();
}
public void renderTankInfo(GuiInfoContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) {
@ -270,34 +294,26 @@ public class FluidTank {
list.add(I18n.format(this.type.getUnlocalizedName()));
list.add(fluid + "/" + maxFluid + "mB");
if(type.temperature < 0)
/*if(type.temperature < 0)
list.add(EnumChatFormatting.BLUE + "" + type.temperature + "°C");
if(type.temperature > 0)
list.add(EnumChatFormatting.RED + "" + type.temperature + "°C");
if(type.isAntimatter())
list.add(EnumChatFormatting.DARK_RED + "Antimatter");
if(type.traits.contains(FluidTrait.CORROSIVE))
list.add(EnumChatFormatting.YELLOW + "Corrosive");
if(type.traits.contains(FluidTrait.CORROSIVE_2))
list.add(EnumChatFormatting.GOLD + "Strongly Corrosive");
if(type.traits.contains(FluidTrait.NO_CONTAINER))
list.add(EnumChatFormatting.RED + "Cannot be stored in any universal tank");
if(type.traits.contains(FluidTrait.LEAD_CONTAINER))
list.add(EnumChatFormatting.YELLOW + "Requires hazardous material tank to hold");
list.add(EnumChatFormatting.YELLOW + "Requires hazardous material tank to hold");*/
type.addInfo(list);
gui.drawFluidInfo(list.toArray(new String[0]), mouseX, mouseY);
}
}
public ResourceLocation getSheet() {
return new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids" + this.type.getSheetID() + ".png");
}
//Called by TE to save fillstate
public void writeToNBT(NBTTagCompound nbt, String s) {
@ -314,7 +330,7 @@ public class FluidTank {
maxFluid = nbt.getInteger(s + "_max");
type = FluidType.getEnumFromName(nbt.getString(s + "_type")); //compat
if(type.getName().equals(Fluids.NONE.name()))
if(type == Fluids.NONE)
type = Fluids.fromID(nbt.getInteger(s + "_type"));
}

View File

@ -11,58 +11,61 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineReactorBreeding extends Container {
private TileEntityMachineReactorBreeding reactor;
public ContainerMachineReactorBreeding(InventoryPlayer invPlayer, TileEntityMachineReactorBreeding tedf) {
reactor = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 35, 35));
this.addSlotToContainer(new SlotMachineOutput(tedf, 1, 125, 35));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack var3 = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if (slot != null && slot.getHasStack()) {
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
var3 = stack.copy();
if (index <= 2) {
if (!this.mergeItemStack(stack, 2, this.inventorySlots.size(), true)) {
if(index <= 2) {
if(!this.mergeItemStack(stack, 2, this.inventorySlots.size(), true)) {
return null;
}
} else if(stack.getItem() instanceof ItemBreedingRod)
if (!this.mergeItemStack(stack, 0, 1, false)) {
} else if(stack.getItem() instanceof ItemBreedingRod) {
if(!this.mergeItemStack(stack, 0, 1, false)) {
return null;
}
} else {
return null;
}
if (stack.stackSize == 0) {
if(stack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
}
return var3;
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {

View File

@ -5,9 +5,13 @@ import java.util.Collections;
import java.util.List;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.fluid.FluidType.FluidTrait;
import com.hbm.lib.RefStrings;
import com.hbm.render.util.EnumSymbol;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class FluidType {
@ -15,14 +19,8 @@ public class FluidType {
private int id;
//Approximate HEX Color of the fluid, used for pipe rendering
private int color;
//X position of the fluid on the sheet, the "row"
private int textureX;
//Y position of the fluid on the sheet, the "column"
private int textureY;
//ID of the texture sheet the fluid is on
private int sheetID;
//Unlocalized string ID of the fluid
private String name;
private String unlocalized;
public int poison;
public int flammability;
@ -30,91 +28,66 @@ public class FluidType {
public EnumSymbol symbol;
public int temperature;
public List<FluidTrait> traits = new ArrayList();
private String compat;
private String stringId;
public FluidType(String compat, int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name) {
this(compat, color, x, y, sheet, p, f, r, symbol, name, 0, new FluidTrait[0]);
}
private ResourceLocation texture;
public FluidType(String compat, int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name, FluidTrait... traits) {
this(compat, color, x, y, sheet, p, f, r, symbol, name, 0, traits);
}
public FluidType(String compat, int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name, int temperature) {
this(compat, color, x, y, sheet, p, f, r, symbol, name, temperature, new FluidTrait[0]);
}
public FluidType(String compat, int color, int x, int y, int sheet, int p, int f, int r, EnumSymbol symbol, String name, int temperature, FluidTrait... traits) {
this.compat = compat;
public FluidType(String name, int color, int p, int f, int r, EnumSymbol symbol) {
this.stringId = name;
this.color = color;
this.textureX = x;
this.textureY = y;
this.name = name;
this.sheetID = sheet;
this.unlocalized = "hbmfluid." + name.toLowerCase();
this.poison = p;
this.flammability = f;
this.reactivity = r;
this.symbol = symbol;
this.temperature = temperature;
Collections.addAll(this.traits, traits);
this.texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids/" + name.toLowerCase() + ".png");
this.id = Fluids.registerSelf(this);
}
public FluidType setTemp(int temperature) {
this.temperature = temperature;
return this;
}
public FluidType addTraits(FluidTrait... traits) {
Collections.addAll(this.traits, traits);
return this;
}
public int getID() {
return this.id;
}
public String getName() {
return this.stringId;
}
public int getColor() {
return this.color;
}
@Deprecated
public int getMSAColor() {
return this.color;
}
public int textureX() {
return this.textureX;
}
public int textureY() {
return this.textureY;
}
public int getSheetID() {
return this.sheetID;
public ResourceLocation getTexture() {
return this.texture;
}
public String getUnlocalizedName() {
return this.name;
}
@Deprecated
public String name() {
return this.compat;
}
@Deprecated
public String getName() {
return this.compat;
return this.unlocalized;
}
public boolean isHot() {
return this.temperature >= 100;
}
public boolean isCorrosive() {
return this.traits.contains(FluidTrait.CORROSIVE) || this.traits.contains(FluidTrait.CORROSIVE_2);
}
public boolean isAntimatter() {
return this.traits.contains(FluidTrait.AMAT);
}
public boolean hasNoContainer() {
return this.traits.contains(FluidTrait.NO_CONTAINER);
}
public boolean hasNoID() {
return this.traits.contains(FluidTrait.NO_ID);
}
public boolean needsLeadContainer() {
return this.traits.contains(FluidTrait.LEAD_CONTAINER);
}
@ -140,6 +113,19 @@ public class FluidType {
public void onFluidRelease(TileEntity te, FluidTank tank, int overflowAmount) { }
//public void onFluidTransmit(FluidNetwork net) { }
public void addInfo(List<String> info) {
if(temperature < 0) info.add(EnumChatFormatting.BLUE + "" + temperature + "°C");
if(temperature > 0) info.add(EnumChatFormatting.RED + "" + temperature + "°C");
if(isAntimatter()) info.add(EnumChatFormatting.DARK_RED + "Antimatter");
if(traits.contains(FluidTrait.CORROSIVE_2)) info.add(EnumChatFormatting.GOLD + "Strongly Corrosive");
else if(traits.contains(FluidTrait.CORROSIVE)) info.add(EnumChatFormatting.YELLOW + "Corrosive");
if(traits.contains(FluidTrait.NO_CONTAINER)) info.add(EnumChatFormatting.RED + "Cannot be stored in any universal tank");
if(traits.contains(FluidTrait.LEAD_CONTAINER)) info.add(EnumChatFormatting.YELLOW + "Requires hazardous material tank to hold");
}
public static enum FluidTrait {
AMAT,
CORROSIVE,
@ -164,4 +150,12 @@ public class FluidType {
public int ordinal() {
return this.getID();
}
@Deprecated
public int getMSAColor() {
return this.color;
}
@Deprecated
public String name() {
return this.stringId;
}
}

View File

@ -0,0 +1,63 @@
package com.hbm.inventory.fluid;
import java.util.List;
import com.hbm.inventory.fluid.FluidType.FluidTrait;
import com.hbm.render.util.EnumSymbol;
import com.hbm.util.BobMathUtil;
import net.minecraft.util.EnumChatFormatting;
/** Because updating all the combustion engines and adding values by hand fucking sucks */
public class FluidTypeCombustible extends FluidTypeFlammable {
protected FuelGrade fuelGrade;
protected long combustionEnergy;
public FluidTypeCombustible(String compat, int color, int p, int f, int r, EnumSymbol symbol) {
super(compat, color, p, f, r, symbol);
}
public FluidTypeCombustible setCombustionEnergy(FuelGrade grade, long energy) {
this.fuelGrade = grade;
this.combustionEnergy = energy;
return this;
}
@Override
public void addInfo(List<String> info) {
super.addInfo(info);
info.add(EnumChatFormatting.GOLD + "[Combustible]");
if(combustionEnergy > 0) {
info.add(EnumChatFormatting.GOLD + "Provides " + EnumChatFormatting.RED + "" + BobMathUtil.getShortNumber(combustionEnergy) + "HE " + EnumChatFormatting.GOLD + "per bucket used in an engine");
info.add(EnumChatFormatting.GOLD + "Fuel grade: " + EnumChatFormatting.RED + this.fuelGrade.getGrade());
}
}
public long getCombustionEnergy() {
return this.combustionEnergy;
}
public FuelGrade getGrade() {
return this.fuelGrade;
}
public static enum FuelGrade {
LOW("Low"), //heating and industrial oil < star engine, iGen
MEDIUM("Medium"), //petroil < diesel generator
HIGH("High"), //diesel, gasoline < HP engine
AERO("Aviation"); //kerosene and other light aviation fuels < turbofan
private String grade;
private FuelGrade(String grade) {
this.grade = grade;
}
public String getGrade() {
return this.grade;
}
}
}

View File

@ -0,0 +1,35 @@
package com.hbm.inventory.fluid;
import java.util.List;
import com.hbm.inventory.fluid.FluidType.FluidTrait;
import com.hbm.render.util.EnumSymbol;
import com.hbm.util.BobMathUtil;
import net.minecraft.util.EnumChatFormatting;
/** If it burns, it needs to be an instance of this class. */
public class FluidTypeFlammable extends FluidType {
/** How much heat energy (usually translates into HE 1:1) 1000mB hold */
protected long energy;
public FluidTypeFlammable(String compat, int color, int p, int f, int r, EnumSymbol symbol) {
super(compat, color, p, f, r, symbol);
}
public FluidTypeFlammable setHeatEnergy(long energy) {
this.energy = energy;
return this;
}
@Override
public void addInfo(List<String> info) {
super.addInfo(info);
info.add(EnumChatFormatting.YELLOW + "[Flammable]");
if(energy > 0)
info.add(EnumChatFormatting.YELLOW + "Provides " + EnumChatFormatting.RED + "" + BobMathUtil.getShortNumber(energy) + "HE " + EnumChatFormatting.YELLOW + "per bucket burned");
}
}

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import com.hbm.inventory.fluid.FluidType.FluidTrait;
import com.hbm.inventory.fluid.FluidTypeCombustible.FuelGrade;
import com.hbm.render.util.EnumSymbol;
public class Fluids {
@ -98,76 +99,77 @@ public class Fluids {
* You may screw with metaOrder as much as you like, as long as you keep all fluids in the list exactly once.
*/
NONE = new FluidType("NONE",0x888888, 0, 1, 1, 0, 0, 0, EnumSymbol.NONE, "hbmfluid.none");
WATER = new FluidType("WATER",0x3333FF, 1, 1, 1, 0, 0, 0, EnumSymbol.NONE, "hbmfluid.water");
STEAM = new FluidType("STEAM",0xe5e5e5, 9, 2, 1, 3, 0, 0, EnumSymbol.NONE, "hbmfluid.steam", 100);
HOTSTEAM = new FluidType("HOTSTEAM",0xE7D6D6, 1, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.hotsteam", 300);
SUPERHOTSTEAM = new FluidType("SUPERHOTSTEAM",0xE7B7B7, 2, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.superhotsteam", 450);
ULTRAHOTSTEAM = new FluidType("ULTRAHOTSTEAM",0xE39393, 13, 1, 2, 4, 0, 0, EnumSymbol.NONE, "hbmfluid.ultrahotsteam", 600);
COOLANT = new FluidType("COOLANT",0xd8fcff, 2, 1, 1, 1, 0, 0, EnumSymbol.NONE, "hbmfluid.coolant");
LAVA = new FluidType("LAVA",0xFF3300, 3, 1, 1, 4, 0, 0, EnumSymbol.NOWATER, "hbmfluid.lava", 1200);
DEUTERIUM = new FluidType("DEUTERIUM",0x0000FF, 4, 1, 1, 3, 4, 0, EnumSymbol.NONE, "hbmfluid.deuterium");
TRITIUM = new FluidType("TRITIUM",0x000099, 5, 1, 1, 3, 4, 0, EnumSymbol.RADIATION, "hbmfluid.tritium");
OIL = new FluidType("OIL",0x020202, 6, 1, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.oil");
HOTOIL = new FluidType("HOTOIL",0x300900, 8, 2, 1, 2, 3, 0, EnumSymbol.NONE, "hbmfluid.hotoil", 350);
HEAVYOIL = new FluidType("HEAVYOIL",0x141312, 2, 2, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.heavyoil");
BITUMEN = new FluidType("BITUMEN",0x1f2426, 3, 2, 1, 2, 0, 0, EnumSymbol.NONE, "hbmfluid.bitumen");
SMEAR = new FluidType("SMEAR",0x190f01, 7, 1, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.smear");
HEATINGOIL = new FluidType("HEATINGOIL",0x211806, 4, 2, 1, 2, 2, 0, EnumSymbol.NONE, "hbmfluid.heatingoil");
RECLAIMED = new FluidType("RECLAIMED",0x332b22, 8, 1, 1, 2, 2, 0, EnumSymbol.NONE, "hbmfluid.reclaimed");
PETROIL = new FluidType("PETROIL",0x44413d, 9, 1, 1, 1, 3, 0, EnumSymbol.NONE, "hbmfluid.petroil");
LUBRICANT = new FluidType("LUBRICANT",0x606060, 10, 1, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.lubricant");
NAPHTHA = new FluidType("NAPHTHA",0x595744, 5, 2, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.naphtha");
DIESEL = new FluidType("DIESEL",0xf2eed5, 11, 1, 1, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.diesel");
DIESEL_CRACK = new FluidType("DIESEL_CRACK",0xf2eed5, 11, 1, 1, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.diesel_crack");
LIGHTOIL = new FluidType("LIGHTOIL",0x8c7451, 6, 2, 1, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.lightoil");
KEROSENE = new FluidType("KEROSENE",0xffa5d2, 12, 1, 1, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.kerosene");
GAS = new FluidType("GAS",0xfffeed, 13, 1, 1, 1, 4, 1, EnumSymbol.NONE, "hbmfluid.gas");
PETROLEUM = new FluidType("PETROLEUM",0x7cb7c9, 7, 2, 1, 1, 4, 1, EnumSymbol.NONE, "hbmfluid.petroleum");
LPG = new FluidType("LPG",0x4747EA, 5, 2, 2, 1, 3, 1, EnumSymbol.NONE, "hbmfluid.lpg");
BIOGAS = new FluidType("BIOGAS",0xbfd37c, 12, 2, 1, 1, 4, 1, EnumSymbol.NONE, "hbmfluid.biogas");
BIOFUEL = new FluidType("BIOFUEL",0xeef274, 13, 2, 1, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.biofuel");
NITAN = new FluidType("NITAN",0x8018ad, 15, 2, 1, 2, 4, 1, EnumSymbol.NONE, "hbmfluid.nitan");
UF6 = new FluidType("UF6",0xD1CEBE, 14, 1, 1, 4, 0, 2, EnumSymbol.RADIATION, "hbmfluid.uf6", FluidTrait.CORROSIVE);
PUF6 = new FluidType("PUF6",0x4C4C4C, 15, 1, 1, 4, 0, 4, EnumSymbol.RADIATION, "hbmfluid.puf6", FluidTrait.CORROSIVE);
SAS3 = new FluidType("SAS3",0x4ffffc, 14, 2, 1, 5, 0, 4, EnumSymbol.RADIATION, "hbmfluid.sas3", FluidTrait.CORROSIVE);
SCHRABIDIC = new FluidType("SCHRABIDIC",0x006B6B, 14, 1, 2, 5, 0, 5, EnumSymbol.ACID, "hbmfluid.schrabidic", FluidTrait.CORROSIVE_2);
AMAT = new FluidType("AMAT",0x010101, 0, 2, 1, 5, 0, 5, EnumSymbol.ANTIMATTER, "hbmfluid.amat", FluidTrait.AMAT);
ASCHRAB = new FluidType("ASCHRAB",0xb50000, 1, 2, 1, 5, 0, 5, EnumSymbol.ANTIMATTER, "hbmfluid.aschrab", FluidTrait.AMAT);
ACID = new FluidType("ACID",0xfff7aa, 10, 2, 1, 3, 0, 3, EnumSymbol.OXIDIZER, "hbmfluid.acid", FluidTrait.CORROSIVE);
WATZ = new FluidType("WATZ",0x86653E, 11, 2, 1, 4, 0, 3, EnumSymbol.ACID, "hbmfluid.watz", FluidTrait.CORROSIVE_2);
CRYOGEL = new FluidType("CRYOGEL",0x32ffff, 0, 1, 2, 2, 0, 0, EnumSymbol.CROYGENIC, "hbmfluid.cryogel", -170);
HYDROGEN = new FluidType("HYDROGEN",0x4286f4, 3, 1, 2, 3, 4, 0, EnumSymbol.CROYGENIC, "hbmfluid.hydrogen");
OXYGEN = new FluidType("OXYGEN",0x98bdf9, 4, 1, 2, 3, 0, 0, EnumSymbol.CROYGENIC, "hbmfluid.oxygen");
XENON = new FluidType("XENON",0xba45e8, 5, 1, 2, 0, 0, 0, EnumSymbol.ASPHYXIANT, "hbmfluid.xenon");
BALEFIRE = new FluidType("BALEFIRE",0x28e02e, 6, 1, 2, 4, 4, 3, EnumSymbol.RADIATION, "hbmfluid.balefire", 1500, FluidTrait.CORROSIVE);
MERCURY = new FluidType("MERCURY",0x808080, 7, 1, 2, 2, 0, 0, EnumSymbol.NONE, "hbmfluid.mercury");
PAIN = new FluidType("PAIN",0x938541, 15, 1, 2, 2, 0, 1, EnumSymbol.ACID, "hbmfluid.pain", 300, FluidTrait.CORROSIVE);
WASTEFLUID = new FluidType("WASTEFLUID",0x544400, 0, 2, 2, 2, 0, 1, EnumSymbol.RADIATION, "hbmfluid.wastefluid", FluidTrait.NO_CONTAINER);
WASTEGAS = new FluidType("WASTEGAS",0xB8B8B8, 1, 2, 2, 2, 0, 1, EnumSymbol.RADIATION, "hbmfluid.wastegas", FluidTrait.NO_CONTAINER);
GASOLINE = new FluidType("GASOLINE",0x445772, 2, 2, 2, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.gasoline");
COALGAS = new FluidType("COALGAS",0x445772, 2, 2, 2, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.coalgas");
SPENTSTEAM = new FluidType("SPENTSTEAM",0x445772, 3, 2, 2, 2, 0, 0, EnumSymbol.NONE, "hbmfluid.spentsteam", FluidTrait.NO_CONTAINER);
FRACKSOL = new FluidType("FRACKSOL",0x798A6B, 4, 2, 2, 1, 3, 3, EnumSymbol.ACID, "hbmfluid.fracksol", FluidTrait.CORROSIVE);
PLASMA_DT = new FluidType("PLASMA_DT",0xF7AFDE, 8, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_dt", 3250, FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_HD = new FluidType("PLASMA_HD",0xF0ADF4, 9, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_hd", 2500, FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_HT = new FluidType("PLASMA_HT",0xD1ABF2, 10, 1, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_ht", 3000, FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_XM = new FluidType("PLASMA_XM",0xC6A5FF, 11, 1, 2, 0, 4, 1, EnumSymbol.RADIATION, "hbmfluid.plasma_xm", 4250, FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_BF = new FluidType("PLASMA_BF",0xA7F1A3, 12, 1, 2, 4, 5, 4, EnumSymbol.ANTIMATTER, "hbmfluid.plasma_bf", 8500, FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
// v v v v v v v v
CARBONDIOXIDE = new FluidType("CARBONDIOXIDE",0x404040, 6, 2, 2, 3, 0, 0, EnumSymbol.ASPHYXIANT, "hbmfluid.carbondioxide");
PLASMA_DH3 = new FluidType("PLASMA_DH3",0xFF83AA, 6, 2, 2, 0, 4, 0, EnumSymbol.RADIATION, "hbmfluid.plasma_dh3", 3480, FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
HELIUM3 = new FluidType("HELIUM3",0xFCF0C4, 7, 2, 2, 3, 4, 0, EnumSymbol.ASPHYXIANT, "hbmfluid.helium3");
DEATH = new FluidType("DEATH",0x717A88, 8, 2, 2, 2, 0, 1, EnumSymbol.ACID, "hbmfluid.death", 300, FluidTrait.CORROSIVE_2, FluidTrait.LEAD_CONTAINER);
ETHANOL = new FluidType("ETHANOL",0xe0ffff, 9, 2, 2, 2, 3, 0, EnumSymbol.NONE, "hbmfluid.ethanol");
HEAVYWATER = new FluidType("HEAVYWATER",0x00a0b0, 10, 2, 2, 1, 0, 0, EnumSymbol.NONE, "hbmfluid.heavywater");
CRACKOIL = new FluidType("CRACKOIL",0x020202, 6, 1, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.crackoil");
COALOIL = new FluidType("COALOIL",0x020202, 6, 1, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.coaloil");
HOTCRACKOIL = new FluidType("HOTCRACKOIL",0x300900, 8, 2, 1, 2, 3, 0, EnumSymbol.NONE, "hbmfluid.hotcrackoil", 350);
NAPHTHA_CRACK = new FluidType("NAPHTHA_CRACK",0x595744, 5, 2, 1, 2, 1, 0, EnumSymbol.NONE, "hbmfluid.naphtha_crack");
LIGHTOIL_CRACK = new FluidType("LIGHTOIL_CRACK",0x8c7451, 6, 2, 1, 1, 2, 0, EnumSymbol.NONE, "hbmfluid.lightoil_crack");
AROMATICS = new FluidType("AROMATICS",0xfffeed, 13, 1, 1, 1, 4, 1, EnumSymbol.NONE, "hbmfluid.aromatics");
UNSATURATEDS = new FluidType("UNSATURATEDS",0xfffeed, 13, 1, 1, 1, 4, 1, EnumSymbol.NONE, "hbmfluid.unsaturateds");
NONE = new FluidType( "NONE", 0x888888, 0, 0, 0, EnumSymbol.NONE);
WATER = new FluidType( "WATER", 0x3333FF, 0, 0, 0, EnumSymbol.NONE);
STEAM = new FluidType( "STEAM", 0xe5e5e5, 3, 0, 0, EnumSymbol.NONE).setTemp(100);
HOTSTEAM = new FluidType( "HOTSTEAM", 0xE7D6D6, 4, 0, 0, EnumSymbol.NONE).setTemp(300);
SUPERHOTSTEAM = new FluidType( "SUPERHOTSTEAM", 0xE7B7B7, 4, 0, 0, EnumSymbol.NONE).setTemp(450);
ULTRAHOTSTEAM = new FluidType( "ULTRAHOTSTEAM", 0xE39393, 4, 0, 0, EnumSymbol.NONE).setTemp(600);
COOLANT = new FluidType( "COOLANT", 0xd8fcff, 1, 0, 0, EnumSymbol.NONE);
LAVA = new FluidType( "LAVA", 0xFF3300, 4, 0, 0, EnumSymbol.NOWATER).setTemp(1200);
DEUTERIUM = new FluidTypeCombustible( "DEUTERIUM", 0x0000FF, 3, 4, 0, EnumSymbol.NONE);
TRITIUM = new FluidTypeCombustible( "TRITIUM", 0x000099, 3, 4, 0, EnumSymbol.RADIATION);
OIL = new FluidTypeFlammable( "OIL", 0x020202, 2, 1, 0, EnumSymbol.NONE);
HOTOIL = new FluidTypeFlammable( "HOTOIL", 0x300900, 2, 3, 0, EnumSymbol.NONE).setTemp(350);
HEAVYOIL = new FluidTypeFlammable( "HEAVYOIL", 0x141312, 2, 1, 0, EnumSymbol.NONE);
BITUMEN = new FluidType( "BITUMEN", 0x1f2426, 2, 0, 0, EnumSymbol.NONE);
SMEAR = new FluidTypeFlammable( "SMEAR", 0x190f01, 2, 1, 0, EnumSymbol.NONE);
HEATINGOIL = new FluidTypeCombustible( "HEATINGOIL", 0x211806, 2, 2, 0, EnumSymbol.NONE);
RECLAIMED = new FluidTypeCombustible( "RECLAIMED", 0x332b22, 2, 2, 0, EnumSymbol.NONE);
PETROIL = new FluidTypeCombustible( "PETROIL", 0x44413d, 1, 3, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.MEDIUM, 300_000);
LUBRICANT = new FluidType( "LUBRICANT", 0x606060, 2, 1, 0, EnumSymbol.NONE);
NAPHTHA = new FluidTypeFlammable( "NAPHTHA", 0x595744, 2, 1, 0, EnumSymbol.NONE);
DIESEL = new FluidTypeCombustible( "DIESEL", 0xf2eed5, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 500_000);
LIGHTOIL = new FluidTypeFlammable( "LIGHTOIL", 0x8c7451, 1, 2, 0, EnumSymbol.NONE);
KEROSENE = new FluidTypeCombustible( "KEROSENE", 0xffa5d2, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.AERO, 1_250_000);
GAS = new FluidTypeFlammable( "GAS", 0xfffeed, 1, 4, 1, EnumSymbol.NONE);
PETROLEUM = new FluidTypeFlammable( "PETROLEUM", 0x7cb7c9, 1, 4, 1, EnumSymbol.NONE);
LPG = new FluidTypeCombustible( "LPG", 0x4747EA, 1, 3, 1, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 450_000);
BIOGAS = new FluidTypeFlammable( "BIOGAS", 0xbfd37c, 1, 4, 1, EnumSymbol.NONE);
BIOFUEL = new FluidTypeCombustible( "BIOFUEL", 0xeef274, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 400_000);
NITAN = new FluidTypeCombustible( "NITAN", 0x8018ad, 2, 4, 1, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 5_000_000);
UF6 = new FluidType( "UF6", 0xD1CEBE, 4, 0, 2, EnumSymbol.RADIATION).addTraits(FluidTrait.CORROSIVE);
PUF6 = new FluidType( "PUF6", 0x4C4C4C, 4, 0, 4, EnumSymbol.RADIATION).addTraits(FluidTrait.CORROSIVE);
SAS3 = new FluidType( "SAS3", 0x4ffffc, 5, 0, 4, EnumSymbol.RADIATION).addTraits(FluidTrait.CORROSIVE);
SCHRABIDIC = new FluidType( "SCHRABIDIC", 0x006B6B, 5, 0, 5, EnumSymbol.ACID).addTraits(FluidTrait.CORROSIVE_2);
AMAT = new FluidType( "AMAT", 0x010101, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(FluidTrait.AMAT);
ASCHRAB = new FluidType( "ASCHRAB", 0xb50000, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(FluidTrait.AMAT);
ACID = new FluidType( "ACID", 0xfff7aa, 3, 0, 3, EnumSymbol.OXIDIZER).addTraits(FluidTrait.CORROSIVE);
WATZ = new FluidType( "WATZ", 0x86653E, 4, 0, 3, EnumSymbol.ACID).addTraits(FluidTrait.CORROSIVE_2);
CRYOGEL = new FluidType( "CRYOGEL", 0x32ffff, 2, 0, 0, EnumSymbol.CROYGENIC).setTemp(-170);
HYDROGEN = new FluidTypeCombustible( "HYDROGEN", 0x4286f4, 3, 4, 0, EnumSymbol.CROYGENIC).setCombustionEnergy(FuelGrade.HIGH, 10_000);
OXYGEN = new FluidType( "OXYGEN", 0x98bdf9, 3, 0, 0, EnumSymbol.CROYGENIC);
XENON = new FluidType( "XENON", 0xba45e8, 0, 0, 0, EnumSymbol.ASPHYXIANT);
BALEFIRE = new FluidType( "BALEFIRE", 0x28e02e, 4, 4, 3, EnumSymbol.RADIATION).setTemp(1500).addTraits(FluidTrait.CORROSIVE);
MERCURY = new FluidType( "MERCURY", 0x808080, 2, 0, 0, EnumSymbol.NONE);
PAIN = new FluidType( "PAIN", 0x938541, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(FluidTrait.CORROSIVE);
WASTEFLUID = new FluidType( "WASTEFLUID", 0x544400, 2, 0, 1, EnumSymbol.RADIATION).addTraits(FluidTrait.NO_CONTAINER);
WASTEGAS = new FluidType( "WASTEGAS", 0xB8B8B8, 2, 0, 1, EnumSymbol.RADIATION).addTraits(FluidTrait.NO_CONTAINER);
GASOLINE = new FluidTypeCombustible( "GASOLINE", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 1_500_000);
COALGAS = new FluidTypeCombustible( "COALGAS", 0x445772, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.MEDIUM, 150_000);
SPENTSTEAM = new FluidType( "SPENTSTEAM", 0x445772, 2, 0, 0, EnumSymbol.NONE).addTraits(FluidTrait.NO_CONTAINER);
FRACKSOL = new FluidType( "FRACKSOL", 0x798A6B, 1, 3, 3, EnumSymbol.ACID).addTraits(FluidTrait.CORROSIVE);
PLASMA_DT = new FluidType( "PLASMA_DT", 0xF7AFDE, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3250).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_HD = new FluidType( "PLASMA_HD", 0xF0ADF4, 0, 4, 0, EnumSymbol.RADIATION).setTemp(2500).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_HT = new FluidType( "PLASMA_HT", 0xD1ABF2, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3000).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_XM = new FluidType( "PLASMA_XM", 0xC6A5FF, 0, 4, 1, EnumSymbol.RADIATION).setTemp(4250).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
PLASMA_BF = new FluidType( "PLASMA_BF", 0xA7F1A3, 4, 5, 4, EnumSymbol.ANTIMATTER).setTemp(8500).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
CARBONDIOXIDE = new FluidType( "CARBONDIOXIDE", 0x404040, 3, 0, 0, EnumSymbol.ASPHYXIANT);
PLASMA_DH3 = new FluidType( "PLASMA_DH3", 0xFF83AA, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3480).addTraits(FluidTrait.NO_CONTAINER, FluidTrait.NO_ID);
HELIUM3 = new FluidType( "HELIUM3", 0xFCF0C4, 3, 4, 0, EnumSymbol.ASPHYXIANT);
DEATH = new FluidType( "DEATH", 0x717A88, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(FluidTrait.CORROSIVE_2, FluidTrait.LEAD_CONTAINER);
ETHANOL = new FluidTypeCombustible( "ETHANOL", 0xe0ffff, 2, 3, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 200_000);
HEAVYWATER = new FluidType( "HEAVYWATER", 0x00a0b0, 1, 0, 0, EnumSymbol.NONE);
CRACKOIL = new FluidTypeFlammable( "CRACKOIL", 0x020202, 2, 1, 0, EnumSymbol.NONE);
COALOIL = new FluidTypeFlammable( "COALOIL", 0x020202, 2, 1, 0, EnumSymbol.NONE);
HOTCRACKOIL = new FluidTypeFlammable( "HOTCRACKOIL", 0x300900, 2, 3, 0, EnumSymbol.NONE).setTemp(350);
NAPHTHA_CRACK = new FluidTypeFlammable( "NAPHTHA_CRACK", 0x595744, 2, 1, 0, EnumSymbol.NONE);
LIGHTOIL_CRACK = new FluidTypeFlammable( "LIGHTOIL_CRACK", 0x8c7451, 1, 2, 0, EnumSymbol.NONE);
DIESEL_CRACK = new FluidTypeCombustible( "DIESEL_CRACK", 0xf2eed5, 1, 2, 0, EnumSymbol.NONE).setCombustionEnergy(FuelGrade.HIGH, 450_000);
AROMATICS = new FluidTypeFlammable( "AROMATICS", 0xfffeed, 1, 4, 1, EnumSymbol.NONE);
UNSATURATEDS = new FluidTypeFlammable( "UNSATURATEDS", 0xfffeed, 1, 4, 1, EnumSymbol.NONE);
// ^ ^ ^ ^ ^ ^ ^ ^
//ADD NEW FLUIDS HERE
//AND DON'T FORGET THE META DOWN HERE
@ -191,10 +193,10 @@ public class Fluids {
metaOrder.add(CRYOGEL);
//pure elements, cyogenic gasses
metaOrder.add(HYDROGEN);
metaOrder.add(HELIUM3);
metaOrder.add(OXYGEN);
metaOrder.add(DEUTERIUM);
metaOrder.add(TRITIUM);
metaOrder.add(HELIUM3);
metaOrder.add(OXYGEN);
metaOrder.add(XENON);
metaOrder.add(MERCURY);
//oils, fuels
@ -213,7 +215,6 @@ public class Fluids {
metaOrder.add(SMEAR);
metaOrder.add(HEATINGOIL);
metaOrder.add(RECLAIMED);
metaOrder.add(PETROIL);
metaOrder.add(LUBRICANT);
metaOrder.add(GAS);
metaOrder.add(PETROLEUM);
@ -223,6 +224,7 @@ public class Fluids {
metaOrder.add(DIESEL);
metaOrder.add(DIESEL_CRACK);
metaOrder.add(KEROSENE);
metaOrder.add(PETROIL);
metaOrder.add(GASOLINE);
metaOrder.add(COALGAS);
metaOrder.add(BIOGAS);

View File

@ -89,16 +89,12 @@ public class GUIAMSBase extends GuiInfoContainer {
if(!base.hasResonators())
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 6);
Minecraft.getMinecraft().getTextureManager().bindTexture(base.tanks[0].getSheet());
base.tanks[0].renderTank(this, guiLeft + 26, guiTop + 70, base.tanks[0].getTankType().textureX() * FluidTank.x, base.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
base.tanks[0].renderTank(guiLeft + 26, guiTop + 70, this.zLevel, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(base.tanks[1].getSheet());
base.tanks[1].renderTank(this, guiLeft + 134, guiTop + 70, base.tanks[1].getTankType().textureX() * FluidTank.x, base.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
base.tanks[1].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(base.tanks[2].getSheet());
base.tanks[2].renderTank(this, guiLeft + 26, guiTop + 124, base.tanks[2].getTankType().textureX() * FluidTank.x, base.tanks[2].getTankType().textureY() * FluidTank.y, 16, 52);
base.tanks[2].renderTank(guiLeft + 26, guiTop + 124, this.zLevel, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(base.tanks[3].getSheet());
base.tanks[3].renderTank(this, guiLeft + 134, guiTop + 124, base.tanks[3].getTankType().textureX() * FluidTank.x, base.tanks[3].getTankType().textureY() * FluidTank.y, 16, 52);
base.tanks[3].renderTank(guiLeft + 134, guiTop + 124, this.zLevel, 16, 52);
}
}

View File

@ -61,8 +61,6 @@ public class GUIAMSEmitter extends GuiInfoContainer {
if(m > 0)
drawTexturedModalRect(guiLeft + 80, guiTop + 17, 176, 36 + 16 * m, 16, 16);
Minecraft.getMinecraft().getTextureManager().bindTexture(emitter.tank.getSheet());
emitter.tank.renderTank(this, guiLeft + 26, guiTop + 69, emitter.tank.getTankType().textureX() * FluidTank.x, emitter.tank.getTankType().textureY() * FluidTank.y, 16, 52);
emitter.tank.renderTank(guiLeft + 26, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -66,8 +66,6 @@ public class GUIAMSLimiter extends GuiInfoContainer {
if(m > 0)
drawTexturedModalRect(guiLeft + 80, guiTop + 17, 176, 36 + 16 * m, 16, 16);
Minecraft.getMinecraft().getTextureManager().bindTexture(limiter.tank.getSheet());
limiter.tank.renderTank(this, guiLeft + 26, guiTop + 69, limiter.tank.getTankType().textureX() * FluidTank.x, limiter.tank.getTankType().textureY() * FluidTank.y, 16, 52);
limiter.tank.renderTank(guiLeft + 26, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -62,9 +62,11 @@ public class GUIBarrel extends GuiInfoContainer {
int i = tank.mode;
drawTexturedModalRect(guiLeft + 151, guiTop + 34, 176, i * 18, 18, 18);
Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
/*Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
tank.tank.renderTank(this, guiLeft + 71, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(this, guiLeft + 71 + 16, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(this, guiLeft + 71 + 32, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 2, 52);
tank.tank.renderTank(this, guiLeft + 71 + 32, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 2, 52);*/
tank.tank.renderTank(guiLeft + 71, guiTop + 69, this.zLevel, 34, 52);
}
}

View File

@ -8,6 +8,7 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.Locale;
import java.util.Stack;
@ -25,7 +26,7 @@ public class GUICalculator extends GuiScreen {
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
inputField = new GuiTextField(fontRendererObj, x + 5, y + 5, 210, 13);
inputField = new GuiTextField(fontRendererObj, x + 5, y + 8, 210, 13);
inputField.setTextColor(-1);
inputField.setCanLoseFocus(false);
inputField.setFocused(true);
@ -42,10 +43,12 @@ public class GUICalculator extends GuiScreen {
if (!inputField.textboxKeyTyped(p_73869_1_, p_73869_2_))
super.keyTyped(p_73869_1_, p_73869_2_);
String input = inputField.getText().replaceAll("[^\\d+\\-*/^!.()\\sA-Za-z]+", "");
if (p_73869_1_ == 13 || p_73869_1_ == 10) { // when pressing enter (CR or LF)
try {
double result = Double.parseDouble(latestResult);
String plainStringRepresentation = (new BigDecimal(result)).toPlainString();
double result = evaluateExpression(input);
String plainStringRepresentation = (new BigDecimal(result, MathContext.DECIMAL64)).toPlainString();
GuiScreen.setClipboardString(plainStringRepresentation);
inputField.setText(plainStringRepresentation);
inputField.setCursorPositionEnd();
@ -54,8 +57,6 @@ public class GUICalculator extends GuiScreen {
return;
}
String input = inputField.getText().replaceAll("[^\\d+\\-*/^.()\\sA-Za-z]+", "");
if (input.isEmpty()) {
latestResult = "?";
return;
@ -115,7 +116,9 @@ public class GUICalculator extends GuiScreen {
while (!operators.isEmpty() && hasPrecedence(String.valueOf(tokens[i]), operators.peek()))
values.push(evaluateOperator(operators.pop().charAt(0), values.pop(), values.pop()));
operators.push(Character.toString(tokens[i]));
} else if (tokens[i] >= 'A' && tokens[i] <= 'Z' || tokens[i] >= 'a' && tokens[i] <= 'z') {
} else if (tokens[i] == '!') {
values.push((double) factorial((int) Math.round(values.pop())));
}else if (tokens[i] >= 'A' && tokens[i] <= 'Z' || tokens[i] >= 'a' && tokens[i] <= 'z') {
StringBuilder charBuffer = new StringBuilder();
while (i < tokens.length && (tokens[i] >= 'A' && tokens[i] <= 'Z' || tokens[i] >= 'a' && tokens[i] <= 'z'))
charBuffer.append(tokens[i++]);
@ -229,9 +232,52 @@ public class GUICalculator extends GuiScreen {
double exponent = evaluateExpression(input.substring(powerOperatorIndex + 1, exponentExpressionEnd));
double result = Math.pow(base, exponent);
// use big decimal to avoid scientific notation messing with the calculation
input = input.substring(0, baseExpressionStart) + (new BigDecimal(result)).toPlainString() + input.substring(exponentExpressionEnd);
input = input.substring(0, baseExpressionStart) + (new BigDecimal(result, MathContext.DECIMAL64)).toPlainString() + input.substring(exponentExpressionEnd);
} while (input.contains("^"));
return input;
}
// TODO Maybe switch the whole calculator to using BigInteger/BigDecimal?
// SplitRecursive algorithm
private static int factorial(int in) {
if (in < 0) throw new IllegalArgumentException("Factorial needs n >= 0");
if (in < 2) return 1;
int p = 1, r = 1;
factorialCurrentN = 1;
int h = 0, shift = 0, high = 1;
int log2n = log2(in);
while (h != in) {
shift += h;
h = in >> log2n--;
int len = high;
high = (h - 1) | 1;
len = (high - len) / 2;
if (len > 0) {
p *= factorialProduct(len);
r *= p;
}
}
return r << shift;
}
private static int factorialCurrentN;
private static int factorialProduct(int in) {
int m = in / 2;
if (m == 0) return factorialCurrentN += 2;
if (in == 2) return (factorialCurrentN += 2) * (factorialCurrentN += 2);
return factorialProduct(in - m) * factorialProduct(m);
}
private static int log2(int in) {
int log = 0;
if((in & 0xffff0000) != 0) { in >>>= 16; log = 16; }
if(in >= 256) { in >>>= 8; log += 8; }
if(in >= 16) { in >>>= 4; log += 4; }
if(in >= 4) { in >>>= 2; log += 2; }
return log + (in >>> 1);
}
}

View File

@ -58,9 +58,7 @@ public class GUICore extends GuiInfoContainer {
int j = core.getHeatScaled(52);
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - j, 192, 52 - j, 16, j);
Minecraft.getMinecraft().getTextureManager().bindTexture(core.tanks[0].getSheet());
core.tanks[0].renderTank(this, guiLeft + 26, guiTop + 69, core.tanks[0].getTankType().textureX() * FluidTank.x, core.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(core.tanks[1].getSheet());
core.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, core.tanks[1].getTankType().textureX() * FluidTank.x, core.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
core.tanks[0].renderTank(guiLeft + 26, guiTop + 69, this.zLevel, 16, 52);
core.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -103,10 +103,9 @@ public class GUICoreEmitter extends GuiInfoContainer {
int i = (int) emitter.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 26, guiTop + 69 - i, 176, 52 - i, 16, i);
this.field.drawTextBox();
this.field.drawTextBox();
Minecraft.getMinecraft().getTextureManager().bindTexture(emitter.tank.getSheet());
emitter.tank.renderTank(this, guiLeft + 8, guiTop + 69, emitter.tank.getTankType().textureX() * FluidTank.x, emitter.tank.getTankType().textureY() * FluidTank.y, 16, 52);
emitter.tank.renderTank(guiLeft + 8, guiTop + 69, this.zLevel, 16, 52);
}
protected void keyTyped(char p_73869_1_, int p_73869_2_) {

View File

@ -47,9 +47,7 @@ public class GUICoreInjector extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
Minecraft.getMinecraft().getTextureManager().bindTexture(injector.tanks[0].getSheet());
injector.tanks[0].renderTank(this, guiLeft + 44, guiTop + 69, injector.tanks[0].getTankType().textureX() * FluidTank.x, injector.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(injector.tanks[1].getSheet());
injector.tanks[1].renderTank(this, guiLeft + 116, guiTop + 69, injector.tanks[1].getTankType().textureX() * FluidTank.x, injector.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
injector.tanks[0].renderTank(guiLeft + 44, guiTop + 69, this.zLevel, 16, 52);
injector.tanks[1].renderTank(guiLeft + 116, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -52,7 +52,6 @@ public class GUICoreReceiver extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
Minecraft.getMinecraft().getTextureManager().bindTexture(receiver.tank.getSheet());
receiver.tank.renderTank(this, guiLeft + 8, guiTop + 69, receiver.tank.getTankType().textureX() * FluidTank.x, receiver.tank.getTankType().textureY() * FluidTank.y, 16, 52);
receiver.tank.renderTank(guiLeft + 8, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -61,7 +61,6 @@ public class GUICrystallizer extends GuiInfoContainer {
this.drawInfoPanel(guiLeft + 87, guiTop + 21, 8, 8, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(acidomatic.tank.getSheet());
acidomatic.tank.renderTank(this, guiLeft + 44, guiTop + 69, acidomatic.tank.getTankType().textureX() * FluidTank.x, acidomatic.tank.getTankType().textureY() * FluidTank.y, 16, 52);
acidomatic.tank.renderTank(guiLeft + 44, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -58,13 +58,8 @@ public class GUIFWatzCore extends GuiInfoContainer {
int m = diFurnace.getSingularityType();
drawTexturedModalRect(guiLeft + 98, guiTop + 109, 240, 4 * m, 16, 4);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 70);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 134, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 70);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[2].getSheet());
diFurnace.tanks[2].renderTank(this, guiLeft + 152, guiTop + 88, diFurnace.tanks[2].getTankType().textureX() * FluidTank.x, diFurnace.tanks[2].getTankType().textureY() * FluidTank.y, 16, 70);
diFurnace.tanks[0].renderTank(guiLeft + 8, guiTop + 88, this.zLevel, 16, 70);
diFurnace.tanks[1].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 70);
diFurnace.tanks[2].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 70);
}
}

View File

@ -55,13 +55,8 @@ public class GUIFusionMultiblock extends GuiInfoContainer {
if(diFurnace.isRunning())
drawTexturedModalRect(guiLeft + 80, guiTop + 18, 240, 0, 16, 16);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 70);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 134, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 70);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[2].getSheet());
diFurnace.tanks[2].renderTank(this, guiLeft + 152, guiTop + 88, diFurnace.tanks[2].getTankType().textureX() * FluidTank.x, diFurnace.tanks[2].getTankType().textureY() * FluidTank.y, 16, 70);
diFurnace.tanks[0].renderTank(guiLeft + 8, guiTop + 88, this.zLevel, 16, 70);
diFurnace.tanks[1].renderTank(guiLeft + 134, guiTop + 88, this.zLevel, 16, 70);
diFurnace.tanks[2].renderTank(guiLeft + 152, guiTop + 88, this.zLevel, 16, 70);
}
}

View File

@ -83,10 +83,7 @@ public class GUIIGenerator extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 51, guiTop + 34, 180, 0, 4, 89);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(igen.tanks[1].getSheet());
igen.tanks[1].renderTank(this, guiLeft + 114, guiTop + 103, igen.tanks[1].getTankType().textureX() * FluidTank.x, igen.tanks[1].getTankType().textureY() * FluidTank.y, 16, 70);
Minecraft.getMinecraft().getTextureManager().bindTexture(igen.tanks[2].getSheet());
igen.tanks[2].renderTank(this, guiLeft + 150, guiTop + 103, igen.tanks[2].getTankType().textureX() * FluidTank.x, igen.tanks[2].getTankType().textureY() * FluidTank.y, 16, 70);
igen.tanks[1].renderTank(guiLeft + 114, guiTop + 103, this.zLevel, 16, 70);
igen.tanks[2].renderTank(guiLeft + 150, guiTop + 103, this.zLevel, 16, 70);
}
}

View File

@ -83,13 +83,9 @@ public class GUIITER extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 44, guiTop + 22, 176, 18, j, 7);
for(int t = 0; t < 2; t++) {
Minecraft.getMinecraft().getTextureManager().bindTexture(iter.tanks[t].getSheet());
iter.tanks[t].renderTank(this, guiLeft + 26 + 108 * t, guiTop + 106, iter.tanks[t].getTankType().textureX() * FluidTank.x, iter.tanks[t].getTankType().textureY() * FluidTank.y, 16, 52);
iter.tanks[t].renderTank(guiLeft + 26 + 108 * t, guiTop + 106, this.zLevel, 16, 52);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(iter.plasma.getSheet());
iter.plasma.renderTank(this, guiLeft + 71, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 34);
iter.plasma.renderTank(this, guiLeft + 71 + 16, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 16, 34);
iter.plasma.renderTank(this, guiLeft + 71 + 32, guiTop + 88, iter.plasma.getTankType().textureX() * FluidTank.x, iter.plasma.getTankType().textureY() * FluidTank.y, 2, 34);
iter.plasma.renderTank(guiLeft + 71, guiTop + 88, this.zLevel, 34, 34);
}
}

View File

@ -57,7 +57,6 @@ public class GUILiquefactor extends GuiInfoContainer {
if(i > 0)
drawTexturedModalRect(guiLeft + 138, guiTop + 4, 176, 52, 9, 12);
Minecraft.getMinecraft().getTextureManager().bindTexture(liquefactor.tank.getSheet());
liquefactor.tank.renderTank(this, guiLeft + 71, guiTop + 88, liquefactor.tank.getTankType().textureX() * FluidTank.x, liquefactor.tank.getTankType().textureY() * FluidTank.y, 16, 52);
liquefactor.tank.renderTank(guiLeft + 71, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -98,10 +98,7 @@ public class GUIMachineBoiler extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(dud.tanks[0].getSheet());
dud.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, dud.tanks[0].getTankType().textureX() * FluidTank.x, dud.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(dud.tanks[1].getSheet());
dud.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, dud.tanks[1].getTankType().textureX() * FluidTank.x, dud.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
dud.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
dud.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -97,10 +97,7 @@ public class GUIMachineBoilerElectric extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(dud.tanks[0].getSheet());
dud.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, dud.tanks[0].getTankType().textureX() * FluidTank.x, dud.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(dud.tanks[1].getSheet());
dud.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, dud.tanks[1].getTankType().textureX() * FluidTank.x, dud.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
dud.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
dud.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -55,7 +55,6 @@ public class GUIMachineCMBFactory extends GuiInfoContainer {
int j1 = diFurnace.getProgressScaled(24);
drawTexturedModalRect(guiLeft + 101 + 9, guiTop + 34, 208, 0, j1 + 1, 16);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tank.getSheet());
diFurnace.tank.renderTank(this, guiLeft + 26, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tank.renderTank(guiLeft + 26, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -76,16 +76,9 @@ public class GUIMachineChemplant extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(chemplant.tanks[0].getSheet());
chemplant.tanks[0].renderTank(this, guiLeft + 8, guiTop + 52, chemplant.tanks[0].getTankType().textureX() * FluidTank.x, chemplant.tanks[0].getTankType().textureY() * FluidTank.y, 16, 34);
Minecraft.getMinecraft().getTextureManager().bindTexture(chemplant.tanks[1].getSheet());
chemplant.tanks[1].renderTank(this, guiLeft + 26, guiTop + 52, chemplant.tanks[1].getTankType().textureX() * FluidTank.x, chemplant.tanks[1].getTankType().textureY() * FluidTank.y, 16, 34);
Minecraft.getMinecraft().getTextureManager().bindTexture(chemplant.tanks[2].getSheet());
chemplant.tanks[2].renderTank(this, guiLeft + 134, guiTop + 52, chemplant.tanks[2].getTankType().textureX() * FluidTank.x, chemplant.tanks[2].getTankType().textureY() * FluidTank.y, 16, 34);
Minecraft.getMinecraft().getTextureManager().bindTexture(chemplant.tanks[3].getSheet());
chemplant.tanks[3].renderTank(this, guiLeft + 152, guiTop + 52, chemplant.tanks[3].getTankType().textureX() * FluidTank.x, chemplant.tanks[3].getTankType().textureY() * FluidTank.y, 16, 34);
chemplant.tanks[0].renderTank(guiLeft + 8, guiTop + 52, this.zLevel, 16, 34);
chemplant.tanks[1].renderTank(guiLeft + 26, guiTop + 52, this.zLevel, 16, 34);
chemplant.tanks[2].renderTank(guiLeft + 134, guiTop + 52, this.zLevel, 16, 34);
chemplant.tanks[3].renderTank(guiLeft + 152, guiTop + 52, this.zLevel, 16, 34);
}
}

View File

@ -92,7 +92,6 @@ public class GUIMachineCoal extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
Minecraft.getMinecraft().getTextureManager().bindTexture(dud.tank.getSheet());
dud.tank.renderTank(this, guiLeft + 8, guiTop + 69, dud.tank.getTankType().textureX() * FluidTank.x, dud.tank.getTankType().textureY() * FluidTank.y, 16, 52);
dud.tank.renderTank(guiLeft + 8, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -88,11 +88,8 @@ public class GUIMachineCompactLauncher extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 11);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[0].getSheet());
launcher.tanks[0].renderTank(this, guiLeft + 116, guiTop + 70, launcher.tanks[0].getTankType().textureX() * FluidTank.x, launcher.tanks[0].getTankType().textureY() * FluidTank.y, 16, 34);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[1].getSheet());
launcher.tanks[1].renderTank(this, guiLeft + 134, guiTop + 70, launcher.tanks[1].getTankType().textureX() * FluidTank.x, launcher.tanks[1].getTankType().textureY() * FluidTank.y, 16, 34);
launcher.tanks[0].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 34);
launcher.tanks[1].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 34);
/// DRAW MISSILE START
GL11.glPushMatrix();

View File

@ -77,9 +77,7 @@ public class GUIMachineCyclotron extends GuiInfoContainer {
this.drawInfoPanel(guiLeft + 21, guiTop + 75, 8, 8, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(cyclotron.coolant.getSheet());
cyclotron.coolant.renderTank(this, guiLeft + 53, guiTop + 124, cyclotron.coolant.getTankType().textureX() * FluidTank.x, cyclotron.coolant.getTankType().textureY() * FluidTank.y, 7, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(cyclotron.amat.getSheet());
cyclotron.amat.renderTank(this, guiLeft + 134, guiTop + 124, cyclotron.amat.getTankType().textureX() * FluidTank.x, cyclotron.amat.getTankType().textureY() * FluidTank.y, 7, 34);
cyclotron.coolant.renderTank(guiLeft + 53, guiTop + 124, this.zLevel, 7, 52);
cyclotron.amat.renderTank(guiLeft + 134, guiTop + 124, this.zLevel, 7, 34);
}
}

View File

@ -10,8 +10,10 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineDiesel;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
import com.hbm.util.BobMathUtil;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
@ -23,11 +25,11 @@ import net.minecraft.util.ResourceLocation;
public class GUIMachineDiesel extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/GUIDiesel.png");
private TileEntityMachineDiesel diFurnace;
private TileEntityMachineDiesel diesel;
public GUIMachineDiesel(InventoryPlayer invPlayer, TileEntityMachineDiesel tedf) {
super(new ContainerMachineDiesel(invPlayer, tedf));
diFurnace = tedf;
diesel = tedf;
this.xSize = 176;
this.ySize = 166;
@ -37,15 +39,19 @@ public class GUIMachineDiesel extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 69 - 52, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.powerCap);
diesel.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 69 - 52, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 69 - 52, 16, 52, diesel.power, diesel.powerCap);
List<String> text = new ArrayList();
text.add(EnumChatFormatting.YELLOW + "Accepted Fuels:");
for(Entry<FluidType, Integer> entry : TileEntityMachineDiesel.fuels.entrySet()) {
text.add(" " + I18nUtil.resolveKey(entry.getKey().getUnlocalizedName()) + " (" + entry.getValue() + " HE/t)");
for(FluidType type : Fluids.getInNiceOrder()) {
long energy = diesel.getHEFromFuel(type);
if(energy > 0)
text.add(" " + I18nUtil.resolveKey(type.getUnlocalizedName()) + " (" + BobMathUtil.getShortNumber(energy) + "HE/t)");
}
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text.toArray(new String[0]));
String[] text1 = new String[] { "Fuel consumption rate:",
@ -54,7 +60,7 @@ public class GUIMachineDiesel extends GuiInfoContainer {
"(Consumption rate is constant)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
if(!diFurnace.hasAcceptableFuel()) {
if(!diesel.hasAcceptableFuel()) {
String[] text2 = new String[] { "Error: The currently set fuel type",
"is not supported by this engine!" };
@ -64,7 +70,7 @@ public class GUIMachineDiesel extends GuiInfoContainer {
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
String name = this.diesel.hasCustomInventoryName() ? this.diesel.getInventoryName() : I18n.format(this.diesel.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
@ -76,12 +82,12 @@ public class GUIMachineDiesel extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.power > 0) {
int i = (int)diFurnace.getPowerScaled(52);
if(diesel.power > 0) {
int i = (int)diesel.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 152, guiTop + 69 - i, 176, 52 - i, 16, i);
}
if(diFurnace.tank.getFill() > 0 && diFurnace.hasAcceptableFuel())
if(diesel.tank.getFill() > 0 && diesel.hasAcceptableFuel())
{
drawTexturedModalRect(guiLeft + 43 + 18 * 4, guiTop + 34, 208, 0, 18, 18);
}
@ -89,22 +95,9 @@ public class GUIMachineDiesel extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
if(!diFurnace.hasAcceptableFuel())
if(!diesel.hasAcceptableFuel())
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tank.getSheet());
diFurnace.tank.renderTank(this, guiLeft + 80, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52);
/*Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.missileNuclear_tex);
GL11.glPushMatrix();
GL11.glTranslatef(guiLeft + 88, guiTop + 110, 50);
GL11.glRotatef(System.currentTimeMillis() / 10 % 360, 0, -1, 0);
GL11.glTranslatef(60, 0, 0);
GL11.glScalef(16, 16, 16);
GL11.glRotatef(90, 1, 0, 0);
GL11.glRotatef(-90, 0, 0, 1);
GL11.glScalef(-1, -1, -1);
ResourceManager.missileNuclear.renderAll();
GL11.glPopMatrix();*/
diesel.tank.renderTank(guiLeft + 80, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -62,9 +62,6 @@ public class GUIMachineFluidTank extends GuiInfoContainer {
int i = tank.mode;
drawTexturedModalRect(guiLeft + 151, guiTop + 34, 176, i * 18, 18, 18);
Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
tank.tank.renderTank(this, guiLeft + 71, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(this, guiLeft + 71 + 16, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(this, guiLeft + 71 + 32, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 2, 52);
tank.tank.renderTank(guiLeft + 71, guiTop + 69, this.zLevel, 34, 52);
}
}

View File

@ -50,9 +50,6 @@ public class GUIMachineGasFlare extends GuiInfoContainer {
int j = (int)flare.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 69 - j, 176, 52 - j, 16, j);
Minecraft.getMinecraft().getTextureManager().bindTexture(flare.tank.getSheet());
flare.tank.renderTank(this, guiLeft + 80, guiTop + 69, flare.tank.getTankType().textureX() * FluidTank.x, flare.tank.getTankType().textureY() * FluidTank.y, 16, 52);
flare.tank.renderTank(this, guiLeft + 80 + 16, guiTop + 69, flare.tank.getTankType().textureX() * FluidTank.x, flare.tank.getTankType().textureY() * FluidTank.y, 16, 52);
flare.tank.renderTank(this, guiLeft + 80 + 32, guiTop + 69, flare.tank.getTankType().textureX() * FluidTank.x, flare.tank.getTankType().textureY() * FluidTank.y, 2, 52);
flare.tank.renderTank(guiLeft + 80, guiTop + 69, this.zLevel, 34, 52);
}
}

View File

@ -75,10 +75,7 @@ public class GUIMachineGenerator extends GuiInfoContainer {
if(diFurnace.tanks[1].getFill() <= 0)
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 7);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 26, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tanks[0].renderTank(guiLeft + 8, guiTop + 88, this.zLevel, 16, 52);
diFurnace.tanks[1].renderTank(guiLeft + 26, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -47,13 +47,8 @@ public class GUIMachineInserter extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 44, guiTop + 69, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 98, guiTop + 69, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[2].getSheet());
diFurnace.tanks[2].renderTank(this, guiLeft + 152, guiTop + 69, diFurnace.tanks[2].getTankType().textureX() * FluidTank.x, diFurnace.tanks[2].getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tanks[0].renderTank(guiLeft + 44, guiTop + 69, this.zLevel, 16, 52);
diFurnace.tanks[1].renderTank(guiLeft + 98, guiTop + 69, this.zLevel, 16, 52);
diFurnace.tanks[2].renderTank(guiLeft + 152, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -56,30 +56,19 @@ public class GUIMachineLargeTurbine extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(turbine.tanks[0].getTankType().name().equals(Fluids.STEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 0, 14, 14);
}
if(turbine.tanks[0].getTankType().name().equals(Fluids.HOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 14, 14, 14);
}
if(turbine.tanks[0].getTankType().name().equals(Fluids.SUPERHOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 28, 14, 14);
}
if(turbine.tanks[0].getTankType().name().equals(Fluids.ULTRAHOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 42, 14, 14);
}
if(turbine.tanks[0].getTankType() == Fluids.STEAM) drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 0, 14, 14);
if(turbine.tanks[0].getTankType() == Fluids.HOTSTEAM) drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 14, 14, 14);
if(turbine.tanks[0].getTankType() == Fluids.SUPERHOTSTEAM)drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 28, 14, 14);
if(turbine.tanks[0].getTankType() == Fluids.ULTRAHOTSTEAM)drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 42, 14, 14);
int i = (int)turbine.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 123, guiTop + 69 - i, 176, 34 - i, 7, i);
if(turbine.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
if(turbine.tanks[1].getTankType() == Fluids.NONE) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(turbine.tanks[0].getSheet());
turbine.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, turbine.tanks[0].getTankType().textureX() * FluidTank.x, turbine.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(turbine.tanks[1].getSheet());
turbine.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, turbine.tanks[1].getTankType().textureX() * FluidTank.x, turbine.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
turbine.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
turbine.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -134,11 +134,8 @@ public class GUIMachineLaunchTable extends GuiInfoContainer {
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 11);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[0].getSheet());
launcher.tanks[0].renderTank(this, guiLeft + 116, guiTop + 70, launcher.tanks[0].getTankType().textureX() * FluidTank.x, launcher.tanks[0].getTankType().textureY() * FluidTank.y, 16, 34);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[1].getSheet());
launcher.tanks[1].renderTank(this, guiLeft + 134, guiTop + 70, launcher.tanks[1].getTankType().textureX() * FluidTank.x, launcher.tanks[1].getTankType().textureY() * FluidTank.y, 16, 34);
launcher.tanks[0].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 34);
launcher.tanks[1].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 34);
/// DRAW MISSILE START
GL11.glPushMatrix();

View File

@ -65,15 +65,11 @@ public class GUIMachineOilWell extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 34, guiTop + 36, 192, 0, 18, 34);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(derrick.tanks[0].getSheet());
derrick.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, derrick.tanks[0].getTankType().textureX() * FluidTank.x, derrick.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(derrick.tanks[1].getSheet());
derrick.tanks[1].renderTank(this, guiLeft + 107, guiTop + 69, derrick.tanks[1].getTankType().textureX() * FluidTank.x, derrick.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
derrick.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
derrick.tanks[1].renderTank(guiLeft + 107, guiTop + 69, this.zLevel, 16, 52);
if(derrick.tanks.length > 2) {
Minecraft.getMinecraft().getTextureManager().bindTexture(derrick.tanks[2].getSheet());
derrick.tanks[2].renderTank(this, guiLeft + 40, guiTop + 69, derrick.tanks[2].getTankType().textureX() * FluidTank.x, derrick.tanks[2].getTankType().textureY() * FluidTank.y, 6, 32);
derrick.tanks[2].renderTank(guiLeft + 40, guiTop + 69, this.zLevel, 6, 32);
}
}
}

View File

@ -46,7 +46,6 @@ public class GUIMachinePuF6Tank extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
tank.tank.renderTank(this, guiLeft + 80, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(guiLeft + 80, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -54,21 +54,10 @@ public class GUIMachineRefinery extends GuiInfoContainer {
int j = (int)refinery.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 70 - j, 176, 52 - j, 16, j);
Minecraft.getMinecraft().getTextureManager().bindTexture(refinery.tanks[0].getSheet());
refinery.tanks[0].renderTank(this, guiLeft + 26, guiTop + 70, refinery.tanks[0].getTankType().textureX() * FluidTank.x, refinery.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
refinery.tanks[0].renderTank(this, guiLeft + 26 + 16, guiTop + 70, refinery.tanks[0].getTankType().textureX() * FluidTank.x, refinery.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
refinery.tanks[0].renderTank(this, guiLeft + 26 + 32, guiTop + 70, refinery.tanks[0].getTankType().textureX() * FluidTank.x, refinery.tanks[0].getTankType().textureY() * FluidTank.y, 2, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(refinery.tanks[1].getSheet());
refinery.tanks[1].renderTank(this, guiLeft + 80, guiTop + 70, refinery.tanks[1].getTankType().textureX() * FluidTank.x, refinery.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(refinery.tanks[2].getSheet());
refinery.tanks[2].renderTank(this, guiLeft + 98, guiTop + 70, refinery.tanks[2].getTankType().textureX() * FluidTank.x, refinery.tanks[2].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(refinery.tanks[3].getSheet());
refinery.tanks[3].renderTank(this, guiLeft + 116, guiTop + 70, refinery.tanks[3].getTankType().textureX() * FluidTank.x, refinery.tanks[3].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(refinery.tanks[4].getSheet());
refinery.tanks[4].renderTank(this, guiLeft + 134, guiTop + 70, refinery.tanks[4].getTankType().textureX() * FluidTank.x, refinery.tanks[4].getTankType().textureY() * FluidTank.y, 16, 52);
refinery.tanks[0].renderTank(guiLeft + 26, guiTop + 70, this.zLevel, 34, 52);
refinery.tanks[1].renderTank(guiLeft + 80, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[2].renderTank(guiLeft + 98, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[3].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 52);
refinery.tanks[4].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -9,9 +9,11 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineSelenium;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
import com.hbm.util.BobMathUtil;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
@ -23,11 +25,11 @@ import net.minecraft.util.ResourceLocation;
public class GUIMachineSelenium extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_selenium.png");
private TileEntityMachineSeleniumEngine diFurnace;
private TileEntityMachineSeleniumEngine selenium;
public GUIMachineSelenium(InventoryPlayer invPlayer, TileEntityMachineSeleniumEngine tedf) {
super(new ContainerMachineSelenium(invPlayer, tedf));
diFurnace = tedf;
selenium = tedf;
this.xSize = 176;
this.ySize = 222;
@ -37,14 +39,17 @@ public class GUIMachineSelenium extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 18, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 108, 160, 16, diFurnace.power, diFurnace.powerCap);
selenium.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 18, 16, 52);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 108, 160, 16, selenium.power, selenium.powerCap);
List<String> text = new ArrayList();
text.add(EnumChatFormatting.YELLOW + "Accepted Fuels:");
for(Entry<FluidType, Integer> entry : TileEntityMachineDiesel.fuels.entrySet()) {
text.add(" " + I18nUtil.resolveKey(entry.getKey().getUnlocalizedName()) + " (" + entry.getValue() + " HE/t)");
for(FluidType type : Fluids.getInNiceOrder()) {
long energy = selenium.getHEFromFuel(type);
if(energy > 0)
text.add(" " + I18nUtil.resolveKey(type.getUnlocalizedName()) + " (" + BobMathUtil.getShortNumber(energy) + "HE/t)");
}
text.add(EnumChatFormatting.ITALIC + "(These numbers are base values,");
@ -59,14 +64,14 @@ public class GUIMachineSelenium extends GuiInfoContainer {
"(Consumption rate per piston)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
if(diFurnace.pistonCount < 3) {
if(selenium.pistonCount < 3) {
String[] text2 = new String[] { "Error: At least three pistons are",
"required to operate this radial engine!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
}
if(!diFurnace.hasAcceptableFuel()) {
if(!selenium.hasAcceptableFuel()) {
String[] text2 = new String[] { "Error: The currently set fuel type",
"is not supported by this engine!" };
@ -76,7 +81,7 @@ public class GUIMachineSelenium extends GuiInfoContainer {
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
String name = this.selenium.hasCustomInventoryName() ? this.selenium.getInventoryName() : I18n.format(this.selenium.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
@ -88,35 +93,34 @@ public class GUIMachineSelenium extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.power > 0) {
int i = (int)diFurnace.getPowerScaled(160);
if(selenium.power > 0) {
int i = (int)selenium.getPowerScaled(160);
i = (int) Math.min(i, 160);
drawTexturedModalRect(guiLeft + 8, guiTop + 108, 0, 222, i, 16);
}
if(diFurnace.tank.getFill() > 0 && diFurnace.hasAcceptableFuel() && diFurnace.pistonCount > 2)
if(selenium.tank.getFill() > 0 && selenium.hasAcceptableFuel() && selenium.pistonCount > 2)
{
drawTexturedModalRect(guiLeft + 115, guiTop + 71, 192, 0, 18, 18);
}
if(diFurnace.pistonCount > 0)
if(selenium.pistonCount > 0)
{
int k = diFurnace.pistonCount;
int k = selenium.pistonCount;
drawTexturedModalRect(guiLeft + 26, guiTop + 81, 176, 52 + 16 * k - 16, 16, 16);
}
if(diFurnace.pistonCount < 3)
if(selenium.pistonCount < 3)
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
if(!diFurnace.hasAcceptableFuel())
if(!selenium.hasAcceptableFuel())
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 48, 16, 16, 7);
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tank.getSheet());
diFurnace.tank.renderTank(this, guiLeft + 80 + 36, guiTop + 70, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52);
selenium.tank.renderTank(guiLeft + 80 + 36, guiTop + 70, this.zLevel, 16, 52);
}
}

View File

@ -33,7 +33,7 @@ public class GUIMachineTurbine extends GuiInfoContainer {
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 62, guiTop + 69 - 52, 16, 52);
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 69 - 52, 16, 52);
if(diFurnace.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
if(diFurnace.tanks[1].getTankType() == Fluids.NONE) {
String[] text2 = new String[] { "Error: Invalid fluid!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 16 + 32, text2);
@ -56,30 +56,19 @@ public class GUIMachineTurbine extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.tanks[0].getTankType().name().equals(Fluids.STEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 0, 14, 14);
}
if(diFurnace.tanks[0].getTankType().name().equals(Fluids.HOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 14, 14, 14);
}
if(diFurnace.tanks[0].getTankType().name().equals(Fluids.SUPERHOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 28, 14, 14);
}
if(diFurnace.tanks[0].getTankType().name().equals(Fluids.ULTRAHOTSTEAM.name())) {
drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 42, 14, 14);
}
if(diFurnace.tanks[0].getTankType() == Fluids.STEAM) drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 0, 14, 14);
if(diFurnace.tanks[0].getTankType() == Fluids.HOTSTEAM) drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 14, 14, 14);
if(diFurnace.tanks[0].getTankType() == Fluids.SUPERHOTSTEAM) drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 28, 14, 14);
if(diFurnace.tanks[0].getTankType() == Fluids.ULTRAHOTSTEAM) drawTexturedModalRect(guiLeft + 99, guiTop + 18, 183, 42, 14, 14);
int i = (int)diFurnace.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 123, guiTop + 69 - i, 176, 34 - i, 7, i);
if(diFurnace.tanks[1].getTankType().name().equals(Fluids.NONE.name())) {
if(diFurnace.tanks[1].getTankType() == Fluids.NONE) {
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
diFurnace.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -63,9 +63,6 @@ public class GUIMachineTurbofan extends GuiInfoContainer {
this.drawInfoPanel(guiLeft + 96, guiTop + 21, 8, 8, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tank.getSheet());
diFurnace.tank.renderTank(this, guiLeft + 53, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tank.renderTank(this, guiLeft + 53 + 16, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tank.renderTank(this, guiLeft + 53 + 32, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 2, 52);
diFurnace.tank.renderTank(guiLeft + 53, guiTop + 69, this.zLevel, 34, 52);
}
}

View File

@ -46,7 +46,6 @@ public class GUIMachineUF6Tank extends GuiInfoContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
Minecraft.getMinecraft().getTextureManager().bindTexture(tank.tank.getSheet());
tank.tank.renderTank(this, guiLeft + 80, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
tank.tank.renderTank(guiLeft + 80, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -87,7 +87,6 @@ public class GUIMiningLaser extends GuiInfoContainer {
this.drawInfoPanel(guiLeft + 87, guiTop + 31, 8, 8, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(laser.tank.getSheet());
laser.tank.renderTank(this, guiLeft + 35, guiTop + 124, laser.tank.getTankType().textureX() * FluidTank.x, laser.tank.getTankType().textureY() * FluidTank.y, 7, 52);
laser.tank.renderTank(guiLeft + 35, guiTop + 124, this.zLevel, 7, 52);
}
}

View File

@ -55,12 +55,8 @@ public class GUIPlasmaHeater extends GuiInfoContainer {
int i = (int)microwave.getPowerScaled(34);
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 176, 34 - i, 16, i);
Minecraft.getMinecraft().getTextureManager().bindTexture(microwave.tanks[0].getSheet());
microwave.tanks[0].renderTank(this, guiLeft + 62, guiTop + 69, microwave.tanks[0].getTankType().textureX() * FluidTank.x, microwave.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(microwave.tanks[1].getSheet());
microwave.tanks[1].renderTank(this, guiLeft + 134, guiTop + 69, microwave.tanks[1].getTankType().textureX() * FluidTank.x, microwave.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(microwave.plasma.getSheet());
microwave.plasma.renderTank(this, guiLeft + 98, guiTop + 69, microwave.plasma.getTankType().textureX() * FluidTank.x, microwave.plasma.getTankType().textureY() * FluidTank.y, 16, 52);
microwave.tanks[0].renderTank(guiLeft + 62, guiTop + 69, this.zLevel, 16, 52);
microwave.tanks[1].renderTank(guiLeft + 134, guiTop + 69, this.zLevel, 16, 52);
microwave.plasma.renderTank(guiLeft + 98, guiTop + 69, this.zLevel, 16, 52);
}
}

View File

@ -75,13 +75,10 @@ public class GUIRadiolysis extends GuiInfoContainer {
int i = (int)(radiolysis.getPower() * 34 / radiolysis.getMaxPower());
drawTexturedModalRect(guiLeft + 8, guiTop + 51 - i, 240, 34 - i, 16, i);
Minecraft.getMinecraft().getTextureManager().bindTexture(radiolysis.tanks[0].getSheet());
radiolysis.tanks[0].renderTank(this, guiLeft + 61, guiTop + 69, radiolysis.tanks[0].getTankType().textureX() * FluidTank.x, radiolysis.tanks[0].getTankType().textureY() * FluidTank.y, 8, 52);
radiolysis.tanks[0].renderTank(guiLeft + 61, guiTop + 69, this.zLevel, 8, 52);
//For some reason, liquid hydrogen appears as lava. but it doesn't seem to be an issue with any other fuel?
for(byte j = 0; j < 2; j++) {
Minecraft.getMinecraft().getTextureManager().bindTexture(radiolysis.tanks[j].getSheet());
radiolysis.tanks[j + 1].renderTank(this, guiLeft + 87, guiTop + 33 + j * 36, radiolysis.tanks[j + 1].getTankType().textureX() * FluidTank.x, radiolysis.tanks[j + 1].getTankType().textureY() * FluidTank.y, 12, 16);
radiolysis.tanks[j + 1].renderTank(guiLeft + 87, guiTop + 33 + j * 36, this.zLevel, 12, 16);
}
this.drawInfoPanel(guiLeft - 16, guiTop + 16, 16, 16, 10);

View File

@ -184,9 +184,7 @@ public class GUIReactorMultiblock extends GuiInfoContainer {
drawTexturedModalRect(guiLeft + 80, guiTop + 108, 0, offset, i, 4);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
diFurnace.tanks[1].renderTank(this, guiLeft + 26, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tanks[0].renderTank(guiLeft + 8, guiTop + 88, this.zLevel, 16, 52);
diFurnace.tanks[1].renderTank(guiLeft + 26, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -57,7 +57,6 @@ public class GUISolidifier extends GuiInfoContainer {
if(i > 0)
drawTexturedModalRect(guiLeft + 138, guiTop + 4, 176, 52, 9, 12);
Minecraft.getMinecraft().getTextureManager().bindTexture(solidifier.tank.getSheet());
solidifier.tank.renderTank(this, guiLeft + 35, guiTop + 88, solidifier.tank.getTankType().textureX() * FluidTank.x, solidifier.tank.getTankType().textureY() * FluidTank.y, 16, 52);
solidifier.tank.renderTank(guiLeft + 35, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -132,10 +132,7 @@ public class GUISoyuzLauncher extends GuiInfoContainer {
else
drawTexturedModalRect(guiLeft + 49, guiTop + 59, 218, 0, 6, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[0].getSheet());
launcher.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, launcher.tanks[0].getTankType().textureX() * FluidTank.x, launcher.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(launcher.tanks[1].getSheet());
launcher.tanks[1].renderTank(this, guiLeft + 26, guiTop + 88, launcher.tanks[1].getTankType().textureX() * FluidTank.x, launcher.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
launcher.tanks[0].renderTank(guiLeft + 8, guiTop + 88, this.zLevel, 16, 52);
launcher.tanks[1].renderTank(guiLeft + 26, guiTop + 88, this.zLevel, 16, 52);
}
}

View File

@ -30,8 +30,7 @@ public class GUITurretFritz extends GUITurretBase {
FluidTank tank = ((TileEntityTurretFritz)this.turret).tank;
Minecraft.getMinecraft().getTextureManager().bindTexture(tank.getSheet());
tank.renderTank(this, guiLeft + 134, guiTop + 116, tank.getTankType().textureX() * FluidTank.x, tank.getTankType().textureY() * FluidTank.y, 7, 52);
tank.renderTank(guiLeft + 134, guiTop + 116, this.zLevel, 7, 52);
}
protected ResourceLocation getTexture() {

View File

@ -57,7 +57,6 @@ public class GUIWatzCore extends GuiInfoContainer {
int l = (int)diFurnace.getPowerScaled(70);
drawTexturedModalRect(guiLeft + 152, guiTop + 106 - 18 - l, 192, 70 - l, 16, l);
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tank.getSheet());
diFurnace.tank.renderTank(this, guiLeft + 134, guiTop + 106 - 18, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 70);
diFurnace.tank.renderTank(guiLeft + 134, guiTop + 106 - 18, this.zLevel, 16, 70);
}
}

View File

@ -12,6 +12,7 @@ import com.hbm.inventory.recipes.RefineryRecipes;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.util.Tuple.Pair;
import com.hbm.util.Tuple.Quartet;
import net.minecraft.item.ItemStack;
@ -49,13 +50,28 @@ public class RadiolysisRecipes {
public static void registerRadiolysis() {
radiolysis.put(Fluids.WATER, new Pair(new FluidStack(80, Fluids.ACID), new FluidStack(20, Fluids.HYDROGEN)));
//now this is poggers
radiolysis.put(Fluids.OIL, new Pair(new FluidStack(RefineryRecipes.oil_crack_oil, Fluids.CRACKOIL), new FluidStack(RefineryRecipes.oil_crack_petro, Fluids.PETROLEUM)));
radiolysis.put(Fluids.BITUMEN, new Pair(new FluidStack(RefineryRecipes.bitumen_crack_oil, Fluids.OIL), new FluidStack(RefineryRecipes.bitumen_crack_aroma, Fluids.AROMATICS)));
radiolysis.put(Fluids.SMEAR, new Pair(new FluidStack(RefineryRecipes.smear_crack_napht, Fluids.NAPHTHA), new FluidStack(RefineryRecipes.smear_crack_petro, Fluids.PETROLEUM)));
radiolysis.put(Fluids.GAS, new Pair(new FluidStack(RefineryRecipes.gas_crack_petro, Fluids.PETROLEUM), new FluidStack(RefineryRecipes.gas_crack_unsat, Fluids.UNSATURATEDS)));
radiolysis.put(Fluids.DIESEL, new Pair(new FluidStack(RefineryRecipes.diesel_crack_kero, Fluids.KEROSENE), new FluidStack(RefineryRecipes.diesel_crack_petro, Fluids.PETROLEUM)));
radiolysis.put(Fluids.KEROSENE, new Pair(new FluidStack(RefineryRecipes.kero_crack_petro, Fluids.PETROLEUM), new FluidStack(0, Fluids.NONE)));
//automatically add cracking recipes to the radiolysis recipe list
//we want the numbers and types to stay consistent anyway and this will save us a lot of headache later on
Map<FluidType, Quartet<FluidType, FluidType, Integer, Integer>> cracking = RefineryRecipes.getCrackingRecipes();
if(cracking.isEmpty()) {
throw new IllegalStateException("RefineryRecipes.getCrackingRecipes has yielded an empty map while registering the radiolysis recipes! Either the load order is broken or cracking recipes have been removed!");
}
for(Entry<FluidType, Quartet<FluidType, FluidType, Integer, Integer>> recipe : cracking.entrySet()) {
FluidType input = recipe.getKey();
FluidType out1 = recipe.getValue().getW();
FluidType out2 = recipe.getValue().getX();
int amount1 = recipe.getValue().getY();
int amount2 = recipe.getValue().getZ();
radiolysis.put(input,
new Pair(
new FluidStack(amount1, out1),
new FluidStack(amount2, out2)
)
);
}
}
public static Pair<FluidStack, FluidStack> getRadiolysis(FluidType input) {

View File

@ -115,4 +115,8 @@ public class RefineryRecipes {
public static Quartet<FluidType, FluidType, Integer, Integer> getCracking(FluidType oil) {
return cracking.get(oil);
}
protected static Map<FluidType, Quartet<FluidType, FluidType, Integer, Integer>> getCrackingRecipes() {
return cracking;
}
}

View File

@ -3,11 +3,12 @@ package com.hbm.inventory.recipes;
import static com.hbm.inventory.fluid.Fluids.*;
import java.util.HashMap;
import java.util.Map.Entry;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.items.ItemEnums.EnumTarType;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.items.ModItems;
import com.hbm.util.Tuple.Pair;
@ -88,4 +89,20 @@ public class SolidificationRecipes {
public static Pair<Integer, ItemStack> getOutput(FluidType type) {
return recipes.get(type);
}
public static HashMap<ItemStack, ItemStack> getRecipes() {
HashMap<ItemStack, ItemStack> recipes = new HashMap<ItemStack, ItemStack>();
for(Entry<FluidType, Pair<Integer, ItemStack>> entry : SolidificationRecipes.recipes.entrySet()) {
FluidType type = entry.getKey();
int amount = entry.getValue().getKey();
ItemStack out = entry.getValue().getValue().copy();
recipes.put(ItemFluidIcon.make(type, amount), out);
}
return recipes;
}
}

View File

@ -49,6 +49,7 @@ public class ItemHolotapeImage extends ItemHoloTape {
HOLO_O_1( EnumChatFormatting.WHITE, "Chroma", "X00-TRANSCRIPT", "[Start of Automated Audio Transcript] <unintelligible> in a boardroom, right, and they're trying to come up with some new ideas. So one guy just says they should reuse this other character from somewhere else, who has like this night-theme you know, and just change the entire schtick to day. So when they had to come up with a name, one guy said, why not take the original name, replace the N with a D, because of night to day, right, and run with it? Now the name sounds like 'Dicks'! Funniest thing I've ever heard! [End of Transcript]"),
HOLO_O_2( EnumChatFormatting.WHITE, "Chroma", "X01-NEWS", "The tape contains a news article, reporting an unusually pale person throwing flashbangs at people in public. The image at the bottom shows one of the incidents, unsurprisingly the light from one of the flashbangs made it unrecognizable."),
HOLO_O_3( EnumChatFormatting.WHITE, "Chroma", "X02-FICTION", "The tape contains an article from a science fiction magazine, engaging with various reader comments about what to do with a time machine. One of those comments suggests engaging in various unsanitary acts with the future self, being signed off with just the initial '~D'."),
HOLO_CHALLENGE( EnumChatFormatting.GRAY, "None", "-", "An empty holotape. The back has the following message scribbled on it with black marker: \"official challenge - convince me that lyons' brotherhood isn't the best brotherhood of steel chapter and win a custom cape!\" The tape smells like chicken nuggets."),
;
private String name;

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (4130)";
public static final String VERSION = "1.0.27 BETA (4130H1)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version

View File

@ -72,6 +72,7 @@ import com.hbm.render.tileentity.*;
import com.hbm.render.util.MissilePart;
import com.hbm.sound.AudioWrapper;
import com.hbm.sound.AudioWrapperClient;
import com.hbm.tileentity.TileEntityDoorGeneric;
import com.hbm.tileentity.bomb.*;
import com.hbm.tileentity.conductor.*;
import com.hbm.tileentity.deco.*;
@ -263,6 +264,7 @@ public class ClientProxy extends ServerProxy {
//doors
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityVaultDoor.class, new RenderVaultDoor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBlastDoor.class, new RenderBlastDoor());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDoorGeneric.class, new RenderDoorGeneric());
}
@Override
@ -656,12 +658,13 @@ public class ClientProxy extends ServerProxy {
FMLCommonHandler.instance().bus().register(handler);
AdvancedModelLoader.registerModelHandler(new HmfModelLoader());
ResourceManager.loadAnimatedModels();
registerTileEntitySpecialRenderer();
registerItemRenderer();
registerEntityRenderer();
registerBlockRenderer();
RenderingRegistry.addNewArmourRendererPrefix("5");
RenderingRegistry.addNewArmourRendererPrefix("6");
RenderingRegistry.addNewArmourRendererPrefix("7");

View File

@ -69,6 +69,8 @@ public class NEIConfig implements IConfigureNEI {
}
API.registerRecipeHandler(new LiquefactionHandler());
API.registerUsageHandler(new LiquefactionHandler());
API.registerRecipeHandler(new SolidificationHandler());
API.registerUsageHandler(new SolidificationHandler());
//Some things are even beyond my control...or are they?
API.hideItem(ItemBattery.getEmptyBattery(ModItems.memory));

View File

@ -1,5 +1,8 @@
package com.hbm.main;
import com.hbm.animloader.AnimatedModel;
import com.hbm.animloader.Animation;
import com.hbm.animloader.ColladaLoader;
import com.hbm.lib.RefStrings;
import com.hbm.render.loader.HFRWavefrontObject;
@ -257,6 +260,10 @@ public class ResourceManager {
public static final IModelCustom blast_door_slider = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blast_door_slider.obj"));
public static final IModelCustom blast_door_block = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/blast_door_block.obj"));
//Transission Seal
public static AnimatedModel transition_seal;
public static Animation transition_seal_anim;
//Tesla Coil
public static final IModelCustom tesla = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/tesla.obj"));
public static final IModelCustom teslacrab = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/teslacrab.obj"));
@ -561,6 +568,9 @@ public class ResourceManager {
public static final ResourceLocation blast_door_tooth_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_tooth.png");
public static final ResourceLocation blast_door_slider_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_slider.png");
public static final ResourceLocation blast_door_block_tex = new ResourceLocation(RefStrings.MODID, "textures/models/blast_door_block.png");
//Doors
public static final ResourceLocation transition_seal_tex = new ResourceLocation(RefStrings.MODID, "textures/models/doors/transition_seal.png");
//Tesla Coil
public static final ResourceLocation tesla_tex = new ResourceLocation(RefStrings.MODID, "textures/models/tesla.png");
@ -1163,4 +1173,9 @@ public class ResourceManager {
public static final IModelCustom deb_zirnox_element = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_element.obj"));
public static final IModelCustom deb_zirnox_exchanger = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_exchanger.obj"));
public static final IModelCustom deb_zirnox_shrapnel = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/zirnox/deb_shrapnel.obj"));
public static void loadAnimatedModels(){
transition_seal = ColladaLoader.load(new ResourceLocation(RefStrings.MODID, "models/doors/seal.dae"), true);
transition_seal_anim = ColladaLoader.loadAnim(24040, new ResourceLocation(RefStrings.MODID, "models/doors/seal.dae"));
}
}

View File

@ -95,6 +95,8 @@ public class PacketDispatcher {
wrapper.registerMessage(NBTControlPacket.Handler.class, NBTControlPacket.class, i++, Side.SERVER);
//Packet to send for anvil recipes to be crafted
wrapper.registerMessage(AnvilCraftPacket.Handler.class, AnvilCraftPacket.class, i++, Side.SERVER);
//Sends a funi text to display like a music disc announcement
wrapper.registerMessage(TEDoorAnimationPacket.Handler.class, TEDoorAnimationPacket.class, i++, Side.CLIENT);
}
}

View File

@ -0,0 +1,72 @@
package com.hbm.packet;
import com.hbm.interfaces.IAnimatedDoor;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.tileentity.TileEntity;
public class TEDoorAnimationPacket implements IMessage {
public int x, y, z;
public byte state;
public byte texture;
public TEDoorAnimationPacket() {
}
public TEDoorAnimationPacket(int x, int y, int z, byte state) {
this(x, y, z, state, (byte) -1);
}
public TEDoorAnimationPacket(int x, int y, int z, byte state, byte tex) {
this.x = x;
this.y = y;
this.z = z;
this.state = state;
this.texture = tex;
}
@Override
public void fromBytes(ByteBuf buf) {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
state = buf.readByte();
if(buf.readableBytes() == 1){
texture = buf.readByte();
}
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeByte(state);
if(texture != -1){
buf.writeByte(texture);
}
}
public static class Handler implements IMessageHandler<TEDoorAnimationPacket, IMessage> {
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(TEDoorAnimationPacket m, MessageContext ctx) {
TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z);
if(te instanceof IAnimatedDoor){
((IAnimatedDoor) te).handleNewState(m.state);
((IAnimatedDoor) te).setTextureState(m.texture);
}
return null;
}
}
}

View File

@ -0,0 +1,101 @@
package com.hbm.render;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
import com.hbm.render.loader.HFRWavefrontObject;
import com.hbm.render.loader.S_GroupObject;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.client.model.obj.GroupObject;
import net.minecraftforge.client.model.obj.WavefrontObject;
public class WavefrontObjDisplayList implements IModelCustom {
public List<Pair<String, Integer>> nameToCallList = new ArrayList<>();
public WavefrontObjDisplayList(WavefrontObject obj) {
Tessellator tes = Tessellator.instance;
for(GroupObject g : obj.groupObjects){
int list = GL11.glGenLists(1);
GL11.glNewList(list, GL11.GL_COMPILE);
tes.startDrawing(g.glDrawingMode);
g.render(tes);
tes.draw();
GL11.glEndList();
nameToCallList.add(Pair.of(g.name, list));
}
}
public WavefrontObjDisplayList(HFRWavefrontObject obj) {
for(S_GroupObject g : obj.groupObjects){
int list = GL11.glGenLists(1);
GL11.glNewList(list, GL11.GL_COMPILE);
g.render();
GL11.glEndList();
nameToCallList.add(Pair.of(g.name, list));
}
}
public int getListForName(String name){
for(Pair<String, Integer> p : nameToCallList){
if(p.getLeft().equalsIgnoreCase(name)){
return p.getRight();
}
}
return 0;
}
@Override
public String getType() {
return "obj_list";
}
@Override
public void renderAll() {
for(Pair<String, Integer> p : nameToCallList)
GL11.glCallList(p.getRight());
}
@Override
public void renderOnly(String... groupNames) {
for(Pair<String, Integer> p : nameToCallList){
for(String name : groupNames){
if(p.getLeft().equalsIgnoreCase(name)){
GL11.glCallList(p.getRight());
break;
}
}
}
}
@Override
public void renderPart(String partName) {
for(Pair<String, Integer> p : nameToCallList){
if(p.getLeft().equalsIgnoreCase(partName)){
GL11.glCallList(p.getRight());
}
}
}
@Override
public void renderAllExcept(String... excludedGroupNames) {
for(Pair<String, Integer> p : nameToCallList){
boolean skip = false;
for(String name : excludedGroupNames){
if(p.getLeft().equalsIgnoreCase(name)){
skip = true;
break;
}
}
if(!skip){
GL11.glCallList(p.getRight());
}
}
}
}

View File

@ -0,0 +1,124 @@
package com.hbm.render.tileentity;
import java.nio.DoubleBuffer;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
import com.hbm.animloader.AnimatedModel;
import com.hbm.animloader.Animation;
import com.hbm.animloader.AnimationWrapper;
import com.hbm.animloader.AnimationWrapper.EndResult;
import com.hbm.animloader.AnimationWrapper.EndType;
import com.hbm.blocks.BlockDummyable;
import com.hbm.render.WavefrontObjDisplayList;
import com.hbm.tileentity.DoorDecl;
import com.hbm.tileentity.TileEntityDoorGeneric;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
public class RenderDoorGeneric extends TileEntitySpecialRenderer {
private static DoubleBuffer buf = null;
private static final float[] tran = new float[3];
private static final float[] orig = new float[3];
private static final float[] rot = new float[3];
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks){
TileEntityDoorGeneric te = (TileEntityDoorGeneric) tile;
if(buf == null){
buf = GLAllocation.createDirectByteBuffer(8*4).asDoubleBuffer();
}
DoorDecl door = te.getDoorType();
GL11.glPushMatrix();
GL11.glTranslated(x+0.5, y, z+0.5);
switch(te.getBlockMetadata() - BlockDummyable.offset) {
case 2: GL11.glRotatef(0+90, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(90+90, 0F, 1F, 0F); break;
case 3: GL11.glRotatef(180+90, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(270+90, 0F, 1F, 0F); break;
}
door.doOffsetTransform();
double[][] clip = door.getClippingPlanes();
for(int i = 0; i < clip.length; i ++){
GL11.glEnable(GL11.GL_CLIP_PLANE0+i);
buf.put(clip[i]);
buf.rewind();
GL11.glClipPlane(GL11.GL_CLIP_PLANE0+i, buf);
}
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LIGHTING);
AnimatedModel animModel = door.getAnimatedModel();
if(animModel != null){
Animation anim = door.getAnim();
bindTexture(door.getTextureForPart(""));
long time = System.currentTimeMillis();
long startTime = te.state > 1 ? te.animStartTime : time;
boolean reverse = te.state == 1 || te.state == 2;
AnimationWrapper w = new AnimationWrapper(startTime, anim).onEnd(new EndResult(EndType.STAY));
if(reverse)
w.reverse();
animModel.controller.setAnim(w);
animModel.renderAnimated(System.currentTimeMillis());
} else {
WavefrontObjDisplayList model = door.getModel();
long ms = System.currentTimeMillis()-te.animStartTime;
float openTicks = MathHelper.clamp_float(te.state == 2 || te.state == 0 ? door.timeToOpen()*50-ms : ms, 0, door.timeToOpen()*50)*0.02F;
for(Pair<String, Integer> p : model.nameToCallList){
if(!door.doesRender(p.getLeft(), false))
continue;
GL11.glPushMatrix();
bindTexture(door.getTextureForPart(p.getLeft()));
doPartTransform(door, p.getLeft(), openTicks, false);
GL11.glCallList(p.getRight());
for(String name : door.getChildren(p.getLeft())){
if(!door.doesRender(name, true))
continue;
GL11.glPushMatrix();
bindTexture(door.getTextureForPart(name));
doPartTransform(door, name, openTicks, true);
model.renderPart(name);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
}
for(int i = 0; i < clip.length; i ++){
GL11.glDisable(GL11.GL_CLIP_PLANE0+i);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
public void doPartTransform(DoorDecl door, String name, float openTicks, boolean child){
door.getTranslation(name, openTicks, child, tran);
door.getOrigin(name, orig);
door.getRotation(name, openTicks, rot);
GL11.glTranslated(orig[0], orig[1], orig[2]);
if(rot[0] != 0)
GL11.glRotated(rot[0], 1, 0, 0);
if(rot[1] != 0)
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]);
}
}

View File

@ -0,0 +1,219 @@
package com.hbm.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.animloader.AnimatedModel;
import com.hbm.animloader.Animation;
import com.hbm.main.ResourceManager;
import com.hbm.render.WavefrontObjDisplayList;
import com.hbm.util.BobMathUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
public abstract class DoorDecl {
public static final DoorDecl TRANSITION_SEAL = new DoorDecl(){
@Override
public String getOpenSoundStart() {
return "hbm:door.TransitionSealOpen";
};
@Override
public float getSoundVolume(){
return 6;
}
@Override
@SideOnly(Side.CLIENT)
public void getTranslation(String partName, float openTicks, boolean child, float[] trans) {
if(!partName.equals("base")){
set(trans, 0, 3.5F*getNormTime(openTicks), 0);
} else {
super.getTranslation(partName, openTicks, child, trans);
}
};
@Override
@SideOnly(Side.CLIENT)
public void doOffsetTransform() {
GL11.glTranslated(0, 0, 0.5);
};
@Override
@SideOnly(Side.CLIENT)
public double[][] getClippingPlanes() {
return super.getClippingPlanes();
};
@Override
public int timeToOpen() {
return 480;
};
@Override
public int[][] getDoorOpenRanges(){
//3 is tall
//4 is wide
return new int[][]{{-9, 2, 0, 20, 20, 1}};
}
@Override
public int[] getDimensions(){
return new int[]{23, 0, 0, 0, 13, 12};
}
@Override
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open) {
return super.getBlockBound(x, y, z, open);
};
@Override
@SideOnly(Side.CLIENT)
public ResourceLocation getTextureForPart(String partName){
return ResourceManager.transition_seal_tex;
}
@Override
@SideOnly(Side.CLIENT)
public Animation getAnim() {
return ResourceManager.transition_seal_anim;
};
@Override
@SideOnly(Side.CLIENT)
public AnimatedModel getAnimatedModel() {
return ResourceManager.transition_seal;
};
@Override
@SideOnly(Side.CLIENT)
public WavefrontObjDisplayList getModel(){
return null;
}
};
//Format: x, y, z, tangent amount 1 (how long the door would be if it moved up), tangent amount 2 (door places blocks in this direction), axis (0-x, 1-y, 2-z)
public abstract int[][] getDoorOpenRanges();
public abstract int[] getDimensions();
public float getDoorRangeOpenTime(int ticks, int idx){
return getNormTime(ticks);
}
public int timeToOpen(){
return 20;
}
public float getNormTime(float time){
return getNormTime(time, 0, timeToOpen());
}
public float getNormTime(float time, float min, float max){
return BobMathUtil.remap01_clamp(time, min, max);
}
@SideOnly(Side.CLIENT)
public abstract ResourceLocation getTextureForPart(String partName);
@SideOnly(Side.CLIENT)
public abstract WavefrontObjDisplayList getModel();
@SideOnly(Side.CLIENT)
public AnimatedModel getAnimatedModel(){
return null;
}
@SideOnly(Side.CLIENT)
public Animation getAnim(){
return null;
}
@SideOnly(Side.CLIENT)
public void getTranslation(String partName, float openTicks, boolean child, float[] trans){
set(trans, 0, 0, 0);
}
@SideOnly(Side.CLIENT)
public void getRotation(String partName, float openTicks, float[] rot){
set(rot, 0, 0, 0);
}
@SideOnly(Side.CLIENT)
public void getOrigin(String partName, float[] orig){
set(orig, 0, 0, 0);
}
@SideOnly(Side.CLIENT)
public boolean doesRender(String partName, boolean child){
return true;
}
private static final String[] nothing = new String[]{};
@SideOnly(Side.CLIENT)
public String[] getChildren(String partName){
return nothing;
}
@SideOnly(Side.CLIENT)
public double[][] getClippingPlanes(){
return new double[][]{};
}
@SideOnly(Side.CLIENT)
public void doOffsetTransform(){
}
public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open){
return open ? AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0) : AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}
public boolean isLadder(boolean open){
return false;
}
public String getOpenSoundLoop(){
return null;
}
//Hack
public String getSoundLoop2(){
return null;
}
public String getCloseSoundLoop(){
return getOpenSoundLoop();
}
public String getOpenSoundStart(){
return null;
}
public String getCloseSoundStart(){
return getOpenSoundStart();
}
public String getOpenSoundEnd(){
return null;
}
public String getCloseSoundEnd(){
return getOpenSoundEnd();
}
public float getSoundVolume(){
return 1;
}
public float[] set(float[] f, float x, float y, float z){
f[0] = x;
f[1] = y;
f[2] = z;
return f;
};
}

View File

@ -0,0 +1,380 @@
package com.hbm.tileentity;
import java.util.HashSet;
import java.util.Set;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.generic.BlockDoorGeneric;
import com.hbm.interfaces.IAnimatedDoor;
import com.hbm.lib.Library;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEDoorAnimationPacket;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.machine.TileEntityLockableBase;
import com.hbm.util.Tuple.Triplet;
import com.hbm.util.fauxpointtwelve.BlockPos;
import com.hbm.util.fauxpointtwelve.Rotation;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAnimatedDoor {
//0: closed, 1: open, 2: closing, 3: opening
public byte state = 0;
protected DoorDecl doorType;
public int openTicks = 0;
public long animStartTime = 0;
public int redstonePower;
public boolean shouldUseBB = false;
public Set<BlockPos> activatedBlocks = new HashSet<>(4);
private AudioWrapper audio;
private AudioWrapper audio2;
@Override
public void updateEntity(){
if(state == 3) {
openTicks++;
if(openTicks >= getDoorType().timeToOpen()) {
openTicks = getDoorType().timeToOpen();
}
} else if(state == 2) {
openTicks--;
if(openTicks <= 0) {
openTicks = 0;
}
}
if(worldObj.isRemote) {
} else {
BlockPos pos = new BlockPos(this);
int[][] ranges = getDoorType().getDoorOpenRanges();
ForgeDirection dir = ForgeDirection.getOrientation(getBlockMetadata() - BlockDummyable.offset);
if(state == 3) {
for(int i = 0; i < ranges.length; i++) {
int[] range = ranges[i];
BlockPos startPos = new BlockPos(range[0], range[1], range[2]);
float time = getDoorType().getDoorRangeOpenTime(openTicks, i);
for(int j = 0; j < Math.abs(range[3]); j++) {
if((float)j / (Math.abs(range[3] - 1)) > time)
break;
for(int k = 0; k < range[4]; k++) {
BlockPos add = new BlockPos(0, 0, 0);
switch(range[5]){
case 0: add = new BlockPos(0, k, (int)Math.signum(range[3]) * j); break;
case 1: add = new BlockPos(k, (int)Math.signum(range[3]) * j, 0); break;
case 2: add = new BlockPos((int)Math.signum(range[3]) * j, k, 0); break;
}
Rotation r = Rotation.getBlockRotation(dir);
if(dir == Library.POS_X || dir == Library.NEG_X)
r = r.add(Rotation.CLOCKWISE_180);
BlockPos finalPos = startPos.add(add).rotate(r).add(pos);
if(finalPos.equals(pos)) {
this.shouldUseBB = false;
} else {
((BlockDummyable)getBlockType()).removeExtra(worldObj, finalPos.getX(), finalPos.getY(), finalPos.getZ());
}
}
}
}
} else if(state == 2){
for(int i = 0; i < ranges.length; i++) {
int[] range = ranges[i];
BlockPos startPos = new BlockPos(range[0], range[1], range[2]);
float time = getDoorType().getDoorRangeOpenTime(openTicks, i);
for(int j = Math.abs(range[3])-1; j >= 0; j--) {
if((float)j / (Math.abs(range[3] - 1)) < time)
break;
for(int k = 0; k < range[4]; k++) {
BlockPos add = new BlockPos(0, 0, 0);
switch(range[5]){
case 0: add = new BlockPos(0, k, (int)Math.signum(range[3]) * j); break;
case 1: add = new BlockPos(k, (int)Math.signum(range[3]) * j, 0); break;
case 2: add = new BlockPos((int)Math.signum(range[3]) * j, k, 0); break;
}
Rotation r = Rotation.getBlockRotation(dir);
if(dir == Library.POS_X || dir == Library.NEG_X)
r = r.add(Rotation.CLOCKWISE_180);
BlockPos finalPos = startPos.add(add).rotate(r).add(pos);
if(finalPos.equals(pos)) {
this.shouldUseBB = false;
} else {
((BlockDummyable)getBlockType()).removeExtra(worldObj, finalPos.getX(), finalPos.getY(), finalPos.getZ());
}
}
}
}
}
if(state == 3 && openTicks == getDoorType().timeToOpen()) {
state = 1;
}
if(state == 2 && openTicks == 0) {
state = 0;
}
PacketDispatcher.wrapper.sendToAllAround(new TEDoorAnimationPacket(xCoord, yCoord, zCoord, state, (byte)(shouldUseBB ? 1 : 0)), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 100));
if(redstonePower == -1 && state == 0){
tryToggle(-1);
} else if(redstonePower > 0 && state == 1){
tryToggle(-1);
}
if(redstonePower == -1){
redstonePower = 0;
}
}
}
@Override
public void onChunkUnload() {
if(audio != null) {
audio.stopSound();
audio = null;
}
if(audio2 != null) {
audio2.stopSound();
audio2 = null;
}
}
public DoorDecl getDoorType(){
if(this.doorType == null)
this.doorType = ((BlockDoorGeneric)this.getBlockType()).type;
return this.doorType;
}
public boolean tryToggle(EntityPlayer player){
System.out.println("start");
if(state == 0 && redstonePower > 0){
System.out.println("red power > 0");
//Redstone "power locks" doors, just like minecraft iron doors
return false;
}
if(this.state == 0) {
if(!worldObj.isRemote && canAccess(player)) {
this.state = 3;
System.out.println("opening");
}
return true;
} else if(this.state == 1) {
if(!worldObj.isRemote && canAccess(player)) {
this.state = 2;
System.out.println("closing");
}
return true;
}
return false;
}
public boolean tryToggle(int passcode){
if(this.isLocked() && passcode != this.lock)
return false;
if(this.state == 0) {
if(!worldObj.isRemote) {
this.state = 3;
}
return true;
} else if(this.state == 1) {
if(!worldObj.isRemote) {
this.state = 2;
}
return true;
}
return false;
}
@Override
public void open(){
if(state == 0)
toggle();
}
@Override
public void close(){
if(state == 1)
toggle();
}
@Override
public DoorState getState(){
return DoorState.values()[state];
}
@Override
public void toggle(){
if(state == 0) {
state = 3;
} else if(state == 1) {
state = 2;
}
}
//TODO: sound loops
@Override
@SideOnly(Side.CLIENT)
public void handleNewState(byte state){
if(this.state != state) {
if(this.state == 0 && state == 3){
if(audio == null){
//audio = MainRegistry.proxy.getLoopedSoundStartStop(world, doorType.getOpenSoundLoop(), doorType.getOpenSoundStart(), doorType.getOpenSoundEnd(), SoundCategory.BLOCKS, pos.getX(), pos.getY(), pos.getZ(), doorType.getSoundVolume(), 1);
//audio.startSound();
}
if(audio2 == null && getDoorType().getSoundLoop2() != null){
//audio2 = MainRegistry.proxy.getLoopedSoundStartStop(world, doorType.getSoundLoop2(), null, null, SoundCategory.BLOCKS, pos.getX(), pos.getY(), pos.getZ(), doorType.getSoundVolume(), 1);
//audio2.startSound();
}
}
if(this.state == 1 && state == 2){
if(audio == null){
//audio = MainRegistry.proxy.getLoopedSoundStartStop(world, doorType.getCloseSoundLoop(), doorType.getCloseSoundStart(), doorType.getCloseSoundEnd(), SoundCategory.BLOCKS, pos.getX(), pos.getY(), pos.getZ(), doorType.getSoundVolume(), 1);
//audio.startSound();
}
if(audio2 == null && getDoorType().getSoundLoop2() != null){
//audio2 = MainRegistry.proxy.getLoopedSoundStartStop(world, doorType.getSoundLoop2(), null, null, SoundCategory.BLOCKS, pos.getX(), pos.getY(), pos.getZ(), doorType.getSoundVolume(), 1);
//audio2.startSound();
}
}
if((this.state == 3 && state == 1) || (this.state == 2 && state == 0)){
if(audio != null){
audio.stopSound();
audio = null;
}
if(audio2 != null){
audio2.stopSound();
audio2 = null;
}
}
this.state = state;
if(state > 1)
animStartTime = System.currentTimeMillis();
}
}
//Ah yes piggy backing on this packet
@Override
public void setTextureState(byte tex){
if(tex > 0)
shouldUseBB = true;
else
shouldUseBB = false;
}
@Override
public AxisAlignedBB getRenderBoundingBox(){
return INFINITE_EXTENT_AABB;
}
@Override
public double getMaxRenderDistanceSquared(){
return 65536D;
}
@Override
public void readFromNBT(NBTTagCompound tag){
this.state = tag.getByte("state");
this.openTicks = tag.getInteger("openTicks");
this.animStartTime = tag.getInteger("animStartTime");
this.redstonePower = tag.getInteger("redstoned");
this.shouldUseBB = tag.getBoolean("shouldUseBB");
NBTTagCompound activatedBlocks = tag.getCompoundTag("activatedBlocks");
this.activatedBlocks.clear();
for(int i = 0; i < activatedBlocks.func_150296_c().size()/3; i ++){
this.activatedBlocks.add(new BlockPos(activatedBlocks.getInteger("x"+i), activatedBlocks.getInteger("y"+i), activatedBlocks.getInteger("z"+i)));
}
super.readFromNBT(tag);
}
@Override
public void writeToNBT(NBTTagCompound tag){
super.writeToNBT(tag);
tag.setByte("state", state);
tag.setInteger("openTicks", openTicks);
tag.setLong("animStartTime", animStartTime);
tag.setInteger("redstoned", redstonePower);
tag.setBoolean("shouldUseBB", shouldUseBB);
NBTTagCompound activatedBlocks = new NBTTagCompound();
int i = 0;
for(BlockPos p : this.activatedBlocks){
activatedBlocks.setInteger("x"+i, p.getX());
activatedBlocks.setInteger("y"+i, p.getY());
activatedBlocks.setInteger("z"+i, p.getZ());
i++;
}
tag.setTag("activatedBlocks", activatedBlocks);
}
@Override
public void validate(){
super.validate();
}
@Override
public void invalidate(){
super.invalidate();
if(audio != null) {
audio.stopSound();
audio = null;
}
if(audio2 != null) {
audio2.stopSound();
audio2 = null;
}
}
public void updateRedstonePower(int x, int y, int z){
//Drillgon200: Best I could come up with without having to use dummy tile entities
BlockPos pos = new BlockPos(x, y, z);
boolean powered = worldObj.isBlockIndirectlyGettingPowered(x, y, z);
boolean contained = activatedBlocks.contains(pos);
if(!contained && powered){
activatedBlocks.add(pos);
if(redstonePower == -1){
redstonePower = 0;
}
redstonePower++;
} else if(contained && !powered){
activatedBlocks.remove(pos);
redstonePower--;
if(redstonePower == 0){
redstonePower = -1;
}
}
}
}

View File

@ -189,6 +189,8 @@ public class TileMappings {
put(TileEntityLoot.class, "tileentity_ntm_loot");
put(TileEntityBobble.class, "tileentity_ntm_bobblehead");
put(TileEntityDoorGeneric.class, "tileentity_ntm_door");
put(TileEntityProxyInventory.class, "tileentity_proxy_inventory");
put(TileEntityProxyEnergy.class, "tileentity_proxy_power");
put(TileEntityProxyCombo.class, "tileentity_proxy_combo");
@ -240,6 +242,7 @@ public class TileMappings {
put(TileEntityDeuteriumExtractor.class, "tileentity_deuterium_extractor");
put(TileEntityDeuteriumTower.class, "tileentity_deuterium_tower");
put(TileEntityMachineLiquefactor.class, "tileentity_liquefactor");
put(TileEntityMachineSolidifier.class, "tileentity_solidifier");
put(TileEntityMachineOilWell.class, "tileentity_derrick");
put(TileEntityMachinePumpjack.class, "tileentity_machine_pumpjack");

View File

@ -9,6 +9,8 @@ import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.FluidTypeCombustible;
import com.hbm.inventory.fluid.FluidTypeCombustible.FuelGrade;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
@ -134,23 +136,32 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
return getHEFromFuel() > 0;
}
public static final HashMap<FluidType, Integer> fuels = new HashMap();
public static HashMap<FuelGrade, Double> fuelEfficiency = new HashMap();
static {
fuels.put(Fluids.HYDROGEN, 10);
fuels.put(Fluids.DIESEL, 500);
fuels.put(Fluids.PETROIL, 300);
fuels.put(Fluids.BIOFUEL, 400);
fuels.put(Fluids.GASOLINE, 1500);
fuels.put(Fluids.NITAN, 5000);
fuels.put(Fluids.LPG, 450);
fuels.put(Fluids.ETHANOL, 200);
fuelEfficiency.put(FuelGrade.LOW, 0.5D);
fuelEfficiency.put(FuelGrade.MEDIUM, 1.0D);
fuelEfficiency.put(FuelGrade.HIGH, 1.0D);
fuelEfficiency.put(FuelGrade.AERO, 0.1D);
}
public int getHEFromFuel() {
FluidType type = tank.getTankType();
Integer value = fuels.get(type);
return value != null ? value : 0;
public long getHEFromFuel() {
return getHEFromFuel(tank.getTankType());
}
public static long getHEFromFuel(FluidType type) {
if(type instanceof FluidTypeCombustible) {
FluidTypeCombustible fuel = (FluidTypeCombustible) type;
FuelGrade grade = fuel.getGrade();
double efficiency = fuelEfficiency.containsKey(grade) ? fuelEfficiency.get(grade) : 0;
if(fuel.getGrade() != FuelGrade.LOW) {
return (long) (fuel.getCombustionEnergy() / 1000L * efficiency);
}
}
return 0;
}
public void generate() {

View File

@ -9,7 +9,9 @@ import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.FluidTypeCombustible;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.FluidTypeCombustible.FuelGrade;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
@ -257,27 +259,29 @@ public class TileEntityMachineSeleniumEngine extends TileEntity implements ISide
return getHEFromFuel() > 0;
}
public static final HashMap<FluidType, Integer> fuels = new HashMap();
public static HashMap<FuelGrade, Double> fuelEfficiency = new HashMap();
static {
fuels.put(Fluids.SMEAR, 50);
fuels.put(Fluids.HEATINGOIL, 75);
fuels.put(Fluids.HYDROGEN, 5);
fuels.put(Fluids.DIESEL, 225);
fuels.put(Fluids.KEROSENE, 300);
fuels.put(Fluids.RECLAIMED, 100);
fuels.put(Fluids.PETROIL, 125);
fuels.put(Fluids.BIOFUEL, 200);
fuels.put(Fluids.GASOLINE, 700);
fuels.put(Fluids.NITAN, 2500);
fuels.put(Fluids.LPG, 200);
fuels.put(Fluids.ETHANOL, 75);
fuelEfficiency.put(FuelGrade.LOW, 1.0D);
fuelEfficiency.put(FuelGrade.MEDIUM, 0.75D);
fuelEfficiency.put(FuelGrade.HIGH, 0.5D);
fuelEfficiency.put(FuelGrade.AERO, 0.05D);
}
public int getHEFromFuel() {
FluidType type = tank.getTankType();
Integer value = fuels.get(type);
return value != null ? value : 0;
public long getHEFromFuel() {
return getHEFromFuel(tank.getTankType());
}
public static long getHEFromFuel(FluidType type) {
if(type instanceof FluidTypeCombustible) {
FluidTypeCombustible fuel = (FluidTypeCombustible) type;
FuelGrade grade = fuel.getGrade();
double efficiency = fuelEfficiency.containsKey(grade) ? fuelEfficiency.get(grade) : 0;
return (long) (fuel.getCombustionEnergy() / 1000L * efficiency);
}
return 0;
}
public void generate() {

View File

@ -1,5 +1,6 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.interfaces.IFluidAcceptor;
@ -164,38 +165,35 @@ public class TileEntityMachineSolidifier extends TileEntityMachineBase implement
@Override
public void setFillstate(int fill, int index) {
// TODO Auto-generated method stub
tank.setFill(fill);
}
@Override
public void setFluidFill(int fill, FluidType type) {
// TODO Auto-generated method stub
if(type == tank.getTankType())
tank.setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
// TODO Auto-generated method stub
tank.setTankType(type);
}
@Override
public List<FluidTank> getTanks() {
// TODO Auto-generated method stub
return null;
List<FluidTank> tanks = new ArrayList();
tanks.add(tank);
return tanks;
}
@Override
public int getFluidFill(FluidType type) {
// TODO Auto-generated method stub
return 0;
return tank.getTankType() == type ? tank.getFill() : 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
// TODO Auto-generated method stub
return 0;
return tank.getTankType() == type ? tank.getMaxFill() : 0;
}
AxisAlignedBB bb = null;

View File

@ -8,6 +8,7 @@ import com.hbm.entity.particle.EntitySSmokeFX;
import com.hbm.entity.particle.EntityTSmokeFX;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
@ -32,6 +33,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@Spaghetti("a")
public class TileEntityMachineTurbofan extends TileEntity implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];

View File

@ -9,11 +9,24 @@ import java.util.List;
import javax.annotation.Nonnegative;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
public class BobMathUtil {
public static Vec3 interpVec(Vec3 vec1, Vec3 vec2, float interp) {
return Vec3.createVectorHelper(
interp(vec1.xCoord, vec2.xCoord, interp),
interp(vec1.yCoord, vec2.yCoord, interp),
interp(vec1.zCoord, vec2.zCoord, interp)
);
}
public static double interp(double x, double y, float interp) {
return x + (y - x) * interp;
}
public static double getAngleFrom2DVecs(double x1, double z1, double x2, double z2) {
double upper = x1 * x2 + z1 * z2;
@ -46,6 +59,14 @@ public class BobMathUtil {
return ((num - min1) / (max1 - min1)) * (max2 - min2) + min2;
}
public static float remap01(float num, float min1, float max1){
return (num - min1) / (max1 - min1);
}
public static float remap01_clamp(float num, float min1, float max1){
return MathHelper.clamp_float((num - min1) / (max1 - min1), 0, 1);
}
public static ForgeDirection[] getShuffledDirs() {
ForgeDirection[] dirs = new ForgeDirection[6];

View File

@ -0,0 +1,58 @@
package com.hbm.util.fauxpointtwelve;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
/**
* Adjusted code from MC 1.12 (com.minecraft.util.math.BlockPos)
*/
public class BlockPos {
private final int x;
private final int y;
private final int z;
public BlockPos(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public BlockPos(TileEntity te) {
this(te.xCoord, te.yCoord, te.zCoord);
}
public BlockPos(double x, double y, double z) {
this((int)MathHelper.floor_double(x), (int)MathHelper.floor_double(y), (int)MathHelper.floor_double(z));
}
public BlockPos add(double x, double y, double z) {
return x == 0.0D && y == 0.0D && z == 0.0D ? this : new BlockPos((double) this.getX() + x, (double) this.getY() + y, (double) this.getZ() + z);
}
public BlockPos add(BlockPos vec) {
return this.add(vec.getX(), vec.getY(), vec.getZ());
}
public BlockPos rotate(Rotation rotationIn) {
switch(rotationIn) {
case NONE:
default: return this;
case CLOCKWISE_90: return new BlockPos(-this.getZ(), this.getY(), this.getX());
case CLOCKWISE_180: return new BlockPos(-this.getX(), this.getY(), -this.getZ());
case COUNTERCLOCKWISE_90: return new BlockPos(this.getZ(), this.getY(), -this.getX());
}
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public int getZ() {
return this.z;
}
}

View File

@ -0,0 +1,61 @@
package com.hbm.util.fauxpointtwelve;
import com.hbm.interfaces.Spaghetti;
import net.minecraftforge.common.util.ForgeDirection;
public enum Rotation {
NONE(), CLOCKWISE_90(), CLOCKWISE_180(), COUNTERCLOCKWISE_90();
/**
* Verbatim code from MC 1.12 (net.minecraft.util.Rotation)
* @param rotation
* @return
*/
@Spaghetti("thanks for the cool code, mojang")
public Rotation add(Rotation rotation) {
switch(rotation) {
case CLOCKWISE_180:
switch(this) {
case NONE: return CLOCKWISE_180;
case CLOCKWISE_90: return COUNTERCLOCKWISE_90;
case CLOCKWISE_180: return NONE;
case COUNTERCLOCKWISE_90: return CLOCKWISE_90;
}
case COUNTERCLOCKWISE_90:
switch(this) {
case NONE: return COUNTERCLOCKWISE_90;
case CLOCKWISE_90: return NONE;
case CLOCKWISE_180: return CLOCKWISE_90;
case COUNTERCLOCKWISE_90: return CLOCKWISE_180;
}
case CLOCKWISE_90:
switch(this) {
case NONE: return CLOCKWISE_90;
case CLOCKWISE_90: return CLOCKWISE_180;
case CLOCKWISE_180: return COUNTERCLOCKWISE_90;
case COUNTERCLOCKWISE_90: return NONE;
}
default: return this;
}
}
/**
* Adjusted code from NTM 1.12 (com.hbm.lib.ForgeDirection)
* @param dir
* @return
*/
public static Rotation getBlockRotation(ForgeDirection dir){
switch(dir) {
case NORTH: return Rotation.NONE;
case SOUTH: return Rotation.CLOCKWISE_180;
case EAST: return Rotation.COUNTERCLOCKWISE_90;
case WEST: return Rotation.CLOCKWISE_90;
default: return Rotation.NONE;
}
}
}

View File

@ -452,6 +452,7 @@ hbm.key.reload=Nachladen
hbmfluid.acid=Wasserstoffperoxid
hbmfluid.amat=Antimaterie
hbmfluid.aromatics=Aromatische Kohlenwasserstoffe
hbmfluid.aschrab=Antischrabidium
hbmfluid.balefire=BF-Raketentreibstoff
hbmfluid.biofuel=Biodiesel
@ -459,10 +460,13 @@ hbmfluid.biogas=Biogas
hbmfluid.bitumen=Bitumen
hbmfluid.carbondioxide=Kohlenstoffdioxid
hbmfluid.coolant=Kühlflüssigkeit
hbmfluid.coaloil=Kohleöl
hbmfluid.crackoil=Crack-Öl
hbmfluid.cryogel=Kryogel
hbmfluid.death=Osmiridiumlösung
hbmfluid.deuterium=Deuterium
hbmfluid.diesel=Diesel
hbmfluid.diesel_crack=Crackdiesel
hbmfluid.ethanol=Ethanol
hbmfluid.fracksol=Frackinglösung
hbmfluid.gas=Erdgas
@ -471,16 +475,19 @@ hbmfluid.heatingoil=Heizöl
hbmfluid.heavyoil=Schweröl
hbmfluid.heavywater=Schweres Wasser
hbmfluid.helium3=Helium-3
hbmfluid.hotcrackoil=Heißes Crack-Öl
hbmfluid.hotoil=Heißes Rohöl
hbmfluid.hotsteam=Dichter Dampf
hbmfluid.hydrogen=Flüssiger Wasserstoff
hbmfluid.kerosene=Kerosin
hbmfluid.lava=Lava
hbmfluid.lightoil=Leichtöl
hbmfluid.lightoil_crack=Crack-Leichtöl
hbmfluid.lpg=LPG
hbmfluid.lubricant=Schmiermittel
hbmfluid.mercury=Quecksilber
hbmfluid.naphtha=Mitteldestillat
hbmfluid.naphtha_crack=Crack-Mitteldestillat
hbmfluid.nitan=NITAN© 100 Oktan Supertreibstoff
hbmfluid.none=Nichts
hbmfluid.oil=Rohöl
@ -505,6 +512,7 @@ hbmfluid.superhotsteam=Superverdichteter Dampf
hbmfluid.tritium=Tritium
hbmfluid.uf6=Uranhexafluorid
hbmfluid.ultrahotsteam=Ultraverdichteter Dampf
hbmfluid.unsaturateds=Ungesättigte Kohlenwasserstoffe
hbmfluid.wastefluid=Flüssiger Atommüll
hbmfluid.wastegas=Gasförmiger Atommüll
hbmfluid.water=Wasser

View File

@ -597,17 +597,21 @@ hbm.key.reload=Reload
hbmfluid.acid=Hydrogen Peroxide
hbmfluid.amat=Antimatter
hbmfluid.aromatics=Aromatic Hydrocarbons
hbmfluid.aschrab=Antischrabidium
hbmfluid.balefire=BF Rocket Fuel
hbmfluid.biofuel=Biofuel
hbmfluid.biogas=Biogas
hbmfluid.bitumen=Bitumen
hbmfluid.carbondioxide=Carbon Dioxide
hbmfluid.coaloil=Coal Oil
hbmfluid.coolant=Coolant
hbmfluid.crackoil=Cracked Oil
hbmfluid.cryogel=Cryogel
hbmfluid.death=Osmiridic Solution
hbmfluid.deuterium=Deuterium
hbmfluid.diesel=Diesel
hbmfluid.diesel_crack=Cracked Diesel
hbmfluid.ethanol=Ethanol
hbmfluid.fracksol=Fracking Solution
hbmfluid.gas=Natural Gas
@ -616,16 +620,19 @@ hbmfluid.heatingoil=Heating Oil
hbmfluid.heavyoil=Heavy Oil
hbmfluid.heavywater=Heavy Water
hbmfluid.helium3=Helium-3
hbmfluid.hotcrackoil=Hot Cracked Oil
hbmfluid.hotoil=Hot Crude Oil
hbmfluid.hotsteam=Dense Steam
hbmfluid.hydrogen=Liquid Hydrogen
hbmfluid.kerosene=Kerosene
hbmfluid.lava=Lava
hbmfluid.lightoil=Light Oil
hbmfluid.lightoil_crack=Cracked Light Oil
hbmfluid.lpg=LPG
hbmfluid.lubricant=Engine Lubricant
hbmfluid.mercury=Mercury
hbmfluid.naphtha=Naphtha
hbmfluid.naphtha_crack=Cracked Naphtha
hbmfluid.nitan=NITAN© 100 Octane Super Fuel
hbmfluid.none=None
hbmfluid.oil=Crude Oil
@ -650,6 +657,7 @@ hbmfluid.superhotsteam=Super Dense Steam
hbmfluid.tritium=Tritium
hbmfluid.uf6=Uranium Hexafluoride
hbmfluid.ultrahotsteam=Ultra Dense Steam
hbmfluid.unsaturateds=Unsaturated Hydrocarbons
hbmfluid.wastefluid=Liquid Nuclear Waste
hbmfluid.wastegas=Gaseous Nuclear Waste
hbmfluid.water=Water

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

View File

@ -3,7 +3,7 @@
"modid": "hbm",
"name": "Hbm's Nuclear Tech",
"description": "A mod that adds weapons, nuclear themed stuff and machines",
"version":"1.0.27_X4130",
"version":"1.0.27_X4130H1",
"mcversion": "1.7.10",
"url": "",
"updateUrl": "",