diff --git a/build.gradle b/build.gradle index 1d04fb7d7..306d8a9dc 100644 --- a/build.gradle +++ b/build.gradle @@ -42,6 +42,7 @@ minecraft { client { workingDirectory project.file('run') arg '-mixin.config=create.mixins.json' + arg '-mixin.config=flywheel.mixins.json' //jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling property 'forge.logging.console.level', 'info' property 'mixin.env.remapRefMap', 'true' diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 16eaa7f7e..4322966b6 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -1743,7 +1743,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear 866fbb0ce2878a73e0440d1caf6534c8bd7c384f assets/create/models/item/zinc_ingot.json a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json -54d925b1465d16d5b8f7af90cf266f78f5d34fa3 assets/create/sounds.json +5049f72c327a88f175f6f9425909e098fc711100 assets/create/sounds.json 0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json 613e64b44bed959da899fdd54c1cacb227fb33f2 data/create/advancements/andesite_alloy.json 81885c6bfb85792c88aaa7c9b70f58832945d31f data/create/advancements/andesite_casing.json diff --git a/src/generated/resources/assets/create/sounds.json b/src/generated/resources/assets/create/sounds.json index bfc8b3624..c755c2668 100644 --- a/src/generated/resources/assets/create/sounds.json +++ b/src/generated/resources/assets/create/sounds.json @@ -300,7 +300,8 @@ }, "sanding_short": { "sounds": [ - "create:sanding_short" + "create:sanding_short", + "create:sanding_short_1" ], "subtitle": "create.subtitle.sanding_short" }, diff --git a/src/main/java/com/simibubi/create/AllSoundEvents.java b/src/main/java/com/simibubi/create/AllSoundEvents.java index 67c5e5704..354d3f5f8 100644 --- a/src/main/java/com/simibubi/create/AllSoundEvents.java +++ b/src/main/java/com/simibubi/create/AllSoundEvents.java @@ -165,6 +165,7 @@ public class AllSoundEvents { .build(), SANDING_SHORT = create("sanding_short").subtitle("Sanding noises") + .addVariant("sanding_short_1") .category(SoundSource.BLOCKS) .build(), @@ -206,17 +207,17 @@ public class AllSoundEvents { .playExisting(SoundEvents.NETHERRACK_HIT) .category(SoundSource.BLOCKS) .build(), - + CRUSHING_2 = create("crushing_2").noSubtitle() .playExisting(SoundEvents.GRAVEL_PLACE) .category(SoundSource.BLOCKS) .build(), - + CRUSHING_3 = create("crushing_3").noSubtitle() .playExisting(SoundEvents.NETHERITE_BLOCK_BREAK) .category(SoundSource.BLOCKS) .build(), - + PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls") .playExisting(SoundEvents.BELL_BLOCK) .category(SoundSource.BLOCKS) @@ -319,10 +320,14 @@ public class AllSoundEvents { protected String subtitle = "unregistered"; protected SoundSource category = SoundSource.BLOCKS; protected List>> wrappedEvents; + protected List variants; public SoundEntryBuilder(ResourceLocation id) { wrappedEvents = new ArrayList<>(); + variants = new ArrayList<>(); this.id = id; + + variants.add(id); } public SoundEntryBuilder subtitle(String subtitle) { @@ -340,6 +345,15 @@ public class AllSoundEvents { return this; } + public SoundEntryBuilder addVariant(String name) { + return addVariant(Create.asResource(name)); + } + + public SoundEntryBuilder addVariant(ResourceLocation id) { + variants.add(id); + return this; + } + public SoundEntryBuilder playExisting(SoundEvent event, float volume, float pitch) { wrappedEvents.add(Pair.of(event, Couple.create(volume, pitch))); return this; @@ -350,8 +364,8 @@ public class AllSoundEvents { } public SoundEntry build() { - SoundEntry entry = wrappedEvents.isEmpty() ? new CustomSoundEntry(id, subtitle, category) - : new WrappedSoundEntry(id, subtitle, wrappedEvents, category); + SoundEntry entry = wrappedEvents.isEmpty() ? new CustomSoundEntry(id, variants, subtitle, category) + : new WrappedSoundEntry(id, variants, subtitle, wrappedEvents, category); entries.put(entry.getId(), entry); return entry; } @@ -361,11 +375,13 @@ public class AllSoundEvents { public static abstract class SoundEntry { protected ResourceLocation id; + protected List variants; protected String subtitle; protected SoundSource category; - public SoundEntry(ResourceLocation id, String subtitle, SoundSource category) { + public SoundEntry(ResourceLocation id, List variants, String subtitle, SoundSource category) { this.id = id; + this.variants = variants; this.subtitle = subtitle; this.category = category; } @@ -385,7 +401,11 @@ public class AllSoundEvents { public ResourceLocation getId() { return id; } - + + public List getVariants() { + return variants; + } + public boolean hasSubtitle() { return subtitle != null; } @@ -416,7 +436,7 @@ public class AllSoundEvents { } public void play(Level world, Player entity, Vec3i pos, float volume, float pitch) { - play(world, entity, pos.getX(), pos.getY(), pos.getZ(), volume, pitch); + play(world, entity, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, volume, pitch); } public void play(Level world, Player entity, Vec3 pos, float volume, float pitch) { @@ -442,9 +462,9 @@ public class AllSoundEvents { private List>> wrappedEvents; private List>> compiledEvents; - public WrappedSoundEntry(ResourceLocation id, String subtitle, List>> wrappedEvents, + public WrappedSoundEntry(ResourceLocation id, List variants, String subtitle, List>> wrappedEvents, SoundSource category) { - super(id, subtitle, category); + super(id, variants, subtitle, category); this.wrappedEvents = wrappedEvents; compiledEvents = Lists.newArrayList(); } @@ -517,8 +537,8 @@ public class AllSoundEvents { protected SoundEvent event; - public CustomSoundEntry(ResourceLocation id, String subtitle, SoundSource category) { - super(id, subtitle, category); + public CustomSoundEntry(ResourceLocation id, List variants, String subtitle, SoundSource category) { + super(id, variants, subtitle, category); } @Override @@ -540,7 +560,11 @@ public class AllSoundEvents { public void write(JsonObject json) { JsonObject entry = new JsonObject(); JsonArray list = new JsonArray(); - list.add(id.toString()); + + for (ResourceLocation variant : variants) { + list.add(variant.toString()); + } + entry.add("sounds", list); entry.addProperty("subtitle", getSubtitleKey()); json.add(id.getPath(), entry); diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java index 98a645530..0476b5459 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java @@ -175,12 +175,12 @@ public class SandPaperItem extends Item { BlockState newState = state.getToolModifiedState(level, pos, player, stack, ToolActions.AXE_SCRAPE); if (newState != null) { - AllSoundEvents.SANDING_LONG.play(level, player, pos); + AllSoundEvents.SANDING_LONG.play(level, player, pos, 1, 1 + (level.random.nextFloat() * 0.5f - 1f) / 5f); level.levelEvent(player, 3005, pos, 0); // Spawn particles } else { newState = state.getToolModifiedState(level, pos, player, stack, ToolActions.AXE_WAX_OFF); if (newState != null) { - AllSoundEvents.SANDING_LONG.play(level, player, pos); + AllSoundEvents.SANDING_LONG.play(level, player, pos, 1, 1 + (level.random.nextFloat() * 0.5f - 1f) / 5f); level.levelEvent(player, 3004, pos, 0); // Spawn particles } } diff --git a/src/main/resources/assets/create/sounds/sanding_short.ogg b/src/main/resources/assets/create/sounds/sanding_short.ogg index 87030f238..ea090aa76 100644 Binary files a/src/main/resources/assets/create/sounds/sanding_short.ogg and b/src/main/resources/assets/create/sounds/sanding_short.ogg differ diff --git a/src/main/resources/assets/create/sounds/sanding_short_1.ogg b/src/main/resources/assets/create/sounds/sanding_short_1.ogg new file mode 100644 index 000000000..7f1884249 Binary files /dev/null and b/src/main/resources/assets/create/sounds/sanding_short_1.ogg differ