Jump to content

mr_crayfish

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by mr_crayfish

  1. By default, transparent pixels in textures are rendered black if the opacity is 0%. Otherwise all other pixels are set to 100% opacity. Assuming using 1.11.2, this code will resolve your problem. public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } Edit: Goes in your block class
  2. Thank you very much! Finally got my head around how it works now. Flipping animation is now smooth to any framerate
  3. Hello, I'm currently working on a flip animation for a grill block I am creating. The problem I am facing is that the animaton speed varies depending on the FPS. I have read that multiplying your values by partialTicks will solve this issue but this doesn't seem to be the case. I'm wonder if you guys what I am doing wrong, and how it can be fixed? Thanks GrillRenderer package com.mrcrayfish.furniture.render.tileentity; import com.mrcrayfish.furniture.blocks.BlockGrill; import com.mrcrayfish.furniture.tileentity.TileEntityGrill; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; public class GrillRenderer extends TileEntitySpecialRenderer { private ItemStack coal = new ItemStack(Items.coal, 1, 1); private EntityItem entityItem = new EntityItem(Minecraft.getMinecraft().theWorld, 0D, 0D, 0D, coal); private final float MAX_ANIM_TIME = 100F; private final float FLIP_HEIGHT = 0.5F; @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage) { entityItem.hoverStart = 0; if(!(te.getBlockType() instanceof BlockGrill)) return; BlockGrill grill = (BlockGrill) te.getBlockType(); TileEntityGrill tileEntityGrill = (TileEntityGrill) te; int rotation = grill.getMetaFromState(te.getWorld().getBlockState(te.getPos())); GlStateManager.pushMatrix(); { GlStateManager.translate(x, y, z); GlStateManager.translate(0.5, 0.85, 0.5); GlStateManager.rotate(rotation * -90F, 0, 1, 0); GlStateManager.translate(0.18, 0, -0.35); GlStateManager.rotate(90F, 1, 0, 0); for(int i = 0; i < tileEntityGrill.getCoal(); i++) { GlStateManager.pushMatrix(); { GlStateManager.rotate(15F, 0, 1, 0); entityItem.setEntityItemStack(coal); Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); } GlStateManager.popMatrix(); GlStateManager.translate(-0.2, 0, 0); } } GlStateManager.popMatrix(); GlStateManager.pushMatrix(); { GlStateManager.translate(x, y, z); GlStateManager.translate(0.5, 1, 0.5); GlStateManager.rotate(rotation * -90F, 0, 1, 0); GlStateManager.translate(0.2, 0, -0.32); GlStateManager.rotate(90F, 1, 0, 0); /* Left */ if(tileEntityGrill.getItem(0) != null) { GlStateManager.pushMatrix(); { if(tileEntityGrill.flippedLeft) { if(tileEntityGrill.leftFlippingCount < MAX_ANIM_TIME / 2) { tileEntityGrill.leftCurrentHeight += (FLIP_HEIGHT / (MAX_ANIM_TIME / 2)) * partialTicks; } else if(tileEntityGrill.leftCurrentHeight > 0F) { tileEntityGrill.leftCurrentHeight -= (FLIP_HEIGHT / (MAX_ANIM_TIME / 2)) * partialTicks; } if(tileEntityGrill.leftCurrentHeight >= 0F) { GlStateManager.translate(0, 0, -Math.sqrt(tileEntityGrill.leftCurrentHeight)); } else { tileEntityGrill.leftCurrentHeight = 0F; } } GlStateManager.rotate((tileEntityGrill.leftFlippingCount / MAX_ANIM_TIME * 180F), 0, 1, 0); entityItem.setEntityItemStack(tileEntityGrill.getItem(0)); Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); if(tileEntityGrill.flippedLeft && tileEntityGrill.leftFlippingCount < MAX_ANIM_TIME) { tileEntityGrill.leftFlippingCount += partialTicks; } } GlStateManager.popMatrix(); } else { tileEntityGrill.leftFlippingCount = 0F; } GlStateManager.translate(-0.4, 0, 0); /* Right */ if(tileEntityGrill.getItem(1) != null) { GlStateManager.pushMatrix(); { if(tileEntityGrill.flippedRight) { if(tileEntityGrill.rightFlippingCount < MAX_ANIM_TIME / 2) { tileEntityGrill.rightCurrentHeight += (FLIP_HEIGHT / (MAX_ANIM_TIME / 2)) * partialTicks; } else if(tileEntityGrill.rightCurrentHeight > 0F) { tileEntityGrill.rightCurrentHeight -= (FLIP_HEIGHT / (MAX_ANIM_TIME / 2)) * partialTicks; } if(tileEntityGrill.rightCurrentHeight >= 0F) { GlStateManager.translate(0, 0, -Math.sqrt(tileEntityGrill.rightCurrentHeight)); } else { tileEntityGrill.rightCurrentHeight = 0F; } } //System.out.println("Right Flip Count:" + tileEntityGrill.rightFlippingCount); //System.out.println("Right Current Height:" + tileEntityGrill.rightCurrentHeight); GlStateManager.rotate(tileEntityGrill.rightFlippingCount / MAX_ANIM_TIME * 180F, 0, 1, 0); entityItem.setEntityItemStack(tileEntityGrill.getItem(1)); Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); if(tileEntityGrill.flippedRight && tileEntityGrill.rightFlippingCount < MAX_ANIM_TIME) { tileEntityGrill.rightFlippingCount += partialTicks; } } GlStateManager.popMatrix(); } else { tileEntityGrill.rightFlippingCount = 0F; } } GlStateManager.popMatrix(); } }
  4. I'm going to be posting the source code to my Furniture Mod very soon. It shows how to texture items and blocks https://github.com/mrcrayfish
  5. I don't know if this would help but ((woodEbony.getMaxU()-woodEbony.getMaxU())*wp)+woodEbony.getMinU() would just equal woodEbony.getMinU() . You are getting the maxU minus the maxU, which just equals 0 and has no purpose. When its multiplied, its still 0. Same goes for the other 3 UVs
  6. Ahh, I'm stupid. Just discovered I can use getActualState to get TileEntity data then parse to BlockState for block models. I just got confused because I thought I was limited to 16 unique state, but now I've found that method, I can do a lot more.
  7. Thank you. That limits block models quite a bit Hopefully someone will implement ISBRH in future but for now I'm going to try to use a TE and TESR to render the water level.
  8. Hello, I seem to be having some trouble with the blockstate for one of my blocks. I have 2 properties, one being a PropertyDirection (north, east, south, west) and PropertyInteger (Min: 0 and Max: 16). They are both used to determine the json file for the render. The problem that I am having is that the properties are going "berserk" when I place and interact with the block down in the world. I understand that each state needs a unique id and I have wrote that correctly in the method getMetaFromState. getStateFromMeta also returns back the correct state. Below is all relevant code and a video showing the problem. Any help is appreciated! BlockBath: BlockFurniture ItemBath blockstates/bath_bottom.json blockstates/bath_top.json Video:
  9. Hello, I seem to be having a problem with my custom achievement page. I looked on another post that had exactly the same crash and was resolved by initializing the achievements in Init and registering the page in PostInit. Unfortunately that did not resolve my crash and still gets the same error. Link to that post: http://www.minecraftforge.net/forum/index.php?topic=16909.0 Here is my code Mod Class @EventHandler public void load(FMLInitializationEvent event) { FurnitureAchievements.loadAchievements(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { FurnitureAchievements.registerPage(); } Achievement Class package com.mrcrayfish.furniture; public class FurnitureAchievements { public static Map<String, Achievement> achievements = new HashMap<String, Achievement>(); public static Achievement installMod; public static Achievement mineKea; public static Achievement placeTree; public static Achievement unwrapPresent; public static Achievement houseParty; public static Achievement applianceCity; public static Achievement cookItem; public static Achievement buyItem; public static Achievement freezeItem; public static Achievement copyItem; public static Achievement whatDidYouEat; public static Achievement mailBox; public static Achievement sendMail; public static Achievement firstMail; public static Achievement donator; public static Achievement privacy; public static Achievement tapped; public static Achievement heyeyey; public static Achievement dingDong; public static Achievement careful; public static Achievement allClean; public static Achievement modernTechnology; public static Achievement gardening; public static Achievement bathroom; public static AchievementPage page; public static void loadAchievements() { registerIndependantAchievement(installMod, "install", 0, 0, new ItemStack(MrCrayfishFurnitureMod.itemCrayfish)); registerAchievement(mineKea, "minekea", 2, 0, new ItemStack(MrCrayfishFurnitureMod.itemChairWood), installMod); registerAchievement(placeTree, "placetree", 3, 1, new ItemStack(MrCrayfishFurnitureMod.itemTree), mineKea); registerAchievement(unwrapPresent, "unwrappresent", 4, 2, new ItemStack(MrCrayfishFurnitureMod.itemPresentRed), placeTree); registerAchievement(privacy, "privacy", 4, 0, new ItemStack(MrCrayfishFurnitureMod.itemCurtains), mineKea); registerAchievement(applianceCity, "appliancecity", 1, 2, new ItemStack(MrCrayfishFurnitureMod.itemOven), installMod); registerAchievement(cookItem, "cookitem", 2, 3, new ItemStack(Items.cooked_chicken), applianceCity); registerAchievement(freezeItem, "freezeitem", 0, 3, new ItemStack(Blocks.ice), applianceCity); registerAchievement(modernTechnology, "moderntechnology", -3, 2, new ItemStack(MrCrayfishFurnitureMod.itemComputer), installMod); registerAchievement(buyItem, "buyitem", -2, 1, new ItemStack(Items.emerald), modernTechnology); registerAchievement(copyItem, "copyitem", -4, 1, new ItemStack(Items.book), modernTechnology); registerAchievement(houseParty, "houseparty", -3, 0, new ItemStack(MrCrayfishFurnitureMod.itemStereo), modernTechnology); registerAchievement(heyeyey, "heyeyey", -4, 3, new ItemStack(MrCrayfishFurnitureMod.itemTV), modernTechnology); registerAchievement(dingDong, "dingdong", -3, 4, new ItemStack(MrCrayfishFurnitureMod.itemDoorBell), modernTechnology); registerAchievement(careful, "careful", -2, 3, new ItemStack(MrCrayfishFurnitureMod.itemElectricFence), modernTechnology); registerAchievement(gardening, "gardening", -2, -2, new ItemStack(MrCrayfishFurnitureMod.itemHedgeBasic), installMod); registerAchievement(mailBox, "mailbox", -3, -3, new ItemStack(MrCrayfishFurnitureMod.itemMailBox), gardening); registerAchievement(sendMail, "sendmail", -4, -4, new ItemStack(MrCrayfishFurnitureMod.itemEnvelope), mailBox); registerAchievement(firstMail, "firstmail", -4, -2, new ItemStack(MrCrayfishFurnitureMod.itemPackage), mailBox); registerAchievement(tapped, "tapped", -1, -3, new ItemStack(MrCrayfishFurnitureMod.itemTap), gardening); registerAchievement(donator, "donator", -1, -4, new ItemStack(MrCrayfishFurnitureMod.itemDollar), gardening); registerAchievement(bathroom, "bathroom", 2, -2, new ItemStack(MrCrayfishFurnitureMod.itemBasin), installMod); registerAchievement(whatDidYouEat, "whatdidyoueat", 3, -3, new ItemStack(MrCrayfishFurnitureMod.itemToilet), bathroom); registerAchievement(allClean, "allclean", 1, -3, new ItemStack(MrCrayfishFurnitureMod.itemShower), bathroom); page = new AchievementPage("MrCrayfish's Furniture Mod", installMod, mineKea, placeTree, unwrapPresent, privacy, applianceCity, cookItem, freezeItem, modernTechnology, buyItem, copyItem, houseParty, heyeyey, dingDong, careful, gardening, mailBox, sendMail, firstMail, tapped, donator, bathroom, whatDidYouEat, allClean); } public static void registerAchievement(Achievement achieve, String name, int iconX, int iconY, ItemStack displayItem, Achievement parent) { achieve = new Achievement("achievement." + name, name, iconX, iconY, displayItem, parent).registerStat(); achievements.put(name, achieve); } public static void registerIndependantAchievement(Achievement achieve, String name, int iconX, int iconY, ItemStack displayItem) { achieve = new Achievement("achievement." + name, name, iconX, iconY, displayItem, null).initIndependentStat().registerStat(); achievements.put(name, achieve); } public static void registerPage() { AchievementPage.registerAchievementPage(page); } public static void triggerAchievement(EntityPlayer player, String name) { player.triggerAchievement(achievements.get(name)); } } Error ---- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 7/4/14 3:28 PM Description: Rendering screen java.lang.NullPointerException: Rendering screen at net.minecraft.client.gui.achievement.GuiAchievements.func_146552_b(GuiAchievements.java:385) at net.minecraft.client.gui.achievement.GuiAchievements.drawScreen(GuiAchievements.java:219) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1209) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1063) at net.minecraft.client.Minecraft.run(Minecraft.java:951) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.client.gui.achievement.GuiAchievements.func_146552_b(GuiAchievements.java:385) at net.minecraft.client.gui.achievement.GuiAchievements.drawScreen(GuiAchievements.java:219) -- Screen render details -- Details: Screen name: net.minecraft.client.gui.achievement.GuiAchievements Mouse location: Scaled: (290, 264). Absolute: (581, 190) Screen size: Scaled: (640, 360). Absolute: (1280, 720). Scale factor of 2 -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player363'/209, l='MpServer', x=-763.98, y=5.62, z=-499.21]] Chunk stats: MultiplayerChunkCache: 225, 225 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (-773,4,-373), Chunk: (at 11,0,11 in -49,-24; contains blocks -784,0,-384 to -769,255,-369), Region: (-2,-1; contains chunks -64,-32 to -33,-1, blocks -1024,0,-512 to -513,255,-1) Level time: 139213 game time, 6000 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 23 total; [EntityClientPlayerMP['Player363'/209, l='MpServer', x=-763.98, y=5.62, z=-499.21], EntitySheep['Sheep'/64, l='MpServer', x=-840.78, y=4.00, z=-446.34], EntitySheep['Sheep'/79, l='MpServer', x=-822.50, y=4.00, z=-449.78], EntityHorse['Horse'/152, l='MpServer', x=-688.16, y=4.00, z=-467.53], EntityPig['Pig'/116, l='MpServer', x=-798.13, y=4.00, z=-427.38], EntityChicken['Chicken'/81, l='MpServer', x=-826.41, y=4.00, z=-438.63], EntityChicken['Chicken'/115, l='MpServer', x=-788.47, y=4.00, z=-435.66], EntitySheep['Sheep'/80, l='MpServer', x=-819.09, y=4.00, z=-448.28], EntityPig['Pig'/114, l='MpServer', x=-790.78, y=4.00, z=-464.47], EntityChicken['Chicken'/113, l='MpServer', x=-792.56, y=4.00, z=-489.47], EntitySheep['Sheep'/82, l='MpServer', x=-826.18, y=4.00, z=-434.34], EntityChicken['Chicken'/112, l='MpServer', x=-794.44, y=4.00, z=-491.81], EntitySheep['Sheep'/59, l='MpServer', x=-843.94, y=4.00, z=-456.09], EntityChicken['Chicken'/127, l='MpServer', x=-783.47, y=4.00, z=-437.53], EntityPig['Pig'/93, l='MpServer', x=-805.34, y=4.00, z=-443.88], EntityChicken['Chicken'/92, l='MpServer', x=-802.47, y=4.00, z=-468.56], EntitySheep['Sheep'/63, l='MpServer', x=-833.22, y=4.00, z=-437.78], EntitySheep['Sheep'/62, l='MpServer', x=-838.22, y=4.00, z=-436.13], EntityChicken['Chicken'/149, l='MpServer', x=-711.81, y=4.00, z=-467.78], EntitySheep['Sheep'/61, l='MpServer', x=-844.94, y=4.00, z=-469.94], EntityPig['Pig'/91, l='MpServer', x=-810.13, y=4.00, z=-554.63], EntitySheep['Sheep'/60, l='MpServer', x=-836.25, y=4.00, z=-455.84], EntityChicken['Chicken'/151, l='MpServer', x=-700.47, y=4.00, z=-487.44]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:418) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2556) at net.minecraft.client.Minecraft.run(Minecraft.java:973) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Hopefully you can point out where I am going wrong. I am sure I had it working before or I wouldn't have released the mod to the public already. Thank you, MrCrayfish
  10. Here is the block class as seen in the picture. I've removed irrelevant code. package com.mrcrayfish.construction.block; public class BlockBuilding extends BlockContainer { private IIcon direction; private IIcon rest; public BlockBuilding(Material par2Material) { super(par2Material); } @Override public IIcon getIcon(int par1, int par2) { return (par1 != par2 ? this.rest : this.direction); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister par1IconRegister) { this.rest = par1IconRegister.registerIcon("ccm:buildingblock_rest"); this.direction = par1IconRegister.registerIcon("ccm:buildingblock_direction"); } } Edit: I seem to have fixed the problem by change the register method to this. GameRegistry.registerBlock(buildingBlock, buildingBlock.getUnlocalizedName().substring(5)); I think the registering name has to be the same as the string set in .setBlockName()
  11. Hey guys, I'm seem to be having a problem when I run my obfuscated mod in Minecraft. The blocks displays as items. When I am in Eclipse, the renders work correctly. Before you start replying, I am registering my blocks and items in preInit. @EventHandler public void preInit(FMLPreInitializationEvent event) { buildingBlock = new BlockBuilding(Material.wood).setBlockName("ccmBlockBuilding").setHardness(0.5F).setCreativeTab(this.tabConstruction); planningBlock = new BlockPlanner(Material.wood).setBlockName("ccmBlockPlanner").setHardness(0.5F).setCreativeTab(this.tabConstruction); itemBlueprint = new ItemBlueprint().setUnlocalizedName("ccmItemBlueprint").setTextureName("ccm:itemblueprint").setCreativeTab(this.tabConstruction); itemWoodHammer = new ItemHammer(1, Item.ToolMaterial.WOOD).setUnlocalizedName("ccmItemWoodHammer").setTextureName("ccm:itemwoodhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemStoneHammer = new ItemHammer(3, Item.ToolMaterial.STONE).setUnlocalizedName("ccmItemStoneHammer").setTextureName("ccm:itemstonehammer").setCreativeTab(this.tabConstruction).setFull3D(); itemIronHammer = new ItemHammer(6, Item.ToolMaterial.IRON).setUnlocalizedName("ccmItemIronHammer").setTextureName("ccm:itemironhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemGoldHammer = new ItemHammer(4, Item.ToolMaterial.GOLD).setUnlocalizedName("ccmItemGoldHammer").setTextureName("ccm:itemgoldhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemDiamondHammer = new ItemHammer(8, Item.ToolMaterial.EMERALD).setUnlocalizedName("ccmItemDiamondHammer").setTextureName("ccm:itemdiamondhammer").setCreativeTab(this.tabConstruction).setFull3D(); itemCreationTool = new ItemCreationTool().setUnlocalizedName("ccmItemCreationTool").setTextureName("ccm:itempencil").setCreativeTab(this.tabConstruction); itemConstructionHelmet = new ItemConstructionHelmet(constructionArmour, 0, 0).setUnlocalizedName("ccmItemConstructionHelmet").setTextureName("ccm:itemconstructionhelmet").setCreativeTab(this.tabConstruction); GameRegistry.registerBlock(buildingBlock, "BlockBuilding"); GameRegistry.registerBlock(planningBlock, "BlockPlanner"); GameRegistry.registerItem(itemConstructionHelmet, "ItemConstructionHelmet"); GameRegistry.registerItem(itemBlueprint, "ItemBlueprint"); GameRegistry.registerItem(itemCreationTool, "ItemCreationTool"); GameRegistry.registerItem(itemWoodHammer, "ItemHammer"); GameRegistry.registerItem(itemStoneHammer, "ItemStoneHammer"); GameRegistry.registerItem(itemIronHammer, "ItemIronHammer"); GameRegistry.registerItem(itemGoldHammer, "ItemGoldHammer"); GameRegistry.registerItem(itemDiamondHammer, "ItemDiamondHammer"); GameRegistry.registerTileEntity(com.mrcrayfish.construction.tileentity.TileEntityBuildingBlock.class, "ccmBuildingBlock"); GameRegistry.registerTileEntity(com.mrcrayfish.construction.tileentity.TileEntityPlanningBlock.class, "ccmPlanningBlock"); proxy.registerRenderers(); NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler); } Eclipse Environment: https://dl.dropboxusercontent.com/s/oy6gugfua44c1eb/2014-03-23_10.15.06.png[/img] Obfuscated Environment: https://dl.dropboxusercontent.com/s/5ynjw1p26g3fprq/2014-03-23_10.32.40.png[/img] If you have any answers, I will appreciate it very much!
  12. I found the problem. I took a look at the rendering of the beacon beam. Just played around with chucking some of the flags from that render. I needed to add this flag in. GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); Thanks for your help anyway
  13. Just tried the flag but didn't make any difference. I also used your debugger, outputs were both the same. When looking at mobs When not looking at mobs
  14. This is the only other relevant code besides the one I posted above. package com.mrcrayfish.construction.client.render; import org.lwjgl.opengl.GL11; import com.mrcrayfish.construction.tileentity.TileEntityBuildingBlock; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; public class OutlineRenderer extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) { TileEntityBuildingBlock tebb = (TileEntityBuildingBlock) tileentity; if (tebb.renderOn) { int metadata = tebb.getWorldObj().getBlockMetadata(tebb.xCoord, tebb.yCoord, tebb.zCoord); int width = tebb.width - 2; int height = tebb.height - 2; int depth = tebb.depth - 2; int offsetX = 0; int offsetY = tebb.offsetY; int offsetZ = 0; int colour = tebb.lineColours[tebb.count]; if (metadata == 2) { offsetX = -tebb.offsetZ - width - 1; offsetZ = tebb.offsetX; offsetX -= tebb.bOffsetZ; offsetZ += tebb.bOffsetX; } if (metadata == 5) { int temp = width; width = height; height = temp; offsetX = -tebb.offsetX - (width + 1); offsetZ = -tebb.offsetZ - (height + 1); offsetX -= tebb.bOffsetX; offsetZ -= tebb.bOffsetZ; } if (metadata == 3) { offsetX = tebb.offsetZ; offsetZ = -tebb.offsetX - (height + 1); offsetX += tebb.bOffsetZ; offsetZ -= tebb.bOffsetX; } if (metadata == 4) { int temp = width; width = height; height = temp; offsetX = tebb.offsetX; offsetZ = tebb.offsetZ; offsetX += tebb.bOffsetX; offsetZ += tebb.bOffsetZ; } offsetY += tebb.bOffsetY; if (tebb.hasDrawnBlueprint) { Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); if (tebb.renderAll) GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glLineWidth(5F); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 1.5D + height + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 0.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.addVertex(x + 0.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + 0.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 0.5D + offsetZ); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 1.5D + height + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.addVertex(x + width + 1.5D + offsetX, y + depth + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + 1.5D + height + offsetZ); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + depth + offsetY, z + 1.5D + height + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + width + 1.5D + offsetX, y + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.addVertex(x + 0.5D + offsetX, y + 0.5D + offsetY, z + height + 1.5D + offsetZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.setColorOpaque_I(colour); tessellator.setBrightness(255); tessellator.addVertex(x + width + 0.5D + 1.0D + offsetX, y + 0.5D + offsetY, z + height + 0.5D + 1.0D + offsetZ); tessellator.addVertex(x + width + 0.5D + 1.0D + offsetX, y + 0.5D + offsetY, z + 0.5D + offsetZ); tessellator.draw(); if (tebb.renderAll) GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); } } } }
  15. Hey, I seem to be having a problem with rendering my TESR. It only renders the outline if a mob is in my view. It use to work fine on 1.6.4 but since I've updated to 1.7.2, it has changed. I've also correctly made sure I'm binding it correctly and that it renders past the standard limit. In ClientProxy ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBuildingBlock.class, new OutlineRenderer()); In TileEntity @Override public double getMaxRenderDistanceSquared() { return 16384D; } @Override @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { return INFINITE_EXTENT_AABB; } https://dl.dropboxusercontent.com/s/4fm4onyzlnkr3s6/2014-03-17_18.40.08.png[/img] https://dl.dropboxusercontent.com/s/zg38ka0fs36q461/2014-03-17_18.40.10.png[/img] If you have any answers to why this might be happening, let me know!
  16. What command are you using to build your mod?
  17. I found a solution. I had to cast "Player" to "EntityPlayerMP". Works like a charm now. Thank you anyway guys!
  18. Yes. This is the exact line in my main class. @NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {"envelope", "package"}, packetHandler = PacketManager.class)
  19. Hello! Some of you may know me for creating a furniture mod called "MrCrayfish's Furniture Mod" but that is besides the point. I am very new to packets and handling them. So far I wrote a code that you would think would seem to work. I am sending an itemstack through a packet. I have taken a look how the book does it, copied the code and just modified to suit mine. The problem is that it doesn't send the NBTTagCompound when I'm on a server or LAN. If anyone could help me out to solve this, I will thank you a lot! Here is all the code associated. GuiEnvelope Only the nesssary code is here PacketManager ItemEnvelope' ItemEnvelopeSigned' GuiHandler
  20. I have been browsing various forums for solutions but seem to have an answer. I just ported my mod from ModLoader 1.5.1 to Forge 7.7.1.616 (1.5.1) (Absolute latest) and I am getting a problem when I load my mod outside a MCP environment. The error has to do something with my class "TileEntityOven" because I tested and removed anything calling it just so it wouldn't load and my mod loaded perfectly but the funny thing is nothing is wrong with my class as all. If you have a solution, please let me know. Error Report: TileEntityOven (Ignore some hard coding)
×
×
  • Create New...

Important Information

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