DarkMorford Posted August 5, 2017 Posted August 5, 2017 I've been working on adding a custom fluid to my mod, using Choonster's TestMod3 as an example. It seems to be working for the most part: I can give myself a bucket of it in Creative mode, and it renders correctly when I place it in the world. The problem I'm having is that the in-world fluid blocks aren't affecting movement at all. I think I'm setting the viscosity and density correctly, but I'm not pushed around or slowed in any way when I stand in it. Is there something else I need to configure to make this work correctly? Mod code is here. Quote
Draco18s Posted August 5, 2017 Posted August 5, 2017 You haven't set the block's material to Material.WATER. Without that you don't get any of the standard water behaviors, as they aren't controlled by the block or fluid, but by the Entity class. 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.
DarkMorford Posted August 5, 2017 Author Posted August 5, 2017 Hm, I think I get it. I changed new MaterialLiquid(MapColor.YELLOW) to MaterialLiquid.WATER in my registerBlocks() method, and I am getting the movement behavior I'm expecting. However, it now renders as blue (water) on maps, and the particle effects when I land in a pool of the stuff are also blue. How would I go about making those yellow to match the fluid texture? Quote
lukas2005 Posted August 5, 2017 Posted August 5, 2017 (edited) 27 minutes ago, DarkMorford said: Hm, I think I get it. I changed new MaterialLiquid(MapColor.YELLOW) to MaterialLiquid.WATER in my registerBlocks() method, and I am getting the movement behavior I'm expecting. However, it now renders as blue (water) on maps, and the particle effects when I land in a pool of the stuff are also blue. How would I go about making those yellow to match the fluid texture? maybe try (new MaterialLiquid(MapColor.YELLOW)).setNoPushMobility(); and if it does not work then i think that it just checks if material is MaterialLiquid.WATER Edited August 5, 2017 by lukas2005 Quote
Draco18s Posted August 5, 2017 Posted August 5, 2017 setNoPushMobility() prevents pistons from pushing it. If you want your custom material to push players around like water, you need to replicate the behavior found in the Entity classes (it's kind of split) into an entity tick 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.
lukas2005 Posted August 5, 2017 Posted August 5, 2017 Just now, Draco18s said: setNoPushMobility() prevents pistons from pushing it. If you want your custom material to push players around like water, you need to replicate the behavior found in the Entity classes (it's kind of split) into an entity tick event handler. i think that it would be cool if forge had just some better way of doing this for example MaterialLiquid(MapColor color, boolean pushEntities) so that you don't need to replicate the code because mc expected to only have water and lava Quote
Draco18s Posted August 5, 2017 Posted August 5, 2017 Make a pull request. 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.
DarkMorford Posted August 6, 2017 Author Posted August 6, 2017 On 8/5/2017 at 10:42 AM, Draco18s said: If you want your custom material to push players around like water, you need to replicate the behavior found in the Entity classes (it's kind of split) into an entity tick event handler. I'm going to show how new I am to modding here... Conceptually, I think I get what an entity tick event handler would be and what would need to go into it, but I have no idea how to actually set one up in code or which Entity classes I'd need to look at. Any chance you could post (or link to) an example? Quote
Draco18s Posted August 6, 2017 Posted August 6, 2017 http://mcforge.readthedocs.io/en/latest/events/intro/ 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.
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.