GregTechCE / GregTech

GregTech rewrite for modern versions of Minecraft
GNU Lesser General Public License v3.0
270 stars 150 forks source link

[BUG] Squid spawning in Oil #1539

Open ArchitektRadim opened 3 years ago

ArchitektRadim commented 3 years ago

Describe the bug Squids do spawn in Oil like in water.

Versions Forge: 14.23.5.2847 GTCE: 1.10.8.599 Modpack: ArchitPack Greg 1.4.0

Setup Singleplayer/Both

Steps To Reproduce 1) Remove surrounding Water to free up water mobcap 2) See that Squids are spawning in Oil springs

Expected behavior Squids should not spawn in oil.

Screenshots 2021-03-20-12-13-51

warjort commented 3 years ago

This is not just oil, it is any GTCE meta fluid. The issue is because the Minecraft material type is water.

From gregtech.common.MetaFluids

BlockFluidBase fluidBlock = new BlockFluidClassic(fluid, net.minecraft.block.material.Material.WATER);

Looking at it, this causes a number of "features":

An obvious fix would be to use a different material with the same properties

// New instance with the same properties as WATER
static Material GTCE_FLUID_MATERIAL = new MaterialLiquid(MapColor.WATER)).setNoPushMobility();

BlockFluidBase fluidBlock = new BlockFluidClassic(fluid, GTCE_FLUID_MATERIAL);

But this would have a number of undesirable consequences, besides removing the "features" listed above

There are other changes that would need more careful analysis because of Minecraft's hardcoding

CAVEAT: I did this analysis fairly quickly, it may not be totally accurate and there maybe more subtle changes from not using Material.WATER

NOTE: common.items.potions.BlockPotionFluid also uses Material.WATER

ArchitektRadim commented 3 years ago

This is not just oil, it is any GTCE meta fluid. The issue is because the Minecraft material type is water.

From gregtech.common.MetaFluids

BlockFluidBase fluidBlock = new BlockFluidClassic(fluid, net.minecraft.block.material.Material.WATER);

Looking at it, this causes a number of "features":

* Water mobs can spawn in them (e.g. squids as reported)

* You can use GTCE fluids to hydrate crops

* You can use them to make terracota from concrete powder

* You can place lily pads on top of them

* You can place reeds (sugar cane) next to them

* You can use a sponge to remove them

* Mobs won't burn in them

* Using an empty water bottle on them will give you a full WATER bottle (i.e. not the fluid)

* You can fish in them

* They evaporate when placed in the nether

An obvious fix would be to use a different material with the same properties

// New instance with the same properties as WATER
static Material GTCE_FLUID_MATERIAL = new MaterialLiquid(MapColor.WATER)).setNoPushMobility();

BlockFluidBase fluidBlock = new BlockFluidClassic(fluid, GTCE_FLUID_MATERIAL);

But this would have a number of undesirable consequences, besides removing the "features" listed above

* You would no longer drown in them

* Mining speed would change when inside them and enchantments like "aqua affinity", etc. would no longer work

* You would not get the "underwater" overlay

* Boats could not be used on top of them (at least they would behave like they are on land)

* Falling blocks would not pass through them, e.g. a dropped anvil would float on top (seems a bit weird that minecraft hardcodes water and lava - the two fluids it knows about - instead of just checking for a fluid?)

There are other changes that would need more careful analysis because of Minecraft's hardcoding

* Changes to player/mob movement

* Changes to water properties (like spreading speed, pushing entities, etc.)

* Some special rendering for water (including particle behaviour)

* Special terrain gen for water

CAVEAT: I did this analysis fairly quickly, it may not be totally accurate and there maybe more subtle changes from not using Material.WATER

NOTE: common.items.potions.BlockPotionFluid also uses Material.WATER

Thanks for the explanation, that is interesting. Regarding the fact it's not a big issue, then I don't care much if that's going to be changed.