Jump to content

Thornack

Members
  • Posts

    624
  • Joined

  • Last visited

Everything posted by Thornack

  1. I have noticed that you cannot install successfully downloaded older src from versions of Forge (from like 1.7.10) and use maven to set up a dev environment which means that effectively you cannot mod older minecraft versions. The build script appears to fail when gradlew is executed due to the external repo's no longer being valid. The message states could not resolve all dependencies, where you get a status code from server 501 https required. Is there a workaround? (and I know the versions are no longer supported but for someone wanting to edit an old mod of mine for an old version of minecraft is it possible?
  2. Ya sorry about that my bad, I ended up fixing the error
  3. [SOLVED] For some reason I had a string that was somehow being deleted right before the NBT data was being saved. So when I tried using it to send a message to the player the string did not exist and this seemed to cause the crash and only happen sometimes. Really weird but meh its fixed
  4. Hi Everyone, Once in a while when I test my mod I get a [Netty Client IO #5/ERROR] any ideas what might cause this? The console says the following: [Netty Client IO #5/ERROR] [FML]: NetworkDispatcher exception io.netty.handler.timeout.ReadTimeoutException [23:29:02] [Client thread/INFO] [FML]: Applying holder lookups [23:29:02] [Client thread/INFO] [FML]: Holder lookups applied
  5. Hey everyone so this is the solution to this problem. To disable the dropping of items via mouse drag you have to override the #mouseMovedOrUp() method (not the mouse clicked method) like so To disable the dropping of items via the "Q" Key (or whichever key this functionality gets bound to) use the following in your gui class and it works
  6. For the mouse drag I tried the following - I created an imaginary barrier and using the draw method just reset the mouse mosition if it goes outside my guis bounds. However it isnt foolproof the player can still try and succeed at dropping the item by dragging the mouse fast. - need a better way to do this still @Override protected void drawGuiContainerBackgroundLayer(float x, int y, int z) { int mousePosX = Mouse.getEventX() * this.width / this.mc.displayWidth; int mousePosY = Mouse.getEventY() * this.height / this.mc.displayHeight; if(mousePosX < 140){ Mouse.setCursorPosition(140 * this.mc.displayWidth/this.width, Mouse.getEventY()); } if (mousePosX > 284){ Mouse.setCursorPosition(284 * this.mc.displayWidth/this.width, Mouse.getEventY()); } if(mousePosY < 58){ Mouse.setCursorPosition(Mouse.getEventX(), 58 * this.mc.displayHeight/this.height); } if(mousePosY > 190){ Mouse.setCursorPosition(Mouse.getEventX(), 190 * this.mc.displayHeight/this.height); } //Rest of drawing code }
  7. @Override protected void keyTyped(char key, int event){ if (event == 1 || event == this.mc.gameSettings.keyBindInventory.getKeyCode()) { this.mc.thePlayer.closeScreen(); } this.checkHotbarKeys(key); } To disable the dropping of items from my gui inventory using the "Q" keyboard Key, I overrode the keyTyped method and changed it to the code above so that the "Q" key cannot be used to drop items. Still have no idea how to disable dropping items via mouse drag though. Any ideas are helpful
  8. Hi everyone, I have created a gui with a custom inventory and container. I want to make it impossible for a player to drop items onto the ground while inside this gui. Anyone know how to achieve this?
  9. not sure why the item movement stuff is so very broken
  10. Key is pressed public class KeyMiney extends KeyBinding { private static int index= 1; public KeyMiney() { super("key.keyMoney", Keyboard.KEY_M, "key.categories.custommod"); } @SubscribeEvent public void keyDown(InputEvent.KeyInputEvent event) { if (isPressed()) { PacketOverlord.sendToServer(new PacketC2SMineyKeyPressed()); } } } that key press sends a packet to server which then sends a packet back to client that opens the gui public class PacketC2SMineyKeyPressed extends AbstractMessageToServer<PacketC2SMineyKeyPressed> { public PacketC2SMineyKeyPressed() {} @Override protected void read(PacketBuffer buffer) throws IOException { } @Override protected void write(PacketBuffer buffer) throws IOException { } @Override public void process(EntityPlayer player, Side side) { PacketOverlord.sendTo(new PacketS2COpenMineyGui((EntityPlayer) player, (int)player.posX, (int)player.posY, (int)player.posZ),(EntityPlayerMP) player); } } packet that actually opens the gui client side public class PacketS2COpenMineyGui extends AbstractMessageToClient<PacketS2COpenMineyGui> { int xPos; int yPos; int zPos; public PacketS2COpenMineyGui() {} public PacketS2COpenMineyGui(EntityPlayer player, int xPos, int yPos, int zPos) { this.xPos = xPos; this.yPos = yPos; this.zPos = zPos; } @Override protected void read(PacketBuffer buffer) throws IOException { xPos = buffer.readInt(); yPos = buffer.readInt(); zPos = buffer.readInt(); } @Override protected void write(PacketBuffer buffer) throws IOException { buffer.writeInt(xPos); buffer.writeInt(yPos); buffer.writeInt(zPos); } @Override public void process(EntityPlayer player, Side side) { if(player.worldObj.isRemote){ //player is only the client side player here using if(!player.worldObj.isRemote) does not work nothing is called player.openGui(CustomMod.instance, 9, player.worldObj, xPos, yPos, zPos); } } }
  11. When I click on an item it appears to be grabbed by the mouse but then immediately jumps back into the slot I grabbed it from so I cannot move it
  12. 176 X 166 pixels is the visible bit
  13. The entire texture is 256x256 but the drawn portion is exact same size as the furnace gui
  14. Hi everyone, I have created a gui where I have the players inventory and a custom inventory. I have run into the problem where If I click on an item which is inside a player inventory slot I cant seem to move it to my other inventory slots (not even from one player inventory slot to the next) and Im not sure what the issue is? here is my code: Gui class Container Class Inventory Class gui Handler class (I removed the other guis cause I have alot of them in there this is just the stuff pertaining to my custom one with the mouse issues)
  15. Hi everyone, I am trying to add slots to a gui that the player can open anytime. The purpose of this gui will be so that the player can convert the amount of currency called "Miney" he stored in his ieep to coin items or vice versa (kinda like a deposit/withdrawal system) I have run into a problem however. I cant seem to get my inventory slots to align with the gui "slots". When the game is resized they end up in the incorrect spot. Anyone know how to fix this? My gui is centered and resizes correctly it seems. It is basically the same shape as the default vanilla furnace gui (same size too and has the players inventory as in the vanilla gui). I cant get the slots to stay aligned with the gui on game resize. Anyone know what the issue is and how to solve this? GuiClass ContainerClass
  16. Hi everyone, I have been searching through the EntityRenderer class and other classes to try and figure out how Minecraft determines whether a player is inside a block (if you teleport underground and then suffocate I want to know what condition sets the lighting here/how is this triggered etc) I cant seem to find it
  17. (special thanks to parzivail who figured this out) Hi everyone, lets say you want to change the camera to be farther back because you have a large entity or whatever and you want it in frame. The way to do this that I now know of is as follows: (if you know of a better way to alter the camera in 1.7.10 please post the full solution below)! 1) create a copy of EntityRenderer class but call it your own, for the purposes of this walkthrough ill call it ReplacementEntityRenderer 2) make ReplacementEntityRenderer extend EntityRenderer and make sure it implements IResourceManagerReloadListener 3) create method inside ReplacementEntityRenderer that does the following: public void setThirdPersonDistance(float distance) { this.thirdPersonDistanceTemp = this.thirdPersonDistance = distance; } 4) inside ClientProxy -> set minecrafts entity renderer instance to use yours instead like so: Minecraft.getMinecraft().entityRenderer = new ReplacementEntityRenderer(Minecraft.getMinecraft(), Minecraft.getMinecraft().getResourceManager()); 5) whenever you want to change the render distance (use the client side only render events such as RenderGameOverlayEvent.Pre, RenderGameOverlayEvent.Post, RenderPlayerEvent.Pre, RenderPlayerEvent.Post, call the set setThirdPersonDistance() method ((ReplacementEntityRenderer)Minecraft.getMinecraft().entityRenderer).setThirdPersonDistance(10); and voila if done correctly you will have set the render distance to 10 The default 3rd Person Render Distance seems to be 4. You can now generate getters and setters for any of the variables and control the camera (I believe)
  18. I hate to restart an old topic but I was wondering if anyone can elaborate on parzivail's idea I cant seem to get a solution using his hint
  19. My code works if used in the RenderGameOverlayEvent.Post event but Im not sure how to modify it to get it to work inside the entities renderer so that the hp box renders at the position of the entity
  20. I looked at RenderSnowball class but im not sure what section is relevant to what I have to do.
  21. Hi everyone, So I am trying to render a mobs HP in a bar above its position if the mob is in a battle with a player (I use a string to control the triggering of the render) basically if the string contains the characters "Fighting:" then the hp bar should render above the mob. So far I tried the following (which is kinda cool but not what I want) (the code below changes the colour of the mob from green to yellow to orange to red as the mob takes damage (I want my health bar to do the same aswell). Im not really experienced with this sort of thing so the code below is code that I created for rendering and Hp bar for the player in his HUD: Im using this as a basis to go off of. Any help / suggestions on what to do next are appreciated. My Renderer Class @SideOnly(Side.CLIENT) public class RenderCustomEntity extends RenderLiving // if I extend RendererLivingEntity the Exp bar always renders and we don't want this { private ModelBase playerModel = new ModelBiped(); private ModelBase consistentModel; // private GameProfile gameProfile = null; private ResourceLocation consistentTexture; private ResourceLocation currentTexture; private Minecraft mc = Minecraft.getMinecraft(); public RenderCustomEntity(ModelBase model, String textureName, float shadowRadius) { super(model, shadowRadius); this.consistentTexture = new ResourceLocation("customMod:textures/mob/" + textureName); this.consistentModel = model; } private static final ResourceLocation healthBarTexture = new ResourceLocation("customMod:textures/gui/HealthBar.png"); @Override public void doRender(Entity entity, double x, double y, double z, float f, float F) { if (entity instanceof EntityCustomEntity) { EntityCustomEntity customEntity= (EntityCustomEntity) entity; if(customEntity.inBattle != null && customEntity.inBattle.contains("Fighting:")){ int currentHp = customEntity.stats.currentHp; int maxHp = customEntity.stats.hp; int width = mc.displayWidth; int height = mc.displayHeight; this.mc.getTextureManager().bindTexture(healthBarTexture); int healthBarWidth = (int)(((float) currentHp/ maxHp) * 71); drawTexturedModalRect(width/2 -106, height- 40, 0, 0, 77, 9); int xOffset = 0; if(currentHp >=100){ xOffset = -6; } if(healthBarWidth > 30){ drawTexturedModalRect(width/2 -106 + 2, height- 40 + 1, 0, 9, healthBarWidth, 5); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -91 + xOffset, height- 49, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -89 + xOffset, height- 49, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 50, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 48, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 49, 56576); } else if(healthBarWidth <= 30 && healthBarWidth >10 ){ drawTexturedModalRect(width/2 -106 + 2, height- 40 + 1, 0, 14, healthBarWidth, 5); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -91 + xOffset, height- 49, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -89 + xOffset, height- 49, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 50, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 48, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 49, 15064320); }else if(healthBarWidth <=10){ drawTexturedModalRect(width/2 -106 + 2, height- 40 + 1, 0, 19, healthBarWidth, 5); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -91 + xOffset, height- 49, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -89 + xOffset, height- 49, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 50, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 48, 0); this.mc.fontRenderer.drawString("HP: " + (int)this.mc.thePlayer.getHealth() + "/" + currentHp, width/2 -90 + xOffset, height- 49, 15015936); } } String ownerName = customEntity.getEntityIsMorphedToPlayer(); if (ownerName != null && !ownerName .equals("")) { this.currentTexture = AbstractClientPlayer.locationStevePng; this.mainModel = this.playerModel; } else { this.currentTexture = this.consistentTexture; this.mainModel = this.consistentModel; } } super.doRender(entity, x, y, z, f, F); } protected ResourceLocation getEntityTexture(Entity entity) { return this.currentTexture; } protected float zLevel; public void drawTexturedModalRect(int x, int y, int u, int v, int rectWidth, int rectHeight) { float f = 0.00390625F; float f1 = 0.00390625F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(x + 0), (double)(y + rectHeight), (double)this.zLevel, (double)((float)(u + 0) * f), (double)((float)(v + rectHeight) * f1)); tessellator.addVertexWithUV((double)(x + rectWidth), (double)(y + rectHeight), (double)this.zLevel, (double)((float)(u + rectWidth) * f), (double)((float)(v + rectHeight) * f1)); tessellator.addVertexWithUV((double)(x + rectWidth), (double)(y + 0), (double)this.zLevel, (double)((float)(u + rectWidth) * f), (double)((float)(v + 0) * f1)); tessellator.addVertexWithUV((double)(x + 0), (double)(y + 0), (double)this.zLevel, (double)((float)(u + 0) * f), (double)((float)(v + 0) * f1)); tessellator.draw(); } }
  22. I solved it, this is the math and yes its sucky //Actual entity position equation is actualPos = lastTickPos + (currentTicPos - lastTickPos) * partialTicks - Thanks to diesieben07 for this //But you have to calculate the lastTicPos and currentTicPos based on the past/present positions of the two players to put the model in the right spot double x = (pre.entityPlayer.prevPosX - thePlayer.prevPosX) + ((pre.entityPlayer.posX - thePlayer.posX) - (pre.entityPlayer.prevPosX - thePlayer.prevPosX))*pre.partialRenderTick; double y = (pre.entityPlayer.prevPosY - thePlayer.prevPosY) + ((pre.entityPlayer.posY - thePlayer.posY) - (pre.entityPlayer.prevPosY - thePlayer.prevPosY))*pre.partialRenderTick; double z = (pre.entityPlayer.prevPosZ - thePlayer.prevPosZ) + ((pre.entityPlayer.posZ - thePlayer.posZ) - (pre.entityPlayer.prevPosZ - thePlayer.prevPosZ))*pre.partialRenderTick;
  23. Hi everyone, I have a mod where the player can morph into entities that he "owns". He can call upon them whenever and all that. i do have an issue however in multiplayer. The models seem to "jitter" when a second player logs in and sees the morphed player (his new model shows up) but it jitters which is odd. I was wondering if there is any way to smooth out this jitter. here is my event @SubscribeEvent public void onRenderPlayerPre(RenderPlayerEvent.Pre pre) { BattlePlayerProperties bpp = BattlePlayerProperties.get(pre.entityPlayer); // Client Side Player if (bpp == null) { return; } if(bpp.isMorphed()) { pre.setCanceled(true); // this stops the player from rendering EntityPlayer thePlayer = Minecraft.getMinecraft().thePlayer; float modelYOffset; if(pre.entityPlayer.equals(thePlayer)){ modelYOffset = -1.625F; } else{ modelYOffset = 0F; } int modelId = bpp.getModelId(); //default is -1 which is steve model double x = pre.entityPlayer.posX - thePlayer.posX; double y = pre.entityPlayer.posY - thePlayer.posY; double z = pre.entityPlayer.posZ - thePlayer.posZ; Render renderPlayerModel = PlayerRenderingRegistry.getRendererByModelId(modelId); renderPlayerMode.doRender(pre.entityPlayer, x, y + modelYOffset, z, 0F, 0.0625F); } } it seems the issue has to do with the x, y, and z x coordinates that I calculate so that the new model renders in the correct spot for the player. Any ideas how to fix the jitter? it only seems to happen when the second player sees the morphed player and this second player moves around while the morphed player is stationary. I think it may also be happening when the morphed player moves around but it isn't as noticeable I don't think.
×
×
  • Create New...

Important Information

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