JeanMiecraft Posted August 18, 2018 Posted August 18, 2018 Hello, I create a custom Fluid with a custom material, but if I wrote this topic, it's because I don't know how create the swimming and the slow movements in the material. I sought in the EntityLivingBase in the moveEntityWithHeading and in the onLivingUpdate but it doesn't work. Can you help me for this problem? Thank you so much for your help! -JM Quote
Draco18s Posted August 18, 2018 Posted August 18, 2018 Its hard. :\ Vanilla handles water movement in the Entity class itself and checks for explicitly Material.WATER You basically have to find that code and copy it to an event handler. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
jabelar Posted August 18, 2018 Posted August 18, 2018 It's pretty tough actually, you have to sort of replace a lot of vanilla movement code. I actually submitted a PR to add ability for custom fluids to automatically do this, but the Forge gods are really busy with 1.13 right now. Some day... Here is how I did it using events though: http://jabelarminecraft.blogspot.com/p/minecraft-modding-custom-fluid-blocks.html It is intrusive and a lot of coding but it is possible to make your custom fluids behave mostly like vanilla. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
JeanMiecraft Posted August 18, 2018 Author Posted August 18, 2018 For the player, I use this: Minecraft mc = Minecraft.getMinecraft(); boolean jump = mc.gameSettings.keyBindJump.isKeyDown(); if (jump == true) { entity.motionY = 0.10000001192092896D; } The problem for the player is the speed, it's possible to slow down look like the slowness potion? And for the other EntityLiving, I don't know because if I use: entity.motionY = 0.10000001192092896D; It work, but they can't move. For example, if I have in my hand a carrot and the entity in my custom fluid is a pig. The motionX and motionZ equal 0; Thank you for your answer! - JM Quote
DaemonUmbra Posted August 18, 2018 Posted August 18, 2018 Please look into the concept of Sides and consider using a more modern version of Minecraft. Quote This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy. As the most common issue I feel I should put this outside the main bulk: The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge. If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan. For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety. Spoiler Logs (Most issues require logs to diagnose): Spoiler Please post logs using one of the following sites (Thank you Lumber Wizard for the list): https://gist.github.com/: 100MB Requires member (Free) https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$) https://hastebin.com/: 400KB Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads. What to provide: ...for Crashes and Runtime issues: Minecraft 1.14.4 and newer: Post debug.log Older versions: Please update... ...for Installer Issues: Post your installer log, found in the same place you ran the installer This log will be called either installer.log or named the same as the installer but with .log on the end Note for Windows users: Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension Where to get it: Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs. Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch: Spoiler Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge) Make a launcher profile targeting this version of Forge. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it). Now launch the pack through that profile and follow the "Mojang Launcher" instructions above. Video: Spoiler or alternately, Fallback ("No logs are generated"): If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft Server Not Starting: Spoiler If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output. Reporting Illegal/Inappropriate Adfocus Ads: Spoiler Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad. Lex will need the Ad ID contained in that URL to report it to Adfocus' support team. Posting your mod as a GitHub Repo: Spoiler When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub. When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository. Open a command prompt (CMD, Powershell, Terminal, etc). Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in). Run the following commands: git init git remote add origin [Your Repository's URL] In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git git fetch git checkout --track origin/master git stage * git commit -m "[Your commit message]" git push Navigate to GitHub and you should now see most of the files. note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from) Now you can share your GitHub link with those who you are asking for help. [Workaround line, please ignore]
JeanMiecraft Posted August 18, 2018 Author Posted August 18, 2018 Ah yes there are a little forgetfulness for my part... I corrige that. For the version, I use forge 1.9.4 because for mi the newest version: 1.10, 1.11 and 1.12 don't work... Quote
JeanMiecraft Posted August 20, 2018 Author Posted August 20, 2018 Hello, no this isn't resolved but with the help, I modified the respiration in the liquid. On 8/18/2018 at 5:47 PM, jabelar said: It's pretty tough actually, you have to sort of replace a lot of vanilla movement code. I actually submitted a PR to add ability for custom fluids to automatically do this, but the Forge gods are really busy with 1.13 right now. Some day... Here is how I did it using events though: http://jabelarminecraft.blogspot.com/p/minecraft-modding-custom-fluid-blocks.html It is intrusive and a lot of coding but it is possible to make your custom fluids behave mostly like vanilla. With that, I add to my fluid the finishes as the drown and the bubbles. Now the problem is the entity's motionY when she jump and the water or lava movement for the player. In the EntityLivingBase for the entity I compare the levitation potion but it's doesn't work... Can you tell me where is the class with the swimming for the entities and the player please. It's very important for me! - JM Quote
jabelar Posted August 20, 2018 Posted August 20, 2018 EntityLivingBase has two methods, handleJumpWater() and handleJumpLava() that simply adjust the motionY. These methods rely on the isInLiquid() method. It might be difficult to intercept them though because they are buried inside the living update and update loops. For example, you could handle the LivingUpdateEvent, but you'd have to recreate a lot of the vanilla code I think. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
JeanMiecraft Posted August 21, 2018 Author Posted August 21, 2018 Hello... Thank you for this answer! I see, this method is in the PathNavigate, in the PathNavigateGround and in the PathNavigateSwimmer... In the EntityAISwimming, I found that: ((PathNavigateGround)entitylivingIn.getNavigator()).setCanSwim(true); The "getNavigator" is register in the EntityLiving. It's possible to change the boolean value if an entity is in my fluid? If yes, where I can place this method? Quote
Draco18s Posted August 21, 2018 Posted August 21, 2018 (edited) That is not what that does. If you change that value, it means the entity can not swim in anything. And again, the concept of "swimming" as far as Minecraft is concerned is Material.WATER and only Material.WATER Edited August 21, 2018 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
JeanMiecraft Posted August 21, 2018 Author Posted August 21, 2018 7 minutes ago, Draco18s said: That is not what that does. If you change that value, it means the entity can not swim in anything. And again, the concept of "swimming" as far as Minecraft is concerned is Material.WATER and only Material.WATER We can "swim" in lava too. Okay, I understand... but it's possible to recreate with a event the swimming effect and the entity can move? I want my custom material because with the Material.WATER or Material.LAVA, there are secondary effects... Thank you for your help! Quote
Draco18s Posted August 21, 2018 Posted August 21, 2018 (edited) 37 minutes ago, JeanMiecraft said: We can "swim" in lava too. Its handled by separate code. You don't actually swim in lava. Go look at EntityLivingBase lines 2572-2587 and lines 235-238 as well as Entity line 545. Quote Okay, I understand... but it's possible to recreate with a event the swimming effect and the entity can move? I want my custom material because with the Material.WATER or Material.LAVA, there are secondary effects... Thank you for your help! Yes: On 8/18/2018 at 11:22 AM, Draco18s said: You basically have to find that code and copy it to an event handler. On 8/18/2018 at 11:47 AM, jabelar said: It is intrusive and a lot of coding but it is possible to make your custom fluids behave mostly like vanilla. Edited August 21, 2018 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
TheMario Posted August 22, 2018 Posted August 22, 2018 You speak about the movement of water but it is the push if the liquid flow. I do not understand the relation with the swimming. Quote
Draco18s Posted August 22, 2018 Posted August 22, 2018 7 hours ago, TheMario said: You speak about the movement of water but it is the push if the liquid flow. I do not understand the relation with the swimming. Did you look at the code I mentioned? One of them directly relates to what happens when you jump and are inside water/lava. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
JeanMiecraft Posted August 23, 2018 Author Posted August 23, 2018 23 hours ago, TheMario said: You speak about the movement of water but it is the push if the liquid flow. I do not understand the relation with the swimming. No, it is the swimming... The problem maintaining, it is to apply this method when the entity jumps or if the player presses the space key... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.