WilLink Posted January 30, 2016 Share Posted January 30, 2016 I'm making this beacon block(basicly a beacon without a block) And the renderer works fine, except lighting is strange when the block is placed on the ground... ProbeBlock.class: package trm.dataprobes.blocks; import java.util.List; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.world.World; import trm.dataprobes.NavigatioNav; import trm.dataprobes.NavigatioNavItems; import trm.dataprobes.tentity.TileEntityProbe; import trm.dataprobes.tentity.TileEntityProbeActivated; public class ProbeBlock extends BlockContainer { public ProbeBlock() { super(Material.iron); this.setBlockName("probeblock"); this.setLightLevel(2); this.setBlockUnbreakable(); } @Override public boolean isOpaqueCube() { return false; } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } @Override public int getRenderType() { return -1; } @Override public void registerBlockIcons(IIconRegister reg) { blockIcon = reg.registerIcon(NavigatioNav.ModID + ":" + "probe"); } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new TileEntityProbe(); } @Override public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { if (!world.isRemote && player.getHeldItem() != null && player.getHeldItem().getItem() == NavigatioNavItems.navDevice) { player.addChatMessage(new ChatComponentText("Data Probe - Removed.")); world.setBlockToAir(x, y, z); } } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int var, float j, float k, float l) { if(!world.isRemote && player.getHeldItem() != null && player.getHeldItem().getItem() == NavigatioNavItems.navDevice) { player.addChatMessage(new ChatComponentText("Data Probe - Installed!")); world.setBlock(x, y, z, NavigatioNavItems.probe_activated); } else if(!world.isRemote) { player.addChatMessage(new ChatComponentText("You need a NavDevice, to configure this.")); } if(player.getHeldItem() != null && player.getHeldItem().getItem() == NavigatioNavItems.navDevice) return true; else return false; } } TileEntityProbe.class: package trm.dataprobes.tentity; import trm.dataprobes.NavigatioNavItems; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public final class TileEntityProbe extends TileEntity { private boolean field_146015_k = true; @SideOnly(Side.CLIENT) private long field_146016_i; @SideOnly(Side.CLIENT) private float field_146014_j; @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 65536.0D; } @Override @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } @SideOnly(Side.CLIENT) public float func_146002_i() { if (!this.field_146015_k ) { return 0.0F; } else { int i = (int)(this.worldObj.getTotalWorldTime() - this.field_146016_i); this.field_146016_i = this.worldObj.getTotalWorldTime(); if (i > 1) { this.field_146014_j -= (float)i / 40.0F; if (this.field_146014_j < 0.0F) { this.field_146014_j = 0.0F; } } this.field_146014_j += 0.025F; if (this.field_146014_j > 1.0F) { this.field_146014_j = 1.0F; } return this.field_146014_j; } } } TileEntityProbeRenderer: package trm.dataprobes.tentity; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import trm.dataprobes.NavigatioNav; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class TileEntityProbeRenderer extends TileEntitySpecialRenderer { private static final ResourceLocation field_147523_b = new ResourceLocation(NavigatioNav.ModID + ":" + "textures/entity/nav_beam.png"); public void renderTileEntityAt(TileEntityProbe entity, double x, double y, double z, float p_147522_8_) { float f1 = entity.func_146002_i(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if (f1 > 0.0F) { Tessellator tessellator = Tessellator.instance; this.bindTexture(field_147523_b); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = (float)entity.getWorldObj().getTotalWorldTime() + p_147522_8_; float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F); byte b0 = 1; double d3 = (double)f2 * 0.025D * (1.0D - (double)(b0 & 1) * 2.5D); tessellator.startDrawingQuads(); tessellator.setColorRGBA(255, 125, 75, 32); double d5 = (double)b0 * 0.2D; double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5; double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5; double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5; double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5; double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5; double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5; double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5; double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5; double d23 = (double)(256.0F * f1); double d25 = 0.0D; double d27 = 1.0D; double d28 = (double)(-1.0F + f3); double d29 = (double)(256.0F * f1) * (0.5D / d5) + d28; double bottom = 1.0D - 1; tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29); tessellator.addVertexWithUV(x + d7, y + bottom, z + d9, d27, d28); tessellator.addVertexWithUV(x + d11, y + bottom, z + d13, d25, d28); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29); tessellator.addVertexWithUV(x + d19, y + bottom, z + d21, d27, d28); tessellator.addVertexWithUV(x + d15, y + bottom, z + d17, d25, d28); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29); tessellator.addVertexWithUV(x + d11, y + bottom, z + d13, d27, d28); tessellator.addVertexWithUV(x + d19, y + bottom, z + d21, d25, d28); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29); tessellator.addVertexWithUV(x + d15, y + bottom, z + d17, d27, d28); tessellator.addVertexWithUV(x + d7, y + bottom, z + d9, d25, d28); tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29); tessellator.draw(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA(255, 255, 255, 32); double d30 = 0.2D; double d4 = 0.2D; double d6 = 0.8D; double d8 = 0.2D; double d10 = 0.2D; double d12 = 0.8D; double d14 = 0.8D; double d16 = 0.8D; double d18 = (double)(256.0F * f1); double d20 = 0.0D; double d22 = 1.0D; double d24 = (double)(-1.0F + f3); double d26 = (double)(256.0F * f1) + d24; tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26); tessellator.addVertexWithUV(x + d30, y + bottom, z + d4, d22, d24); tessellator.addVertexWithUV(x + d6, y + bottom, z + d8, d20, d24); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26); tessellator.addVertexWithUV(x + d14, y + bottom, z + d16, d22, d24); tessellator.addVertexWithUV(x + d10, y + bottom, z + d12, d20, d24); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26); tessellator.addVertexWithUV(x + d6, y + bottom, z + d8, d22, d24); tessellator.addVertexWithUV(x + d14, y + bottom, z + d16, d20, d24); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26); tessellator.addVertexWithUV(x + d10, y + bottom, z + d12, d22, d24); tessellator.addVertexWithUV(x + d30, y + bottom, z + d4, d20, d24); tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); } GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); } public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float par5) { this.renderTileEntityAt((TileEntityProbe)entity, x, y, z, par5); } } Here's a screenshot of the issue: (And if I put the beacon on top of a block emitting light(Glowstone or Redstone Lamp) the glowstone/lamp becomes invisible and I can see caves through it.) Quote Link to comment Share on other sites More sharing options...
WilLink Posted February 2, 2016 Author Share Posted February 2, 2016 Bump..? Quote Link to comment Share on other sites More sharing options...
N247S Posted February 2, 2016 Share Posted February 2, 2016 Returning true in the method isOpaque() should do the trick Quote Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager Link to comment Share on other sites More sharing options...
Draco18s Posted February 2, 2016 Share Posted February 2, 2016 Returning true in the method isOpaque() should do the trick Cough, return false, cough. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
WilLink Posted February 2, 2016 Author Share Posted February 2, 2016 Returning true in the method isOpaque() should do the trick Cough, return false, cough. Well... isOpaqueCube() is already returning false, and if I put it to true, then the beam block will make the block underneath's surface see-throughable. Quote Link to comment Share on other sites More sharing options...
N247S Posted February 2, 2016 Share Posted February 2, 2016 @Draco Lol, I said it the other way around indeed. @wilLink If that is set correctly, maybe playing around with the renderType?(Dont know what number you need exactually, I dont have acces to my IDE right now) Otherwise you might need to add some lightning adjustments inside your tileEntityRenderef code. Though I higly doubt that it would be necessary. Quote Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager Link to comment Share on other sites More sharing options...
Draco18s Posted February 2, 2016 Share Posted February 2, 2016 @Draco Lol, I said it the other way around indeed. God damn function names not matching what they mean. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given. Link to comment Share on other sites More sharing options...
WilLink Posted February 5, 2016 Author Share Posted February 5, 2016 @Draco Lol, I said it the other way around indeed. @wilLink If that is set correctly, maybe playing around with the renderType?(Dont know what number you need exactually, I dont have acces to my IDE right now) Otherwise you might need to add some lightning adjustments inside your tileEntityRenderef code. Though I higly doubt that it would be necessary. Well, I could play around with renderType and stuff, but about lighting adjustments... I'm not that good at rendering codes. Quote Link to comment Share on other sites More sharing options...
WilLink Posted February 15, 2016 Author Share Posted February 15, 2016 Bump. Quote Link to comment Share on other sites More sharing options...
Elix_x Posted February 15, 2016 Share Posted February 15, 2016 When using TESR, there are 3 methods to override in block class: @Override public boolean isOpaqueCube(){ return false; } @Override public boolean renderAsNormalBlock(){ return false; } @Override public int getRenderType(){ return -1; } Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
WilLink Posted February 16, 2016 Author Share Posted February 16, 2016 When using TESR, there are 3 methods to override in block class: @Override public boolean isOpaqueCube(){ return false; } @Override public boolean renderAsNormalBlock(){ return false; } @Override public int getRenderType(){ return -1; } Thanks for the help, but I've already tried with all these methods overwritten. It didn't work. Quote Link to comment Share on other sites More sharing options...
WilLink Posted February 22, 2016 Author Share Posted February 22, 2016 Bump..? Quote Link to comment Share on other sites More sharing options...
WilLink Posted March 3, 2016 Author Share Posted March 3, 2016 Bump. Quote Link to comment Share on other sites More sharing options...
Pdan4 Posted June 22, 2016 Share Posted June 22, 2016 Have you set, in your block class, this.setLightOpacity(0) ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.