mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-29 00:09:17 +00:00
Cache the Auto Chisel target when using a reversion upgrade
This commit is contained in:
1 parent
db2d2622e1
commit
66789b3476
1 file changed
+10
-6
@@ -85,7 +85,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
// Crafting caches to avoid creating a new ItemStack result each tick
|
||||
private ItemStack baseCache = null;
|
||||
private ItemStack targetCache = null;
|
||||
private ItemStack resultCache;
|
||||
private ItemStack reversionTargetCache = null;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
@@ -221,13 +221,17 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
private ItemStack getTarget() {
|
||||
// If we have a reversion upgrade, use that for the target
|
||||
if (inventory[BASE] != null && hasUpgrade(Upgrade.REVERSION)) {
|
||||
// if we have a reversion upgrade, use that for the target
|
||||
List<ItemStack> possible = Carving.chisel.getItemsForChiseling(inventory[BASE]);
|
||||
return possible.isEmpty() ? null : possible.get(0);
|
||||
} else {
|
||||
return inventory[TARGET];
|
||||
if (reversionTargetCache == null) {
|
||||
List<ItemStack> possible = Carving.chisel.getItemsForChiseling(inventory[BASE]);
|
||||
reversionTargetCache = possible == null || possible.isEmpty() ? null : possible.get(0);
|
||||
}
|
||||
return reversionTargetCache;
|
||||
}
|
||||
|
||||
reversionTargetCache = null;
|
||||
return inventory[TARGET];
|
||||
}
|
||||
|
||||
private boolean canChisel(ItemStack toMerge) {
|
||||
|
||||
Reference in new issue
Block a user