mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 01:54:46 +00:00
More SideOnly safety, should fix #309 again
This commit is contained in:
1 parent
fbab0eb9d8
commit
f0cb6555a8
6 files changed
+47
-6
No files matched your search
@@ -11,9 +11,13 @@ import com.cricketcraft.chisel.api.rendering.ISubmapManager;
|
||||
import com.cricketcraft.chisel.api.rendering.RenderBlocksCTM;
|
||||
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> {
|
||||
|
||||
private static RenderBlocksCTM rb = new RenderBlocksCTM();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private RenderBlocksCTM rb;
|
||||
|
||||
private TextureSubmap submap;
|
||||
private TextureSubmap submapSmall;
|
||||
@@ -22,6 +26,7 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
public SubmapManagerSlab(String texture) {
|
||||
this.texture = texture;
|
||||
this.rb = new RenderBlocksCTM();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,6 +40,7 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||
String path = modName + ":" + texture;
|
||||
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
||||
@@ -43,6 +49,7 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
rb.renderMaxY = 1f / 2f;
|
||||
rb.submap = submap;
|
||||
@@ -53,6 +60,7 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
private boolean hadOverride = false;
|
||||
|
||||
@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);
|
||||
@@ -63,6 +71,7 @@ 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) {
|
||||
if (!hadOverride) {
|
||||
renderer.rendererOld.clearOverrideBlockTexture();
|
||||
|
||||
Reference in new issue
Block a user