Added random sfx for lava pools and furnaces while they're cookin
parent
e117a7e25c
commit
c092414565
|
@ -115,7 +115,7 @@ public class WyHelper {
|
||||||
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
|
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
|
||||||
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
|
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
|
||||||
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
|
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
|
||||||
player.dropItem(new ItemInstance(ItemType.flintAndSteel, 1));
|
player.dropItem(new ItemInstance(ItemType.bucket, 1));
|
||||||
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
|
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
|
||||||
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
|
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,20 @@ public class FurnaceEntityMixin {
|
||||||
@Shadow
|
@Shadow
|
||||||
private ItemInstance[] contents;
|
private ItemInstance[] contents;
|
||||||
|
|
||||||
|
private int nextRandomTick = 20;
|
||||||
|
|
||||||
|
@Inject(method = "tick", at = @At("HEAD"))
|
||||||
|
public void tickHead(CallbackInfo ci) {
|
||||||
|
FurnaceEntity tileEntity = ((FurnaceEntity)(Object)this);
|
||||||
|
if (ModConfig.ADD_MORE_SOUNDS.get() && tileEntity.cookTime > 0) {
|
||||||
|
if (tileEntity.level.getLevelTime() % this.nextRandomTick == 0) {
|
||||||
|
float pitch = 0.5f + tileEntity.level.rand.nextFloat() / 1.5f;
|
||||||
|
tileEntity.level.playSound(tileEntity.x, tileEntity.y, tileEntity.z, "sound3.liquid.lavapop", 0.4f, pitch);
|
||||||
|
this.nextRandomTick = 20 + tileEntity.level.rand.nextInt(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/FurnaceEntity;getFuelTime(Lnet/minecraft/item/ItemInstance;)I", shift = At.Shift.BY, by = 5), cancellable = true)
|
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/FurnaceEntity;getFuelTime(Lnet/minecraft/item/ItemInstance;)I", shift = At.Shift.BY, by = 5), cancellable = true)
|
||||||
public void tick(CallbackInfo ci) {
|
public void tick(CallbackInfo ci) {
|
||||||
if(ModConfig.FIX_FURNACE_LAVA_BUCKET.get()) {
|
if(ModConfig.FIX_FURNACE_LAVA_BUCKET.get()) {
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package xyz.pixelatedw.finalbeta.mixin;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.level.Level;
|
||||||
|
import net.minecraft.tile.StillFluidTile;
|
||||||
|
import net.minecraft.tile.material.Material;
|
||||||
|
|
||||||
|
@Mixin(StillFluidTile.class)
|
||||||
|
public class StillFluidTileMixin {
|
||||||
|
@Inject(method = "onScheduledTick", at = @At("HEAD"))
|
||||||
|
public void onScheduledTick(Level level, int x, int y, int z, Random random, CallbackInfo ci) {
|
||||||
|
StillFluidTile tile = ((StillFluidTile) (Object) this);
|
||||||
|
if (tile.material == Material.LAVA) {
|
||||||
|
if (level.rand.nextBoolean()) {
|
||||||
|
level.playSound(x, y, z, "sound3.liquid.lava", 0.5f, 1.0f);
|
||||||
|
} else {
|
||||||
|
level.playSound(x, y, z, "sound3.liquid.lavapop", 0.5f, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,7 +48,8 @@
|
||||||
"FoodItemMixin",
|
"FoodItemMixin",
|
||||||
"ItemTypeAccessor",
|
"ItemTypeAccessor",
|
||||||
"PressurePlateTileMixin",
|
"PressurePlateTileMixin",
|
||||||
"LeavesTileMixin"
|
"LeavesTileMixin",
|
||||||
|
"StillFluidTileMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": -1
|
"defaultRequire": -1
|
||||||
|
|
Loading…
Reference in New Issue