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");
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)");
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,
"Removes nightmares completely");
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"))
public void travel(float f, float f1, CallbackInfo ci) {
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);
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.level.TileView;
import net.minecraft.tile.Tile;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(TileRenderer.class)
public class TileRendererMixin {
@ -26,6 +27,10 @@ public class TileRendererMixin {
// Fence renderer to handle it connecting with other non-fence blocks
@Inject(method = "method_78", at = @At("HEAD"), cancellable = true)
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;
int var5 = 0;