From acdf5290f92c6c0ec5f2ca50141fd04172b52a72 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 3 Aug 2015 18:46:46 -0400 Subject: [PATCH] Support for v* in RCTM, change name of class to match --- .../com/cricketcraft/chisel/Features.java | 2 +- .../chisel/api/rendering/TextureType.java | 2 +- ...CTM.java => SubmapManagerCombinedCTM.java} | 38 +++++++++++-------- 3 files changed, 25 insertions(+), 17 deletions(-) rename src/main/java/com/cricketcraft/chisel/client/render/{SubmapManagerRCTM.java => SubmapManagerCombinedCTM.java} (61%) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index c1316801..3ad11527 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -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"); diff --git a/src/main/java/com/cricketcraft/chisel/api/rendering/TextureType.java b/src/main/java/com/cricketcraft/chisel/api/rendering/TextureType.java index 5c9fa0d0..53b14859 100644 --- a/src/main/java/com/cricketcraft/chisel/api/rendering/TextureType.java +++ b/src/main/java/com/cricketcraft/chisel/api/rendering/TextureType.java @@ -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 diff --git a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerRCTM.java b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerCombinedCTM.java similarity index 61% rename from src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerRCTM.java rename to src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerCombinedCTM.java index 27c22452..3a4de1ba 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerRCTM.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/SubmapManagerCombinedCTM.java @@ -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;