Fix up some more models, register StateMappers using the right function at the right time.

This commit is contained in:
Ben Spiers committed 2016-04-27 23:40:23 +01:00
1 parent 7efa4bcdbb
commit 79d7d8b024
101 files changed
+6636 -4264

No files matched your search

@@ -96,12 +96,14 @@ public class ModelChemicalInfuser extends ModelBase
pipeAngle2.setRotationPoint(5F, 13.01F, -2F);
pipeAngle2.setTextureSize(128, 64);
pipeAngle2.mirror = true;
//TODO
setRotation(pipeAngle2, 0F, 0.7853982F, 0F);
connectorAngle = new ModelRenderer(this, 40, 45);
connectorAngle.addBox(0F, 0F, 0F, 2, 8, 2);
connectorAngle.setRotationPoint(-1F, 13F, 5F);
connectorAngle.setTextureSize(128, 64);
connectorAngle.mirror = true;
//TODO
setRotation(connectorAngle, -0.4886922F, 0F, 0F);
pipe2 = new ModelRenderer(this, 40, 35);
pipe2.addBox(0F, 0F, 0F, 1, 6, 4);
@@ -192,30 +194,35 @@ public class ModelChemicalInfuser extends ModelBase
pipeAngle1.setRotationPoint(-5F, 13.01F, -2F);
pipeAngle1.setTextureSize(128, 64);
pipeAngle1.mirror = true;
//TODO
setRotation(pipeAngle1, 0F, -0.7853982F, 0F);
exhaust4 = new ModelRenderer(this, 0, 9);
exhaust4.addBox(0F, 0F, 0F, 1, 1, 1);
exhaust4.setRotationPoint(-1.33F, 11.5F, -6.2F);
exhaust4.setTextureSize(128, 64);
exhaust4.mirror = true;
//TODO
setRotation(exhaust4, 0.3490659F, 0F, 0F);
exhaust3 = new ModelRenderer(this, 0, 9);
exhaust3.addBox(0F, 0F, 0F, 1, 1, 1);
exhaust3.setRotationPoint(-3F, 11.5F, -6.2F);
exhaust3.setTextureSize(128, 64);
exhaust3.mirror = true;
//TODO
setRotation(exhaust3, 0.3490659F, 0F, 0F);
exhaust2 = new ModelRenderer(this, 0, 9);
exhaust2.addBox(0F, 0F, 0F, 1, 1, 1);
exhaust2.setRotationPoint(2F, 11.5F, -6.2F);
exhaust2.setTextureSize(128, 64);
exhaust2.mirror = true;
//TODO
setRotation(exhaust2, 0.3490659F, 0F, 0F);
exhaust1 = new ModelRenderer(this, 0, 9);
exhaust1.addBox(0F, 0F, 0F, 1, 1, 1);
exhaust1.setRotationPoint(0.33F, 11.5F, -6.2F);
exhaust1.setTextureSize(128, 64);
exhaust1.mirror = true;
//TODO
setRotation(exhaust1, 0.3490659F, 0F, 0F);
}
@@ -66,6 +66,7 @@ public class ModelChemicalWasher extends ModelBase
pipe2b.setRotationPoint(-3.49F, 14F, -3.5F);
pipe2b.setTextureSize(128, 64);
pipe2b.mirror = true;
//TODO
setRotation(pipe2b, 0.837758F, 0F, 0F);
portRight = new ModelRenderer(this, 48, 0);
portRight.addBox(0F, 0F, 0F, 1, 8, 8);
@@ -108,6 +109,7 @@ public class ModelChemicalWasher extends ModelBase
pipe2.setRotationPoint(-2.51F, 14F, -3.5F);
pipe2.setTextureSize(128, 64);
pipe2.mirror = true;
//TODO
setRotation(pipe2, 0.837758F, 0F, 0F);
tankLeft = new ModelRenderer(this, 0, 36);
tankLeft.addBox(0F, 0F, 0F, 7, 10, 8);
@@ -144,6 +146,7 @@ public class ModelChemicalWasher extends ModelBase
tubeLeft1.setRotationPoint(-6F, 8.5F, 4F);
tubeLeft1.setTextureSize(128, 64);
tubeLeft1.mirror = true;
//TODO
setRotation(tubeLeft1, 0.6806784F, 0F, 0F);
tubeLeft2 = new ModelRenderer(this, 30, 36);
tubeLeft2.addBox(0F, 0F, 0F, 1, 1, 8);
@@ -156,24 +159,28 @@ public class ModelChemicalWasher extends ModelBase
tubeRight3.setRotationPoint(6F, 10F, -2.5F);
tubeRight3.setTextureSize(128, 64);
tubeRight3.mirror = true;
//TODO
setRotation(tubeRight3, 0F, 0F, 0.3141593F);
tubeRight1 = new ModelRenderer(this, 30, 39);
tubeRight1.addBox(0F, -1F, 0F, 1, 2, 1);
tubeRight1.setRotationPoint(6F, 10F, -6.5F);
tubeRight1.setTextureSize(128, 64);
tubeRight1.mirror = true;
//TODO
setRotation(tubeRight1, 0F, 0F, 0.3141593F);
tubeRight2 = new ModelRenderer(this, 30, 39);
tubeRight2.addBox(0F, -1F, 0F, 1, 2, 1);
tubeRight2.setRotationPoint(6F, 10F, -4.5F);
tubeRight2.setTextureSize(128, 64);
tubeRight2.mirror = true;
//TODO
setRotation(tubeRight2, 0F, 0F, 0.3141593F);
tubeLeft3 = new ModelRenderer(this, 30, 36);
tubeLeft3.addBox(0F, 0F, 0F, 1, 2, 1);
tubeLeft3.setRotationPoint(-6F, 9.5F, -4F);
tubeLeft3.setTextureSize(128, 64);
tubeLeft3.mirror = true;
//TODO
setRotation(tubeLeft3, 0F, 0F, -0.8203047F);
}
@@ -78,6 +78,7 @@ public class ModelElectrolyticSeparator extends ModelBase
tube2.setRotationPoint(5F, 12F, -0.5F);
tube2.setTextureSize(128, 64);
tube2.mirror = true;
//TODO
setRotation(tube2, 0F, 0F, -0.5235988F);
tube1 = new ModelRenderer(this, 0, 0);
tube1.addBox(-3F, -1F, 0F, 3, 1, 1);
@@ -446,6 +446,7 @@ public class ModelEnergyCube extends ModelBase
cube = new ModelRenderer(this, 0, 0);
cube.addBox(-8, -8, -8, 16, 16, 16);
cube.setRotationPoint(0, 0, 0);
cube.setTextureSize(32, 32);
cube.mirror = true;
}
@@ -114,6 +114,7 @@ public class ModelLaser extends ModelBase
wire.setRotationPoint(-1.5F, 11F, -0.5F);
wire.setTextureSize(64, 32);
wire.mirror = true;
//TODO
setRotation(wire, 0F, 0F, 0.1919862F);
rod3 = new ModelRenderer(this, 0, 9);
rod3.addBox(0F, 0F, 0F, 1, 5, 1);
@@ -106,6 +106,7 @@ public class ModelQuantumEntangloporter extends ModelBase
energyCubeCore.setRotationPoint(0F, 16F, 0F);
energyCubeCore.setTextureSize(128, 64);
energyCubeCore.mirror = true;
//TODO
setRotation(energyCubeCore, 0.7132579F, 0.403365F, 0.645384F);
frameEdge1 = new ModelRenderer(this, 0, 16);
frameEdge1.addBox(0F, 0F, 0F, 1, 10, 1);
@@ -50,36 +50,42 @@ public class ModelSecurityDesk extends ModelBase
led.setRotationPoint(-7F, 5F, 4F);
led.setTextureSize(128, 64);
led.mirror = true;
//TODO
setRotation(led, -0.4712389F, 0F, 0F);
monitorBack = new ModelRenderer(this, 82, 0);
monitorBack.addBox(1F, -3F, 0F, 12, 6, 1);
monitorBack.setRotationPoint(-7F, 5F, 4F);
monitorBack.setTextureSize(128, 64);
monitorBack.mirror = true;
//TODO
setRotation(monitorBack, -0.4712389F, 0F, 0F);
keyboard = new ModelRenderer(this, 64, 27);
keyboard.addBox(0F, 0F, 0F, 10, 1, 5);
keyboard.setRotationPoint(-5F, 10.5F, -6F);
keyboard.setTextureSize(128, 64);
keyboard.mirror = true;
//TODO
setRotation(keyboard, 0.0872665F, 0F, 0F);
monitor = new ModelRenderer(this, 64, 10);
monitor.addBox(0F, -5F, -2F, 14, 10, 2);
monitor.setRotationPoint(-7F, 5F, 4F);
monitor.setTextureSize(128, 64);
monitor.mirror = true;
//TODO
setRotation(monitor, -0.4712389F, 0F, 0F);
standNeck = new ModelRenderer(this, 96, 7);
standNeck.addBox(0F, -7F, -1F, 2, 7, 1);
standNeck.setRotationPoint(-1F, 10F, 6F);
standNeck.setTextureSize(128, 64);
standNeck.mirror = true;
//TODO
setRotation(standNeck, 0.0698132F, 0F, 0F);
standBase = new ModelRenderer(this, 64, 22);
standBase.addBox(0F, 0F, -4F, 8, 1, 4);
standBase.setRotationPoint(-4F, 10F, 6F);
standBase.setTextureSize(128, 64);
standBase.mirror = true;
//TODO
setRotation(standBase, 0.1047198F, 0F, 0F);
deskMiddle = new ModelRenderer(this, 0, 23);
deskMiddle.addBox(0F, 0F, 0F, 14, 1, 14);
@@ -92,6 +98,7 @@ public class ModelSecurityDesk extends ModelBase
monitorScreen.setRotationPoint(-7F, 5F, 4F);
monitorScreen.setTextureSize(128, 64);
monitorScreen.mirror = true;
//TODO
setRotation(monitorScreen, -0.4712389F, 0F, 0F);
}
@@ -106,6 +106,7 @@ public class ModelSeismicVibrator extends ModelBase
arm3.setRotationPoint(-1F, 7F, 3F);
arm3.setTextureSize(128, 64);
arm3.mirror = true;
//TODO
setRotation(arm3, -0.3665191F, 0F, 0F);
plate2 = new ModelRenderer(this, 48, 0);
plate2.addBox(0F, 0F, 0F, 4, 2, 4);
@@ -136,6 +137,7 @@ public class ModelSeismicVibrator extends ModelBase
frameBack5.setRotationPoint(7.5F, 7F, 6.49F);
frameBack5.setTextureSize(128, 64);
frameBack5.mirror = true;
//TODO
setRotation(frameBack5, 0F, 0F, 0.837758F);
pole3 = new ModelRenderer(this, 0, 34);
pole3.addBox(0F, 0F, 0F, 1, 25, 1);
@@ -148,6 +150,7 @@ public class ModelSeismicVibrator extends ModelBase
frameRight5.setRotationPoint(6.485F, 7F, -7.5F);
frameRight5.setTextureSize(128, 64);
frameRight5.mirror = true;
//TODO
setRotation(frameRight5, 0.837758F, 0F, 0F);
baseRight = new ModelRenderer(this, 38, 18);
baseRight.mirror = true;
@@ -184,30 +187,35 @@ public class ModelSeismicVibrator extends ModelBase
frameRight4.setRotationPoint(6.49F, 7F, 7.5F);
frameRight4.setTextureSize(128, 64);
frameRight4.mirror = true;
//TODO
setRotation(frameRight4, -0.837758F, 0F, 0F);
frameRight1 = new ModelRenderer(this, 4, 34);
frameRight1.addBox(0F, 0F, 0F, 1, 19, 1);
frameRight1.setRotationPoint(6.485F, -6F, -7.5F);
frameRight1.setTextureSize(128, 64);
frameRight1.mirror = true;
//TODO
setRotation(frameRight1, 0.837758F, 0F, 0F);
frameRight2 = new ModelRenderer(this, 4, 34);
frameRight2.addBox(0F, 0F, -1F, 1, 19, 1);
frameRight2.setRotationPoint(6.49F, -6F, 7.5F);
frameRight2.setTextureSize(128, 64);
frameRight2.mirror = true;
//TODO
setRotation(frameRight2, -0.837758F, 0F, 0F);
frameLeft5 = new ModelRenderer(this, 4, 34);
frameLeft5.addBox(0F, 0F, 0F, 1, 19, 1);
frameLeft5.setRotationPoint(-7.485F, 7F, -7.5F);
frameLeft5.setTextureSize(128, 64);
frameLeft5.mirror = true;
//TODO
setRotation(frameLeft5, 0.837758F, 0F, 0F);
frameLeft4 = new ModelRenderer(this, 4, 34);
frameLeft4.addBox(0F, 0F, -1F, 1, 19, 1);
frameLeft4.setRotationPoint(-7.49F, 7F, 7.5F);
frameLeft4.setTextureSize(128, 64);
frameLeft4.mirror = true;
//TODO
setRotation(frameLeft4, -0.837758F, 0F, 0F);
frameBack3 = new ModelRenderer(this, 36, 52);
frameBack3.addBox(0F, 0F, 0F, 13, 1, 1);
@@ -220,12 +228,14 @@ public class ModelSeismicVibrator extends ModelBase
frameLeft2.setRotationPoint(-7.485F, -6F, -7.5F);
frameLeft2.setTextureSize(128, 64);
frameLeft2.mirror = true;
//TODO
setRotation(frameLeft2, 0.837758F, 0F, 0F);
frameLeft1 = new ModelRenderer(this, 4, 34);
frameLeft1.addBox(0F, 0F, -1F, 1, 19, 1);
frameLeft1.setRotationPoint(-7.49F, -6F, 7.5F);
frameLeft1.setTextureSize(128, 64);
frameLeft1.mirror = true;
//TODO
setRotation(frameLeft1, -0.837758F, 0F, 0F);
pole2 = new ModelRenderer(this, 0, 34);
pole2.addBox(0F, 0F, 0F, 1, 25, 1);
@@ -238,18 +248,21 @@ public class ModelSeismicVibrator extends ModelBase
frameBack1.setRotationPoint(7.5F, -6F, 6.49F);
frameBack1.setTextureSize(128, 64);
frameBack1.mirror = true;
//TODO
setRotation(frameBack1, 0F, 0F, 0.837758F);
frameBack2 = new ModelRenderer(this, 4, 34);
frameBack2.addBox(0F, 0F, 0F, 1, 19, 1);
frameBack2.setRotationPoint(-7.5F, -6F, 6.49F);
frameBack2.setTextureSize(128, 64);
frameBack2.mirror = true;
//TODO
setRotation(frameBack2, 0F, 0F, -0.837758F);
frameBack4 = new ModelRenderer(this, 4, 34);
frameBack4.addBox(0F, 0F, 0F, 1, 19, 1);
frameBack4.setRotationPoint(-7.5F, 7F, 6.49F);
frameBack4.setTextureSize(128, 64);
frameBack4.mirror = true;
//TODO
setRotation(frameBack4, 0F, 0F, -0.837758F);
frameLeft3 = new ModelRenderer(this, 64, 27);
frameLeft3.addBox(0F, 0F, 0F, 1, 1, 13);
@@ -72,6 +72,7 @@ public class ModelSolarNeutronActivator extends ModelBase
panel3.setRotationPoint(-2.75F, -4.95F, 8F);
panel3.setTextureSize(128, 64);
panel3.mirror = true;
//TODO
setRotation(panel3, -0.1082104F, 0.0279253F, 0.2617994F);
port = new ModelRenderer(this, 0, 45);
port.addBox(0F, 0F, 0F, 8, 8, 1);
@@ -84,48 +85,56 @@ public class ModelSolarNeutronActivator extends ModelBase
panel1.addBox(0F, 0F, -16F, 6, 1, 16);
panel1.setRotationPoint(2.75F, -4.95F, 8F);
panel1.setTextureSize(128, 64);
//TODO
setRotation(panel1, -0.1082104F, -0.0279253F, -0.2617994F);
panel2 = new ModelRenderer(this, 84, 15);
panel2.addBox(0F, 0F, -16F, 6, 1, 16);
panel2.setRotationPoint(-3F, -5F, 8F);
panel2.setTextureSize(128, 64);
panel2.mirror = true;
//TODO
setRotation(panel2, -0.1047198F, 0F, 0F);
panelBase = new ModelRenderer(this, 28, 45);
panelBase.addBox(0F, 1F, -16F, 6, 1, 14);
panelBase.setRotationPoint(-3F, -5F, 9F);
panelBase.setTextureSize(128, 64);
panelBase.mirror = true;
//TODO
setRotation(panelBase, -0.1047198F, 0F, 0F);
panelBraceLeft2 = new ModelRenderer(this, 64, 15);
panelBraceLeft2.addBox(-4F, 0.5F, -5F, 5, 1, 2);
panelBraceLeft2.setRotationPoint(-3F, -5F, 9F);
panelBraceLeft2.setTextureSize(128, 64);
panelBraceLeft2.mirror = true;
//TODO
setRotation(panelBraceLeft2, -0.1047198F, 0F, 0.2505517F);
panelBraceRight2 = new ModelRenderer(this, 64, 15);
panelBraceRight2.addBox(-1F, 0.5F, -5F, 5, 1, 2);
panelBraceRight2.setRotationPoint(3F, -5F, 9F);
panelBraceRight2.setTextureSize(128, 64);
panelBraceRight2.mirror = true;
//TODO
setRotation(panelBraceRight2, -0.1047198F, 0F, -0.2555938F);
panelBraceLeft1 = new ModelRenderer(this, 64, 15);
panelBraceLeft1.addBox(-4F, 0.5F, -15F, 5, 1, 2);
panelBraceLeft1.setRotationPoint(-3F, -5F, 9F);
panelBraceLeft1.setTextureSize(128, 64);
panelBraceLeft1.mirror = true;
//TODO
setRotation(panelBraceLeft1, -0.1047198F, 0F, 0.2505517F);
panelBraceRight1 = new ModelRenderer(this, 64, 15);
panelBraceRight1.addBox(-1F, 0.5F, -15F, 5, 1, 2);
panelBraceRight1.setRotationPoint(3F, -5F, 9F);
panelBraceRight1.setTextureSize(128, 64);
panelBraceRight1.mirror = true;
//TODO
setRotation(panelBraceRight1, -0.1047198F, 0F, -0.2555938F);
panelBrace = new ModelRenderer(this, 56, 18);
panelBrace.addBox(0F, 1.2F, -10F, 2, 2, 9);
panelBrace.setRotationPoint(-1F, -5F, 8F);
panelBrace.setTextureSize(128, 64);
panelBrace.mirror = true;
//TODO
setRotation(panelBrace, -0.1047198F, 0F, 0F);
bridge = new ModelRenderer(this, 65, 1);
bridge.addBox(0F, 0F, 0F, 12, 1, 13);
@@ -138,36 +147,42 @@ public class ModelSolarNeutronActivator extends ModelBase
platform.setRotationPoint(-0.5F, 8F, -2.5F);
platform.setTextureSize(128, 64);
platform.mirror = true;
//TODO
setRotation(platform, -0.1047198F, 0F, 0F);
hole2 = new ModelRenderer(this, 0, 6);
hole2.addBox(1F, 0F, 0F, 1, 2, 1);
hole2.setRotationPoint(-0.5F, 8F, -2.5F);
hole2.setTextureSize(128, 64);
hole2.mirror = true;
//TODO
setRotation(hole2, -0.1047198F, 0F, 0F);
hole4 = new ModelRenderer(this, 0, 3);
hole4.addBox(-1F, 0F, 1F, 3, 2, 1);
hole4.setRotationPoint(-0.5F, 8F, -2.5F);
hole4.setTextureSize(128, 64);
hole4.mirror = true;
//TODO
setRotation(hole4, -0.1047198F, 0F, 0F);
hole1 = new ModelRenderer(this, 0, 3);
hole1.addBox(-1F, 0F, -1F, 3, 2, 1);
hole1.setRotationPoint(-0.5F, 8F, -2.5F);
hole1.setTextureSize(128, 64);
hole1.mirror = true;
//TODO
setRotation(hole1, -0.1047198F, 0F, 0F);
hole3 = new ModelRenderer(this, 0, 6);
hole3.addBox(-1F, 0F, 0F, 1, 2, 1);
hole3.setRotationPoint(-0.5F, 8F, -2.5F);
hole3.setTextureSize(128, 64);
hole3.mirror = true;
//TODO
setRotation(hole3, -0.1047198F, 0F, 0F);
brace2 = new ModelRenderer(this, 0, 11);
brace2.addBox(0F, 0F, 0F, 1, 1, 2);
brace2.setRotationPoint(1F, 9.5F, -7.1F);
brace2.setTextureSize(128, 64);
brace2.mirror = true;
//TODO
setRotation(brace2, 0.1745329F, 0F, 0F);
tube2c = new ModelRenderer(this, 0, 9);
tube2c.addBox(0F, 0F, 0F, 1, 1, 1);
@@ -216,6 +231,7 @@ public class ModelSolarNeutronActivator extends ModelBase
brace1.setRotationPoint(-2F, 9.5F, -7.1F);
brace1.setTextureSize(128, 64);
brace1.mirror = true;
//TODO
setRotation(brace1, 0.1745329F, 0F, 0F);
tank = new ModelRenderer(this, 0, 0);
tank.addBox(0F, 0F, 0F, 16, 9, 16);
@@ -228,6 +244,7 @@ public class ModelSolarNeutronActivator extends ModelBase
laser.setRotationPoint(-1F, -5F, 8F);
laser.setTextureSize(128, 64);
laser.mirror = true;
//TODO
setRotation(laser, -0.1117011F, 0F, 0F);
base = new ModelRenderer(this, 0, 25);
base.addBox(0F, 0F, 0F, 16, 4, 16);
@@ -342,6 +359,7 @@ public class ModelSolarNeutronActivator extends ModelBase
laserBeamToggle.setRotationPoint(-1F, -5F, 8F);
laserBeamToggle.setTextureSize(128, 64);
laserBeamToggle.mirror = true;
//TODO
setRotation(laserBeamToggle, -0.1117011F, 0F, 0F);
}
@@ -0,0 +1,129 @@
#!/usr/bin/env perl
# Released into Public Domain
# A quick and dirty script to convert ModelBase Java code as generated
# by Techne or Tabula (untested) into Minecraft's JSON model format.
# It is quite limited (it does not handle rotations, as the JSON model format
# is limited in that regard anyway), but it is at least a help.
# Usage:
# modelbase_to_json input.java > output.json
# Note that Minecraft requires the texure to be square, so you might need to
# resize your texture
# If you instead want to convert to Wavefront OBJ, check out modelbase_to_obj.perl
# in this Gist below.
use strict;
use warnings;
use List::Util qw[max];
my %parts;
while(<>) {
if(/(\w+) = new ModelRenderer\(this, (\d+), (\d+)\);/) {
$parts{$1}{base_uv} = [$2, $3];
}
elsif(/(\w+)\.addBox\((-?\d*\.?\d*)[Ff]?, (-?\d*\.?\d*)[Ff]?, (-?\d*\.?\d*)[Ff]?, (\d+), (\d+), (\d+)\);/) {
$parts{$1}{offset} = [$2, $3, $4];
$parts{$1}{size} = [$5, $6, $7];
}
elsif(/(\w+)\.setRotationPoint\((-?\d*\.?\d*)[Ff]?, (-?\d*\.?\d*)[Ff]?, (-?\d*\.?\d*)[Ff]?\);/) {
$parts{$1}{rot_point} = [$2, $3, $4];
}
elsif(/(\w+)\.setTextureSize\((\d+), (\d+)\);/) {
$parts{$1}{tex_size} = [$2, $3];
}
elsif(/(\w+)\.mirror = (true|false);/) {
#$parts{$1}{mirror} = ($2 eq "true"); #FIXME: This is being ignored
}
elsif(/setRotation\((\w+), (-?\d*\.?\d*)[Ff]?, (-?\d*\.?\d*)[Ff]?, (-?\d*\.?\d*)[Ff]?\)/) {
#$parts{$1}{rotation} = [$2, $3, $4];
#We ignore the rotation
if($2 != 0 || $3 != 0 || $4 != 0) {
print STDERR "Warning: Line $.: Nonzero rotations are not supported\n";
}
}
else {
#print STDERR "Ignoring line $.\n";
}
}
print qq({
"elements": [
);
my $first = 1;
foreach my $part (keys %parts) {
my $offset = $parts{$part}{offset};
my $size = $parts{$part}{size};
my $rot_point = $parts{$part}{rot_point};
#Textures need to be square
my $tex_size = max($parts{$part}{tex_size}->[0], $parts{$part}{tex_size}->[1]);
my $base_uv = $parts{$part}{base_uv};
my $xmin = 8 - $offset->[0] - $size->[0] - $rot_point->[0];
my $ymin = 24 - $offset->[1] - $size->[1] - $rot_point->[1];
my $zmin = 8 + $offset->[2] + $rot_point->[2];
my $xmax = 8 - $offset->[0] - $rot_point->[0];
my $ymax = 24 - $offset->[1] - $rot_point->[1];
my $zmax = 8 + $offset->[2] + $size->[2] + $rot_point->[2];
my @uvmin = (
[$base_uv->[0] + $size->[2] + 2*$size->[0], $base_uv->[1]], #down
[$base_uv->[0] + $size->[2] + $size->[0], $base_uv->[1] + $size->[2]], #up
[$base_uv->[0] + $size->[2], $base_uv->[1] + $size->[2]], #north
[$base_uv->[0] + 2*$size->[2] + $size->[0], $base_uv->[1] + $size->[2]], #south
[$base_uv->[0] + $size->[2] + $size->[0], $base_uv->[1] + $size->[2]], #west
[$base_uv->[0], $base_uv->[1] + $size->[2]]); #east
my @uvmax = (
[$uvmin[0][0] - $size->[0], $uvmin[0][1] + $size->[2]], #down
[$uvmin[1][0] - $size->[0], $uvmin[1][1] - $size->[2]], #up
[$uvmin[2][0] + $size->[0], $uvmin[2][1] + $size->[1]], #north
[$uvmin[3][0] + $size->[0], $uvmin[3][1] + $size->[1]], #south
[$uvmin[4][0] + $size->[2], $uvmin[4][1] + $size->[1]], #west
[$uvmin[5][0] + $size->[2], $uvmin[5][1] + $size->[1]]); #east
#Scale UVs from 0 to 16 with respect to texture size
foreach my $f (@uvmin) {
foreach (@$f) {
$_ = $_ / $tex_size * 16;
}
}
foreach my $f (@uvmax) {
foreach (@$f) {
$_ = $_ / $tex_size * 16;
}
}
print ",\n" unless $first;
$first = 0;
print
qq( {
"__comment": "$part",
"from": [$xmin, $ymin, $zmin],
"to": [$xmax, $ymax, $zmax],
"faces": {
"down": {"uv": [$uvmin[0][0], $uvmin[0][1], $uvmax[0][0], $uvmax[0][1]], "texture": "#all"},
"up": {"uv": [$uvmin[1][0], $uvmin[1][1], $uvmax[1][0], $uvmax[1][1]], "texture": "#all"},
"north": {"uv": [$uvmin[2][0], $uvmin[2][1], $uvmax[2][0], $uvmax[2][1]], "texture": "#all"},
"south": {"uv": [$uvmin[3][0], $uvmin[3][1], $uvmax[3][0], $uvmax[3][1]], "texture": "#all"},
"west": {"uv": [$uvmin[4][0], $uvmin[4][1], $uvmax[4][0], $uvmax[4][1]], "texture": "#all"},
"east": {"uv": [$uvmin[5][0], $uvmin[5][1], $uvmax[5][0], $uvmax[5][1]], "texture": "#all"}
}
});
}
print qq(
],
"textures": {
"all": "...",
"particle": "..."
}
}
);
@@ -22,7 +22,7 @@ public class RenderGasTank extends TileEntitySpecialRenderer<TileEntityGasTank>
public void renderTileEntityAt(TileEntityGasTank tileEntity, double x, double y, double z, float partialTick, int destroyStage)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 1.5F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "GasTank" + tileEntity.tier.getBaseTier().getName() + ".png"));
switch(tileEntity.facing.ordinal()) /*TODO: switch the enum*/
@@ -21,7 +21,7 @@ public class RenderResistiveHeater extends TileEntitySpecialRenderer<TileEntityR
public void renderTileEntityAt(TileEntityResistiveHeater tileEntity, double x, double y, double z, float partialTick, int destroyStage)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 1.5F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ResistiveHeater.png"));
switch(tileEntity.facing.ordinal())
@@ -21,7 +21,7 @@ public class RenderRotaryCondensentrator extends TileEntitySpecialRenderer<TileE
public void renderTileEntityAt(TileEntityRotaryCondensentrator tileEntity, double x, double y, double z, float partialTick, int destroyStage)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 1.5F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "RotaryCondensentrator.png"));
@@ -21,6 +21,7 @@ import mekanism.common.block.BlockPlastic;
import mekanism.common.block.BlockPlasticFence;
import mekanism.common.block.BlockSalt;
import mekanism.common.block.states.BlockStateMachine;
import mekanism.common.block.states.BlockStatePlastic.PlasticBlockStateMapper;
import mekanism.common.block.states.BlockStatePlastic.PlasticBlockType;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.item.ItemBlockCardboardBox;
@@ -32,17 +33,20 @@ import mekanism.common.item.ItemBlockPlastic;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemModelMesher;
import net.minecraft.client.renderer.block.statemap.BlockStateMapper;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.gen.structure.StructureVillagePieces.Road;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javafx.scene.effect.Glow;
@ObjectHolder("Mekanism")
public class MekanismBlocks
{
@@ -67,6 +71,7 @@ public class MekanismBlocks
private static final IStateMapper machineMapper = new MachineBlockStateMapper();
private static final IStateMapper basicMapper = new BasicBlockStateMapper();
private static final IStateMapper plasticMapper = new PlasticBlockStateMapper();
@@ -93,18 +98,29 @@ public class MekanismBlocks
GameRegistry.registerBlock(RoadPlasticBlock, ItemBlockPlastic.class, "RoadPlasticBlock");
GameRegistry.registerBlock(PlasticFence, ItemBlockPlastic.class, "PlasticFence");
GameRegistry.registerBlock(SaltBlock, "SaltBlock");
ModelLoader.setCustomStateMapper(MachineBlock, machineMapper);
ModelLoader.setCustomStateMapper(MachineBlock2, machineMapper);
ModelLoader.setCustomStateMapper(MachineBlock3, machineMapper);
ModelLoader.setCustomStateMapper(BasicBlock, basicMapper);
ModelLoader.setCustomStateMapper(BasicBlock2, basicMapper);
ModelLoader.setCustomStateMapper(PlasticBlock, plasticMapper);
ModelLoader.setCustomStateMapper(SlickPlasticBlock, plasticMapper);
ModelLoader.setCustomStateMapper(GlowPlasticBlock, plasticMapper);
ModelLoader.setCustomStateMapper(ReinforcedPlasticBlock, plasticMapper);
ModelLoader.setCustomStateMapper(RoadPlasticBlock, plasticMapper);
}
@SideOnly(Side.CLIENT)
public static void registerRender()
{
ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
for(MachineType type : BlockStateMachine.MachineType.values())
{
mesher.register(Item.getItemFromBlock(type.typeBlock.getBlock()), type.meta, new ModelResourceLocation("mekanism:" + type.getName(), "inventory"));
}
for(BasicBlockType type : BasicBlockType.values())
{
mesher.register(Item.getItemFromBlock(type.blockType.getBlock()), type.meta, new ModelResourceLocation("mekanism:" + type.getName(), "inventory"));
@@ -184,12 +200,5 @@ public class MekanismBlocks
new ResourceLocation("mekanism", "induction_provider")
);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().registerBlockWithStateMapper(MachineBlock, machineMapper);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().registerBlockWithStateMapper(MachineBlock2, machineMapper);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().registerBlockWithStateMapper(MachineBlock3, machineMapper);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().registerBlockWithStateMapper(BasicBlock, basicMapper);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().registerBlockWithStateMapper(BasicBlock2, basicMapper);
}
}
@@ -5,8 +5,12 @@ import java.util.Random;
import mekanism.api.gas.IGasItem;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.base.IActiveState;
import mekanism.common.base.ISustainedInventory;
import mekanism.common.base.ITierItem;
import mekanism.common.block.states.BlockStateFacing;
import mekanism.common.block.states.BlockStateGasTank;
import mekanism.common.block.states.BlockStateMachine;
import mekanism.common.security.ISecurityItem;
import mekanism.common.security.ISecurityTile;
import mekanism.common.security.ISecurityTile.SecurityMode;
@@ -18,6 +22,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
@@ -30,9 +35,12 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import buildcraft.api.tools.IToolWrench;
import static mekanism.common.block.states.BlockStateFacing.facingProperty;
public class BlockGasTank extends BlockContainer
{
public BlockGasTank()
@@ -44,6 +52,37 @@ public class BlockGasTank extends BlockContainer
setCreativeTab(Mekanism.tabMekanism);
}
@Override
protected BlockState createBlockState()
{
return new BlockStateGasTank(this);
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState();
}
@Override
public int getMetaFromState(IBlockState state)
{
return 0;
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
TileEntity tile = worldIn.getTileEntity(pos);
if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).facing != null)
{
state = state.withProperty(facingProperty, ((TileEntityBasicBlock)tile).facing);
}
return state;
}
/*
@Override
@SideOnly(Side.CLIENT)
@@ -23,6 +23,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import static mekanism.common.block.states.BlockStatePlastic.colorProperty;
public class BlockPlastic extends Block
{
public PlasticBlockType type;
@@ -38,8 +40,6 @@ public class BlockPlastic extends Block
{
slipperiness = 0.98F;
}
setDefaultState(blockState.getBaseState().withProperty(BlockStatePlastic.typeProperty, type));
}
@Override
@@ -51,13 +51,13 @@ public class BlockPlastic extends Block
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(BlockStatePlastic.colorProperty, EnumDyeColor.byMetadata(meta));
return this.getDefaultState().withProperty(colorProperty, EnumDyeColor.byMetadata(meta));
}
@Override
public int getMetaFromState(IBlockState state)
{
return state.getValue(BlockStatePlastic.colorProperty).getMetadata();
return state.getValue(colorProperty).getMetadata();
}
@@ -127,8 +127,9 @@ public class BlockPlastic extends Block
@Override
public int getRenderColor(IBlockState state)
{
EnumColor colour = EnumColor.DYES[getMetaFromState(state)];
return (int)(colour.getColor(0)*255) << 16 | (int)(colour.getColor(1)*255) << 8 | (int)(colour.getColor(2)*255);
EnumDyeColor color = state.getValue(colorProperty);
EnumColor dye = EnumColor.DYES[color.getDyeDamage()];
return (int)(dye.getColor(0)*255) << 16 | (int)(dye.getColor(1)*255) << 8 | (int)(dye.getColor(2)*255);
}
@Override
@@ -1,15 +1,12 @@
package mekanism.common.block.states;
import mekanism.common.MekanismBlocks;
import mekanism.common.block.BlockGasTank;
/**
* Created by ben on 23/12/14.
*/
public class BlockStateGasTank extends BlockStateFacing
{
public BlockStateGasTank(BlockGasTank block)
{
super(block);
@@ -144,12 +144,12 @@ public class BlockStateMachine extends BlockStateFacing
CHEMICAL_CRYSTALLIZER(MachineBlock.MACHINE_BLOCK_2, 8, "ChemicalCrystallizer", 37, TileEntityChemicalCrystallizer.class, true, true, true, Plane.HORIZONTAL, true),
SEISMIC_VIBRATOR(MachineBlock.MACHINE_BLOCK_2, 9, "SeismicVibrator", 39, TileEntitySeismicVibrator.class, true, true, false, Plane.HORIZONTAL, true),
PRESSURIZED_REACTION_CHAMBER(MachineBlock.MACHINE_BLOCK_2, 10, "PressurizedReactionChamber", 40, TileEntityPRC.class, true, true, false, Plane.HORIZONTAL, true),
FLUID_TANK(MachineBlock.MACHINE_BLOCK_2, 11, "PortableTank", 41, TileEntityFluidTank.class, false, true, false, never, true),
FLUID_TANK(MachineBlock.MACHINE_BLOCK_2, 11, "FluidTank", 41, TileEntityFluidTank.class, false, true, false, never, true),
FLUIDIC_PLENISHER(MachineBlock.MACHINE_BLOCK_2, 12, "FluidicPlenisher", 42, TileEntityFluidicPlenisher.class, true, true, false, Plane.HORIZONTAL, true),
LASER(MachineBlock.MACHINE_BLOCK_2, 13, "Laser", -1, TileEntityLaser.class, true, true, false, always, false),
LASER_AMPLIFIER(MachineBlock.MACHINE_BLOCK_2, 14, "LaserAmplifier", 44, TileEntityLaserAmplifier.class, false, true, false, always, true),
LASER_TRACTOR_BEAM(MachineBlock.MACHINE_BLOCK_2, 15, "LaserTractorBeam", 45, TileEntityLaserTractorBeam.class, false, true, false, always, true),
QUANTUM_ENTANGLOPORTER(MachineBlock.MACHINE_BLOCK_3, 0, "EntangledBlock", 46, TileEntityQuantumEntangloporter.class, true, false, false, Plane.HORIZONTAL, true),
QUANTUM_ENTANGLOPORTER(MachineBlock.MACHINE_BLOCK_3, 0, "QuantumEntangloporter", 46, TileEntityQuantumEntangloporter.class, true, false, false, Plane.HORIZONTAL, true),
SOLAR_NEUTRON_ACTIVATOR(MachineBlock.MACHINE_BLOCK_3, 1, "SolarNeutronActivator", 47, TileEntitySolarNeutronActivator.class, false, true, false, Plane.HORIZONTAL, true),
AMBIENT_ACCUMULATOR(MachineBlock.MACHINE_BLOCK_3, 2, "AmbientAccumulator", 48, TileEntityAmbientAccumulator.class, true, false, false, never, true),
OREDICTIONIFICATOR(MachineBlock.MACHINE_BLOCK_3, 3, "Oredictionificator", 52, TileEntityOredictionificator.class, false, false, false, Plane.HORIZONTAL, true),
@@ -8,17 +8,20 @@ import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
public class BlockStatePlastic extends BlockState
{
public static PropertyEnum<EnumDyeColor> colorProperty = PropertyEnum.create("color", EnumDyeColor.class);
public static PropertyEnum<PlasticBlockType> typeProperty = PropertyEnum.create("type", PlasticBlockType.class);
public BlockStatePlastic(BlockPlastic block)
{
super(block, colorProperty, typeProperty);
super(block, colorProperty);
}
public static enum PlasticBlockType implements IStringSerializable
@@ -35,4 +38,18 @@ public class BlockStatePlastic extends BlockState
return name().toLowerCase();
}
}
public static class PlasticBlockStateMapper extends StateMapperBase
{
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
PlasticBlockType type = ((BlockPlastic)state.getBlock()).type;
String property = "type=" + type.getName();
ResourceLocation baseLocation = new ResourceLocation("mekanism", "plastic_block");
return new ModelResourceLocation(baseLocation, property);
}
}
}