Moved sounds to deferred.

Moved sounds to datagen.
Fixed sounds in the reconstructor.
This commit is contained in:
Flanks255 2022-05-18 15:39:49 -05:00
parent 21a57f2ac9
commit ab672f6474
15 changed files with 96 additions and 86 deletions

View file

@ -4,7 +4,7 @@
- [ ] Smiley cloud
- [x] Occasional solidified XP drop from mobs
- [ ] Treasure chests
- [ ] Composter and bio-mash, biomass, bio coal and fertilizer
- [x] Composter and bio-mash, biomass, bio coal and fertilizer
- [x] Charcoal blocks
- [x] Ender pearl blocks
- [x] ESDs

View file

@ -342,7 +342,6 @@ a8a6a7b651721f6218ae46ec272961b2c0941bfa assets/actuallyadditions/models/item/et
8bcb533ef0b7c42b3218e2cf52c752fef283c267 assets/actuallyadditions/models/item/farmer.json
d4338f09f71dd9bc75babcb7cebba80ab57eee01 assets/actuallyadditions/models/item/feeder.json
bb4fc4a881ec4b949fb657b112826731988cdaf8 assets/actuallyadditions/models/item/fermenting_barrel.json
60ad6e5930b80fc07c18e367e73472627ec4fb3e assets/actuallyadditions/models/item/fertilizer.json
66dfca0e0ef8e04d76acddab3efbd294d3588d38 assets/actuallyadditions/models/item/filter.json
bc83a5a96df045a0c005637ec1cb8f0e66de69a5 assets/actuallyadditions/models/item/firework_box.json
a09cf83500fa2357cd5be2cb896014dfb4310ac9 assets/actuallyadditions/models/item/flax_seeds.json
@ -455,6 +454,7 @@ f68d37fcdaf57ec06518d5974cbf540e6c45d271 assets/actuallyadditions/models/item/wo
f657eabc7321de0b05cf92d9ebdd6f5215a685b5 assets/actuallyadditions/models/item/wooden_aiot.json
7f8e5e703d9244222706c52d7b24b299e07cb2db assets/actuallyadditions/models/item/worm.json
0b1ab8963077c90a5104b516eab36e56c8a07057 assets/actuallyadditions/models/item/xp_solidifier.json
ecf1cc8efe1f425334e8e07a6c747641c714c92c assets/actuallyadditions/sounds.json
9a7897ef54a7b27d06db0cbb412465fd1e71b9fe data/actuallyadditions/loot_tables/blocks/atomic_reconstructor.json
de3c64d6a363f8e27078d7f7df1a67e4931fd81c data/actuallyadditions/loot_tables/blocks/battery_box.json
fb968dc63f2d0a467eff504f3f6ff386080e2433 data/actuallyadditions/loot_tables/blocks/bio_reactor.json

View file

@ -1,6 +0,0 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "actuallyadditions:item/fertilizer"
}
}

View file

@ -0,0 +1,22 @@
{
"reconstructor": {
"sounds": [
"actuallyadditions:reconstructor"
]
},
"crusher": {
"sounds": [
"actuallyadditions:crusher"
]
},
"coffee_machine": {
"sounds": [
"actuallyadditions:coffee_machine"
]
},
"duh_duh_duh_duuuh": {
"sounds": [
"actuallyadditions:duh_duh_duh_duuuh"
]
}
}

View file

@ -15,29 +15,26 @@ public class ActuallyAdditionsData {
DataGenerator generator = event.getGenerator();
ExistingFileHelper helper = event.getExistingFileHelper();
if (event.includeClient()) {
// generator.addProvider(new GeneratorBlockStates(generator, helper));
// generator.addProvider(new GeneratorItemModels(generator, helper));
// generator.addProvider(new GeneratorLanguage(generator));
}
// generator.addProvider(new GeneratorBlockStates(generator, helper));
// generator.addProvider(new GeneratorItemModels(generator, helper));
// generator.addProvider(new GeneratorLanguage(generator));
BlockTagsGenerator generatorBlockTags = new BlockTagsGenerator(generator, helper);
if (event.includeServer()) {
BlockTagsGenerator generatorBlockTags = new BlockTagsGenerator(generator, helper);
generator.addProvider(new LootTableGenerator(generator));
generator.addProvider(new BlockRecipeGenerator(generator));
generator.addProvider(new ItemRecipeGenerator(generator));
generator.addProvider(generatorBlockTags);
generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper));
generator.addProvider(new LootTableGenerator(generator));
generator.addProvider(new BlockRecipeGenerator(generator));
generator.addProvider(new ItemRecipeGenerator(generator));
generator.addProvider(generatorBlockTags);
generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper));
generator.addProvider(new BlockStateGenerator(generator, helper));
generator.addProvider(new ItemModelGenerator(generator, helper));
generator.addProvider(new BlockStateGenerator(generator, helper));
generator.addProvider(new ItemModelGenerator(generator, helper));
generator.addProvider(new LaserRecipeGenerator(generator));
generator.addProvider(new EmpoweringRecipeGenerator(generator));
generator.addProvider(new CrushingRecipeGenerator(generator));
generator.addProvider(new FuelRecipeGenerator(generator));
generator.addProvider(new MiscMachineRecipeGenerator(generator));
generator.addProvider(new LaserRecipeGenerator(generator));
generator.addProvider(new EmpoweringRecipeGenerator(generator));
generator.addProvider(new CrushingRecipeGenerator(generator));
generator.addProvider(new FuelRecipeGenerator(generator));
generator.addProvider(new MiscMachineRecipeGenerator(generator));
}
generator.addProvider(new SoundsGenerator(generator, helper));
}
}

