mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Add default bucket sounds for milk (#9432)
This commit is contained in:
1 parent
4e5eecac12
commit
f5e16aa353
3 files changed
+63
-1
No files matched your search
@@ -49,6 +49,7 @@ import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.common.data.ForgeBiomeTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeFluidTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeSpriteSourceProvider;
|
||||
import net.minecraftforge.common.data.VanillaSoundDefinitionsProvider;
|
||||
import net.minecraftforge.common.extensions.IForgeEntity;
|
||||
import net.minecraftforge.common.extensions.IForgePlayer;
|
||||
import net.minecraftforge.common.loot.CanToolPerformAction;
|
||||
@@ -389,6 +390,8 @@ public class ForgeMod
|
||||
});
|
||||
|
||||
private static boolean enableMilkFluid = false;
|
||||
public static final RegistryObject<SoundEvent> BUCKET_EMPTY_MILK = RegistryObject.create(new ResourceLocation("item.bucket.empty_milk"), ForgeRegistries.SOUND_EVENTS);
|
||||
public static final RegistryObject<SoundEvent> BUCKET_FILL_MILK = RegistryObject.create(new ResourceLocation("item.bucket.fill_milk"), ForgeRegistries.SOUND_EVENTS);
|
||||
public static final RegistryObject<FluidType> MILK_TYPE = RegistryObject.createOptional(new ResourceLocation("milk"), ForgeRegistries.Keys.FLUID_TYPES.location(), "minecraft");
|
||||
public static final RegistryObject<Fluid> MILK = RegistryObject.create(new ResourceLocation("milk"), ForgeRegistries.FLUIDS);
|
||||
public static final RegistryObject<Fluid> FLOWING_MILK = RegistryObject.create(new ResourceLocation("flowing_milk"), ForgeRegistries.FLUIDS);
|
||||
@@ -504,6 +507,7 @@ public class ForgeMod
|
||||
gen.addProvider(event.includeServer(), new ForgeBiomeTagsProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
|
||||
gen.addProvider(event.includeClient(), new ForgeSpriteSourceProvider(packOutput, existingFileHelper));
|
||||
gen.addProvider(event.includeClient(), new VanillaSoundDefinitionsProvider(packOutput, existingFileHelper));
|
||||
}
|
||||
|
||||
public void missingSoundMapping(MissingMappingsEvent event)
|
||||
@@ -533,8 +537,18 @@ public class ForgeMod
|
||||
{
|
||||
if (enableMilkFluid)
|
||||
{
|
||||
// register milk fill, empty sounds (delegates to water fill, empty sounds)
|
||||
event.register(ForgeRegistries.Keys.SOUND_EVENTS, helper -> {
|
||||
helper.register(BUCKET_EMPTY_MILK.getId(), SoundEvent.createVariableRangeEvent(BUCKET_EMPTY_MILK.getId()));
|
||||
helper.register(BUCKET_FILL_MILK.getId(), SoundEvent.createVariableRangeEvent(BUCKET_FILL_MILK.getId()));
|
||||
});
|
||||
|
||||
// register fluid type
|
||||
event.register(ForgeRegistries.Keys.FLUID_TYPES, helper -> helper.register(MILK_TYPE.getId(), new FluidType(FluidType.Properties.create().density(1024).viscosity(1024))
|
||||
event.register(ForgeRegistries.Keys.FLUID_TYPES, helper -> helper.register(MILK_TYPE.getId(), new FluidType(
|
||||
FluidType.Properties.create().density(1024).viscosity(1024)
|
||||
.sound(SoundActions.BUCKET_FILL, BUCKET_FILL_MILK.get())
|
||||
.sound(SoundActions.BUCKET_EMPTY, BUCKET_EMPTY_MILK.get())
|
||||
)
|
||||
{
|
||||
@Override
|
||||
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.data;
|
||||
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
|
||||
public class VanillaSoundDefinitionsProvider extends SoundDefinitionsProvider {
|
||||
|
||||
public VanillaSoundDefinitionsProvider(PackOutput output, ExistingFileHelper helper) {
|
||||
super(output, "minecraft", helper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSounds() {
|
||||
this.add(ForgeMod.BUCKET_EMPTY_MILK.getId(), definition().subtitle("subtitles.item.bucket.empty")
|
||||
.with(sound("item/bucket/empty1"), sound("item/bucket/empty1").pitch(0.9),
|
||||
sound("item/bucket/empty2"), sound("item/bucket/empty3")));
|
||||
this.add(ForgeMod.BUCKET_FILL_MILK.getId(), definition().subtitle("subtitles.item.bucket.fill")
|
||||
.with(sound("item/bucket/fill1"), sound("item/bucket/fill2"), sound("item/bucket/fill3")));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user