Jump to content

Silly511

Members
  • Posts

    176
  • Joined

Everything posted by Silly511

  1. Never mind, I figured it out. All I had to do was add GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); before GL11.glEnable(GL11.GL_BLEND);
  2. I have a custom model that has a semi-transparent texture, but for some reason the model randomly flashes white. Why is this? Heres a imgur album showing what happens: And heres my render code: public class CrystalRender extends TileEntitySpecialRenderer { ResourceLocation modelTexture = new ResourceLocation(EnchantedAura.modid + ":textures/blocks/AuraCrystal.png"); ResourceLocation objModelLocation = new ResourceLocation(EnchantedAura.modid + ":models/Crystal.obj"); IModelCustom model = AdvancedModelLoader.loadModel(objModelLocation); @Override public void renderTileEntityAt(TileEntity tile, double posX, double posY, double posZ, float thing) { int rot = 1; float Xoffset = 0; float Yoffset = 0; float Zoffset = 0; if (!(tile.getWorldObj() == null)) { rot = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); } if (rot == 0) { Yoffset = 0.5F; } else if (rot == 1) { Yoffset = -0.5F; } else if (rot == 2) { Zoffset = 0.5F; } else if (rot == 3) { Zoffset = -0.5F; } else if (rot == 4) { Xoffset = 0.5F; } else if (rot == 5) { Xoffset = -0.5F; } GL11.glPushMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glTranslated(posX + Xoffset + 0.5F, posY + Yoffset + 0.5F, posZ + Zoffset + 0.5F); if (rot == 0) { GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); } else if (rot == 2) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } else if (rot == 3) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } else if (rot == 4) { GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); } else if (rot == 5) { GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } if (tile.getWorldObj() != null) { GL11.glScalef(2F, 2F, 2F); } else { GL11.glScalef(3.5F, 3.5F, 3.5F); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(modelTexture); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); model.renderAll(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopAttrib(); GL11.glPopMatrix(); } }
  3. I know I can add chat formatting codes to the lang file to change the name color of an item, but how can I make the color continuously change? Or is that even possible?
  4. I am trying to make it where when you right click a block with a keybind held down, then it places a block. But when I right click a block it does nothing. Heres my code: @SubscribeEvent public void onItemUse(PlayerUseItemEvent event) { if (KeyBindings.Ability.isPressed()) { MovingObjectPosition mop = WorldHelper.getBlockLookingAt(event.entityPlayer); if (mop != null) { ForgeDirection side = ForgeDirection.getOrientation(mop.sideHit); if (event.entityPlayer.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.stone) { event.entityPlayer.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, EnchantedAuraBlocks.Spectistone); event.entityPlayer.worldObj.playAuxSFX(2001, mop.blockX, mop.blockY, mop.blockZ, Block.getIdFromBlock(event.entityPlayer.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ)) + (0 << 12)); } else { event.entityPlayer.worldObj.setBlock(mop.blockX + side.offsetX, mop.blockY + side.offsetY, mop.blockZ + side.offsetZ, EnchantedAuraBlocks.Spectiglass); } } } } WorldHelper.getBlockLookingAt: public static MovingObjectPosition getBlockLookingAt(EntityLivingBase entity) { Vec3 vec3 = entity.getPosition(1.0F); Vec3 vec31 = entity.getLook(1.0F); Vec3 vec32 = vec3.addVector(vec31.xCoord * 200, vec31.yCoord * 200, vec31.zCoord * 200); return entity.worldObj.func_147447_a(vec3, vec32, false, false, true); } What am I doing wrong?
  5. I tried looking at chisel, but couldn't find out where it references CTMLib. Does any one know where chisel references to CTMLib?
  6. I made a block and made it extend CTMBlock, but the texture does not connect. I looked at the SubmapManagerCTM class, and saw that the getIcon method did nothing. I know I need to look at the blocks around the block, etc, etc, but I don't even know where to begin. Does anyone have code that I can use?
  7. Solved. I basically just copped Calculator's connected texture code, and then tweaked it to work for me. I'm glad that I did, since it only requires 16 textures wheres the other tut required 47.
  8. No, probably not. I just thought that if the unlocalized name of a block was the same as another block, then that means their both the same block. What should I do instead of that?
  9. I've followed a tutorial on connected textures, but for some reason my block always has a missing texture. Here's my code: ConnectedTextures Class: package net.sparklepopprograms.core.render; import java.io.Serializable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; public class ConnectedTextures extends Block { public static IIcon[] textures = new IIcon[47]; public static int[] textureRefByID = {0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 4, 4, 5, 5, 4, 4, 5, 5, 17, 17, 22, 26, 17, 17, 22, 26, 16, 16, 20, 20, 16, 16, 28, 28, 21, 21, 46, 42, 21, 21, 43, 38, 4, 4, 5, 5, 4, 4, 5, 5, 9, 9, 30, 12, 9, 9, 30, 12, 16, 16, 20, 20, 16, 16, 28, 28, 25, 25, 45, 37, 25, 25, 40, 32, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 0, 0, 6, 6, 0, 0, 6, 6, 3, 3, 19, 15, 3, 3, 19, 15, 1, 1, 18, 18, 1, 1, 13, 13, 2, 2, 23, 31, 2, 2, 27, 14, 4, 4, 5, 5, 4, 4, 5, 5, 17, 17, 22, 26, 17, 17, 22, 26, 7, 7, 24, 24, 7, 7, 10, 10, 29, 29, 44, 41, 29, 29, 39, 33, 4, 4, 5, 5, 4, 4, 5, 5, 9, 9, 30, 12, 9, 9, 30, 12, 7, 7, 24, 24, 7, 7, 10, 10, 8, 8, 36, 35, 8, 8, 34, 11}; protected ConnectedTextures(Material mat) { super(mat); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { boolean[] bitMatrix = new boolean[8]; if (side == 0 || side == 1) { bitMatrix[0] = world.getBlock(x-1, y, z-1).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[1] = world.getBlock(x, y, z-1).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[2] = world.getBlock(x+1, y, z-1).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[3] = world.getBlock(x-1, y, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[4] = world.getBlock(x+1, y, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[5] = world.getBlock(x-1, y, z+1).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[6] = world.getBlock(x, y, z+1).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[7] = world.getBlock(x+1, y, z+1).getUnlocalizedName() == this.getUnlocalizedName(); } if (side == 2 || side == 3) { bitMatrix[0] = world.getBlock(x+(side==2?1:-1), y+1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[1] = world.getBlock(x, y+1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[2] = world.getBlock(x+(side==3?1:-1), y+1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[3] = world.getBlock(x+(side==2?1:-1), y, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[4] = world.getBlock(x+(side==3?1:-1), y, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[5] = world.getBlock(x+(side==2?1:-1), y-1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[6] = world.getBlock(x, y-1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[7] = world.getBlock(x+(side==3?1:-1), y-1, z).getUnlocalizedName() == this.getUnlocalizedName(); } if (side == 4 || side == 5) { bitMatrix[0] = world.getBlock(x, y+1, z+(side==5?1:-1)).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[1] = world.getBlock(x, y+1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[2] = world.getBlock(x, y+1, z+(side==4?1:-1)).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[3] = world.getBlock(x, y, z+(side==5?1:-1)).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[4] = world.getBlock(x, y, z+(side==4?1:-1)).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[5] = world.getBlock(x, y-1, z+(side==5?1:-1)).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[6] = world.getBlock(x, y-1, z).getUnlocalizedName() == this.getUnlocalizedName(); bitMatrix[7] = world.getBlock(x, y-1, z+(side==4?1:-1)).getUnlocalizedName() == this.getUnlocalizedName(); } int idBuilder = 0; for (int i = 0; i <= 7; i++) idBuilder = idBuilder + (bitMatrix[i]?(i==0?1:(i==1?2:(i==2?4:(i==3?8:(i==4?16:(i==5?32:(i==6?64:128))))))):0); return idBuilder>255||idBuilder<0?textures[0]:textures[textureRefByID[idBuilder]]; } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegistry) { for (int i = 0; i < 47; i++) { textures[i] = iconRegistry.registerIcon(this.getTextureName() + "_" + i+1); } } } Block Class: package net.sparklepopprograms.enchantedaura.blocks; import net.minecraft.block.material.Material; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.sparklepopprograms.core.render.ConnectedTextures; import net.sparklepopprograms.enchantedaura.EnchantedAura; import net.sparklepopprograms.enchantedaura.EnchantedAuraBlocks; public class SoildLight extends ConnectedTextures { public SoildLight() { super(Material.glass); this.setBlockName("SoildLight"); this.setBlockTextureName(EnchantedAura.modid + ":SoildLight"); this.setCreativeTab(EnchantedAura.tab); } } And here's the tutorial: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571290-forge-domis-advanced-modding-tutorials-taking What am I doing wrong?
  10. I looked up rim shader and it's definitely what I want. But how would I apply a rim shader to the item render? Like I said I don't know much about rendering.
  11. I want to make a custom IItemRenderer that applys a glowing outline to a item. When the item is in hand or on the ground, the outline can be seen through blocks. Basically just like 1.9's glowing effect, except on a item. How would I do this? I don't know much about rendering. Here is my code so far: @SideOnly(Side.CLIENT) class GlowRender implements IItemRenderer { @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { IIcon icon = item.getIconIndex(); Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); if (type == ItemRenderType.ENTITY) { GL11.glTranslatef(-0.5F, -0.25F, 0.0F); } ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); GL11.glPopMatrix(); } } What do I add that makes somthing like this? Or is this even possible with a IItemRenderer?
  12. When I unwrap a model I made in blender, I join all objects into one, then mark seams, then UV unwrap. But the UV map proportions are really weird. Like a simple cube could be stretched really thin, or a circle could be compressed in a oval. What am I doing wrong?
  13. != means if type is not equal to inventory and == means if type is equal to inventory. So if (type != ItemRenderType.INVENTORY) { return true; } else { return false; } } Means that if type is not equal to inventory then return true, else return false.
  14. Ok, so I got most of it to work. The transparent texture now works perfectly, but for some reason when I pick the item up, it briefly turns white. Why would it do that? Here is my new code: @SideOnly(Side.CLIENT) public class SemiTransparentRenderer implements IItemRenderer { @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return type != ItemRenderType.INVENTORY; } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { IIcon icon = item.getIconIndex(); Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); if (type == ItemRenderType.ENTITY) { GL11.glTranslatef(-0.5F, -0.25F, 0.0F); } GL11.glEnable(GL11.GL_BLEND); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } }
  15. I have a item that uses a semi-transparent texture, however the texture is only semi-transparent in the inventory, not in my hand or on the ground. I know I need to make custom Item Renderer and enable GL_BLEND. I've made a item renderer but what do I put in it to render the item normally, but with GL_BLEND enabled? Here is my current IItemRenderer: @SideOnly(Side.CLIENT) public class SemiTransparentRenderer implements IItemRenderer { private Item item; public SemiTransparentRenderer(Item item) { this.item = item; } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { if (type != ItemRenderType.INVENTORY) { return true; } else { return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND); } }
  16. I can't figure out what coords to use there. Could you give me a image of which set of coords correspond to which places on the gui texture? EDIT: Never mind, I figured it out. I was thinking about it to hard.
  17. I am making a GUI for a energy storage block I made, and I want a bar indicating how much energy is stored in the storage block. I know you can have more than one texture in the same file, but how do I implant the texture? I am using drawTexturedModalRect for my main texture but how do I select a part of the image?
  18. How would I do that? I tried: ChatStyle link = new ChatStyle(); ChatStyle nolink = new ChatStyle(); nolink.setChatClickEvent(null)); nolink.setChatHoverEvent(null))); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); IChatComponent button = new ChatComponentText("[Download]").setChatStyle(link); IChatComponent text = new ChatComponentText(EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(nolink); And: ChatStyle link = new ChatStyle(); ChatStyle nolink = new ChatStyle(); nolink.setParentStyle(null); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); IChatComponent button = new ChatComponentText("[Download]").setChatStyle(link); IChatComponent text = new ChatComponentText(EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(nolink);
  19. I changed my code to this: ChatStyle link = new ChatStyle(); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); IChatComponent button = new ChatComponentText("[Download]").setChatStyle(link); IChatComponent text = new ChatComponentText(EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(new ChatStyle()); event.player.addChatMessage(button.appendSibling(text)); But it still does the same thing. What am I doing wrong?
  20. I'm making a update checker that tells the user in the chat when theres a new version of the mod. What I what is a link to my download page, and I know I can do this to make a link: ChatStyle link = new ChatStyle(); link.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://minecraft.curseforge.com/projects/dimensionalcore/files")); link.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.AQUA + "Download the latest version of DimensionalCore"))); link.setColor(EnumChatFormatting.BLUE); event.player.addChatMessage(new ChatComponentText("[Download]" + EnumChatFormatting.RESET + " A new version of DimensionalCore is available:").setChatStyle(link)); But I only want the link to be on the [Download] part not the whole thing. How to make the link only work on the [Download] part?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.