mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-20 20:32:24 +00:00
Update for spotlessApply
This commit is contained in:
17 files changed
+218
-112
No files matched your search
@@ -42,7 +42,7 @@ public enum TextureType {
|
||||
register.registerIcon(modName + ":" + texturePath + "-top")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
IIcon[] icons = (IIcon[]) cachedObject;
|
||||
@@ -57,7 +57,7 @@ public enum TextureType {
|
||||
register.registerIcon(modName + ":" + texturePath + "-top")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
IIcon[] icons = (IIcon[]) cachedObject;
|
||||
@@ -65,18 +65,18 @@ public enum TextureType {
|
||||
}
|
||||
},
|
||||
CTMV("ctmv", "top"){
|
||||
|
||||
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return Pair.of(new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctmv"), 2, 2), register.registerIcon(modName + ":" + texturePath + "-top"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
return side < 2 ? data.getRight() : data.getLeft().getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
@@ -96,13 +96,13 @@ public enum TextureType {
|
||||
return map.getSubIcon(1, 0);
|
||||
return map.getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
RenderBlocksColumn ret = theRenderBlocksColumn;
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
|
||||
|
||||
ret.blockAccess = world;
|
||||
ret.renderMaxX = 1.0;
|
||||
ret.renderMaxY = 1.0;
|
||||
@@ -117,13 +117,13 @@ public enum TextureType {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return Pair.of(new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-ctmh"), 2, 2), register.registerIcon(modName + ":" + texturePath + "-top"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return CTMV.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
Pair<TextureSubmap, IIcon> data = (Pair<TextureSubmap, IIcon>) cachedObject;
|
||||
@@ -143,7 +143,7 @@ public enum TextureType {
|
||||
p = ctm.isConnected(world, x, y, z - 1, side, block, meta);
|
||||
n = ctm.isConnected(world, x, y, z + 1, side, block, meta);
|
||||
}
|
||||
|
||||
|
||||
TextureSubmap map = data.getLeft();
|
||||
if (p && n)
|
||||
return map.getSubIcon(1, 0);
|
||||
@@ -159,14 +159,14 @@ public enum TextureType {
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-v9"), 3, 3);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getVIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
}
|
||||
},
|
||||
@@ -175,12 +175,12 @@ public enum TextureType {
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-v4"), 2, 2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((TextureSubmap)cachedObject).getSubIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getVIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
@@ -196,12 +196,12 @@ public enum TextureType {
|
||||
new TextureSubmap(baseIcon, 2, 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return ((Triple<IIcon, ?, ?>)cachedObject).getLeft();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
@@ -220,13 +220,13 @@ public enum TextureType {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r16"), 4, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getRIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
@@ -236,30 +236,30 @@ public enum TextureType {
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r9"), 3, 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V9.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getRIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
}
|
||||
},
|
||||
R4("r4"){
|
||||
|
||||
|
||||
@Override
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return new TextureSubmap(register.registerIcon(modName + ":" + texturePath + "-r4"), 2, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return V4.getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getRIcon(this, (TextureSubmap) cachedObject, x, y, z, side);
|
||||
@@ -267,9 +267,9 @@ public enum TextureType {
|
||||
},
|
||||
NORMAL,
|
||||
CUSTOM;
|
||||
|
||||
|
||||
/* Some util stuff for shared code between v* and r* */
|
||||
|
||||
|
||||
public static IIcon getVIcon(TextureType type, TextureSubmap map, int x, int y, int z, int side) {
|
||||
int variationSize = (type == TextureType.V9) ? 3 : 2;
|
||||
|
||||
@@ -304,23 +304,23 @@ public enum TextureType {
|
||||
|
||||
return map.getSubIcon(index % variationSize, index / variationSize);
|
||||
}
|
||||
|
||||
|
||||
public static IIcon getRIcon(TextureType type, TextureSubmap map, int x, int y, int z, int side) {
|
||||
rand.setSeed(getCoordinateRandom(x, y, z));
|
||||
rand.nextBoolean();
|
||||
int size = type == TextureType.R4 ? 2 : type == TextureType.R9 ? 3 : 4;
|
||||
return map.getSubIcon(rand.nextInt(size), rand.nextInt(size));
|
||||
}
|
||||
|
||||
|
||||
private static long getCoordinateRandom(int x, int y, int z) {
|
||||
// MC 1.8 code...
|
||||
long l = (x * 3129871) ^ z * 116129781L ^ y;
|
||||
l = l * l * 42317861L + l * 11L;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
/* End of that mess */
|
||||
|
||||
|
||||
private static final TextureType[] VALUES;
|
||||
private static final CTM ctm = CTM.getInstance();
|
||||
private static final Random rand = new Random();
|
||||
@@ -337,31 +337,31 @@ public enum TextureType {
|
||||
private TextureType(String... suffixes) {
|
||||
this.suffixes = suffixes.length == 0 ? new String[] { "" } : suffixes;
|
||||
}
|
||||
|
||||
|
||||
private static void initStatics() {
|
||||
if (theRenderBlocksCTM == null) {
|
||||
theRenderBlocksCTM = new RenderBlocksCTM();
|
||||
theRenderBlocksColumn = new RenderBlocksColumn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
return new SubmapManagerDefault(this, variation, texturePath);
|
||||
}
|
||||
|
||||
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, Block block, int meta) {
|
||||
return new SubmapManagerExistingIcon(this, variation, block, meta);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||
return register.registerIcon(modName + ":" + texturePath);
|
||||
}
|
||||
|
||||
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, int side, int meta) {
|
||||
return (IIcon) cachedObject;
|
||||
}
|
||||
|
||||
|
||||
protected IIcon getIcon(ICarvingVariation variation, Object cachedObject, IBlockAccess world, int x, int y, int z, int side, int meta) {
|
||||
return getIcon(variation, cachedObject, side, meta);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ public enum TextureType {
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
return rendererOld;
|
||||
}
|
||||
|
||||
|
||||
public static TextureType getTypeFor(CarvableHelper inst, String modid, String path) {
|
||||
if (path == null) {
|
||||
return CUSTOM;
|
||||
@@ -388,7 +388,7 @@ public enum TextureType {
|
||||
}
|
||||
return CUSTOM;
|
||||
}
|
||||
|
||||
|
||||
// This is ugly, but faster than class.getResource
|
||||
private static boolean exists(String modid, String path, String postfix) {
|
||||
ResourceLocation rl = new ResourceLocation(modid, "textures/blocks/" + path + postfix + ".png");
|
||||
@@ -399,18 +399,18 @@ public enum TextureType {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract static class AbstractSubmapManager implements ISubmapManager {
|
||||
protected final TextureType type;
|
||||
protected ICarvingVariation variation;
|
||||
protected Object cachedObject;
|
||||
|
||||
|
||||
private AbstractSubmapManager(TextureType type, ICarvingVariation variation) {
|
||||
this.type = type;
|
||||
this.variation = variation;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return type.getIcon(variation, cachedObject, side, meta);
|
||||
@@ -420,7 +420,7 @@ public enum TextureType {
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return type.getIcon(variation, cachedObject, world, x, y, z, side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
@@ -428,15 +428,15 @@ public enum TextureType {
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
|
||||
public Object getCachedObject() {
|
||||
return cachedObject;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ public enum TextureType {
|
||||
private static class SubmapManagerDefault extends AbstractSubmapManager {
|
||||
|
||||
private String texturePath;
|
||||
|
||||
|
||||
private SubmapManagerDefault(TextureType type, ICarvingVariation variation, String texturePath) {
|
||||
super(type, variation);
|
||||
this.texturePath = texturePath;
|
||||
@@ -457,24 +457,24 @@ public enum TextureType {
|
||||
cachedObject = type.registerIcons(variation, modName, texturePath, register);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class SubmapManagerExistingIcon extends AbstractSubmapManager {
|
||||
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
|
||||
|
||||
private SubmapManagerExistingIcon(TextureType type, ICarvingVariation variation, Block block, int meta) {
|
||||
super(type, variation);
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return block.getIcon(side, this.meta);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
@@ -484,4 +484,4 @@ public enum TextureType {
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user