Skip to content

Commit

Permalink
Improve accuracy of FluidType#canConvertToSource for vanilla fluids (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster authored Nov 1, 2023
1 parent 48f88f0 commit 7357532
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/net/neoforged/neoforge/common/NeoForgeMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
Expand Down Expand Up @@ -301,6 +304,15 @@ public void setItemMovement(ItemEntity entity) {
.sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY)
.sound(SoundActions.FLUID_VAPORIZE, SoundEvents.FIRE_EXTINGUISH)
.canHydrate(true)) {
@Override
public boolean canConvertToSource(FluidState state, LevelReader reader, BlockPos pos) {
if (reader instanceof Level level) {
return level.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION);
}
//Best guess fallback to default (true)
return super.canConvertToSource(state, reader, pos);
}

@Override
public @Nullable BlockPathTypes getBlockPathType(FluidState state, BlockGetter level, BlockPos pos, @Nullable Mob mob, boolean canFluidLog) {
return canFluidLog ? super.getBlockPathType(state, level, pos, mob, true) : null;
Expand Down Expand Up @@ -359,6 +371,15 @@ public int getTintColor(FluidState state, BlockAndTintGetter getter, BlockPos po
.density(3000)
.viscosity(6000)
.temperature(1300)) {
@Override
public boolean canConvertToSource(FluidState state, LevelReader reader, BlockPos pos) {
if (reader instanceof Level level) {
return level.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION);
}
//Best guess fallback to default (false)
return super.canConvertToSource(state, reader, pos);
}

@Override
public double motionScale(Entity entity) {
return entity.level().dimensionType().ultraWarm() ? 0.007D : 0.0023333333333333335D;
Expand Down

0 comments on commit 7357532

Please sign in to comment.