mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-12 16:27:45 +00:00
Add block param to createRenderContext. Set render bounds from blocks.
Closes #311
This commit is contained in:
1 parent
9aa5c25175
commit
9f0c9d0b6c
7 files changed
+15
-14
No files matched your search
@@ -41,7 +41,7 @@ public interface ISubmapManager<T extends RenderBlocks> {
|
||||
void registerIcons(String modName, Block block, IIconRegister register);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
T createRenderContext(RenderBlocks rendererOld, IBlockAccess world);
|
||||
T createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void preRenderSide(T renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side);
|
||||
|
||||
@@ -234,9 +234,6 @@ public enum TextureType {
|
||||
RenderBlocksCTM ret = theRenderBlocksCTM;
|
||||
Triple<?, TextureSubmap, TextureSubmap> data = (Triple<?, TextureSubmap, TextureSubmap>) cachedObject;
|
||||
ret.blockAccess = world;
|
||||
ret.renderMaxX = 1.0;
|
||||
ret.renderMaxY = 1.0;
|
||||
ret.renderMaxZ = 1.0;
|
||||
|
||||
ret.submap = data.getMiddle();
|
||||
ret.submapSmall = data.getRight();
|
||||
@@ -342,7 +339,7 @@ public enum TextureType {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected RenderBlocks createRenderContext(RenderBlocks rendererOld, IBlockAccess world, Object cachedObject) {
|
||||
return null;
|
||||
return rendererOld;
|
||||
}
|
||||
|
||||
public static TextureType getTypeFor(CarvableHelper inst, String modid, String path) {
|
||||
@@ -396,9 +393,11 @@ public enum TextureType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public T createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
public T createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
initStatics();
|
||||
return (T) type.createRenderContext(rendererOld, world, cachedObject);
|
||||
T rb = (T) type.createRenderContext(rendererOld, world, cachedObject);
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
return rb;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class RendererCTM implements ISimpleBlockRenderingHandler {
|
||||
IVariationInfo var = ((ICarvable) block).getVariation(world, x, y, z, meta);
|
||||
|
||||
if (!rendererOld.hasOverrideBlockTexture() && var != null) {
|
||||
RenderBlocks rb = var.getSubmapManager().createRenderContext(rendererOld, world);
|
||||
RenderBlocks rb = var.getSubmapManager().createRenderContext(rendererOld, block, world);
|
||||
if (rb != null && rb != rendererOld) {
|
||||
rb.blockAccess = world;
|
||||
if (rb instanceof RenderBlocksCTM) {
|
||||
|
||||
@@ -54,10 +54,11 @@ public class SubmapManagerAntiblock extends SubmapManagerBase<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTMFullbright();
|
||||
}
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cricketcraft.chisel.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -20,7 +21,7 @@ public abstract class SubmapManagerBase<T extends RenderBlocks> implements ISubm
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public T createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
public T createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ public class SubmapManagerCarpetFloor extends SubmapManagerBase<RenderBlocksCTM>
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
rb.renderMaxY = 1f / 16f;
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
|
||||
@@ -49,11 +49,11 @@ public class SubmapManagerSlab implements ISubmapManager<RenderBlocksCTM> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, IBlockAccess world) {
|
||||
public RenderBlocksCTM createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||
if (rb == null) {
|
||||
rb = new RenderBlocksCTM();
|
||||
}
|
||||
rb.renderMaxY = 1f / 2f;
|
||||
rb.setRenderBoundsFromBlock(block);
|
||||
rb.submap = submap;
|
||||
rb.submapSmall = submapSmall;
|
||||
return rb;
|
||||
|
||||
Reference in new issue
Block a user