mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Add config options, remove debug prints
This commit is contained in:
1 parent
fa5c4c0218
commit
93aa429cf2
3 files changed
+67
-47
No files matched your search
@@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
@@ -44,9 +45,6 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
private long savedTick = 0;
|
||||
private long savedSystemTimeExpiration = 0;
|
||||
|
||||
// Maximum crafting time of 750ms before ejecting out and stop hard-locking the server
|
||||
static long WORKTABLE_MAX_CRAFT_TIME = 750 * 1000 * 1000;
|
||||
|
||||
public TileWorktable() {
|
||||
super("worktable");
|
||||
setInternalInventory(new InventoryWorktable(this));
|
||||
@@ -126,18 +124,20 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
return false;
|
||||
}
|
||||
|
||||
long currentTick = worldObj.getTotalWorldTime();
|
||||
if (currentTick == savedTick){
|
||||
// Processing in the same tick, second call, check expiration timer
|
||||
long currentTime = System.nanoTime();
|
||||
if(currentTime > savedSystemTimeExpiration) {
|
||||
// Time to craft has expired, stop crafting loop
|
||||
return false;
|
||||
if( Config.enableCraftingTimeout ) {
|
||||
long currentTick = worldObj.getTotalWorldTime();
|
||||
if (currentTick == savedTick){
|
||||
// Processing in the same tick, second call, check expiration timer
|
||||
long currentTime = System.nanoTime();
|
||||
if(currentTime > savedSystemTimeExpiration) {
|
||||
// Time to craft has expired, stop crafting loop
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// New tick has arrived, so reset timer data
|
||||
savedTick=currentTick;
|
||||
savedSystemTimeExpiration = System.nanoTime() + Config.craftingTimeout * 1000000;
|
||||
}
|
||||
} else {
|
||||
// New tick has arrived, so reset timer data
|
||||
savedTick=currentTick;
|
||||
savedSystemTimeExpiration = System.nanoTime() + WORKTABLE_MAX_CRAFT_TIME;
|
||||
}
|
||||
|
||||
ItemStack[] recipeItems = InventoryUtil.getStacks(currentRecipe.getCraftMatrix());
|
||||
|
||||
Reference in new issue
Block a user