Thru the name can some make me a custom mod for fabric for 1.20.5 or 1.20.6 that lets you if u grow with the attribute generic.scale command to size 5 till 16 it will use a custom sound if you walk like a giant footsteps sounds then Minecraft walking sounds but the custom sounds is on the resource pack so the mod and resource pack works together
#Generic.scale custom walking sound
9 messages · Page 1 of 1 (latest)
I used this code but it doesn't work it was generated from chatgpt
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
public class GiantWalkingSoundMod implements ModInitializer {
@Override
public void onInitialize() {
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
server.getPlayerManager().getPlayerList().forEach(player -> {
player.getAttributeInstance(EntityAttributes.GENERIC_SCALE).setOnAttributeModifiedCallback((attribute, value) -> {
double size = player.getAttributeInstance(EntityAttributes.GENERIC_SCALE).getValue();
// Check if the player's size is within the specified range
if (size >= 5.0 && size <= 16.0) {
// Check if the player is moving
if (player.horizontalSpeed > 0) {
// Play custom sound
playCustomSound(player, CustomSoundEvents.GIANT_WALKING);
}
}
return value;
});
});
});
}
private void playCustomSound(ServerPlayerEntity player, SoundEvent soundEvent) {
player.playSound(soundEvent, 1.0f, 1.0f);
}
// Define custom sound event
public static class CustomSoundEvents {
// Ensure these identifiers match the sounds in your resource pack
public static final SoundEvent GIANT_WALKING = register("yourmodid:giant_walking");
private static SoundEvent register(String name) {
return new SoundEvent(new Identifier(name));
}
}
}
With this resource pack
ChatGPT = bad for modding
In general LLM = bad for writing code
Also, what is the resource pack for
For my server