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.

Schottky

Members
  • Joined

  • Last visited

  1. So I have created a GUI in which I have rendered an Armor-stand. My goal is it to get the exact part that the player clicked at (an arm, a leg, the torso, e.t.c.). I can't use Minecraft#objectMouseHover, since the Entity hasn't been added to the world (it's only rendered). For the same reason, I can't use World#rayTrace(). Is there an easy way of accomplishing what I want to do, or do I manually have to calculate the "inverse projection"? Here's the code that I use to render the Armor-stand (basically what Minecraft does inside the player inventory): private void renderInside() { final int i = guiLeft + windowWidth / 2; final int j = guiTop + windowHeight / 2 + 80; final int scale = 80; RenderSystem.pushMatrix(); RenderSystem.translatef(i, j, 1050.0F); RenderSystem.scalef(1.0F, 1.0F, -1.0F); MatrixStack matrixstack = new MatrixStack(); matrixstack.func_227861_a_(0.0D, 0.0D, 1000.0D); matrixstack.func_227862_a_((float)scale, (float)scale, (float)scale); // horizontal scale Quaternion quaternion = Vector3f.field_229183_f_.func_229187_a_(180.0F); // vertical scale Quaternion quaternion1 = Vector3f.field_229179_b_.func_229187_a_(-previousPitch * 20.0F); quaternion.multiply(quaternion1); matrixstack.func_227863_a_(quaternion); // renderYawOffset: everything but base plate float f2 = armorStandEntity.renderYawOffset; float f4 = armorStandEntity.rotationPitch; float f5 = armorStandEntity.prevRotationYawHead; float f6 = armorStandEntity.rotationYawHead; armorStandEntity.renderYawOffset = 180.0F + previousYaw * 20.0F; armorStandEntity.rotationPitch = - previousPitch; armorStandEntity.rotationYawHead = armorStandEntity.rotationYaw; armorStandEntity.prevRotationYawHead = armorStandEntity.rotationYaw; EntityRendererManager entityrenderermanager = minecraft.getRenderManager(); quaternion1.conjugate(); entityrenderermanager.func_229089_a_(quaternion1); entityrenderermanager.setRenderShadow(false); IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance().func_228019_au_().func_228487_b_(); entityrenderermanager.func_229084_a_(armorStandEntity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, irendertypebuffer$impl, 15728880); irendertypebuffer$impl.func_228461_a_(); entityrenderermanager.setRenderShadow(true); armorStandEntity.renderYawOffset = f2; armorStandEntity.rotationPitch = f4; armorStandEntity.prevRotationYawHead = f5; armorStandEntity.rotationYawHead = f6; RenderSystem.popMatrix(); }
  2. Sry for not writing so long! Thank you so much for that tip, after that everything worked as intended (and i hopefully understand now the difference between Client and Server :P) Just one more question: why shouldn't i use LinkedLists's? In this content off it doesn't make a lot of sense but if i want to make something different where i might need Lists, what should i use instead? thx, Schottky
  3. hmm here is an example of what i mean... Maybe the error is not in the method i posted but in some other code, maybe where i initialize the armor itself?
  4. thanks a lot, but still this doesn't solve the problem that the durability decreases but sometimes also increases even thou i have no method that should increase it... any solutions for that?
  5. Hey everyone, I am new to modding and therefore not so familiar with how i should write my mods, please be gentle I have written this method in an event class and there seems something to be odd about it: first of all: is this the best way to achieve what i want (If the player stands in water, the armor should loose durability)? What i have done seems a bit inperformant.. second: If i try this out everything works as expected but sometimes the durability value increases by 1 even thou it should decrease every time. Is this normal? Thanks in advance, Schottky Here is the code: private static int ticks = 0; private static final LinkedList<Item> DIRT_ARMOR_SET = ModItems.getDirtArmorSet(); @SubscribeEvent public static void armorInFluid(TickEvent.PlayerTickEvent event) { if(ticks == 200) { EntityPlayer player = event.player; if(player.isInWater()) { for(ItemStack armor: player.getArmorInventoryList()) { if(DIRT_ARMOR_SET.contains(armor.getItem())) { int armorDamage = armor.getItemDamage(); if((armor.getMaxDamage() - armorDamage) <= 1) { armor.setCount(0); player.playSound(SoundEvents.ENTITY_ITEM_BREAK, 1.0f, 0); } else { armor.setItemDamage(armorDamage +1); } } } ticks = 0; } } else { ++ticks; } }

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.