Skip to content

Commit

Permalink
1.21.1 -> 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Nov 21, 2024
1 parent c725f79 commit 37f6d44
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 42 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ reckon {
}

repositories {
flatDir { dirs 'lib' }
maven { name 'pehkui'; url 'https://jitpack.io' }
maven { name 'modmenu'; url 'https://maven.terraformersmc.com/releases' }
maven { name 'minelp'; url 'https://repo.minelittlepony-mod.com/maven/snapshot' }
Expand All @@ -57,7 +58,11 @@ dependencies {
modApi "com.minelittlepony:kirin:${project.kirin_version}"
include "com.minelittlepony:kirin:${project.kirin_version}"

modCompileOnly "com.minelittlepony:minelittlepony:${project.minelp_version}"
if (project.use_minelp == '1') {
modCompileOnly "com.minelittlepony:minelittlepony:${project.minelp_version}"
} else {
modCompileOnly "com.minelittlepony:minelittlepony-dummy:${project.minelp_version}"
}
modCompileOnly("com.terraformersmc:modmenu:${project.modmenu_version}")

// modImplementation "com.github.Virtuoel:Pehkui:${project.pehkui_version}"
Expand Down
19 changes: 11 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.daemon=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.4
fabric_version=0.102.0+1.21.1
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.8
fabric_version=0.106.1+1.21.3

# Mod Properties
group=com.presencefootsteps
Expand All @@ -16,12 +16,15 @@ org.gradle.daemon=false
url=http://presencefootsteps.ha3.eu

# Publishing
minecraft_version_range=>=1.21
minecraft_version_range=>=1.21.3
modrinth_loader_type=fabric
modrinth_project_id=rcTfTZr3

# Testing
use_minelp=0

# Dependencies
modmenu_version=11.0.0-beta.1
minelp_version=4.12.0+1.21
kirin_version=1.20.0+1.21
modmenu_version=12.0.0-beta.1
minelp_version=4.12.1+1.21
kirin_version=1.20.1+1.21.3
pehkui_version=3.7.2
Binary file added lib/minelittlepony-dummy-4.12.1+1.21.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/eu/ha3/presencefootsteps/PFDebugHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void render(HitResult blockHit, HitResult fluidHit, List<String> finalLis
}
list.add(String.format(Locale.ENGLISH, "Primitive Key: %s", PrimitiveLookup.getKey(state.getSoundGroup())));
BlockPos above = pos.up();
boolean hasRain = client.world.isRaining() && client.world.getBiome(above).value().getPrecipitation(above) == Biome.Precipitation.RAIN;
boolean hasRain = client.world.isRaining() && client.world.getBiome(above).value().getPrecipitation(above, client.world.getSeaLevel()) == Biome.Precipitation.RAIN;
boolean hasLava = client.world.getBlockState(above).getFluidState().isIn(FluidTags.LAVA);
boolean hasWater = client.world.hasRain(above)
|| state.getFluidState().isIn(FluidTags.WATER)
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/eu/ha3/presencefootsteps/sound/SoundEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import org.jetbrains.annotations.Nullable;

import com.mojang.datafixers.util.Unit;

import eu.ha3.presencefootsteps.PFConfig;
import eu.ha3.presencefootsteps.PresenceFootsteps;
import eu.ha3.presencefootsteps.sound.player.ImmediateSoundPlayer;
Expand Down Expand Up @@ -39,6 +41,7 @@
import net.minecraft.util.crash.CrashReport;
import net.minecraft.util.crash.CrashReportSection;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.util.profiler.Profilers;

public class SoundEngine implements IdentifiableResourceReloadListener {
private static final Identifier ID = PresenceFootsteps.id("sounds");
Expand Down Expand Up @@ -170,10 +173,10 @@ public void onFrame(MinecraftClient client, Entity cameraEntity) {

public boolean onSoundRecieved(@Nullable RegistryEntry<SoundEvent> event, SoundCategory category) {
return event != null && isRunning(MinecraftClient.getInstance()) && event.getKeyOrValue().right().filter(sound -> {
return event == SoundEvents.ENTITY_PLAYER_SWIM
|| event == SoundEvents.ENTITY_PLAYER_SPLASH
|| event == SoundEvents.ENTITY_PLAYER_BIG_FALL
|| event == SoundEvents.ENTITY_PLAYER_SMALL_FALL;
return sound == SoundEvents.ENTITY_PLAYER_SWIM
|| sound == SoundEvents.ENTITY_PLAYER_SPLASH
|| sound == SoundEvents.ENTITY_PLAYER_BIG_FALL
|| sound == SoundEvents.ENTITY_PLAYER_SMALL_FALL;
}).isPresent();
}

Expand All @@ -183,15 +186,12 @@ public Identifier getFabricId() {
}

@Override
public CompletableFuture<Void> reload(Synchronizer sync, ResourceManager sender,
Profiler serverProfiler, Profiler clientProfiler,
Executor serverExecutor, Executor clientExecutor) {
return sync.whenPrepared(null).thenRunAsync(() -> {
clientProfiler.startTick();
clientProfiler.push("Reloading PF Sounds");
public CompletableFuture<Void> reload(Synchronizer sync, ResourceManager sender, Executor serverExecutor, Executor clientExecutor) {
return sync.whenPrepared(Unit.INSTANCE).thenRunAsync(() -> {
Profiler profiler = Profilers.get();
profiler.push("Reloading PF Sounds");
reloadEverything(sender);
clientProfiler.pop();
clientProfiler.endTick();
profiler.pop();
}, clientExecutor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void playStep(Association association, State event, Options options) {
}

soundPlayer.playSound(association.source(),
soundType.getStepSound().getId().toString(),
soundType.getStepSound().id().toString(),
soundType.getVolume() * 0.15F,
soundType.getPitch(),
options
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package eu.ha3.presencefootsteps.sound.generator;

import net.minecraft.client.network.OtherClientPlayerEntity;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.EquippableComponent;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.AbstractHorseEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.util.math.BlockPos;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -329,8 +330,10 @@ private void simulateBrushes() {

protected void playStep(Association association, State eventType) {
if (engine.getConfig().getEnabledFootwear()) {
if (entity.getEquippedStack(EquipmentSlot.FEET).getItem() instanceof ArmorItem bootItem) {
SoundsKey bootSound = engine.getIsolator().primitives().getAssociation(bootItem.getEquipSound().value(), Substrates.DEFAULT);

EquippableComponent equipable = entity.getEquippedStack(EquipmentSlot.FEET).get(DataComponentTypes.EQUIPPABLE);
if (equipable != null) {
SoundsKey bootSound = engine.getIsolator().primitives().getAssociation(equipable.equipSound().value(), Substrates.DEFAULT);
if (bootSound.isEmitter()) {
engine.getIsolator().acoustics().playStep(association, eventType, Options.singular("volume_percentage", 0.5F));
engine.getIsolator().acoustics().playAcoustic(entity, bootSound, eventType, Options.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package eu.ha3.presencefootsteps.world;

import java.util.Arrays;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Stream;

import org.jetbrains.annotations.Nullable;

Expand All @@ -13,16 +15,10 @@

public class HeuristicStateLookup {
private final Function<Block, Optional<Block>> leafBlockCache = Util.memoize(block -> {
String id = Registries.BLOCK.getId(block).getPath();

for (String part : id.split("_")) {
Optional<Block> leavesBlock = Registries.BLOCK.getOrEmpty(Identifier.of(part + "_leaves"));
if (leavesBlock.isPresent()) {
return leavesBlock;
}
}

return Optional.empty();
return Stream.of(Registries.BLOCK.getId(block).getPath())
.flatMap(id -> Arrays.stream(id.split("_")))
.flatMap(part -> Registries.BLOCK.getOptionalValue(Identifier.of(part + "_leaves")).stream())
.findFirst();
});

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.registry.Registries;
import net.minecraft.sound.BlockSoundGroup;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void writeToReport(boolean full, JsonObjectWriter writer, Map<String, Blo
writer.each(Registries.ENTITY_TYPE, type -> {
Identifier id = EntityType.getId(type);
if (full || !contains(id)) {
if (type.create(MinecraftClient.getInstance().world) instanceof LivingEntity) {
if (type.create(MinecraftClient.getInstance().world, SpawnReason.CHUNK_GENERATION) instanceof LivingEntity) {
writer.field(id.toString(), values.getOrDefault(id, Locomotion.NONE).name());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class PrimitiveLookup extends AbstractSubstrateLookup<SoundEvent> {
@Override
protected Identifier getId(SoundEvent key) {
return key.getId();
return key.id();
}

@Override
Expand All @@ -29,6 +29,6 @@ public static String getSubstrate(BlockSoundGroup group) {
}

public static String getKey(BlockSoundGroup group) {
return group.getStepSound().getId().toString() + "@" + getSubstrate(group);
return group.getStepSound().id().toString() + "@" + getSubstrate(group);
}
}
6 changes: 3 additions & 3 deletions src/main/java/eu/ha3/presencefootsteps/world/StateLookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void writeToReport(boolean full, JsonObjectWriter writer, Map<String, Blo
var group = block.getDefaultState().getSoundGroup();
if (group != null && group.getStepSound() != null) {
String substrate = String.format(Locale.ENGLISH, "%.2f_%.2f", group.volume, group.pitch);
groups.put(group.getStepSound().getId().toString() + "@" + substrate, group);
groups.put(group.getStepSound().id().toString() + "@" + substrate, group);
}

if (full || !contains(state)) {
Expand Down Expand Up @@ -104,7 +104,7 @@ private String getSoundData(@Nullable BlockSoundGroup group) {
if (group.getStepSound() == null) {
return "NO_SOUND";
}
return group.getStepSound().getId().getPath();
return group.getStepSound().id().getPath();
}

private String getClassData(BlockState state) {
Expand All @@ -123,7 +123,7 @@ private String getClassData(BlockState state) {
}

private String getTagData(BlockState state) {
return Registries.BLOCK.streamTags().filter(state::isIn).map(TagKey::id).map(Identifier::toString).collect(Collectors.joining(","));
return state.getRegistryEntry().streamTags().map(TagKey::id).map(Identifier::toString).collect(Collectors.joining(","));
}

private interface Bucket {
Expand Down

0 comments on commit 37f6d44

Please sign in to comment.