Posted March 18, 20187 yr Hi, I am trying to create a Mod which can show "Ghost-Items" in the world and cover them with a colored glowing effect. NOTICE: clientside only! Here you can see how the "Ghost-Items" are generated: ghostEntity = new EntityItem(mc.player.getEntityWorld(), 0, 70, 0, new ItemStack(Blocks.COBBLESTONE)); To render the Ghost-Items, I created a custom renderer which can render the Ghost-Item at a specific location in the world: (based on RenderEntityItem.class) public void doRender(EntityItem entity, double xPos, double yPos, double zPos, float entityYaw, float partialTicks) { ItemStack itemstack = entity.getItem(); // Noetig damit Item keine Defaulttextur bekommt bindEntityTexture(entity); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); RenderHelper.enableStandardItemLighting(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.pushMatrix(); IBakedModel ibakedmodel = itemRenderer.getItemModelWithOverrides(itemstack, entity.world, (EntityLivingBase) null); boolean forceGlowing = true; if (forceGlowing) { // FORCE ENTITY GLOWING GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } Minecraft mc = Minecraft.getMinecraft(); float playerX = (float) (mc.player.lastTickPosX + (mc.player.posX - mc.player.lastTickPosX) * partialTicks); float playerY = (float) (mc.player.lastTickPosY + (mc.player.posY - mc.player.lastTickPosY) * partialTicks); float playerZ = (float) (mc.player.lastTickPosZ + (mc.player.posZ - mc.player.lastTickPosZ) * partialTicks); float dx = (float) (xPos - playerX); float dy = (float) (yPos - playerY); float dz = (float) (zPos - playerZ); GlStateManager.translate(dx, dy, dz); // Groesse aendern! wenn auskommentiert, wird voller Block gerendert ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); // Item Rendern itemRenderer.renderItem(itemstack, ibakedmodel); if (forceGlowing) { // FORCE ENTITY GLOWING GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); } To add the colored glowing effect, I created a custom team and added the Ghost-Item Scoreboard scoreboard = mc.player.getWorldScoreboard(); if(scoreboard != null){ if(scoreboard.getTeam("Test1") == null){ System.out.println("create Team"); scoreboard.createTeam("Test1"); scoreboard.getTeam("Test1").setColor(TextFormatting.GOLD); ghostEntity = new EntityItem(mc.player.getEntityWorld(), 0, 70, 0, new ItemStack(Blocks.COBBLESTONE)); ghostEntity.setGlowing(true); scoreboard.addPlayerToTeam(ghostEntity.getCachedUniqueIdString(), "Test1"); } } The problem is, that if the glowing effect is enabled, the whole Ghost-Item is rendered white. Picture 1: Ghost-Item at a specific location in the world without glowing effect: CLICK Picture 2: Ghost-Item at a specific location in the world with glowing effect: CLICK How can I fix this? The teamcolor is e.g GOLD. Thank you for your help. Edited March 18, 20187 yr by badner
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.