Sets the empty/fill sounds for vanilla fluids.

Use Fluid's fillSound rather than emptySound when filling buckets.
This commit is contained in:
Sebastian Hartte 2020-06-19 19:34:50 +02:00 committed by David Quintana
parent 738491c25d
commit 6eb3e20abb
2 changed files with 8 additions and 3 deletions

View file

@ -35,7 +35,7 @@
p_77659_2_.func_71029_a(Stats.field_75929_E.func_199076_b(this));
- p_77659_2_.func_184185_a(fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M, 1.0F, 1.0F);
+
+ SoundEvent soundevent = this.field_77876_a.getAttributes().getEmptySound();
+ SoundEvent soundevent = this.field_77876_a.getAttributes().getFillSound();
+ if (soundevent == null) soundevent = fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M;
+ p_77659_2_.func_184185_a(soundevent, 1.0F, 1.0F);
ItemStack itemstack1 = DrinkHelper.func_242398_a(itemstack, p_77659_2_, new ItemStack(fluid.func_204524_b()));

View file

@ -93,6 +93,7 @@ import net.minecraft.util.text.*;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraft.tileentity.FurnaceTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
@ -838,13 +839,17 @@ public class ForgeHooks
new ResourceLocation("block/water_flow"))
.overlay(new ResourceLocation("block/water_overlay"))
.translationKey("block.minecraft.water")
.color(0xFF3F76E4).build(fluid);
.color(0xFF3F76E4)
.sound(SoundEvents.ITEM_BUCKET_FILL, SoundEvents.ITEM_BUCKET_EMPTY)
.build(fluid);
if (fluid instanceof LavaFluid)
return net.minecraftforge.fluids.FluidAttributes.builder(
new ResourceLocation("block/lava_still"),
new ResourceLocation("block/lava_flow"))
.translationKey("block.minecraft.lava")
.luminosity(15).density(3000).viscosity(6000).temperature(1300).build(fluid);
.luminosity(15).density(3000).viscosity(6000).temperature(1300)
.sound(SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundEvents.ITEM_BUCKET_EMPTY_LAVA)
.build(fluid);
throw new RuntimeException("Mod fluids must override createAttributes.");
}