Fix random sound bug

This commit is contained in:
Blood-Asp 2016-10-26 20:34:04 +02:00 committed by Technus
parent 13c99700cf
commit c30e62421f
2 changed files with 12 additions and 3 deletions

View file

@ -6,6 +6,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.api.tool.ITool; import crazypants.enderio.api.tool.ITool;
import forestry.api.arboriculture.IToolGrafter; import forestry.api.arboriculture.IToolGrafter;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enchants.Enchantment_Radioactivity; import gregtech.api.enchants.Enchantment_Radioactivity;
import gregtech.api.enums.Materials; import gregtech.api.enums.Materials;
@ -16,6 +17,7 @@ import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Proxy;
import mods.railcraft.api.core.items.IToolCrowbar; import mods.railcraft.api.core.items.IToolCrowbar;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -476,7 +478,8 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
if (tStats == null) return null; if (tStats == null) return null;
doDamage(aStack, tStats.getToolDamagePerContainerCraft()); doDamage(aStack, tStats.getToolDamagePerContainerCraft());
aStack = aStack.stackSize > 0 ? aStack : null; aStack = aStack.stackSize > 0 ? aStack : null;
if (playSound) { if (playSound && GT_Mod.gregtechproxy.mTicksUntilNextCraftSound <= 0) {
GT_Mod.gregtechproxy.mTicksUntilNextCraftSound = 10;
String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound(); String sound = (aStack == null) ? tStats.getBreakingSound() : tStats.getCraftingSound();
GT_Utility.doSoundAtClient(sound, 1, 1.0F); GT_Utility.doSoundAtClient(sound, 1, 1.0F);
} }

View file

@ -149,6 +149,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mAE2Integration = true; public boolean mAE2Integration = true;
//public boolean mArcSmeltIntoAnnealed = true; //public boolean mArcSmeltIntoAnnealed = true;
//public boolean mMagneticraftRecipes = true; //public boolean mMagneticraftRecipes = true;
//public boolean mImmersiveEngineeringRecipes = true;
private boolean isFirstServerWorldTick = true; private boolean isFirstServerWorldTick = true;
private boolean mOreDictActivated = false; private boolean mOreDictActivated = false;
public boolean mChangeHarvestLevels=false; public boolean mChangeHarvestLevels=false;
@ -172,6 +173,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public int mPollutionPoisonLimit = 750000; public int mPollutionPoisonLimit = 750000;
public int mPollutionVegetationLimit = 1000000; public int mPollutionVegetationLimit = 1000000;
public int mPollutionSourRainLimit = 2000000; public int mPollutionSourRainLimit = 2000000;
public int mTicksUntilNextCraftSound = 0;
//public double mMagneticraftBonusOutputPercent = 100.0d; //public double mMagneticraftBonusOutputPercent = 100.0d;
private World mUniverse = null; private World mUniverse = null;
private final String aTextThermalExpansion = "ThermalExpansion"; private final String aTextThermalExpansion = "ThermalExpansion";
@ -179,6 +181,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
private final String aTextTwilightForest = "TwilightForest"; private final String aTextTwilightForest = "TwilightForest";
private final String aTextForestry = "Forestry"; private final String aTextForestry = "Forestry";
private final String aTextArsmagica2 = "arsmagica2"; private final String aTextArsmagica2 = "arsmagica2";
//public boolean mTEMachineRecipes = false;
//public boolean mEnableAllMaterials = false;
//public boolean mEnableAllComponents = false;
public GT_Proxy() { public GT_Proxy() {
GameRegistry.registerFuelHandler(this); GameRegistry.registerFuelHandler(this);
@ -695,7 +700,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
'X', OrePrefixes.crushed.get(aMaterial)}); 'X', OrePrefixes.crushed.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial.mMacerateInto, 1L), tBits, new Object[]{"h", "X", GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustImpure, aMaterial.mMacerateInto, 1L), tBits, new Object[]{"h", "X",
'X', OrePrefixes.dirtyGravel.get(aMaterial)}); 'X', OrePrefixes.dirtyGravel.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 4L), tBits, GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 4L), tBits,
new Object[]{" X", " ", 'X', OrePrefixes.dust.get(aMaterial)}); new Object[]{" X", " ", 'X', OrePrefixes.dust.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustTiny, aMaterial, 9L), tBits, GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustTiny, aMaterial, 9L), tBits,
@ -1391,6 +1395,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
@SubscribeEvent @SubscribeEvent
public void onWorldTickEvent(TickEvent.WorldTickEvent aEvent) { public void onWorldTickEvent(TickEvent.WorldTickEvent aEvent) {
if(aEvent.world.provider.dimensionId == 0)
mTicksUntilNextCraftSound--;
if (aEvent.side.isServer()) { if (aEvent.side.isServer()) {
if (this.mUniverse == null) { if (this.mUniverse == null) {
this.mUniverse = aEvent.world; this.mUniverse = aEvent.world;
@ -1435,7 +1441,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
} }
} }
if(aEvent.world.provider.dimensionId==0) if(aEvent.world.provider.dimensionId==0)
GT_Pollution.onWorldTick(aEvent.world, (int) (aEvent.world.getTotalWorldTime() % 1000)); GT_Pollution.onWorldTick(aEvent.world, (int) (aEvent.world.getTotalWorldTime() % 1200));
} }
} }