Jump to content

Kriptikz

Members
  • Posts

    81
  • Joined

  • Last visited

Everything posted by Kriptikz

  1. Yea that's a common problem with most teleportation mods, I am planning on looking into it though as I also have a method of teleportation in a mod i'm working on. I know vanilla does a check when the player logs in to see if the dragon is there because it tries to render the boss bar or something like that. Atm I don't yet know of a way to remove the bar from in game properly.
  2. I do believe KeyInputEvent is fired only client side. So, what I would do is put this in it's own class where I can also have other client side only events and only register that in the client proxy. Then you can just useMinecraft.getMinecraft().player. Also remember that all logic, such as giving the player an item or spawning something, should only be done server side, so if you want to do that stuff you need to send a packet.
  3. Show your code. Also explain what you tried and how it didn't work.
  4. Here is what mcjty does in rftools, although you will probably have to go through his code a couple times as a couple of his own methods in different files. https://github.com/McJty/RFTools/blob/b738a7e6b830c7f4ceb763914200fc98e1ed5a83/src/main/java/mcjty/rftools/blocks/teleporter/TeleportationTools.java#L354-L369
  5. Do you mean like a twitch account, they are free to make and you will stay logged in. Then when you launch the game it uses Mojangs launcher so you just use your minecraft account to login there. Also I'm pretty sure twitch uses its own minecraft install. At least I know mine does Here is an article for playing minecraft with twitch: https://help.twitch.tv/customer/en/portal/articles/2764216-how-to-play-minecraft-with-twitch-app
  6. The twitch app has its own way of handling profiles, allowing you to have multiple profiles with whatever different mods you want even with different versions of Minecraft if you want. Then most mods can be added inside the twitch app as well without you having to move files around or anything like that.
  7. No idea what Magic Launcher is, but after looking into it a little it looks like it's just a minecraft launcher that is suppose to make it easier to get mods, right? Are you trying to run a server? Just let them play SinglePlayer? Or do a SinglePlayer world and then openToLan so they can play with eachother? If your trying to run a server then that is setup separately and I could link you some steps or something if you want. For playing without a dedicated server, so for SinglePlayer/ Singleplayer + openToLan, then what I recommend is using the twitch app to install mods. With the twitch app it is really easy to create a custom profile and add mods individually, or you can download preexisting modpacks that others built as well. https://app.twitch.tv/
  8. Replace the line where you reverse the motionY. Basically the line that is almost identical except I added the * HEIGHT_MULTIPLIER
  9. Yea I think that part is for particles: try doing this: entityIn.motionY = -entityIn.motionY * HEIGHT_MULTIPLIER;
  10. does that value actually affect players? because it says: if (!(entityIn instanceof EntityLivingBase)) doesn't that say if the entityIn is NOT an instance of EntityLivingBase?
  11. Yea I figured this could end up becoming a problem. From what I understand the client is what moves the player and the server validates that movement correct? But yea, back to the drawing board.
  12. No problem, for future reference you should post in Modder Support: http://www.minecraftforge.net/forum/forum/70-modder-support/
  13. Ok thanks guys, still no idea why it doesn't crash, but I'm going to fix it before it does. Now to figure exactly how I want to handle this.
  14. Even though it's not crashing I understand that I shouldn't do it this way, what would be the recommended way to do this?
  15. The problem is when you call new ModItems(); in your common proxy preInit. Which ofc calls the constructor you made in ModItems() which calls initItems(); registerItems(); and registerRenders(); which means your calling registerRenders() in your common proxy preInit. You can only register renders on the client, so this method should only be called in your client proxy. I explain the steps to fix up your code below: First get rid of this constructor: https://github.com/TheCaliban/CaliArmor/blob/master/src/main/java/com/mod/CaliArmor/init/ModItems.java#L29-L34 And make all your methods in ModItems static. Then instead of creating an instance here: https://github.com/TheCaliban/CaliArmor/blob/master/src/main/java/com/mod/CaliArmor/proxy/CommonProxy.java#L9 do this: public class CommonProxy { public void preInit() { // Get rid of this, as methods should be all static now //new ModItems(); // initialize items ModItems.initItems(); // register items ModItems.registerItems(); } public void Init() { new ModRecipes().registerCraftRecipes(); new ModRecipes().registerFurnaceRecipes(); new ModRecipes().registerBrewingRecipes(); } } Then for your ClientProxy: public class ClientProxy extends CommonProxy { @Override public void preInit() { super.preInit(); // register renders ModItems.registerRenders(); } @Override public void Init() { super.Init(); } }
  16. There is a section for modder support, it would probably be better if you posted there: http://www.minecraftforge.net/forum/forum/70-modder-support/ As for your problem, it's difficult to help you without being able to see your actual code. But from what I'm getting you need to use proxies: https://mcforge.readthedocs.io/en/latest/concepts/sides/ A common use case is to register renderers and models, something which must be called from the main initialization methods preInit, init, or postInit. However, many rendering related classes and registries are not present on the physical server and may crash it. Therefore, we put these actions into the client proxy, ensuring that they will always execute for the physical client. Here is what I do: My @Mod class: https://github.com/Kriptikz/Archmage/blob/1.11.2/src/main/java/kriptikz/archmage/Archmage.java My ClientProxy where I register renders for Entities: https://github.com/Kriptikz/Archmage/blob/1.11.2/src/main/java/kriptikz/archmage/proxy/ClientProxy.java#L29
  17. Why wouldn't the server be loading the class? I do have other methods in this class I just only posted the piece I was wondering about. I also do register this for both client and server I'm pretty sure. Here is the actual entire class: Here is the @Mod class:
  18. In my code I am trying to stop the player from moving when they are stunned. So using PlayerTickEvent I disable some of the keys used for movement. Here is the code: From what I understand is even if I use world.isRemote before using Minecraft.getMinecraft() this can still cause the server to crash, but it doesn't. I did test it on a dedicated server, but I was still running the server and client on the same computer idk if that affects it. If using Minecraft.getMinecraft() even after making sure world.isRemote can cause a crash on the server, what's the proper way to go about this? Maybe create a method in my proxy to handle this, where the ServerProxy does nothing and ClientProxy has this code?
  19. I made my own form of levitation for my mod and when using it the server kicks the player for flying. I understand that there is a private floatingTickCount variable in NetHandlerPlayServer that will kick a player for floating for 80 ticks. To get around this you can allow flight from the server properties, but I do believe this leaves the server vulnerable to hacked clients being able to fly around, also I don't want users to have to change this setting for my mod as other flight mods, like with jetpacks, don't require this. I looked into SimplyJetpacks2 source and it looks like they use reflection to access the floatingTickCount and reset it to 0. What I was doing before I looked into SimplyJetpacks2 source was go to change EntityPlayer#capability.allowFlying = true which is how you give a player creative flight but I would only set this on the server and NOT the client, this ensured the player didn't get kicked for flying but also didn't give the player actual creative flight on the client, although it still disables fall damage but that's not a big deal. Then when the player turns off the levitation or runs out of mana or whatever disables their levitation I change EntityPlayer#capability.allowFlying = false and again I only do this on the server. I'm wondering how I should go about making sure players don't get kicked for using my mods levitation and not have to allow flight in the server properties. If I use my original method, which was changing EntityPlayer#capability.allowFlying I'm mainly worried about whether or not this is ok to do and also no idea how this will affect other mods that use this for flight. I think if they update this every tick then it's ok because I only change this value when the spell is activated or deactivated.
  20. EDIT: I was rereading the previous posts and you actually do want to allow some stuff when they are stunned, such as allowing mobs/players to attack and stuff so this won't really work for you. You will probably have to code for all the special situations. I'm currently implementing a stun spell in my mod. I use a capability to store whether or not the entity is stunned and how long they will be stunned for. I actually have two capabilities, one for the player and one for the mobs because I store a lot of other data in the player capability, but I'm pretty sure you could use one capability for both. So if the entity is an instance of EntityLiving I just turn off the AI with Entity#setNoAI(true) and set the stun duration in the capability. When you turn off the AI they still take damage but they don't get knocked back interestingly enough. Then I use LivingUpdateEvent to handle the increment of ticks stunned, and when it reaches the stun duration I do Entity#setNoAI(false). Next if the entity is an instance of EntityPlayer I set the isStunned boolean in the player capability to true and set the stun duration. Then in PlayerTickEvent I check if (player.world.isRemote) and then I check the players capability to see if the player isStunned. if they are stunned I increment the ticksStunned and if it's less than the duration I use KeyBinding.unPressAllKeys(); else IsetIsStunned(false) and setTicksStunned(0) For the player I don't think this stops knockback so you would probably have to do something like what you already do to stop that, but it prevents them from moving. I'm pretty sure you can still use the esc, inventory, and 123456...(to quick select from hotbar) hotkeys when using unPressAllKeys() but you can't activate/use any items or attack/defend. Also no Idea if I'm doing something I shouldn't but this is what I found works for what I'm trying to do.
×
×
  • Create New...

Important Information

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