mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 04:32:18 +00:00
Transparent/translucent facades will no longer stop conduit rendering.
This commit is contained in:
1 parent
73b68940ce
commit
5cb34bf8b8
4 files changed
+45
-17
No files matched your search
@@ -24,10 +24,12 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode;
|
||||
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -83,6 +85,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
|
||||
BlockConduitBundle result = new BlockConduitBundle();
|
||||
result.init();
|
||||
MinecraftForge.EVENT_BUS.register(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -297,6 +300,27 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBreakSpeed(BreakSpeed event) {
|
||||
if (event.block == this) {
|
||||
event.newSpeed *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static volatile int theRenderPass;
|
||||
|
||||
@Override
|
||||
public boolean canRenderInPass(int pass) {
|
||||
theRenderPass = pass;
|
||||
System.out.println(pass);
|
||||
return pass == 0 || pass == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z,
|
||||
|
||||
@@ -188,7 +188,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
@Override
|
||||
public int getLightOpacity() {
|
||||
if((worldObj != null && !worldObj.isRemote) || lightOpacity == -1) {
|
||||
return hasFacade() ? 255 : 0;
|
||||
return hasFacade() ? facadeId.getLightOpacity() : 0;
|
||||
}
|
||||
return lightOpacity;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) {
|
||||
IConduitBundle bundle = (IConduitBundle) te;
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
if(bundle.hasFacade() && !ConduitUtil.isFacadeHidden(bundle, player)) {
|
||||
if(bundle.hasFacade() && bundle.getFacadeId().isOpaqueCube() && !ConduitUtil.isFacadeHidden(bundle, player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,8 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
IConduitBundle bundle = (IConduitBundle) world.getTileEntity(x, y, z);
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
boolean renderConduit = renderFacade(x, y, z, rb, bundle, player);
|
||||
boolean renderedFacade = !renderFacade(x, y, z, rb, bundle, player);
|
||||
boolean renderConduit = !renderedFacade && BlockConduitBundle.theRenderPass == 0;
|
||||
|
||||
if(renderConduit) {
|
||||
BlockCoord loc = bundle.getLocation();
|
||||
@@ -114,9 +115,10 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
brightness = bundle.getEntity().getWorldObj().getLightBrightnessForSkyBlocks(loc.x, loc.y, loc.z, 0);
|
||||
}
|
||||
renderConduits(bundle, x, y, z, 0, brightness);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return renderedFacade || (bundle.hasFacade() && !bundle.getFacadeId().isOpaqueCube());
|
||||
}
|
||||
|
||||
private boolean renderFacade(int x, int y, int z, RenderBlocks rb, IConduitBundle bundle, EntityClientPlayerMP player) {
|
||||
@@ -140,20 +142,22 @@ public class ConduitBundleRenderer extends TileEntitySpecialRenderer implements
|
||||
|
||||
} else if(facadeId != null){
|
||||
bundle.setFacadeRenderAs(FacadeRenderState.FULL);
|
||||
res = false;
|
||||
res = !facadeId.isOpaqueCube();
|
||||
|
||||
IBlockAccess origBa = rb.blockAccess;
|
||||
rb.blockAccess = new FacadeAccessWrapper(origBa);
|
||||
try {
|
||||
rb.renderBlockByRenderType(facadeId, x, y, z);
|
||||
} catch(Exception e) {
|
||||
//just in case the paint source wont render safely in this way
|
||||
rb.setOverrideBlockTexture(IconUtil.errorTexture);
|
||||
rb.renderStandardBlock(Blocks.stone, x, y, z);
|
||||
rb.setOverrideBlockTexture(null);
|
||||
if(BlockConduitBundle.theRenderPass == 1) {
|
||||
IBlockAccess origBa = rb.blockAccess;
|
||||
rb.blockAccess = new FacadeAccessWrapper(origBa);
|
||||
try {
|
||||
rb.renderBlockByRenderType(facadeId, x, y, z);
|
||||
} catch (Exception e) {
|
||||
//just in case the paint source wont render safely in this way
|
||||
rb.setOverrideBlockTexture(IconUtil.errorTexture);
|
||||
rb.renderStandardBlock(Blocks.stone, x, y, z);
|
||||
rb.setOverrideBlockTexture(null);
|
||||
}
|
||||
|
||||
rb.blockAccess = origBa;
|
||||
}
|
||||
|
||||
rb.blockAccess = origBa;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class BasicPainterTemplate implements IMachineRecipe {
|
||||
return false;
|
||||
}
|
||||
|
||||
return block.isOpaqueCube() || (block.getMaterial().isOpaque() && block.renderAsNormalBlock()) || block == Blocks.glass;
|
||||
return block.getRenderType() == 0 || block.isOpaqueCube() || block.isNormalCube();
|
||||
}
|
||||
|
||||
protected final Block[] validTargets;
|
||||
|
||||
Reference in new issue
Block a user