GotoLink
Members-
Posts
2012 -
Joined
-
Last visited
-
Days Won
1
Everything posted by GotoLink
-
[Solved] Setting light value of block based on metadata [1.6.2]
GotoLink replied to larsgerrits's topic in Modder Support
@hydroflame : You are right on one thing, if your block emits light, it will appear brighter by default. To avoid this, you'll have to override public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) too. Basic Example: @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { if(world.getBlockMetadata(x,y,z) >8 return 15; else if(world.getBlockMetadata(x,y,z) ==0 return 0; else return super.getLightValue(world,x,y,z); } @Override public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return 0; } As I said, if you change block metadata somehow, you'll have to re-render the block for the change to take effect. -
[Solved] Setting light value of block based on metadata [1.6.2]
GotoLink replied to larsgerrits's topic in Modder Support
Guys, I used it in one of my mod. getLightValue(args) receives another call from the World computeLightValue(args). If you are not convinced, look at what setLightValue(float) really does. -
[Solved] Custom BlockFenceGate won't make open/close sounds
GotoLink replied to ozBillo's topic in Modder Support
Try with (EntityPlayer)null instead of the entity instance. It seems the given entity don't receive the packet. -
[Solved] Setting light value of block based on metadata [1.6.2]
GotoLink replied to larsgerrits's topic in Modder Support
@Override public int getLightValue(IBlockAccess world, int x, int y, int z) Note: you'll have to update the block when metadata is changed for the light value change to take effect. -
I thought this issue was already handled by Minecraft due to 1.6 changes ? All a texture maker would have to do is make a resource pack with the same folder system as your mod: assets/modid/textures...
-
Why would a texture maker put his png file in a jar ?
-
Custom Enchantment adding effect when attacking an Entity
GotoLink replied to OwnAgePau's topic in Modder Support
Yeah, it is event.source actually, but I thought you could take a look at the event class. That is where the field are defined. -
Custom Enchantment adding effect when attacking an Entity
GotoLink replied to OwnAgePau's topic in Modder Support
if(event.source instance of EntityDamageSource) { Entity entity = ((EntityDamageSource)event.source).getEntity(); if(entity instanceof EntityPlayer) ((EntityPlayer) entity).getHeldItem(); } -
I am currently updating the lasermod. Sadly, the main issue is rendering the lasers, which I don't have much experience with. The main rendering file, in github. https://github.com/GotoLink/LaserMod/blob/master/render/BeamRender.java Direct: package assets.lasermod.render; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.util.Icon; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; import assets.lasermod.Beam; import assets.lasermod.LaserMod; import assets.lasermod.ModInfo; import assets.lasermod.blocks.BlockBeam; import assets.lasermod.blocks.BlockLaserBlock; import assets.lasermod.tiles.EntityBeam; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class BeamRender extends BlockRenderer implements ISimpleBlockRenderingHandler { static int brightness; public static final ResourceLocation sprite = new ResourceLocation("lasermod","textures/sprites.png"); @Override public boolean renderWorldBlock(IBlockAccess iblockaccess, int i, int j, int k, Block block, int modelId, RenderBlocks renderblocks) { Tessellator tessellator = Tessellator.instance; tessellator.draw(); GL11.glPushMatrix(); //GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); EntityBeam entitybeam = (EntityBeam)iblockaccess.getBlockTileEntity(i, j, k); brightness = LaserMod.blockLaserBeam.getMixedBrightnessForBlock(iblockaccess, i, j, k); float f = (float)i + 0.5F; float f1 = (float)j + 0.5F; float f2 = (float)k + 0.5F; if ((BlockBeam.renderPass == 1) ^ (LaserMod.beamTransparency == 0)) { if (entitybeam.isOnAxis(2)) { RenderInfo renderinfo = getBeamInfo(entitybeam, 2, i, j, k, iblockaccess); if (entitybeam.isOnAxis(0)) { RenderInfo renderinfo3 = getBeamInfo(entitybeam, 0, i, j, k, iblockaccess); if (entitybeam.isOnAxis(1)) { RenderInfo renderinfo6 = getBeamInfo(entitybeam, 1, i, j, k, iblockaccess); if (renderinfo.thickness == renderinfo3.thickness && renderinfo.thickness == renderinfo6.thickness) { if (!renderinfo.end_at_pos) { renderBeamX(tessellator, renderinfo, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo.end_at_neg) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } if (!renderinfo3.end_at_pos) { renderBeamY(tessellator, renderinfo3, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo3.end_at_neg) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } if (!renderinfo6.end_at_pos) { renderBeamZ(tessellator, renderinfo6, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo6.end_at_neg) { renderBeamZ(tessellator, renderinfo6, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } tessellator.startDrawing(7); tessellator.setColorRGBA_I(renderinfo.color | renderinfo3.color, renderinfo3.alpha); double d3 = (double)renderinfo.thickness * 0.0625D; if (renderinfo3.cap_pos) { tessellator.addVertex((double)f - d3, (double)f1 + d3, (double)f2 - d3); tessellator.addVertex((double)f - d3, (double)f1 + d3, (double)f2 + d3); tessellator.addVertex((double)f + d3, (double)f1 + d3, (double)f2 + d3); tessellator.addVertex((double)f + d3, (double)f1 + d3, (double)f2 - d3); } if (renderinfo3.cap_neg) { tessellator.addVertex((double)f - d3, (double)f1 - d3, (double)f2 + d3); tessellator.addVertex((double)f - d3, (double)f1 - d3, (double)f2 - d3); tessellator.addVertex((double)f + d3, (double)f1 - d3, (double)f2 - d3); tessellator.addVertex((double)f + d3, (double)f1 - d3, (double)f2 + d3); } if (renderinfo.cap_neg) { tessellator.addVertex((double)f - d3, (double)f1 - d3, (double)f2 - d3); tessellator.addVertex((double)f - d3, (double)f1 - d3, (double)f2 + d3); tessellator.addVertex((double)f - d3, (double)f1 + d3, (double)f2 + d3); tessellator.addVertex((double)f - d3, (double)f1 + d3, (double)f2 - d3); } if (renderinfo.cap_pos) { tessellator.addVertex((double)f + d3, (double)f1 - d3, (double)f2 + d3); tessellator.addVertex((double)f + d3, (double)f1 - d3, (double)f2 - d3); tessellator.addVertex((double)f + d3, (double)f1 + d3, (double)f2 - d3); tessellator.addVertex((double)f + d3, (double)f1 + d3, (double)f2 + d3); } if (renderinfo6.cap_neg) { tessellator.addVertex((double)f - d3, (double)f1 - d3, (double)f2 - d3); tessellator.addVertex((double)f - d3, (double)f1 + d3, (double)f2 - d3); tessellator.addVertex((double)f + d3, (double)f1 + d3, (double)f2 - d3); tessellator.addVertex((double)f + d3, (double)f1 - d3, (double)f2 - d3); } if (renderinfo6.cap_pos) { tessellator.addVertex((double)f - d3, (double)f1 + d3, (double)f2 + d3); tessellator.addVertex((double)f - d3, (double)f1 - d3, (double)f2 + d3); tessellator.addVertex((double)f + d3, (double)f1 - d3, (double)f2 + d3); tessellator.addVertex((double)f + d3, (double)f1 + d3, (double)f2 + d3); } tessellator.draw(); } else if (renderinfo.thickness >= renderinfo3.thickness && renderinfo.thickness >= renderinfo6.thickness) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, 0.5F); if (!renderinfo3.end_at_pos) { renderBeamY(tessellator, renderinfo3, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo3.end_at_neg) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } if (!renderinfo6.end_at_pos) { renderBeamZ(tessellator, renderinfo6, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo6.end_at_neg) { renderBeamZ(tessellator, renderinfo6, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } } else if (renderinfo3.thickness < renderinfo.thickness || renderinfo3.thickness < renderinfo6.thickness) { renderBeamZ(tessellator, renderinfo6, f, f1, f2, 0.5F, 0.5F); if (!renderinfo3.end_at_pos) { renderBeamY(tessellator, renderinfo3, f, f1, f2, -0.0625F * renderinfo6.thickness, 0.5F); } if (!renderinfo3.end_at_neg) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.5F, -0.0625F * renderinfo6.thickness); } if (!renderinfo.end_at_pos) { renderBeamX(tessellator, renderinfo, f, f1, f2, -0.0625F * renderinfo6.thickness, 0.5F); } if (!renderinfo.end_at_neg) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, -0.0625F * renderinfo6.thickness); } } } else if (renderinfo.thickness > renderinfo3.thickness) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, 0.5F); if (!renderinfo3.end_at_pos) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo3.end_at_neg) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.5F, 0.0625F * renderinfo.thickness); } } else if (renderinfo.thickness < renderinfo3.thickness) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.5F, 0.5F); if (!renderinfo.end_at_pos) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.0625F * renderinfo3.thickness, 0.5F); } if (!renderinfo.end_at_neg) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, 0.0625F * renderinfo3.thickness); } } else { if (!renderinfo.end_at_pos) { renderBeamX(tessellator, renderinfo, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo.end_at_neg) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } if (!renderinfo3.end_at_pos) { renderBeamY(tessellator, renderinfo3, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo3.end_at_neg) { renderBeamY(tessellator, renderinfo3, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } tessellator.startDrawing(7); tessellator.setColorRGBA_I(renderinfo.color | renderinfo3.color, renderinfo3.alpha); double d = (double)renderinfo.thickness * 0.0625D; if (renderinfo3.cap_pos) { tessellator.addVertex((double)f - d, (double)f1 + d, (double)f2 - d); tessellator.addVertex((double)f - d, (double)f1 + d, (double)f2 + d); tessellator.addVertex((double)f + d, (double)f1 + d, (double)f2 + d); tessellator.addVertex((double)f + d, (double)f1 + d, (double)f2 - d); } if (renderinfo3.cap_neg) { tessellator.addVertex((double)f - d, (double)f1 - d, (double)f2 + d); tessellator.addVertex((double)f - d, (double)f1 - d, (double)f2 - d); tessellator.addVertex((double)f + d, (double)f1 - d, (double)f2 - d); tessellator.addVertex((double)f + d, (double)f1 - d, (double)f2 + d); } if (renderinfo.cap_neg) { tessellator.addVertex((double)f - d, (double)f1 - d, (double)f2 - d); tessellator.addVertex((double)f - d, (double)f1 - d, (double)f2 + d); tessellator.addVertex((double)f - d, (double)f1 + d, (double)f2 + d); tessellator.addVertex((double)f - d, (double)f1 + d, (double)f2 - d); } if (renderinfo.cap_pos) { tessellator.addVertex((double)f + d, (double)f1 - d, (double)f2 + d); tessellator.addVertex((double)f + d, (double)f1 - d, (double)f2 - d); tessellator.addVertex((double)f + d, (double)f1 + d, (double)f2 - d); tessellator.addVertex((double)f + d, (double)f1 + d, (double)f2 + d); } tessellator.addVertex((double)f - d, (double)f1 - d, (double)f2 - d); tessellator.addVertex((double)f - d, (double)f1 + d, (double)f2 - d); tessellator.addVertex((double)f + d, (double)f1 + d, (double)f2 - d); tessellator.addVertex((double)f + d, (double)f1 - d, (double)f2 - d); tessellator.addVertex((double)f - d, (double)f1 + d, (double)f2 + d); tessellator.addVertex((double)f - d, (double)f1 - d, (double)f2 + d); tessellator.addVertex((double)f + d, (double)f1 - d, (double)f2 + d); tessellator.addVertex((double)f + d, (double)f1 + d, (double)f2 + d); tessellator.draw(); } } else if (entitybeam.isOnAxis(1)) { RenderInfo renderinfo4 = getBeamInfo(entitybeam, 1, i, j, k, iblockaccess); if (renderinfo.thickness > renderinfo4.thickness) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, 0.5F); if (!renderinfo4.end_at_pos) { renderBeamZ(tessellator, renderinfo4, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo4.end_at_neg) { renderBeamZ(tessellator, renderinfo4, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } } else if (renderinfo.thickness < renderinfo4.thickness) { renderBeamZ(tessellator, renderinfo4, f, f1, f2, 0.5F, 0.5F); if (!renderinfo.end_at_pos) { renderBeamX(tessellator, renderinfo, f, f1, f2, -0.0625F * renderinfo4.thickness, 0.5F); } if (!renderinfo.end_at_neg) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, -0.0625F * renderinfo4.thickness); } } else { if (!renderinfo.end_at_pos) { renderBeamX(tessellator, renderinfo, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo.end_at_neg) { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } if (!renderinfo4.end_at_pos) { renderBeamZ(tessellator, renderinfo4, f, f1, f2, -0.0625F * renderinfo.thickness, 0.5F); } if (!renderinfo4.end_at_neg) { renderBeamZ(tessellator, renderinfo4, f, f1, f2, 0.5F, -0.0625F * renderinfo.thickness); } tessellator.startDrawing(7); tessellator.setColorRGBA_I(renderinfo.color | renderinfo4.color, renderinfo4.alpha); double d1 = (double)renderinfo.thickness * 0.0625D; tessellator.addVertex((double)f - d1, (double)f1 + d1, (double)f2 - d1); tessellator.addVertex((double)f - d1, (double)f1 + d1, (double)f2 + d1); tessellator.addVertex((double)f + d1, (double)f1 + d1, (double)f2 + d1); tessellator.addVertex((double)f + d1, (double)f1 + d1, (double)f2 - d1); tessellator.addVertex((double)f - d1, (double)f1 - d1, (double)f2 + d1); tessellator.addVertex((double)f - d1, (double)f1 - d1, (double)f2 - d1); tessellator.addVertex((double)f + d1, (double)f1 - d1, (double)f2 - d1); tessellator.addVertex((double)f + d1, (double)f1 - d1, (double)f2 + d1); if (renderinfo.cap_neg) { tessellator.addVertex((double)f - d1, (double)f1 - d1, (double)f2 - d1); tessellator.addVertex((double)f - d1, (double)f1 - d1, (double)f2 + d1); tessellator.addVertex((double)f - d1, (double)f1 + d1, (double)f2 + d1); tessellator.addVertex((double)f - d1, (double)f1 + d1, (double)f2 - d1); } if (renderinfo.cap_pos) { tessellator.addVertex((double)f + d1, (double)f1 - d1, (double)f2 + d1); tessellator.addVertex((double)f + d1, (double)f1 - d1, (double)f2 - d1); tessellator.addVertex((double)f + d1, (double)f1 + d1, (double)f2 - d1); tessellator.addVertex((double)f + d1, (double)f1 + d1, (double)f2 + d1); } if (renderinfo4.cap_neg) { tessellator.addVertex((double)f - d1, (double)f1 - d1, (double)f2 - d1); tessellator.addVertex((double)f - d1, (double)f1 + d1, (double)f2 - d1); tessellator.addVertex((double)f + d1, (double)f1 + d1, (double)f2 - d1); tessellator.addVertex((double)f + d1, (double)f1 - d1, (double)f2 - d1); } if (renderinfo4.cap_pos) { tessellator.addVertex((double)f - d1, (double)f1 + d1, (double)f2 + d1); tessellator.addVertex((double)f - d1, (double)f1 - d1, (double)f2 + d1); tessellator.addVertex((double)f + d1, (double)f1 - d1, (double)f2 + d1); tessellator.addVertex((double)f + d1, (double)f1 + d1, (double)f2 + d1); } tessellator.draw(); } } else { renderBeamX(tessellator, renderinfo, f, f1, f2, 0.5F, 0.5F); } } else if (entitybeam.isOnAxis(0)) { RenderInfo renderinfo1 = getBeamInfo(entitybeam, 0, i, j, k, iblockaccess); if (entitybeam.isOnAxis(1)) { RenderInfo renderinfo5 = getBeamInfo(entitybeam, 1, i, j, k, iblockaccess); if (renderinfo5.thickness > renderinfo1.thickness) { renderBeamZ(tessellator, renderinfo5, f, f1, f2, 0.5F, 0.5F); if (!renderinfo1.end_at_pos) { renderBeamY(tessellator, renderinfo1, f, f1, f2, -0.0625F * renderinfo5.thickness, 0.5F); } if (!renderinfo1.end_at_neg) { renderBeamY(tessellator, renderinfo1, f, f1, f2, 0.5F, -0.0625F * renderinfo5.thickness); } } else if (renderinfo5.thickness < renderinfo1.thickness) { renderBeamY(tessellator, renderinfo1, f, f1, f2, 0.5F, 0.5F); if (!renderinfo5.end_at_pos) { renderBeamZ(tessellator, renderinfo5, f, f1, f2, -0.0625F * renderinfo1.thickness, 0.5F); } if (!renderinfo5.end_at_neg) { renderBeamZ(tessellator, renderinfo5, f, f1, f2, 0.5F, -0.0625F * renderinfo1.thickness); } } else { if (!renderinfo5.end_at_pos) { renderBeamZ(tessellator, renderinfo5, f, f1, f2, -0.0625F * renderinfo5.thickness, 0.5F); } if (!renderinfo5.end_at_neg) { renderBeamZ(tessellator, renderinfo5, f, f1, f2, 0.5F, -0.0625F * renderinfo5.thickness); } if (!renderinfo1.end_at_pos) { renderBeamY(tessellator, renderinfo1, f, f1, f2, -0.0625F * renderinfo5.thickness, 0.5F); } if (!renderinfo1.end_at_neg) { renderBeamY(tessellator, renderinfo1, f, f1, f2, 0.5F, -0.0625F * renderinfo5.thickness); } tessellator.startDrawing(7); tessellator.setColorRGBA_I(renderinfo5.color | renderinfo1.color, renderinfo1.alpha); double d2 = (double)renderinfo5.thickness * 0.0625D; if (renderinfo1.cap_pos) { tessellator.addVertex((double)f - d2, (double)f1 + d2, (double)f2 - d2); tessellator.addVertex((double)f - d2, (double)f1 + d2, (double)f2 + d2); tessellator.addVertex((double)f + d2, (double)f1 + d2, (double)f2 + d2); tessellator.addVertex((double)f + d2, (double)f1 + d2, (double)f2 - d2); } if (renderinfo1.cap_neg) { tessellator.addVertex((double)f - d2, (double)f1 - d2, (double)f2 + d2); tessellator.addVertex((double)f - d2, (double)f1 - d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 - d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 - d2, (double)f2 + d2); } tessellator.addVertex((double)f - d2, (double)f1 - d2, (double)f2 - d2); tessellator.addVertex((double)f - d2, (double)f1 - d2, (double)f2 + d2); tessellator.addVertex((double)f - d2, (double)f1 + d2, (double)f2 + d2); tessellator.addVertex((double)f - d2, (double)f1 + d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 - d2, (double)f2 + d2); tessellator.addVertex((double)f + d2, (double)f1 - d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 + d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 + d2, (double)f2 + d2); if (renderinfo5.cap_neg) { tessellator.addVertex((double)f - d2, (double)f1 - d2, (double)f2 - d2); tessellator.addVertex((double)f - d2, (double)f1 + d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 + d2, (double)f2 - d2); tessellator.addVertex((double)f + d2, (double)f1 - d2, (double)f2 - d2); } if (renderinfo5.cap_pos) { tessellator.addVertex((double)f - d2, (double)f1 + d2, (double)f2 + d2); tessellator.addVertex((double)f - d2, (double)f1 - d2, (double)f2 + d2); tessellator.addVertex((double)f + d2, (double)f1 - d2, (double)f2 + d2); tessellator.addVertex((double)f + d2, (double)f1 + d2, (double)f2 + d2); } tessellator.draw(); } } else { renderBeamY(tessellator, renderinfo1, f, f1, f2, 0.5F, 0.5F); } } else if (entitybeam.isOnAxis(1)) { RenderInfo renderinfo2 = getBeamInfo(entitybeam, 1, i, j, k, iblockaccess); renderBeamZ(tessellator, renderinfo2, f, f1, f2, 0.5F, 0.5F); } } renderLens(tessellator, iblockaccess, entitybeam, i, j, k, renderblocks); //GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); tessellator.startDrawing(7); if (BlockBeam.renderPass == 0 && BlockBeam.inGlass(iblockaccess, i, j, k)) { renderblocks.renderStandardBlock(Block.blocksList[iblockaccess.getBlockId(i, j, k)], i, j, k); tessellator.draw(); tessellator.startDrawing(7); } return true; } private RenderInfo getBeamInfo(EntityBeam entitybeam, int i, int j, int k, int l, IBlockAccess iblockaccess) { i <<= 1; RenderInfo renderinfo = new RenderInfo(); Beam beam = entitybeam.get(i); Beam beam1 = entitybeam.get(i + 1); if (beam != null) { if (beam.hasBeamAt(j, k, l)) { if (beam1 != null) { if (beam1.hasBeamAt(j, k, l)) { if (beam.getPower() > beam1.getPower()) { renderinfo.color = beam.getColor().toRGB(); renderinfo.power = beam.getPower(); } else if (beam1.getPower() > beam.getPower()) { renderinfo.color = beam1.getColor().toRGB(); renderinfo.power = beam1.getPower(); } else { if (beam.getColor() == beam1.getColor()) { renderinfo.color = beam.getColor().toRGB(); } else { renderinfo.color = beam.getColor().mix(beam1.getColor()).toRGB(); } renderinfo.power = beam.getPower(); } } if (beam1.lens != null && beam1.isStart(j, k, l)) { renderinfo.lens_at_neg = true; } } else { renderinfo.color = beam.getColor().toRGB(); renderinfo.power = beam.getPower(); renderinfo.cap_neg = beam.isEnd(j, k, l); renderinfo.end_at_neg = beam.isMax(j, k, l); } } if (beam.lens != null && beam.isStart(j, k, l)) { renderinfo.lens_at_pos = true; } } else if (beam1 != null) { if (beam1.hasBeamAt(j, k, l)) { renderinfo.color = beam1.getColor().toRGB(); renderinfo.power = beam1.getPower(); renderinfo.cap_pos = beam1.isEnd(j, k, l); renderinfo.end_at_pos = beam1.isMax(j, k, l); } if (beam1.lens != null && beam1.isStart(j, k, l)) { renderinfo.lens_at_neg = true; } } if (renderinfo.power != 0.0F) { int i1 = (int)((9F - renderinfo.power - 1.0F) * 10F); if (beam != null && !beam.getInvisible()) { i1 = 0; } if (beam1 != null && !beam1.getInvisible()) { i1 = 0; } renderinfo.thickness = (renderinfo.power - 1.0F) / 3F + 1.0F; renderinfo.alpha = 80 - i1; } if (LaserMod.beamTransparency == 0) { int j1 = (renderinfo.color & 0xff0000) >> 16; int k1 = (renderinfo.color & 0xff00) >> 8; int l1 = renderinfo.color & 0xff; j1 = j1 * LaserMod.colorMultiplier >> 8; k1 = k1 * LaserMod.colorMultiplier >> 8; l1 = l1 * LaserMod.colorMultiplier >> 8; renderinfo.color = j1 << 16 | k1 << 8 | l1; if ((beam == null || beam.getInvisible()) && (beam1 == null || beam1.getInvisible())) { renderinfo.power = 0.0F; } } else { renderinfo.alpha *= 3F - ((float)LaserMod.beamTransparency / 100F) * 2.0F; } return renderinfo; } static void renderBeamX(Tessellator tessellator, RenderInfo renderinfo, float f, float f1, float f2, float f3, float f4) { GL11.glTranslatef(f,f1,f2); if (renderinfo.cap_neg && f3 > 0.0F && renderinfo.end_at_neg) { f3 = 0.0F; } if (renderinfo.cap_pos && f4 > 0.0F && renderinfo.end_at_pos) { f4 = 0.0F; } if (renderinfo.lens_at_pos && f4 > 0.375F) { f4 = 0.375F; } if (renderinfo.lens_at_neg && f3 > 0.375F) { f3 = 0.375F; } float f5 = 0.0625F * renderinfo.thickness; float f6 = f - f3; float f7 = f + f4; float f8 = f1 - f5; float f9 = f1 + f5; float f10 = f2 - f5; float f11 = f2 + f5; tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(0xf00070); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f7, f9, f10); tessellator.addVertex(f6, f8, f10); tessellator.addVertex(f7, f8, f10); tessellator.addVertex(f6, f8, f11); tessellator.addVertex(f7, f8, f11); tessellator.addVertex(f6, f9, f11); tessellator.addVertex(f7, f9, f11); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f7, f9, f10); tessellator.draw(); if (renderinfo.cap_neg && f3 >= 0.0F) { tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(brightness); tessellator.addVertex(f6, f9, f11); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f6, f8, f11); tessellator.addVertex(f6, f8, f10); tessellator.draw(); } if (renderinfo.cap_pos && f4 >= 0.0F) { tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(brightness); tessellator.addVertex(f7, f9, f10); tessellator.addVertex(f7, f9, f11); tessellator.addVertex(f7, f8, f10); tessellator.addVertex(f7, f8, f11); tessellator.draw(); } } static void renderBeamY(Tessellator tessellator, RenderInfo renderinfo, float f, float f1, float f2, float f3, float f4) { GL11.glTranslatef(f,f1,f2); if (renderinfo.cap_neg && f3 > 0.0F && renderinfo.end_at_neg) { f3 = 0.0F; } if (renderinfo.cap_pos && f4 > 0.0F && renderinfo.end_at_pos) { f4 = 0.0F; } if (renderinfo.lens_at_pos && f4 > 0.375F) { f4 = 0.375F; } if (renderinfo.lens_at_neg && f3 > 0.375F) { f3 = 0.375F; } float f5 = 0.0625F * renderinfo.thickness; float f6 = f - f5; float f7 = f + f5; float f8 = f1 - f3; float f9 = f1 + f4; float f10 = f2 - f5; float f11 = f2 + f5; tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(0xf00070); tessellator.addVertex(f6, f8, f10); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f7, f8, f10); tessellator.addVertex(f7, f9, f10); tessellator.addVertex(f7, f8, f11); tessellator.addVertex(f7, f9, f11); tessellator.addVertex(f6, f8, f11); tessellator.addVertex(f6, f9, f11); tessellator.addVertex(f6, f8, f10); tessellator.addVertex(f6, f9, f10); tessellator.draw(); if (renderinfo.cap_neg && f3 >= 0.0F) { tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(brightness); tessellator.addVertex(f7, f8, f11); tessellator.addVertex(f6, f8, f11); tessellator.addVertex(f7, f8, f10); tessellator.addVertex(f6, f8, f10); tessellator.draw(); } if (renderinfo.cap_pos && f4 >= 0.0F) { tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(brightness); tessellator.addVertex(f6, f9, f11); tessellator.addVertex(f7, f9, f11); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f7, f9, f10); tessellator.draw(); } } static void renderBeamZ(Tessellator tessellator, RenderInfo renderinfo, float f, float f1, float f2, float f3, float f4) { GL11.glTranslatef(f,f1,f2); if (renderinfo.cap_neg && f3 > 0.0F && renderinfo.end_at_neg) { f3 = 0.0F; } if (renderinfo.cap_pos && f4 > 0.0F && renderinfo.end_at_pos) { f4 = 0.0F; } if (renderinfo.lens_at_pos && f4 > 0.375F) { f4 = 0.375F; } if (renderinfo.lens_at_neg && f3 > 0.375F) { f3 = 0.375F; } float f5 = 0.0625F * renderinfo.thickness; float f6 = f - f5; float f7 = f + f5; float f8 = f1 - f5; float f9 = f1 + f5; float f10 = f2 - f3; float f11 = f2 + f4; tessellator.startDrawing(5); tessellator.setBrightness(0xf00070); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f6, f9, f11); tessellator.addVertex(f7, f9, f10); tessellator.addVertex(f7, f9, f11); tessellator.addVertex(f7, f8, f10); tessellator.addVertex(f7, f8, f11); tessellator.addVertex(f6, f8, f10); tessellator.addVertex(f6, f8, f11); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f6, f9, f11); tessellator.draw(); if (renderinfo.cap_neg && f3 >= 0.0F) { tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(brightness); tessellator.addVertex(f6, f8, f10); tessellator.addVertex(f6, f9, f10); tessellator.addVertex(f7, f8, f10); tessellator.addVertex(f7, f9, f10); tessellator.draw(); } if (renderinfo.cap_pos && f4 >= 0.0F) { tessellator.startDrawing(5); tessellator.setColorRGBA_I(renderinfo.color, renderinfo.alpha); tessellator.setBrightness(brightness); tessellator.addVertex(f6, f9, f11); tessellator.addVertex(f6, f8, f11); tessellator.addVertex(f7, f9, f11); tessellator.addVertex(f7, f8, f11); tessellator.draw(); } } private void renderLens(Tessellator tessellator, IBlockAccess iblockaccess, EntityBeam entitybeam, int i, int j, int k, RenderBlocks renderblocks) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float f = 0.00390625F; float f1 = f * 8F; //scale(0.0625F); GL11.glTranslatef(-0.5F,-0.5F,-0.5F); //move(0.5F + (float)i, 0.5F + (float)j, 0.5F + (float)k); //scaleUV(f, f); //translateUV(-0.03125F, -0.03125F); Beam beam = entitybeam.get(0); GL11.glPushMatrix(); if (beam != null && beam.isStart(i, j, k) && beam.lens != null) { Icon l = beam.lens.getFrame(); renderblocks.setOverrideBlockTexture(l); float f2 = l.getInterpolatedU(0) + f1; float f8 = l.getInterpolatedV(0) + f1; if (BlockBeam.renderPass == 1) { rotate(Axis.X, 90); renderLens(tessellator, beam.lens.color.toRGB(), Axis.Y, -1); } else { if (LaserMod.lensTransparency == 0) { rotate(Axis.X, 90); renderLens(tessellator, beam.lens.color.multiply(LaserMod.colorMultiplier), Axis.Y, -1); } rotate(Axis.X, 90); moveUV(f2, f8); renderFrame(tessellator, Axis.Y); } } GL11.glPopMatrix(); beam = entitybeam.get(1); GL11.glPushMatrix(); if (beam != null && beam.isStart(i, j, k) && beam.lens != null) { Icon l = beam.lens.getFrame(); renderblocks.setOverrideBlockTexture(l); float f3 = l.getInterpolatedU(0) + f1; float f9 = l.getInterpolatedV(0) + f1; if (BlockBeam.renderPass == 1) { rotate(Axis.X, -90); renderLens(tessellator, beam.lens.color.toRGB(), Axis.Y, 1); } else { if (LaserMod.lensTransparency == 0) { rotate(Axis.X, -90); renderLens(tessellator, beam.lens.color.multiply(LaserMod.colorMultiplier), Axis.Y, 1); } rotate(Axis.X, -90); moveUV(f3, f9); renderFrame(tessellator, Axis.Y); } } GL11.glPopMatrix(); beam = entitybeam.get(2); GL11.glPushMatrix(); if (beam != null && beam.isStart(i, j, k) && beam.lens != null) { Icon l = beam.lens.getFrame(); renderblocks.setOverrideBlockTexture(l); float f4 = l.getInterpolatedU(0) + f1; float f10 = l.getInterpolatedV(0) + f1; if (BlockBeam.renderPass == 1) { rotate(Axis.Y, 180); renderLens(tessellator, beam.lens.color.toRGB(), Axis.Z, -1); } else { if (LaserMod.lensTransparency == 0) { rotate(Axis.Y, 180); renderLens(tessellator, beam.lens.color.multiply(LaserMod.colorMultiplier), Axis.Z, -1); } rotate(Axis.Y, 180); moveUV(f4, f10); renderFrame(tessellator, Axis.Z); } } GL11.glPopMatrix(); beam = entitybeam.get(3); GL11.glPushMatrix(); if (beam != null && beam.isStart(i, j, k) && beam.lens != null) { Icon l = beam.lens.getFrame(); renderblocks.setOverrideBlockTexture(l); float f5 = l.getInterpolatedU(0) + f1; float f11 = l.getInterpolatedV(0) + f1; if (BlockBeam.renderPass == 1) { renderLens(tessellator, beam.lens.color.toRGB(), Axis.Z, 1); } else { if (LaserMod.lensTransparency == 0) { renderLens(tessellator, beam.lens.color.multiply(LaserMod.colorMultiplier), Axis.Z, 1); } moveUV(f5, f11); renderFrame(tessellator, Axis.Z); } } GL11.glPopMatrix(); beam = entitybeam.get(4); GL11.glPushMatrix(); if (beam != null && beam.isStart(i, j, k) && beam.lens != null) { Icon l = beam.lens.getFrame(); renderblocks.setOverrideBlockTexture(l); float f6 = l.getInterpolatedU(0) + f1; float f12 = l.getInterpolatedV(0) + f1; if (BlockBeam.renderPass == 1) { rotate(Axis.Y, -90); renderLens(tessellator, beam.lens.color.toRGB(), Axis.X, -1); } else { if (LaserMod.lensTransparency == 0) { rotate(Axis.Y, -90); renderLens(tessellator, beam.lens.color.multiply(LaserMod.colorMultiplier), Axis.X, -1); } moveUV(f6, f12); rotate(Axis.Y, -90); renderFrame(tessellator, Axis.X); } } GL11.glPopMatrix(); beam = entitybeam.get(5); GL11.glPushMatrix(); if (beam != null && beam.isStart(i, j, k) && beam.lens != null) { Icon l = beam.lens.getFrame(); renderblocks.setOverrideBlockTexture(l); float f7 = l.getInterpolatedU(0) + f1; float f13 = l.getInterpolatedV(0) + f1; if (BlockBeam.renderPass == 1) { rotate(Axis.Y, 90); renderLens(tessellator, beam.lens.color.toRGB(), Axis.X, 1); } else { if (LaserMod.lensTransparency == 0) { rotate(Axis.Y, 90); renderLens(tessellator, beam.lens.color.multiply(LaserMod.colorMultiplier), Axis.X, 1); } moveUV(f7, f13); rotate(Axis.Y, 90); renderFrame(tessellator, Axis.X); } } GL11.glPopMatrix(); renderblocks.clearOverrideBlockTexture(); GL11.glPopMatrix(); } private void renderFrame(Tessellator tess, Axis axis) { tess.startDrawing(7); tess.setColorOpaque_I(0xffffff); tess.setBrightness(brightness); float f0 = 0F; float f1 = 5F; float f2 = 11F; float f3 = 2F; for (int i = 0; i < 4; i++) { tess.addVertexWithUV(1.0F, 5F, 2.0F, f1, f0); tess.addVertexWithUV(1.0F, 11F, 2.0F, f2, f0); tess.addVertexWithUV(1.0F, 11F, 0.0F, f2, f3); tess.addVertexWithUV(1.0F, 5F, 0.0F, f1, f3); tess.addVertexWithUV(3F, 10F, 2.0F, f2, f0); tess.addVertexWithUV(3F, 6F, 2.0F, f1, f0); tess.addVertexWithUV(3F, 6F, 0.0F, f1, f3); tess.addVertexWithUV(3F, 10F, 0.0F, f2, f3); tess.addVertexWithUV(1.0F, 11F, 2.0F, 1.0F, 11F); tess.addVertexWithUV(1.0F, 5F, 2.0F, 1.0F, 5F); tess.addVertexWithUV(3F, 6F, 2.0F, 3F, 6F); tess.addVertexWithUV(3F, 10F, 2.0F, 3F, 10F); tess.addVertexWithUV(5F, 1.0F, 2.0F, 0.0F, f0); tess.addVertexWithUV(1.0F, 5F, 2.0F, f1, f0); tess.addVertexWithUV(1.0F, 5F, 0.0F, f1, f3); tess.addVertexWithUV(5F, 1.0F, 0.0F, 0.0F, f3); tess.addVertexWithUV(3F, 6F, 2.0F, f1, f0); tess.addVertexWithUV(6F, 3F, 2.0F, 0.0F, f0); tess.addVertexWithUV(6F, 3F, 0.0F, 0.0F, f3); tess.addVertexWithUV(3F, 6F, 0.0F, f1, f3); tess.addVertexWithUV(3F, 6F, 2.0F, 0.0F, f0); tess.addVertexWithUV(1.0F, 5F, 2.0F, 0.0F, f3); tess.addVertexWithUV(5F, 1.0F, 2.0F, f1, f3); tess.addVertexWithUV(6F, 3F, 2.0F, f1, f0); rotate(axis, 90); //rotateUV(90); } tess.draw(); } private void renderLens(Tessellator tess, int i, Axis axis, int j) { j *= 90; //GL11.glPushMatrix(); //GL11.glDisable(GL11.GL_TEXTURE_2D); tess.startDrawing(6); if (LaserMod.lensTransparency == 0) { tess.setColorRGBA_I(i, LaserMod.colorMultiplier); } else { tess.setColorRGBA_I(i, (int)(128F * (2.0F - ((float)LaserMod.lensTransparency / 100F) * 1.0F))); } tess.setBrightness(brightness); tess.addVertex(8F, 8F, 1.0F); for (int k = 0; k < 4; k++) { tess.addVertex(3F, 6F, 1.0F); tess.addVertex(6F, 3F, 1.0F); rotate(axis, j); } tess.addVertex(3F, 6F, 1.0F); tess.draw(); //GL11.glEnable(GL11.GL_TEXTURE_2D); //GL11.glPopMatrix(); } @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { } @Override public boolean shouldRender3DInInventory() { return false; } @Override public int getRenderId() { return BlockBeam.renderID; } } The previous author was using custom texture handling, which can't be used with the new rendering in Minecraft. Feel free to suggest anything, I don't have much done.
-
Custom Enchantment adding effect when attacking an Entity
GotoLink replied to OwnAgePau's topic in Modder Support
event.entityLiving is the entity hit. event.source contains the entity hitting. if(entity instanceof EntityPlayer) ((EntityPlayer) entity).getHeldItem(); -
Man...any .lang file ?...what about the language set in your options file ?
-
Custom Enchantment adding effect when attacking an Entity
GotoLink replied to OwnAgePau's topic in Modder Support
I don't think so. Most useful args are contained by the event arg. (event.entityLiving, event.cause, event.ammount in your event case) -
Fluid f = new Fluid("LINSEED_OIL").setDensity(800).setViscosity(1500); FluidRegistry.registerFluid(f); linseedOil = FluidRegistry.getFluid("LINSEED_OIL") == null? f:FluidRegistry.getFluid("LINSEED_OIL"); I am not much into fluids, so I might not be of great help. What are trying to do with the last line ? isn't the f instance enough ? The screen overlay color comes from your block material I think. Each block material has its own MapColor instance. In BlockFluid, I know of two methods dealing with rendering color: public int getBlockColor() public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) Drowning is calculated in EntityLivingBase, here are the lines: boolean flag = this instanceof EntityPlayer && ((EntityPlayer)this).capabilities.disableDamage; if (this.isEntityAlive() && this.isInsideOfMaterial(Material.water)) { if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !flag) { this.setAir(this.decreaseAirSupply(this.getAir())); if (this.getAir() == -20) { this.setAir(0); for (int i = 0; i < 8; ++i) { float f = this.rand.nextFloat() - this.rand.nextFloat(); float f1 = this.rand.nextFloat() - this.rand.nextFloat(); float f2 = this.rand.nextFloat() - this.rand.nextFloat(); this.worldObj.spawnParticle("bubble", this.posX + (double)f, this.posY + (double)f1, this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ); } this.attackEntityFrom(DamageSource.drown, 2.0F); It is worth noting that your block material should be water. (no drowning in lava ! ) Your fluid height is calculated with /** * Returns the percentage of the fluid block that is air, based on the given flow decay of the fluid. */ public static float getFluidHeightPercent(int par0) { if (par0 >= { par0 = 0; } return (float)(par0 + 1) / 9.0F; } in BlockFluid.
-
[1.6.2] [Solved] Selecting entity ID returns an incorrect value
GotoLink replied to RaTheBadger's topic in Modder Support
EntityList.getEntityID(entity); -
[1.5.2] [Forge] TickHandler any example on how to do that??
GotoLink replied to lorizz's topic in Modder Support
You'll have to send a packet from your keyhandler to the server then. -
Hooking chat commands client-side on multiplayer
GotoLink replied to harik's topic in Modder Support
Look, if you accurately describe a problem, people can then suggest better solutions. If you can't handle any other ideas than your own, don't ask. By the way, if you meant this thread as a suggestion, this isn't the right section of these forums. It is sad that you insist into using chat commands when a simple gui can do what you want. You are only making this harder on yourself. -
[SOLVED][1.6.2] [Forge] Custom Drops for Existing Mobs
GotoLink replied to SuperHB's topic in Modder Support
Duplicate with http://www.minecraftforge.net/forum/index.php/topic,6254.0.html -
Block.waterMoving probably has a dynamic texture instead of an Icon. Set your own.
-
getDisplayName() always return english name?
GotoLink replied to DrEinsteinium's topic in Modder Support
String currentLanguageFormatted = Minecraft.getMinecraft().gameSettings.language; -
float f = (float)j / 20.0F; You didn't change anything...
-
Looks like this is it
-
Yes, you just have to override the main method with a copy and replace the values where needed.
-
Custom Enchantment adding effect when attacking an Entity
GotoLink replied to OwnAgePau's topic in Modder Support
Don't do setCanceled(true) ItemStack item = player.getHeldItem(); if(item!=null && item.getItem() instanceof 'CustomSwordClass' && item.hasTagCompound()) { NBTTagList enchTag = item.getEnchantmentTagList();//use this if you stored your enchantment at "ench" tag in the item //then do things } -
It is an hardcoded value.
-
Minecraft.getMinecraft().getRenderEngine()./bindTextureInObfName/(texture); ?