Allow max 1 crafting sound every 10 ticks to prevent rare crashes.
This commit is contained in:
parent
8c1550e5c2
commit
16f03e76e8
2 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,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";
|
||||||
|
@ -1186,10 +1187,12 @@ 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;
|
||||||
}
|
}
|
||||||
if (this.isFirstServerWorldTick) {
|
if (this.isFirstServerWorldTick) {
|
||||||
File tSaveDiretory = getSaveDirectory();
|
File tSaveDiretory = getSaveDirectory();
|
||||||
if (tSaveDiretory != null) {
|
if (tSaveDiretory != null) {
|
||||||
|
|
Loading…
Reference in a new issue