Fixed ladders still making sounds when idling on them and new config to stop fences from connecting

master
Wynd 2024-08-18 18:57:47 +03:00
parent 9e9e91fb01
commit b90a18346d
3 changed files with 8 additions and 1 deletions

View File

@ -22,6 +22,8 @@ public class ModConfig {
"Disables id tags showing above entities in F3 mode"); "Disables id tags showing above entities in F3 mode");
public static final Option<Boolean> FENCE_SLIM_HITBOX = make("Slim Hitbox for Fences", true, public static final Option<Boolean> FENCE_SLIM_HITBOX = make("Slim Hitbox for Fences", true,
"Uses slim hitbox for fences on the X and Z axies (the height of the fence is not changed)"); "Uses slim hitbox for fences on the X and Z axies (the height of the fence is not changed)");
public static final Option<Boolean> FENCE_CONNECT = make("Fence connections", true,
"Visually connects fences with nearby solid blocks");
public static final Option<Boolean> REMOVE_NIGHTMARES = make("Remove Nightmares", false, public static final Option<Boolean> REMOVE_NIGHTMARES = make("Remove Nightmares", false,
"Removes nightmares completely"); "Removes nightmares completely");
public static final Option<Boolean> DISABLE_BEDS = make("Disable Beds", false, public static final Option<Boolean> DISABLE_BEDS = make("Disable Beds", false,

View File

@ -55,7 +55,7 @@ public class LivingEntityMixin {
@Inject(method = "travel", at = @At("HEAD")) @Inject(method = "travel", at = @At("HEAD"))
public void travel(float f, float f1, CallbackInfo ci) { public void travel(float f, float f1, CallbackInfo ci) {
LivingEntity entity = (LivingEntity) (Object) this; LivingEntity entity = (LivingEntity) (Object) this;
if (ModConfig.ADD_MORE_SOUNDS.get() && entity.isOnLadder() && entity.velocityY != 0 && entity.field_1645 % 20 == 0 && !entity.onGround) { if (ModConfig.ADD_MORE_SOUNDS.get() && entity.isOnLadder() && (entity.velocityY > 0.1 || entity.velocityY < -0.1) && entity.field_1645 % 15 == 0 && !entity.onGround) {
float pitch = WyHelper.clamp(0.85f + entity.level.rand.nextFloat() / 2, 0.0f, 1.0f); float pitch = WyHelper.clamp(0.85f + entity.level.rand.nextFloat() / 2, 0.0f, 1.0f);
entity.level.playSound(entity.x, entity.y, entity.z, "sound3.step.ladder", 0.3f, pitch); entity.level.playSound(entity.x, entity.y, entity.z, "sound3.step.ladder", 0.3f, pitch);
} }

View File

@ -13,6 +13,7 @@ import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.TileRenderer; import net.minecraft.client.render.TileRenderer;
import net.minecraft.level.TileView; import net.minecraft.level.TileView;
import net.minecraft.tile.Tile; import net.minecraft.tile.Tile;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(TileRenderer.class) @Mixin(TileRenderer.class)
public class TileRendererMixin { public class TileRendererMixin {
@ -26,6 +27,10 @@ public class TileRendererMixin {
// Fence renderer to handle it connecting with other non-fence blocks // Fence renderer to handle it connecting with other non-fence blocks
@Inject(method = "method_78", at = @At("HEAD"), cancellable = true) @Inject(method = "method_78", at = @At("HEAD"), cancellable = true)
public void fenceRenderer(Tile tile, int x, int y, int z, CallbackInfoReturnable<Boolean> cir) { public void fenceRenderer(Tile tile, int x, int y, int z, CallbackInfoReturnable<Boolean> cir) {
if (!ModConfig.FENCE_CONNECT.get()) {
return;
}
TileRenderer renderer = (TileRenderer) (Object) this; TileRenderer renderer = (TileRenderer) (Object) this;
int var5 = 0; int var5 = 0;