Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Sound on cooling
  • Loading branch information
CtrlAltDavid01 committed Jun 30, 2019
1 parent c64bfae commit 967774a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/net/dries007/tfc/objects/te/TEBarrel.java
Expand Up @@ -10,12 +10,14 @@
import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.block.state.IBlockState;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.*;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
Expand Down Expand Up @@ -295,6 +297,8 @@ public void setAndUpdateSlots(int slot)
super.setAndUpdateSlots(slot);
}

long soundLastPlayed = 0L;

private boolean coolDownItemRecipe(ItemStack inputStack, FluidStack inputFluid)
{
IItemHeat heat = inputStack.getCapability(CapabilityItemHeat.ITEM_HEAT_CAPABILITY, null);
Expand All @@ -312,6 +316,12 @@ private boolean coolDownItemRecipe(ItemStack inputStack, FluidStack inputFluid)
heat.setTemperature(0);
}

if (world.getTotalWorldTime() - soundLastPlayed >= 3)
{
world.playSound(null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f);
soundLastPlayed = world.getTotalWorldTime();
}

IBlockState state = world.getBlockState(pos);
world.notifyBlockUpdate(pos, state, state, 3);
return true;
Expand Down

0 comments on commit 967774a

Please sign in to comment.