Support for v* in RCTM, change name of class to match

This commit is contained in:
tterrag1098 committed 2015-08-03 18:46:46 -04:00
1 parent 7777d30aea
commit acdf5290f9
3 files changed
+25 -17

No files matched your search

@@ -2232,7 +2232,7 @@ public enum Features {
technical4.carverHelper.addVariation("tile.technical4.1.desc", 1, "technical/new/weatheredOrangePanels");
technical4.carverHelper.addVariation("tile.technical4.2.desc", 2, "technical/new/Sturdy");
technical4.carverHelper.addVariation("tile.technical4.3.desc", 3, "technical/new/MegaCell");
technical4.carverHelper.addVariation("tile.technical4.4.desc", 4, "technical/new/test/ExhaustPlating", new SubmapManagerRCTM(4, "technical/new/test/ExhaustPlating", TextureType.R4));
technical4.carverHelper.addVariation("tile.technical4.4.desc", 4, "technical/new/test/ExhaustPlating", new SubmapManagerCombinedCTM(4, "technical/new/test/ExhaustPlating", TextureType.R4));
technical4.carverHelper.addVariation("tile.technical4.5.desc", 5, "technical/new/MakeshiftPanels");
technical4.carverHelper.addVariation("tile.technical4.6.desc", 6, "technical/new/TapeDrive");
technical4.carverHelper.addVariation("tile.technical4.7.desc", 7, "technical/new/Piping");
@@ -29,7 +29,7 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Handles all default {@link ISubmapManager} behavior
*/
@SuppressWarnings({ "unchecked", "deprecation" })
@SuppressWarnings("unchecked")
public enum TextureType {
// @formatter:off
@@ -19,52 +19,59 @@ import com.cricketcraft.ctmlib.TextureSubmap;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SubmapManagerRCTM extends SubmapManagerBase {
public class SubmapManagerCombinedCTM extends SubmapManagerBase {
@SideOnly(Side.CLIENT)
private class RenderBlocksRCTM extends RenderBlocksCTM {
@Override
public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.submap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.WEST.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.smallSubmap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.WEST.ordinal());
setIcons(rType, x, y, z, ForgeDirection.WEST);
super.renderFaceXNeg(block, x, y, z, submapSmall.getSubIcon(0, 0));
}
@Override
public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.submap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.EAST.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.smallSubmap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.EAST.ordinal());
setIcons(rType, x, y, z, ForgeDirection.EAST);
super.renderFaceXPos(block, x, y, z, submapSmall.getSubIcon(0, 0));
}
@Override
public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.submap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.DOWN.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.smallSubmap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.DOWN.ordinal());
setIcons(rType, x, y, z, ForgeDirection.DOWN);
super.renderFaceYNeg(block, x, y, z, submapSmall.getSubIcon(0, 0));
}
@Override
public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.submap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.UP.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.smallSubmap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.UP.ordinal());
setIcons(rType, x, y, z, ForgeDirection.UP);
super.renderFaceYPos(block, x, y, z, submapSmall.getSubIcon(0, 0));
}
@Override
public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.submap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.NORTH.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.smallSubmap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.UP.ordinal());
setIcons(rType, x, y, z, ForgeDirection.NORTH);
super.renderFaceZNeg(block, x, y, z, submapSmall.getSubIcon(0, 0));
}
@Override
public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.submap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.SOUTH.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerRCTM.this.smallSubmap, MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z), ForgeDirection.SOUTH.ordinal());
setIcons(rType, x, y, z, ForgeDirection.SOUTH);
super.renderFaceZPos(block, x, y, z, submapSmall.getSubIcon(0, 0));
}
private void setIcons(TextureType type, double x, double y, double z, ForgeDirection side) {
int ix = MathHelper.floor_double(x);
int iy = MathHelper.floor_double(y);
int iz = MathHelper.floor_double(z);
if (type == TextureType.V4 || type == TextureType.V9) {
submap = (TextureSubmap) TextureType.getVIcon(rType, SubmapManagerCombinedCTM.this.submap, ix, iy, iz, side.ordinal());
submapSmall = (TextureSubmap) TextureType.getVIcon(rType, SubmapManagerCombinedCTM.this.smallSubmap, ix, iy, iz, side.ordinal());
} else {
submap = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerCombinedCTM.this.submap, ix, iy, iz, side.ordinal());
submapSmall = (TextureSubmap) TextureType.getRIcon(rType, SubmapManagerCombinedCTM.this.smallSubmap, ix, iy, iz, side.ordinal());
}
}
}
private class Submap extends TextureSubmap {
@@ -97,8 +104,9 @@ public class SubmapManagerRCTM extends SubmapManagerBase {
private IIcon defaultIcon;
private TextureType rType;
public SubmapManagerRCTM(int meta, String texturePath, TextureType rType) {
assert rType == TextureType.R16 || rType == TextureType.R9 || rType == TextureType.R4
public SubmapManagerCombinedCTM(int meta, String texturePath, TextureType rType) {
assert rType == TextureType.R16 || rType == TextureType.R9 || rType == TextureType.R4 ||
rType == TextureType.V4 || rType == TextureType.V9
: "Not a valid random type!";
this.meta = meta;