Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

TheGreyGhost

Members
  • Joined

  • Last visited

Everything posted by TheGreyGhost

  1. Hi This link might help you understand how to use the IItemRenderer to achieve the things you want. http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html Look at the Item Rendering sections. I think TLHPoE's suggestions are good; esp. you could make the image for your coloured parts white (or grayscale), then before you draw it change the colour (using glColor4f like you already do) You don't need Blend unless you want the coloured parts to be partially transparent, but if you try to draw two textures exactly on top of each other you will get the weird 'texture fighting stripes" in your first picture. Try splitting your icon into two non-overlapping parts instead like TLHPoE suggested. -TGG
  2. Hi The "flying fragments of block" are generated using an EntityDiggingFX, which takes its texture from this.setParticleIcon(block.getIcon(side, metadata)); So I'm not sure why your public IIcon getIcon(int side, int meta) { isn't working. (add @Override before it just in case?) Does your System.out.println(icon[meta]); print something when you smash the block? Does your console say "Using missing texture, unable to load" for these textures? I really don't think it's anything to do with render type, isOpaqueCube, etc. Try using a 16x16 texture like DieSieben and EternalDoom say and see if that solves the problem (very easy to test!) ? -TGG
  3. Hi The flag you are looking for is probably ALPHA_TEST, assuming you've set the background alpha properly. GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); .. do your rendering here GL11.glPopAttrib(); GL11.glPopMatrix(); pushMatrix & popMatrix stops your glTranslate and glRotate from affecting anything drawn after you're done pushAttrib and popAttrib prevents your changed rendering settings (eg ALPHA_TEST) from affecting vanilla renders after your render -TGG
  4. That is not actually true. It fires on both sides. Hi DieSieben Are you sure? The only caller appears to be InventoryPlayer.decrementAnimations(), which says /** * Decrement the number of animations remaining. Only called on client side. This is used to handle the animation of * receiving a block. */ Let's see what a breakpoint in my debugger says... [....] Ah well you're right, it breaks on both client and server. Sorry about that Fireplace. onArmorTick() is probably fine. I'd suggest wrapping your damage code in if (!world.isRemote) { } and getting rid of the datawatcher (you don't need it on the server (not even sure it works on server), use isBurning() instead) and seeing if that helps. -TGG
  5. Hi The code from vanilla for rendering the outline is in RenderGlobal:: /** * Draws the selection box for the player. Args: entityPlayer, rayTraceHit, i, itemStack, partialTickTime */ public void drawSelectionBox(EntityPlayer entityPlayer, MovingObjectPosition blockToHighlightMOP, int alwaysZero, float partialTickTime) { if (alwaysZero == 0 && blockToHighlightMOP.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float f1 = 0.002F; Block block = this.theWorld.getBlock(blockToHighlightMOP.blockX, blockToHighlightMOP.blockY, blockToHighlightMOP.blockZ); if (block.getMaterial() != Material.air) { block.setBlockBoundsBasedOnState(this.theWorld, blockToHighlightMOP.blockX, blockToHighlightMOP.blockY, blockToHighlightMOP.blockZ); double d0 = entityPlayer.lastTickPosX + (entityPlayer.posX - entityPlayer.lastTickPosX) * (double)partialTickTime; double d1 = entityPlayer.lastTickPosY + (entityPlayer.posY - entityPlayer.lastTickPosY) * (double)partialTickTime; double d2 = entityPlayer.lastTickPosZ + (entityPlayer.posZ - entityPlayer.lastTickPosZ) * (double)partialTickTime; drawOutlinedBoundingBox(block.getSelectedBoundingBoxFromPool(this.theWorld, blockToHighlightMOP.blockX, blockToHighlightMOP.blockY, blockToHighlightMOP.blockZ).expand((double)f1, (double)f1, (double)f1).getOffsetBoundingBox(-d0, -d1, -d2), -1); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } } So it looks to me like your getSelectedBoundingBoxFromPool should have worked. Maybe you could try putting a breakpoint into drawSelectionBox() to see what is going wrong... -TGG
  6. Hi delete this part p_70821_1_.canEntityBeSeen(this); and I think it will probably do exactly what you want. This code takes two vectors: vec3 = the player look vector, normalised vec31 = the vector for the entity position relative to the player position it calculates the dot product between the two, which is related to the angle between the two (actually, the cosine of the angle) http://www.mathsisfun.com/algebra/vectors-dot-product.html If the cosine is greater than 1 - 0.025/(distance between player and entity), then the player is looking more or less straight at the entity. the canEntityBeSeen part just checks for blocks in the way, so you don't want that. -TGG
  7. Hi onArmorTick is called on the client side only (it's intended for animations / rendering updates). You are doing damage etc on the client side, but not the server side, so the server just overwrites the client copy a short time later. You need to move your damage logic into something that ticks on the server side. For example, PlayerTickEvent - on the server side, each tick check the player inventory to see if they're burning and wearing the armour and if so do your damage to the armour there. -TGG
  8. Hi I think this is the code that the enderman uses to tell whether the player is looking at the enderman. Should be some useful clues in there. /** * Checks to see if this enderman should be attacking this player */ private boolean shouldAttackPlayer(EntityPlayer p_70821_1_) { ItemStack itemstack = p_70821_1_.inventory.armorInventory[3]; if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) { return false; } else { Vec3 vec3 = p_70821_1_.getLook(1.0F).normalize(); Vec3 vec31 = Vec3.createVectorHelper(this.posX - p_70821_1_.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - (p_70821_1_.posY + (double)p_70821_1_.getEyeHeight()), this.posZ - p_70821_1_.posZ); double d0 = vec31.lengthVector(); vec31 = vec31.normalize(); double d1 = vec3.dotProduct(vec31); return d1 > 1.0D - 0.025D / d0 && p_70821_1_.canEntityBeSeen(this); } } -TGG
  9. Hi Are you sure you're placing BlocksAS.deviceGasLampactive in the world, and are you sure that you created deviceGasLampactive with true in the constructor? I'd suggest you comment out all that switching logic first off and just try to create a block with light level 15. If that doesn't work, there's a bigger problem somewhere BTW delete this - private static final String __OBFID = "CL_00000325"; it is used by the (de)obfuscation process for vanilla blocks only and will cause you problems if you include it in your own classes. -TGG
  10. Hi You might find the topics under "Item Rendering" useful http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html You could use an IItemRenderer, or alternatively an ISimpleBlockRenderingHandler (which might be easier). These will let you rotate the block to face any way you choose A quick google should shown you some tutorials -TGG
  11. Hi Check out MovingSoundMinecartRiding repeat = true -TGG
  12. By crikey dude, if you multiply the damage by 1x10^15, no wonder it does 'infinite damage' The LivingHurtEvent is working fine, you've done the hard bit already, you just need to figure out why RPG.getPlayerStrength returns 1.4107303442451825E15, which for sure it shouldn't -TGG
  13. That should have worked fine. Show your code? -TGG
  14. Yeah, I would have thought so. Except - now that I look more closely, perhaps it's not <MessageIronNote.class, MessageIronNote.class> from INSTANCE.registerMessage(MessageIronNote.class, MessageIronNote.class, id++, Side.SERVER); might not be the same as <MessageIronNote, IMessage> from MessageIronNote extends MessageGeneric implements IMessageHandler<MessageIronNote, IMessage> The templates on SimpleNetworkWrapper caused me serious head damage for a while, still not 100% sure I understand how it works. Maybe this is a similar problem. -TGG
  15. Hi When I got this error message, it was because I was sending packets from the client but I hadn't registered a corresponding handler for that packet type on the server. So the packets weren't being delivered. The way I figured that out was to put a breakpoint in the forge code and look at what the 'this' packet was. FMLProxyPacket:: processPacket() if (internalChannel.writeInbound(this)) { badPackets.add(this.channel); // BREAKPOINT HERE, AND INSPECT this if (badPackets.size() % packetCountWarning == 0) { FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size()); int i = 0; for (Entry<String> s : Multisets.copyHighestCountFirst(badPackets).entrySet()) -TGG
  16. Hi Did you override setBlockBoundsBasedOnState() and perhaps addCollisionBoxesToList() like BlockSlab does? They are used to set the correct block bounds immediately before rendering (and collision detection) -TGG
  17. Post your latest code including the System.out.println diagnostic? -TGG
  18. Hi > I'm not sure whats wrong still, but I know how to make it work. > As long as i remember to rename the folder the textures are stored in its fine. > I may fiddle with it at a later time. Hmm ok personally I would find that really frustrating but that's just me >Also how did my code read? I'm for sure no coding guru but it looked good to me. Easy to understand at a glance. -TGG
  19. Hi Try using this blend function instead of GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Use an alpha value of (say) 0.25 to start off with. This online tool might be helpful, http://www.andersriggelsen.dk/glblendfunc.php also this background info link http://www.glprogramming.com/red/chapter06.html -TGG
  20. That's another symptom of the same problem. You place the air block on the client, but s soon as the server updates that air block information (because you place another block next to it), the client air block is overwritten with the original which is still on the server. -TGG
  21. Hi Interesting that you don't get any Server println at all. For sure you should, eg [sTDOUT]: [com.zacharysturtz.items.OrangePickaxe:onItemUse:63]: onItemUse [server]; isReady:true When your client presses a key to use the item, vanilla normally calls onItemUse locally and also sends a packet to the server, which executes onItemUse on the server as well. I don't understand why that's not happening for you. How is the item use triggered, are you calling it manually? -TGG
  22. Hi I see a 'missing texture' block next to your model; what does your error console say? Look for a "missing texture unable to load"? -TGG
  23. Hi Those symptoms sound very much like a client<-->server mismatch; i.e. that these actions are happening on the client side but not on the server side. So you see something happen on the client side (block replaced by air) but the server then immediately overwrites it again, the item won't damage because it's not being damaged on the server, and the dropped item doesn't really exist because the server doesn't know about it. I think it might be because you are using static "ready" flags: on the first call (on the client) isReady is true. The client sets it to false. The method is then called a short time later on the server (in response to a vanilla packet), and this time the isReady is false so it does nothing. Easy to test if you put this line at the top of your onItemUse System.out.println("onItemUse " + (world.isRemote ? "[Client]" : "[server]") + "; isReady:" + isReady); Also, if other players join your game, the isReady will interfere between different players. You need to store the status flags for the action somewhere else; for example in the ItemStack NBT, http://www.minecraftforge.net/wiki/Creating_NBT_for_items or in a variable in one of your own classes that is unique for each client, as well as a unique variable on the server for every connected client. -TGG
  24. Hi Just a guess - try replacing your this.bindTexture() with Minecraft.getMinecraft().renderEngine.bindTexture(textureGemFuser); perhaps the TextureManager in your TESR hasn't been set -TGG
  25. Hi This link might help with some of that http://www.minecraftforge.net/forum/index.php/topic,23561.msg119530.html#msg119530 -TGG

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.