View file

@ -0,0 +1,23 @@
package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.AASounds;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.data.DataGenerator;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.common.data.SoundDefinitionsProvider;
public class SoundsGenerator extends SoundDefinitionsProvider {
protected SoundsGenerator(DataGenerator generator, ExistingFileHelper helper) {
super(generator, ActuallyAdditions.MODID, helper);
}
@Override
public void registerSounds() {
add(AASounds.RECONSTRUCTOR, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "reconstructor"))));
add(AASounds.CRUSHER, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "crusher"))));
add(AASounds.COFFEE_MACHINE, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine"))));
add(AASounds.DUH_DUH_DUH_DUUUH, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh"))));
}
}

View file

@ -0,0 +1,23 @@
package de.ellpeck.actuallyadditions.mod;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public class AASounds {
public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, ActuallyAdditions.MODID);
public static RegistryObject<SoundEvent> RECONSTRUCTOR = SOUNDS.register("reconstructor", () -> new SoundEvent(new ResourceLocation(ActuallyAdditions.MODID, "reconstructor")));
public static RegistryObject<SoundEvent> CRUSHER = SOUNDS.register("crusher", () -> new SoundEvent(new ResourceLocation(ActuallyAdditions.MODID, "crusher")));
public static RegistryObject<SoundEvent> COFFEE_MACHINE = SOUNDS.register("coffee_machine", () -> new SoundEvent(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine")));
public static RegistryObject<SoundEvent> DUH_DUH_DUH_DUUUH = SOUNDS.register("duh_duh_duh_duuuh", () -> new SoundEvent(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh")));
public static void init(IEventBus bus) {
SOUNDS.register(bus);
}
}

View file

@ -97,6 +97,7 @@ public class ActuallyAdditions {
ActuallyBlocks.init(eventBus);
ActuallyItems.init(eventBus);
ActuallyRecipes.init(eventBus);
AASounds.init(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus);
eventBus.addListener(this::onConfigReload);

View file

@ -29,6 +29,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
public class ActuallyAdditionsClient {

View file

@ -155,7 +155,6 @@ public final class ActuallyItems {
public static final RegistryObject<Item> DRILL_UPGRADE_THREE_BY_THREE = ITEMS.register("drill_upgrade_three_by_three", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE));
public static final RegistryObject<Item> DRILL_UPGRADE_FIVE_BY_FIVE = ITEMS.register("drill_upgrade_five_by_five", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE));
public static final RegistryObject<Item> DRILL_UPGRADE_BLOCK_PLACING = ITEMS.register("drill_upgrade_block_placing", () -> new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER));
public static final RegistryObject<Item> FERTILIZER = ITEMS.register("fertilizer", ItemFertilizer::new);
public static final RegistryObject<Item> COFFEE = ITEMS.register("coffee", ItemCoffee::new); //TODO flatten
public static final RegistryObject<Item> PHANTOM_CONNECTOR = ITEMS.register("phantom_connector", ItemPhantomConnector::new);
//public static final RegistryObject<Item> FOOD = ITEMS.register("food", ItemBase::new); //just... food? //TODO
@ -202,11 +201,7 @@ public final class ActuallyItems {
DRILL_LIME, DRILL_MAGENTA, DRILL_ORANGE, DRILL_PINK, DRILL_PURPLE, DRILL_RED, DRILL_WHITE, DRILL_YELLOW,
DRILL_UPGRADE_SPEED, DRILL_UPGRADE_SPEED_II, DRILL_UPGRADE_SPEED_III, DRILL_UPGRADE_SILK_TOUCH,
DRILL_UPGRADE_FORTUNE, DRILL_UPGRADE_FORTUNE_II, DRILL_UPGRADE_THREE_BY_THREE, DRILL_UPGRADE_FIVE_BY_FIVE, DRILL_UPGRADE_BLOCK_PLACING,
FERTILIZER, COFFEE_CUP, PHANTOM_CONNECTOR, RICE,
/* FOOD_CHEESE, FOOD_PUMPKIN_STEW, FOOD_CARROT_JUICE, FOOD_FISH_N_CHIPS, FOOD_FRENCH_FRIES, FOOD_FRENCH_FRY,
FOOD_SPAGHETTI, FOOD_NOODLE, FOOD_CHOCOLATE_CAKE, FOOD_CHOCOLATE, FOOD_TOAST, FOOD_SUBMARINE_SANDWICH, FOOD_BIG_COOKIE,
FOOD_HAMBURGER, FOOD_PIZZA, FOOD_BAGUETTE, FOOD_RICE, FOOD_RICE_BREAD, FOOD_DOUGHNUT, FOOD_TOAST_O_CHOCOLATE,
FOOD_BACON,*/
COFFEE_CUP, PHANTOM_CONNECTOR, RICE,
KNIFE, CRAFTER_ON_A_STICK,
/* CRUSHED_IRON, CRUSHED_GOLD, CRUSHED_DIAMOND, CRUSHED_EMERALD, CRUSHED_LAPIS,
CRUSHED_QUARTZ, CRUSHED_COAL, CRUSHED_BLACK_QUARTZ, */

View file

@ -1,40 +0,0 @@
/*
* This file ("SoundHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.misc;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
// TODO: [port] port over to deferred register
public final class SoundHandler {
public static SoundEvent duhDuhDuhDuuuh;
public static SoundEvent coffeeMachine;
public static SoundEvent reconstructor;
public static SoundEvent crusher;
public static void init() {
duhDuhDuhDuuuh = registerSound("duh_duh_duh_duuuh");
coffeeMachine = registerSound("coffee_machine");
reconstructor = registerSound("reconstructor");
crusher = registerSound("crusher");
}
private static SoundEvent registerSound(String name) {
ResourceLocation resLoc = new ResourceLocation(ActuallyAdditions.MODID, name);
SoundEvent event = new SoundEvent(resLoc);
event.setRegistryName(resLoc);
// RegistryHandler.SOUNDS_TO_REGISTER.add(event);
return event;
}
}

View file

@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.mod.AASounds;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
@ -51,7 +51,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
}
public static void shootLaser(IAtomicReconstructor tile, World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens) {
world.playSound(null, startX, startY, startZ, SoundHandler.reconstructor, SoundCategory.BLOCKS, 0.35F, 1.0F);
world.playSound(null, startX, startY, startZ, AASounds.RECONSTRUCTOR.get(), SoundCategory.BLOCKS, 0.35F, 1.0F);
AssetUtil.spawnLaserWithTimeServer(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), 25, 0, 0.2F, 0.8F);
}

View file

@ -12,11 +12,11 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.AASounds;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
@ -179,7 +179,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
if (StackUtil.isValid(input) && input.getItem() == ActuallyItems.COFFEE_CUP.get() && !StackUtil.isValid(this.inv.getStackInSlot(SLOT_OUTPUT)) && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid().getFluid() == Fluids.WATER && this.tank.getFluidAmount() >= WATER_USE) {
if (this.storage.getEnergyStored() >= ENERGY_USED) {
if (this.brewTime % 30 == 0) {
this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.1F, 1.0F);
this.level.playSound(null, this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ(), AASounds.COFFEE_MACHINE.get(), SoundCategory.BLOCKS, 0.1F, 1.0F);
}
this.brewTime++;

View file

@ -10,10 +10,10 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.AASounds;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.CrusherContainer;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
@ -171,7 +171,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
}
if (shouldPlaySound) {
this.level.playSound(null, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.025F, 1.0F);
this.level.playSound(null, this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), AASounds.CRUSHER.get(), SoundCategory.BLOCKS, 0.025F, 1.0F);
}
}
}

View file

@ -1,6 +0,0 @@
{
"duh_duh_duh_duuuh": { "category": "record", "sounds":["actuallyadditions:duh_duh_duh_duuuh"] },
"coffee_machine": { "category": "block", "sounds":["actuallyadditions:coffee_machine"] },
"reconstructor": { "category": "block", "sounds":["actuallyadditions:reconstructor"] },
"crusher": { "category": "block", "sounds":["actuallyadditions:crusher"] }
}