Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

HappyKiller1O1

Members
  • Posts

    581
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    Intermediate Forge Developer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

HappyKiller1O1's Achievements

Dragon Slayer

Dragon Slayer (6/8)

14

Reputation

  1. Most of my update has been in LivingUpdate, will switch over here soon. My only problem is creating a timer within an update event. Seems the timer will always be reset, which is not what someone wants at all. Even though this is basic java, could you give an example on how I would start with a timer in a tick event?
  2. Thank you both, I realized I was on peaceful when testing, so the hunger bar wouldn't deplete. I do have a question about the implementation though: I use it in the #LivingUpdateEvent, and was wondering how I could do this with my weight variable. Should I create a timer that is affected by the player's current weight? Or do some math in order to determine how much exhaustion to add with the weight?
  3. I understand the base of how to acquire the player's FoodStats, but I would like to know how it works. Does FoodStats#addExaustion() affect it's drain speed? Or is there a better way of doing this? I simple example would be very helpful.
  4. Could you please show your full block, and TileEntity class.
  5. Alright, would they put that annotation over their Item or Block class? (I created the weight limit mod , so they have to implement my interface in order to provide items with weight).
  6. One more question though, what if someone implements my API classes, and someone using that mod does not have my mod loaded? Wouldn't that crash the game?
  7. Silly me, just had to create the file outside of eclipse. Thanks!
  8. I tried creating that, but it says you can't use a dash in your class name.
  9. Are you sure it's a .info file? Wouldn't you need to do a .java to use the @API annotation?
  10. So, I understand that an API is just some classes for other mods to interact with mine. But, do I simply create a package for my API classes, compile my mod with it, and have people use the source of my mod for the API? Do I have to compile an API separately? Do I have to define a class or package as an API? I just want to make sure people won't have errors when attempting to interact with my mod.
  11. I've looked through quite a few classes, and I can't seem to find a way to get the amplifier of the potion active on a player. I thought Potion#getEffectivness would be it, but it always returns one (for strength at least). Is there some way to get the amplifier of the active potion on a player?
  12. Very weird error, and it never happened during my compiling a few days ago. It failed with this log: C:\Users\Happy Pappy\Desktop\Mod Directory\Minecraft\Weight Limit 1.8.8>gradlew build This set of MCP mappings was designed for MC 1.8. Use at your own peril. ################################################# ForgeGradle 2.1-SNAPSHOT-8267717 https://github.com/MinecraftForge/ForgeGradle ################################################# Powered by MCP unknown http://modcoderpack.com by: Searge, ProfMobius, Fesh0r, R4wk, ZeuX, IngisKahn, bspkrs ################################################# :deobfCompileDummyTask :deobfProvidedDummyTask :sourceApiJava UP-TO-DATE :compileApiJava UP-TO-DATE :processApiResources UP-TO-DATE :apiClasses UP-TO-DATE :sourceMainJava :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not find tools.jar * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 11.172 secs C:\Users\Happy Pappy\Desktop\Mod Directory\Minecraft\Weight Limit 1.8.8> Any ideas?
  13. So, my model that I am rendering on the player's back works quite fine. But, my only problem is that when the player sneaks, my model doesn't rotate. Here's an example: Standing with model: Sneaking with model: Here's my model code: package com.happykiller.weightlimit.render.models; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelSmallBackpack extends ModelBiped { ModelRenderer BackpackBase; ModelRenderer BackpackSecondary; ModelRenderer MainButton; ModelRenderer PocketLeft; ModelRenderer PocketRight; ModelRenderer PocketFront; ModelRenderer FrontButton; public ModelSmallBackpack(float scale) { super(scale, 0.0F, 64, 32); BackpackBase = new ModelRenderer(this, 0, 0); BackpackBase.addBox(-3F, 1F, 2F, 6, 8, 2); BackpackBase.setRotationPoint(0F, 0F, 0F); BackpackBase.setTextureSize(64, 32); BackpackBase.mirror = true; setRotation(BackpackBase, 0F, 0F, 0F); BackpackSecondary = new ModelRenderer(this, 16, 0); BackpackSecondary.addBox(-2F, 3F, 3.5F, 4, 6, 1); BackpackSecondary.setRotationPoint(0F, 0F, 0F); BackpackSecondary.setTextureSize(64, 32); BackpackSecondary.mirror = true; setRotation(BackpackSecondary, 0F, 0F, 0F); MainButton = new ModelRenderer(this, 0, 10); MainButton.addBox(-1F, 1.5F, 3.2F, 2, 1, 1); MainButton.setRotationPoint(0F, 0F, 0F); MainButton.setTextureSize(64, 32); MainButton.mirror = true; setRotation(MainButton, 0F, 0F, 0F); PocketLeft = new ModelRenderer(this, 0, 12); PocketLeft.addBox(2.5F, 6F, 1.8F, 1, 2, 2); PocketLeft.setRotationPoint(0F, 0F, 0F); PocketLeft.setTextureSize(64, 32); PocketLeft.mirror = true; setRotation(PocketLeft, 0F, 0F, 0F); PocketRight = new ModelRenderer(this, 6, 12); PocketRight.addBox(-3.533333F, 6F, 1.8F, 1, 2, 2); PocketRight.setRotationPoint(0F, 0F, 0F); PocketRight.setTextureSize(64, 32); PocketRight.mirror = true; setRotation(PocketRight, 0F, 0F, 0F); PocketFront = new ModelRenderer(this, 0, 16); PocketFront.addBox(-1F, 6F, 4F, 2, 2, 1); PocketFront.setRotationPoint(0F, 0F, 0F); PocketFront.setTextureSize(64, 32); PocketFront.mirror = true; setRotation(PocketFront, 0F, 0F, 0F); FrontButton = new ModelRenderer(this, 0, 10); FrontButton.addBox(-1F, 5F, 3.8F, 2, 1, 1); FrontButton.setRotationPoint(0F, 0F, 0F); FrontButton.setTextureSize(64, 32); FrontButton.mirror = true; setRotation(FrontButton, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { setRotationAngles(f, f1, f2, f3, f4, f5, entity); BackpackBase.render(f5); BackpackSecondary.render(f5); MainButton.render(f5); PocketLeft.render(f5); PocketRight.render(f5); PocketFront.render(f5); FrontButton.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); //Is this the problem? copyModelAngles(this.bipedBody, BackpackBase); copyModelAngles(this.bipedBody, BackpackSecondary); copyModelAngles(this.bipedBody, MainButton); copyModelAngles(this.bipedBody, PocketLeft); copyModelAngles(this.bipedBody, PocketRight); copyModelAngles(this.bipedBody, PocketFront); copyModelAngles(this.bipedBody, FrontButton); } } I thought #copyModelAngles() would do it, but it doesn't help. Am I calling it incorrectly?
  14. This is very simple with SharedMonsterAttributes. One of the things you MUST understand is that nothing is impossible in programming. No matter what, there is always a way to accomplish anything you want. Here is my way of modifying the player speed. You can replace the things you'd need to, in order to update the player health. @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)event.entity; ExtendedPlayer props = ExtendedPlayer.get(player); if(WLConfig.slowPlayerWhenOverEncumbered) { if(props != null) { final UUID speedModifierUUID = UUID.fromString("db1f6a32-af5e-11e5-bf7f-feff819cdc9f"); AttributeModifier speedModifier = (new AttributeModifier(speedModifierUUID, "weightSpeedModifier", -0.4, 2)).setSaved(false); IAttributeInstance iai = player.getEntityAttribute(SharedMonsterAttributes.movementSpeed); if(props.isOverEncumbered() && !player.capabilities.isCreativeMode && !player.isSpectator()) { if(iai.getModifier(speedModifierUUID) == null) { iai.applyModifier(speedModifier); } player.setSprinting(false); if(player.worldObj.isRemote) { Minecraft mc = Minecraft.getMinecraft(); KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), false); } }else { if(iai.getModifier(speedModifierUUID) != null) { iai.removeModifier(speedModifier); } } } } } The UUID is required, I use the random UUID generator here. I don't have time as of now to explain all the workings, so I hope you can figure out some of this on your own. The onLivingUpdate goes in your event handler, and you must subscribe to it.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.