mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 16:27:45 +00:00
Remove generics from ISubmapManager to prevent serverside errors
This commit is contained in:
1 parent
fb70c66184
commit
f8a1f4d937
12 files changed
+43
-47
No files matched your search
@@ -39,7 +39,7 @@ public class CarvableHelper {
|
||||
this.theBlock = block;
|
||||
}
|
||||
|
||||
public void addVariation(String description, int metadata, ISubmapManager<?> manager) {
|
||||
public void addVariation(String description, int metadata, ISubmapManager manager) {
|
||||
addVariation(description, metadata, null, manager);
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ public class CarvableHelper {
|
||||
}
|
||||
|
||||
public void addVariation(String description, int metadata, String texture) {
|
||||
addVariation(description, metadata, texture, (ISubmapManager<?>) null);
|
||||
addVariation(description, metadata, texture, (ISubmapManager) null);
|
||||
}
|
||||
|
||||
public void addVariation(String description, int metadata, String texture, ISubmapManager<?> manager) {
|
||||
public void addVariation(String description, int metadata, String texture, ISubmapManager manager) {
|
||||
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, manager);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public class CarvableHelper {
|
||||
addVariation(description, metadata, texture, block, blockMeta, modid, null);
|
||||
}
|
||||
|
||||
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid, ISubmapManager<?> customManager) {
|
||||
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid, ISubmapManager customManager) {
|
||||
|
||||
if (infoList.size() >= 16)
|
||||
return;
|
||||
@@ -96,14 +96,14 @@ public class CarvableHelper {
|
||||
infoMap[metadata] = info;
|
||||
}
|
||||
|
||||
private IVariationInfo getClientInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager<?> customManager) {
|
||||
private IVariationInfo getClientInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager customManager) {
|
||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(theBlock, metadata, metadata);
|
||||
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
||||
if (type == TextureType.CUSTOM && customManager == null && block == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
||||
}
|
||||
|
||||
ISubmapManager<?> manager;
|
||||
ISubmapManager manager;
|
||||
if (customManager != null) {
|
||||
manager = customManager;
|
||||
} else if (block != null) {
|
||||
@@ -114,7 +114,7 @@ public class CarvableHelper {
|
||||
return new VariationInfoBase(var, description, manager);
|
||||
}
|
||||
|
||||
private IVariationInfo getServerInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager<?> customManager) {
|
||||
private IVariationInfo getServerInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager customManager) {
|
||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(theBlock, metadata, metadata);
|
||||
return new VariationInfoBase(var, description, null);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.TextureType;
|
||||
|
||||
public interface IVariationInfo {
|
||||
|
||||
ISubmapManager<? extends RenderBlocks> getSubmapManager();
|
||||
ISubmapManager getSubmapManager();
|
||||
|
||||
ICarvingVariation getVariation();
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
@@ -10,14 +9,14 @@ public class VariationInfoBase implements IVariationInfo {
|
||||
|
||||
private ICarvingVariation variation;
|
||||
private String unlocDesc;
|
||||
private ISubmapManager<?> manager;
|
||||
private ISubmapManager manager;
|
||||
private TextureType type;
|
||||
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager<? extends RenderBlocks> manager) {
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
|
||||
this(variation, unlocDesc, manager, TextureType.CUSTOM);
|
||||
}
|
||||
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager<? extends RenderBlocks> manager, TextureType type) {
|
||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager, TextureType type) {
|
||||
this.variation = variation;
|
||||
this.unlocDesc = unlocDesc;
|
||||
this.manager = manager;
|
||||
@@ -35,7 +34,7 @@ public class VariationInfoBase implements IVariationInfo {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISubmapManager<?> getSubmapManager() {
|
||||
public ISubmapManager getSubmapManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ISubmapManager<T extends RenderBlocks> {
|
||||
public interface ISubmapManager {
|
||||
|
||||
/**
|
||||
* Gets the icon for item rendering, based on side and item metadata.
|
||||
@@ -41,11 +41,11 @@ public interface ISubmapManager<T extends RenderBlocks> {
|
||||
void registerIcons(String modName, Block block, IIconRegister register);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
T createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world);
|
||||
RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void preRenderSide(T renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void postRenderSide(T renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class RenderBlocksCTM extends RenderBlocks {
|
||||
public TextureSubmap submap;
|
||||
public TextureSubmap submapSmall;
|
||||
public RenderBlocks rendererOld;
|
||||
public ISubmapManager<RenderBlocksCTM> manager;
|
||||
public ISubmapManager manager;
|
||||
|
||||
protected int[][] lightmap = new int[3][3];
|
||||
protected float[][] redmap = new float[3][3];
|
||||
|
||||
@@ -316,11 +316,11 @@ public enum TextureType {
|
||||
}
|
||||
}
|
||||
|
||||
public ISubmapManager<?> createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||
return new SubmapManagerDefault(this, variation, texturePath);
|
||||
}
|
||||
|
||||
public ISubmapManager<?> createManagerFor(ICarvingVariation variation, Block block, int meta) {
|
||||
public ISubmapManager createManagerFor(ICarvingVariation variation, Block block, int meta) {
|
||||
return new SubmapManagerExistingIcon(this, variation, block, meta);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ public enum TextureType {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private abstract static class SubmapManagerBase<T extends RenderBlocks> implements ISubmapManager<T> {
|
||||
private abstract static class SubmapManagerBase implements ISubmapManager {
|
||||
protected final TextureType type;
|
||||
protected ICarvingVariation variation;
|
||||
protected Object cachedObject;
|
||||
@@ -393,9 +393,9 @@ public enum TextureType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
T rb = (T) type.createRenderContext(rendererOld, world, cachedObject);
|
||||
RenderBlocks rb = type.createRenderContext(rendererOld, world, cachedObject);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ public enum TextureType {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class SubmapManagerDefault extends SubmapManagerBase<RenderBlocks> {
|
||||
private static class SubmapManagerDefault extends SubmapManagerBase {
|
||||
|
||||
private String texturePath;
|
||||
|
||||
@@ -426,7 +426,7 @@ public enum TextureType {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class SubmapManagerExistingIcon extends SubmapManagerBase<RenderBlocks> {
|
||||
private static class SubmapManagerExistingIcon extends SubmapManagerBase {
|
||||
|
||||
private Block block;
|
||||
private int meta;
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.api.carving.IVariationInfo;
|
||||
import com.cricketcraft.chisel.api.rendering.ClientUtils;
|
||||
import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.RenderBlocksCTM;
|
||||
import com.cricketcraft.chisel.utils.Drawing;
|
||||
|
||||
@@ -33,7 +32,6 @@ public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks rendererOld) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
@@ -45,7 +43,7 @@ public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
if (rb != null && rb != rendererOld) {
|
||||
rb.blockAccess = world;
|
||||
if (rb instanceof RenderBlocksCTM) {
|
||||
((RenderBlocksCTM)rb).manager = (ISubmapManager<RenderBlocksCTM>) var.getSubmapManager();
|
||||
((RenderBlocksCTM)rb).manager = var.getSubmapManager();
|
||||
((RenderBlocksCTM)rb).rendererOld = rendererOld;
|
||||
}
|
||||
return rb.renderStandardBlock(block, x, y, z);
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerAntiblock extends SubmapManagerBase<RenderBlocksCTM> {
|
||||
public class SubmapManagerAntiblock extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static class RenderBlocksCTMFullbright extends RenderBlocksCTM {
|
||||
@@ -54,7 +54,7 @@ public class SubmapManagerAntiblock extends SubmapManagerBase<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTMFullbright();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public abstract class SubmapManagerBase<T extends RenderBlocks> implements ISubmapManager<T> {
|
||||
public abstract class SubmapManagerBase implements ISubmapManager {
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
@@ -21,17 +21,17 @@ public abstract class SubmapManagerBase<T extends RenderBlocks> implements ISubm
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public T createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preRenderSide(T renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRenderSide(T 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) {
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerCarpetFloor extends SubmapManagerBase<RenderBlocksCTM> {
|
||||
public class SubmapManagerCarpetFloor extends SubmapManagerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
@@ -45,7 +45,7 @@ public class SubmapManagerCarpetFloor extends SubmapManagerBase<RenderBlocksCTM>
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,6 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -12,9 +11,10 @@ import com.cricketcraft.chisel.init.ChiselBlocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import static com.cricketcraft.chisel.api.rendering.Dir.*;
|
||||
|
||||
public class SubmapManagerFakeController extends SubmapManagerBase<RenderBlocks> {
|
||||
public class SubmapManagerFakeController extends SubmapManagerBase {
|
||||
|
||||
private TextureSubmap map;
|
||||
private CTM ctm = CTM.getInstance();
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
public class SubmapManagerSlab implements ISubmapManager {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static RenderBlocksCTM rb;
|
||||
@@ -49,7 +49,7 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
@@ -63,9 +63,10 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preRenderSide(RenderBlocksCTM renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
if (side.ordinal() < 2 && !renderer.rendererOld.hasOverrideBlockTexture()) {
|
||||
renderer.rendererOld.setOverrideBlockTexture(sideTexture);
|
||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||
RenderBlocksCTM rbctm = (RenderBlocksCTM) renderer;
|
||||
if (side.ordinal() < 2 && !rbctm.rendererOld.hasOverrideBlockTexture()) {
|
||||
rbctm.rendererOld.setOverrideBlockTexture(sideTexture);
|
||||
hadOverride = false;
|
||||
} else {
|
||||
hadOverride = true;
|
||||
@@ -74,9 +75,9 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void postRenderSide(RenderBlocksCTM 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) {
|
||||
if (!hadOverride) {
|
||||
renderer.rendererOld.clearOverrideBlockTexture();
|
||||
((RenderBlocksCTM) renderer).rendererOld.clearOverrideBlockTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user