Fix container item crafting (again)
avoid making some copies fix crash without JEI
This commit is contained in:
@@ -33,6 +33,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import appeng.container.slot.*;
|
||||
import appeng.util.Platform;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -159,7 +160,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
|
||||
final List<Slot> slots = this.getInventorySlots();
|
||||
final Iterator<Slot> i = slots.iterator();
|
||||
while( i.hasNext() )
|
||||
while ( i.hasNext() )
|
||||
{
|
||||
if( i.next() instanceof SlotME )
|
||||
{
|
||||
@@ -208,13 +209,17 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
}
|
||||
}
|
||||
GlStateManager.enableDepth();
|
||||
bookmarkedJEIghostItem(mouseX,mouseY);
|
||||
if( Platform.isModLoaded( "jei" ) )
|
||||
{
|
||||
bookmarkedJEIghostItem( mouseX, mouseY );
|
||||
}
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
|
||||
void bookmarkedJEIghostItem(final int mouseX, final int mouseY) {
|
||||
|
||||
if (!isJeiGhostItem)
|
||||
@Optional.Method( modid = "jei" )
|
||||
void bookmarkedJEIghostItem( final int mouseX, final int mouseY )
|
||||
{
|
||||
if( !isJeiGhostItem )
|
||||
{
|
||||
bookmarkedIngredient = runtime.getBookmarkOverlay().getIngredientUnderMouse();
|
||||
}
|
||||
@@ -248,7 +253,9 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
}
|
||||
}
|
||||
}
|
||||
private void drawTargets(int mouseX, int mouseY) {
|
||||
|
||||
private void drawTargets( int mouseX, int mouseY )
|
||||
{
|
||||
GlStateManager.disableLighting();
|
||||
for( IGhostIngredientHandler.Target target : hoveredIngredientTargets )
|
||||
{
|
||||
@@ -377,17 +384,13 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
final AppEngSlot aeSlot = (AppEngSlot) slot;
|
||||
if( aeSlot.isSlotEnabled() )
|
||||
{
|
||||
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
|
||||
18,
|
||||
18 );
|
||||
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, 18 );
|
||||
}
|
||||
else
|
||||
{
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
|
||||
GlStateManager.enableBlend();
|
||||
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
|
||||
18,
|
||||
18 );
|
||||
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, 18 );
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
}
|
||||
@@ -506,7 +509,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
{
|
||||
final EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
if( this.isJeiGhostItem && isDraggingJeiGhostItem)
|
||||
if( this.isJeiGhostItem && isDraggingJeiGhostItem )
|
||||
{
|
||||
for( IGhostIngredientHandler.Target target : hoveredIngredientTargets )
|
||||
{
|
||||
@@ -759,7 +762,8 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
this.disableShiftClick = false;
|
||||
}
|
||||
|
||||
if (clickType == ClickType.PICKUP && isJeiGhostItem && !isDraggingJeiGhostItem) {
|
||||
if( clickType == ClickType.PICKUP && isJeiGhostItem && !isDraggingJeiGhostItem )
|
||||
{
|
||||
this.isDraggingJeiGhostItem = true;
|
||||
return;
|
||||
}
|
||||
@@ -879,7 +883,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
if( stack != ItemStack.EMPTY )
|
||||
{
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||
final PacketInventoryAction p = new PacketInventoryAction( direction , slot.slotNumber , 0);
|
||||
final PacketInventoryAction p = new PacketInventoryAction( direction, slot.slotNumber, 0 );
|
||||
NetworkHandler.instance().sendToServer( p );
|
||||
}
|
||||
}
|
||||
@@ -1032,27 +1036,11 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
final float f1 = 0.00390625F;
|
||||
final float f = 0.00390625F;
|
||||
final float par6 = 16;
|
||||
vb.pos( par1 + 0, par2 + par6, this.zLevel )
|
||||
.tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 )
|
||||
.color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() )
|
||||
.endVertex();
|
||||
vb.pos( par1 + 0, par2 + par6, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
final float par5 = 16;
|
||||
vb.pos( par1 + par5, par2 + par6, this.zLevel )
|
||||
.tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 )
|
||||
.color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() )
|
||||
.endVertex();
|
||||
vb.pos( par1 + par5, par2 + 0, this.zLevel )
|
||||
.tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 )
|
||||
.color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() )
|
||||
.endVertex();
|
||||
vb.pos( par1 + 0, par2 + 0, this.zLevel )
|
||||
.tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 )
|
||||
.color( 1.0f, 1.0f, 1.0f,
|
||||
aes.getOpacityOfIcon() )
|
||||
.endVertex();
|
||||
vb.pos( par1 + par5, par2 + par6, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + par5, par2 + 0, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
vb.pos( par1 + 0, par2 + 0, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
}
|
||||
@@ -1066,8 +1054,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
{
|
||||
if( ( (AppEngSlot) s ).getIsValid() == hasCalculatedValidness.NotAvailable )
|
||||
{
|
||||
boolean isValid = s.isItemValid(
|
||||
is ) || s instanceof SlotOutput || s instanceof AppEngCraftingSlot || s instanceof SlotDisabled || s instanceof SlotInaccessible || s instanceof SlotFake || s instanceof SlotRestrictedInput || s instanceof SlotDisconnected;
|
||||
boolean isValid = s.isItemValid( is ) || s instanceof SlotOutput || s instanceof AppEngCraftingSlot || s instanceof SlotDisabled || s instanceof SlotInaccessible || s instanceof SlotFake || s instanceof SlotRestrictedInput || s instanceof SlotDisconnected;
|
||||
if( isValid && s instanceof SlotRestrictedInput )
|
||||
{
|
||||
try
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.List;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.container.implementations.ContainerExpandedProcessingPatternTerm;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import gregtech.common.items.MetaTool;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
@@ -41,6 +40,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -175,7 +175,8 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
{
|
||||
ItemStack currentItem = craftMatrix.getStackInSlot( x );
|
||||
|
||||
if (x >= this.recipe.size()) {
|
||||
if( x >= this.recipe.size() )
|
||||
{
|
||||
currentItem = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -228,7 +229,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
out = Platform.poweredExtraction( energy, storage, request, cct.getActionSource() );
|
||||
if( out == null )
|
||||
{
|
||||
if( request.getItem().isDamageable() || ( Platform.isModLoaded( "gregtech" ) && request.getItem() instanceof MetaTool ) )
|
||||
if( request.getItem().isDamageable() || Platform.isGTDamageableItem( request.getItem() ) )
|
||||
{
|
||||
Collection<IAEItemStack> outList = inv.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getStorageList().findFuzzy( request, FuzzyMode.IGNORE_ALL );
|
||||
for( IAEItemStack is : outList )
|
||||
@@ -261,7 +262,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
|
||||
if( out != null )
|
||||
{
|
||||
if (!cct.useRealItems())
|
||||
if( !cct.useRealItems() )
|
||||
{
|
||||
out.setStackSize( recipe.get( x )[y].getCount() );
|
||||
}
|
||||
@@ -285,7 +286,7 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cct.useRealItems())
|
||||
if( !cct.useRealItems() )
|
||||
{
|
||||
if( currentItem.isEmpty() && recipe.size() > x && this.recipe.get( x ) != null )
|
||||
{
|
||||
@@ -298,25 +299,28 @@ public class PacketJEIRecipe extends AppEngPacket
|
||||
|
||||
con.onCraftMatrixChanged( new WrapperInvItemHandler( craftMatrix ) );
|
||||
|
||||
if( this.output != null && ( ( con instanceof ContainerPatternTerm && !( (ContainerPatternTerm) con ).isCraftingMode() ) || con instanceof ContainerExpandedProcessingPatternTerm ) ) {
|
||||
IItemHandler outputSlots = cct.getInventoryByName("output");
|
||||
for (int i = 0; i < outputSlots.getSlots(); ++i) {
|
||||
ItemHandlerUtil.setStackInSlot(outputSlots, i, ItemStack.EMPTY);
|
||||
}
|
||||
for (int i = 0; i < this.output.size() && i < outputSlots.getSlots(); ++i) {
|
||||
if (this.output.get(i) == null || this.output.get(i) == ItemStack.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
ItemHandlerUtil.setStackInSlot(outputSlots, i, this.output.get(i));
|
||||
}
|
||||
if( this.output != null && ( ( con instanceof ContainerPatternTerm && !( (ContainerPatternTerm) con ).isCraftingMode() ) || con instanceof ContainerExpandedProcessingPatternTerm ) )
|
||||
{
|
||||
IItemHandler outputSlots = cct.getInventoryByName( "output" );
|
||||
for( int i = 0; i < outputSlots.getSlots(); ++i )
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( outputSlots, i, ItemStack.EMPTY );
|
||||
}
|
||||
for( int i = 0; i < this.output.size() && i < outputSlots.getSlots(); ++i )
|
||||
{
|
||||
if( this.output.get( i ) == null || this.output.get( i ) == ItemStack.EMPTY )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ItemHandlerUtil.setStackInSlot( outputSlots, i, this.output.get( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot
|
||||
* @param is itemstack
|
||||
* @param is itemstack
|
||||
* @return is if it can be used, else EMPTY
|
||||
*/
|
||||
private ItemStack canUseInSlot( int slot, ItemStack is )
|
||||
|
||||
@@ -58,7 +58,6 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
private final World world;
|
||||
private final IItemList<IAEItemStack> crafting = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> missing = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
private final IItemList<IAEItemStack> usedWhileBuilding = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
||||
|
||||
private final HashMap<String, TwoIntegers> opsAndMultiplier = new HashMap<>();
|
||||
private final Object monitor = new Object();
|
||||
@@ -92,7 +91,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
this.cc = grid.getCache( ICraftingGrid.class );
|
||||
final GridStorageCache sg = grid.getCache( IStorageGrid.class );
|
||||
this.original = new MECraftingInventory( sg.getExtractableList( actionSrc ) );
|
||||
this.original = sg.getExtractableList( actionSrc );
|
||||
|
||||
this.setTree( this.getCraftingTree( cc, what ) );
|
||||
this.availableCheck = null;
|
||||
@@ -108,11 +107,6 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
this.availableCheck.injectItems( o, Actionable.MODULATE, this.actionSrc );
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getUsedWhileBuilding()
|
||||
{
|
||||
return usedWhileBuilding;
|
||||
}
|
||||
|
||||
IAEItemStack checkUse( final IAEItemStack available )
|
||||
{
|
||||
return this.availableCheck.extractItems( available, Actionable.MODULATE, this.actionSrc );
|
||||
@@ -120,12 +114,7 @@ public class CraftingJob implements Runnable, ICraftingJob
|
||||
|
||||
IAEItemStack checkAvailable( final IAEItemStack available )
|
||||
{
|
||||
return this.original.extractItems( available.copy().setStackSize( Long.MAX_VALUE ), Actionable.SIMULATE, this.actionSrc );
|
||||
}
|
||||
|
||||
public void writeToNBT( final NBTTagCompound out )
|
||||
{
|
||||
|
||||
return this.availableCheck.extractItems( available, Actionable.SIMULATE, this.actionSrc );
|
||||
}
|
||||
|
||||
void addTask( IAEItemStack what, final long crafts, final ICraftingPatternDetails details, final int depth )
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -36,8 +37,10 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
|
||||
@Optional.Interface( iface = "gregtech.api.items.IToolItem", modid = "gregtech" )
|
||||
public class CraftingTreeNode
|
||||
{
|
||||
|
||||
@@ -119,7 +122,7 @@ public class CraftingTreeNode
|
||||
{
|
||||
Collection<IAEItemStack> itemList = new ArrayList<>();
|
||||
|
||||
if( this.what.getItem().hasContainerItem( this.what.getDefinition() ) || this.what.getItem().isDamageable() )
|
||||
if( this.what.getItem().isDamageable() || Platform.isGTDamageableItem( this.what.getItem() ) )
|
||||
{
|
||||
itemList.addAll( inventoryList.findFuzzy( this.what, FuzzyMode.IGNORE_ALL ) );
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ public class CraftingTreeProcess
|
||||
private final World world;
|
||||
boolean possible = true;
|
||||
private long crafts = 0;
|
||||
private boolean limitQty;
|
||||
private long bytes = 0;
|
||||
|
||||
public CraftingTreeProcess( final ICraftingGrid cc, final CraftingJob job, final ICraftingPatternDetails details, final CraftingTreeNode craftingTreeNode, final int depth )
|
||||
@@ -70,19 +69,8 @@ public class CraftingTreeProcess
|
||||
{
|
||||
return;
|
||||
}
|
||||
final IAEItemStack[] list = details.getInputs();
|
||||
|
||||
for( final IAEItemStack part : details.getCondensedOutputs() )
|
||||
{
|
||||
for( final IAEItemStack o : details.getCondensedInputs() )
|
||||
{
|
||||
if( part.equals( o ) )
|
||||
{
|
||||
this.limitQty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final IAEItemStack[] list = details.getInputs();
|
||||
|
||||
// this is minor different then below, this slot uses the pattern, but kinda fudges it.
|
||||
for( IAEItemStack part : details.getCondensedInputs() )
|
||||
@@ -100,13 +88,11 @@ public class CraftingTreeProcess
|
||||
if( part.getItem().hasContainerItem( part.getDefinition() ) )
|
||||
{
|
||||
part = list[x];
|
||||
this.limitQty = true;
|
||||
isPartContainer = true;
|
||||
}
|
||||
|
||||
long wantedSize = part.getStackSize();
|
||||
IAEItemStack found;
|
||||
IAEItemStack used;
|
||||
long remaining = 0;
|
||||
long requestAmount = 0;
|
||||
|
||||
@@ -120,19 +106,7 @@ public class CraftingTreeProcess
|
||||
|
||||
if( found != null )
|
||||
{
|
||||
used = job.getUsedWhileBuilding().findPrecise( subs );
|
||||
remaining = found.getStackSize();
|
||||
if( used != null )
|
||||
{
|
||||
if( used.getStackSize() >= found.getStackSize() )
|
||||
{
|
||||
remaining = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
remaining -= used.getStackSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( remaining > 0 )
|
||||
@@ -149,7 +123,6 @@ public class CraftingTreeProcess
|
||||
wantedSize -= remaining;
|
||||
}
|
||||
subs = subs.copy().setStackSize( requestAmount );
|
||||
job.getUsedWhileBuilding().addStorage( subs );
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, subs, this, x, depth + 1 ), requestAmount );
|
||||
if( wantedSize == 0 )
|
||||
{
|
||||
@@ -164,19 +137,7 @@ public class CraftingTreeProcess
|
||||
|
||||
if( found != null )
|
||||
{
|
||||
used = job.getUsedWhileBuilding().findPrecise( part );
|
||||
remaining = found.getStackSize();
|
||||
if( used != null )
|
||||
{
|
||||
if( used.getStackSize() >= found.getStackSize() )
|
||||
{
|
||||
remaining = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
remaining -= used.getStackSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( remaining > 0 )
|
||||
@@ -193,7 +154,6 @@ public class CraftingTreeProcess
|
||||
wantedSize -= remaining;
|
||||
}
|
||||
part = part.copy().setStackSize( requestAmount );
|
||||
job.getUsedWhileBuilding().addStorage( part );
|
||||
this.nodes.put( new CraftingTreeNode( cc, job, part, this, x, depth + 1 ), requestAmount );
|
||||
}
|
||||
}
|
||||
@@ -272,9 +232,15 @@ public class CraftingTreeProcess
|
||||
|
||||
long getTimes( final long remaining, final long stackSize )
|
||||
{
|
||||
if( this.limitQty )
|
||||
for( final IAEItemStack part : details.getCondensedOutputs() )
|
||||
{
|
||||
return 1;
|
||||
for( final IAEItemStack o : details.getCondensedInputs() )
|
||||
{
|
||||
if( part.equals( o ) || o.getItem().hasContainerItem( part.getDefinition() ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ( remaining / stackSize ) + ( remaining % stackSize != 0 ? 1 : 0 );
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.helpers;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import gregtech.common.items.MetaTool;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -41,6 +40,7 @@ import appeng.container.ContainerNull;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
|
||||
public class PatternHelper implements ICraftingPatternDetails, Comparable<PatternHelper>
|
||||
@@ -267,7 +267,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
this.testFrame.setInventorySlotContents( slotIndex, i );
|
||||
|
||||
// If we cannot substitute, the items must match exactly
|
||||
if( ( !( i.getItem().isDamageable() || Platform.isModLoaded( "gregtech" ) && i.getItem() instanceof MetaTool ) && !canSubstitute ) && slotIndex < inputs.length )
|
||||
if( ( !( i.getItem().isDamageable() || Platform.isGTDamageableItem( i.getItem() ) ) && !canSubstitute ) && slotIndex < inputs.length )
|
||||
{
|
||||
if( !inputs[slotIndex].isSameType( i ) )
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import gregtech.api.items.IToolItem;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -73,6 +74,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -134,6 +136,7 @@ import appeng.util.prioritylist.IPartitionList;
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
@Optional.Interface( iface = "gregtech.api.items.IToolItem", modid = "gregtech" )
|
||||
public class Platform
|
||||
{
|
||||
|
||||
@@ -176,9 +179,8 @@ public class Platform
|
||||
/**
|
||||
* This displays the value for encoded longs ( double *100 )
|
||||
*
|
||||
* @param n to be formatted long value
|
||||
* @param n to be formatted long value
|
||||
* @param isRate if true it adds a /t to the formatted string
|
||||
*
|
||||
* @return formatted long value
|
||||
*/
|
||||
public static String formatPowerLong( final long n, final boolean isRate )
|
||||
@@ -188,12 +190,14 @@ public class Platform
|
||||
final PowerUnits displayUnits = AEConfig.instance().selectedPowerUnit();
|
||||
p = PowerUnits.AE.convertTo( displayUnits, p );
|
||||
|
||||
final String[] preFixes = { "k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y" };
|
||||
final String[] preFixes = {
|
||||
"k", "M", "G", "T", "P", "T", "P", "E", "Z", "Y"
|
||||
};
|
||||
String unitName = displayUnits.name();
|
||||
|
||||
String level = "";
|
||||
int offset = 0;
|
||||
while( p > 1000 && offset < preFixes.length )
|
||||
while ( p > 1000 && offset < preFixes.length )
|
||||
{
|
||||
p /= 1000;
|
||||
level = preFixes[offset];
|
||||
@@ -210,7 +214,7 @@ public class Platform
|
||||
final int west_y = forward.zOffset * up.xOffset - forward.xOffset * up.zOffset;
|
||||
final int west_z = forward.xOffset * up.yOffset - forward.yOffset * up.xOffset;
|
||||
|
||||
switch( west_x + west_y * 2 + west_z * 3 )
|
||||
switch ( west_x + west_y * 2 + west_z * 3 )
|
||||
{
|
||||
case 1:
|
||||
return AEPartLocation.EAST;
|
||||
@@ -237,7 +241,7 @@ public class Platform
|
||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
|
||||
switch( west_x + west_y * 2 + west_z * 3 )
|
||||
switch ( west_x + west_y * 2 + west_z * 3 )
|
||||
{
|
||||
case 1:
|
||||
return EnumFacing.EAST;
|
||||
@@ -271,8 +275,7 @@ public class Platform
|
||||
{
|
||||
ce = nextEnum( ce );
|
||||
}
|
||||
}
|
||||
while( !validOptions.contains( ce ) || isNotValidSetting( ce ) );
|
||||
} while ( !validOptions.contains( ce ) || isNotValidSetting( ce ) );
|
||||
|
||||
return ce;
|
||||
}
|
||||
@@ -446,7 +449,7 @@ public class Platform
|
||||
{
|
||||
if( upAndDown )
|
||||
{
|
||||
switch( dir )
|
||||
switch ( dir )
|
||||
{
|
||||
case NORTH:
|
||||
return AEPartLocation.SOUTH;
|
||||
@@ -466,7 +469,7 @@ public class Platform
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( dir )
|
||||
switch ( dir )
|
||||
{
|
||||
case UP:
|
||||
return AEPartLocation.DOWN;
|
||||
@@ -519,8 +522,7 @@ public class Platform
|
||||
final double offset_x = ( getRandomInt() % 32 - 16 ) / 82;
|
||||
final double offset_y = ( getRandomInt() % 32 - 16 ) / 82;
|
||||
final double offset_z = ( getRandomInt() % 32 - 16 ) / 82;
|
||||
final EntityItem ei = new EntityItem( w, 0.5 + offset_x + pos.getX(), 0.5 + offset_y + pos.getY(), 0.2 + offset_z + pos.getZ(), i
|
||||
.copy() );
|
||||
final EntityItem ei = new EntityItem( w, 0.5 + offset_x + pos.getX(), 0.5 + offset_y + pos.getY(), 0.2 + offset_z + pos.getZ(), i.copy() );
|
||||
w.spawnEntity( ei );
|
||||
}
|
||||
}
|
||||
@@ -592,8 +594,7 @@ public class Platform
|
||||
|
||||
try
|
||||
{
|
||||
ITooltipFlag.TooltipFlags tooltipFlag = Minecraft
|
||||
.getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
||||
ITooltipFlag.TooltipFlags tooltipFlag = Minecraft.getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
||||
return itemStack.getTooltip( Minecraft.getMinecraft().player, tooltipFlag );
|
||||
}
|
||||
catch( final Exception errB )
|
||||
@@ -764,7 +765,7 @@ public class Platform
|
||||
|
||||
public static int MC2MEColor( final int color )
|
||||
{
|
||||
switch( color )
|
||||
switch ( color )
|
||||
{
|
||||
case 4: // "blue"
|
||||
return 0;
|
||||
@@ -842,10 +843,10 @@ public class Platform
|
||||
return forward;
|
||||
}
|
||||
|
||||
switch( forward )
|
||||
switch ( forward )
|
||||
{
|
||||
case DOWN:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case DOWN:
|
||||
return forward;
|
||||
@@ -864,7 +865,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case UP:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case NORTH:
|
||||
return AEPartLocation.WEST;
|
||||
@@ -879,7 +880,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case NORTH:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return AEPartLocation.WEST;
|
||||
@@ -894,7 +895,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case SOUTH:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return AEPartLocation.EAST;
|
||||
@@ -909,7 +910,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case EAST:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return AEPartLocation.NORTH;
|
||||
@@ -923,7 +924,7 @@ public class Platform
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return AEPartLocation.SOUTH;
|
||||
@@ -944,10 +945,10 @@ public class Platform
|
||||
|
||||
public static EnumFacing rotateAround( final EnumFacing forward, final EnumFacing axis )
|
||||
{
|
||||
switch( forward )
|
||||
switch ( forward )
|
||||
{
|
||||
case DOWN:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case DOWN:
|
||||
return forward;
|
||||
@@ -966,7 +967,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case UP:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case NORTH:
|
||||
return EnumFacing.WEST;
|
||||
@@ -981,7 +982,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case NORTH:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return EnumFacing.WEST;
|
||||
@@ -996,7 +997,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case SOUTH:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return EnumFacing.EAST;
|
||||
@@ -1011,7 +1012,7 @@ public class Platform
|
||||
}
|
||||
break;
|
||||
case EAST:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return EnumFacing.NORTH;
|
||||
@@ -1025,7 +1026,7 @@ public class Platform
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
switch( axis )
|
||||
switch ( axis )
|
||||
{
|
||||
case UP:
|
||||
return EnumFacing.SOUTH;
|
||||
@@ -1101,9 +1102,7 @@ public class Platform
|
||||
|
||||
final Vec3d vec31 = vec3.addVector( f7 * d3, f6 * d3, f8 * d3 );
|
||||
|
||||
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( vec3.x, vec31.x ), Math.min( vec3.y, vec31.y ), Math.min( vec3.z,
|
||||
vec31.z ), Math.max( vec3.x, vec31.x ), Math.max( vec3.y, vec31.y ), Math.max( vec3.z, vec31.z ) ).grow(
|
||||
16, 16, 16 );
|
||||
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( vec3.x, vec31.x ), Math.min( vec3.y, vec31.y ), Math.min( vec3.z, vec31.z ), Math.max( vec3.x, vec31.x ), Math.max( vec3.y, vec31.y ), Math.max( vec3.z, vec31.z ) ).grow( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
double closest = 9999999.0D;
|
||||
@@ -1249,12 +1248,11 @@ public class Platform
|
||||
final T leftover = input.copy();
|
||||
final T split = input.copy();
|
||||
|
||||
leftover.decStackSize(itemToAdd);
|
||||
split.setStackSize(itemToAdd);
|
||||
leftover.add(cell.injectItems(split, Actionable.MODULATE, src));
|
||||
leftover.decStackSize( itemToAdd );
|
||||
split.setStackSize( itemToAdd );
|
||||
leftover.add( cell.injectItems( split, Actionable.MODULATE, src ) );
|
||||
|
||||
src.player().ifPresent( player ->
|
||||
{
|
||||
src.player().ifPresent( player -> {
|
||||
final long diff = original - leftover.getStackSize();
|
||||
Stats.ItemsInserted.addToPlayer( player, (int) diff );
|
||||
} );
|
||||
@@ -1264,8 +1262,7 @@ public class Platform
|
||||
|
||||
final T ret = cell.injectItems( input, Actionable.MODULATE, src );
|
||||
|
||||
src.player().ifPresent( player ->
|
||||
{
|
||||
src.player().ifPresent( player -> {
|
||||
final long diff = ret == null ? input.getStackSize() : input.getStackSize() - ret.getStackSize();
|
||||
Stats.ItemsInserted.addToPlayer( player, (int) diff );
|
||||
} );
|
||||
@@ -1282,7 +1279,7 @@ public class Platform
|
||||
return input;
|
||||
}
|
||||
|
||||
@SuppressWarnings( { "rawtypes", "unchecked" } )
|
||||
@SuppressWarnings( {"rawtypes", "unchecked"} )
|
||||
public static void postChanges( final IStorageGrid gs, final ItemStack removed, final ItemStack added, final IActionSource src )
|
||||
{
|
||||
for( final IStorageChannel<?> chan : AEApi.instance().storage().storageChannels() )
|
||||
@@ -1361,8 +1358,7 @@ public class Platform
|
||||
final String locationA = a.getGridBlock().isWorldAccessible() ? a.getGridBlock().getLocation().toString() : "notInWorld";
|
||||
final String locationB = b.getGridBlock().isWorldAccessible() ? b.getGridBlock().getLocation().toString() : "notInWorld";
|
||||
|
||||
AELog.info( "Audit: Node A [isSecure=%b, key=%d, playerID=%d, location={%s}] vs Node B[isSecure=%b, key=%d, playerID=%d, location={%s}]",
|
||||
a_isSecure, a.getLastSecurityKey(), a.getPlayerID(), locationA, b_isSecure, b.getLastSecurityKey(), b.getPlayerID(), locationB );
|
||||
AELog.info( "Audit: Node A [isSecure=%b, key=%d, playerID=%d, location={%s}] vs Node B[isSecure=%b, key=%d, playerID=%d, location={%s}]", a_isSecure, a.getLastSecurityKey(), a.getPlayerID(), locationA, b_isSecure, b.getLastSecurityKey(), b.getPlayerID(), locationB );
|
||||
}
|
||||
|
||||
// can't do that son...
|
||||
@@ -1423,7 +1419,7 @@ public class Platform
|
||||
float yaw = 0.0f;
|
||||
// player.yOffset = 1.8f;
|
||||
|
||||
switch( side )
|
||||
switch ( side )
|
||||
{
|
||||
case DOWN:
|
||||
pitch = 90.0f;
|
||||
@@ -1513,16 +1509,14 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
final boolean checkFuzzy = ae_req.getOre().isPresent() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate
|
||||
.hasTagCompound() || providedTemplate.isItemStackDamageable();
|
||||
final boolean checkFuzzy = ae_req.getOre().isPresent() || providedTemplate.getItemDamage() == OreDictionary.WILDCARD_VALUE || providedTemplate.hasTagCompound() || providedTemplate.isItemStackDamageable();
|
||||
|
||||
if( items != null && checkFuzzy )
|
||||
{
|
||||
for( final IAEItemStack x : items )
|
||||
{
|
||||
final ItemStack sh = x.getDefinition();
|
||||
if( ( Platform.itemComparisons().isEqualItemType( providedTemplate, sh ) || ae_req.sameOre( x ) ) && !ItemStack.areItemsEqual( sh,
|
||||
output ) )
|
||||
if( ( Platform.itemComparisons().isEqualItemType( providedTemplate, sh ) || ae_req.sameOre( x ) ) && !ItemStack.areItemsEqual( sh, output ) )
|
||||
{ // Platform.isSameItemType( sh, providedTemplate )
|
||||
final ItemStack cp = sh.copy();
|
||||
cp.setCount( 1 );
|
||||
@@ -1681,4 +1675,9 @@ public class Platform
|
||||
|
||||
return isPurified;
|
||||
}
|
||||
|
||||
public static boolean isGTDamageableItem( Item item )
|
||||
{
|
||||
return ( isModLoaded( "gregtech" ) && item instanceof IToolItem );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
package appeng.util.inv;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.helpers.NonBlockingItems;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import gregtech.common.items.MetaTool;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.util.item;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -27,7 +26,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import gregtech.common.items.MetaTool;
|
||||
import gregtech.api.items.IToolItem;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -45,7 +44,7 @@ import appeng.core.Api;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack
|
||||
public class AEItemStack extends AEStack<IAEItemStack> implements IAEItemStack
|
||||
{
|
||||
private static final String NBT_STACKSIZE = "Cnt";
|
||||
private static final String NBT_REQUESTABLE = "Req";
|
||||
@@ -363,7 +362,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
|
||||
private boolean fuzzyItemStackComparison( ItemStack a, ItemStack b, FuzzyMode mode )
|
||||
{
|
||||
if( a.getItem() == b.getItem() && ( a.getItem().isDamageable() || Platform.isModLoaded( "gregtech" ) && a.getItem() instanceof MetaTool ) )
|
||||
if( a.getItem() == b.getItem() && ( a.getItem().isDamageable() || Platform.isGTDamageableItem( a.getItem() ) ) )
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
@@ -371,7 +370,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( Platform.isModLoaded( "gregtech" ) && a.getItem() instanceof MetaTool )
|
||||
else if( Platform.isGTDamageableItem( a.getItem() ) )
|
||||
{
|
||||
return a.getItemDamage() == b.getItemDamage();
|
||||
}
|
||||
@@ -382,9 +381,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
{
|
||||
return a.getItemDamage() > 1 == b.getItemDamage() > 1;
|
||||
}
|
||||
else if( Platform.isModLoaded( "gregtech" ) && a.getItem() instanceof MetaTool )
|
||||
else if( Platform.isGTDamageableItem( a.getItem() ) )
|
||||
{
|
||||
return ( (MetaTool) a.getItem() ).getItemDamage( a ) == ( (MetaTool) b.getItem() ).getItemDamage( b );
|
||||
return ( (IToolItem) a.getItem() ).getItemDamage( a ) == ( (IToolItem) b.getItem() ).getItemDamage( b );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -396,10 +395,10 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
percentDamageOfA = (float) a.getItemDamage() / a.getMaxDamage();
|
||||
percentDamageOfB = (float) b.getItemDamage() / b.getMaxDamage();
|
||||
}
|
||||
else if( Platform.isModLoaded( "gregtech" ) && a.getItem() instanceof MetaTool )
|
||||
else if( Platform.isGTDamageableItem( a.getItem() ) )
|
||||
{
|
||||
percentDamageOfA = (float) ( (MetaTool) a.getItem() ).getItemDamage( a ) / ( (MetaTool) a.getItem() ).getMaxItemDamage( a );
|
||||
percentDamageOfB = (float) ( (MetaTool) b.getItem() ).getItemDamage( b ) / ( (MetaTool) b.getItem() ).getMaxItemDamage( b );
|
||||
percentDamageOfA = (float) ( (IToolItem) a.getItem() ).getItemDamage( a ) / ( (IToolItem) a.getItem() ).getMaxItemDamage( a );
|
||||
percentDamageOfB = (float) ( (IToolItem) b.getItem() ).getItemDamage( b ) / ( (IToolItem) b.getItem() ).getMaxItemDamage( b );
|
||||
}
|
||||
|
||||
return percentDamageOfA > mode.breakPoint == percentDamageOfB > mode.breakPoint;
|
||||
@@ -408,4 +407,5 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import appeng.util.Platform;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import gregtech.common.items.MetaTool;
|
||||
import gregtech.api.items.IToolItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectAVLTreeMap;
|
||||
@@ -165,14 +165,14 @@ class FuzzyItemVariantList extends ItemVariantList
|
||||
*/
|
||||
static ItemDamageBound makeLowerBound( final ItemStack stack, final FuzzyMode fuzzy )
|
||||
{
|
||||
Preconditions.checkState( stack.getItem().isDamageable() || ( Platform.isModLoaded( "gregtech" ) && stack.getItem() instanceof MetaTool ), "Item#isDamageable() has to be true" );
|
||||
Preconditions.checkState( stack.getItem().isDamageable() || ( Platform.isGTDamageableItem( stack.getItem() ) ), "Item#isDamageable() has to be true" );
|
||||
|
||||
int damage;
|
||||
int maxDamage;
|
||||
if( Platform.isModLoaded( "gregtech" ) && stack.getItem() instanceof MetaTool )
|
||||
if( Platform.isGTDamageableItem( stack.getItem() ) )
|
||||
{
|
||||
maxDamage = ( (MetaTool) stack.getItem() ).getMaxItemDamage( stack );
|
||||
damage = ( (MetaTool) stack.getItem() ).getItemDamage( stack );
|
||||
maxDamage = ( (IToolItem) stack.getItem() ).getMaxItemDamage( stack );
|
||||
damage = ( (IToolItem) stack.getItem() ).getItemDamage( stack );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -202,7 +202,7 @@ class FuzzyItemVariantList extends ItemVariantList
|
||||
*/
|
||||
static ItemDamageBound makeUpperBound( final ItemStack stack, final FuzzyMode fuzzy )
|
||||
{
|
||||
Preconditions.checkState( stack.getItem().isDamageable() || ( Platform.isModLoaded( "gregtech" ) && stack.getItem() instanceof MetaTool ), "Item#isDamageable() has to be true" );
|
||||
Preconditions.checkState( stack.getItem().isDamageable() || ( Platform.isGTDamageableItem( stack.getItem() ) ), "Item#isDamageable() has to be true" );
|
||||
|
||||
int damage;
|
||||
if( fuzzy == FuzzyMode.IGNORE_ALL )
|
||||
@@ -212,10 +212,10 @@ class FuzzyItemVariantList extends ItemVariantList
|
||||
else
|
||||
{
|
||||
int maxDamage;
|
||||
if( Platform.isModLoaded( "gregtech" ) && stack.getItem() instanceof MetaTool )
|
||||
if( Platform.isGTDamageableItem( stack.getItem() ) )
|
||||
{
|
||||
maxDamage = ( (MetaTool) stack.getItem() ).getMaxItemDamage( stack );
|
||||
damage = ( (MetaTool) stack.getItem() ).getItemDamage( stack );
|
||||
maxDamage = ( (IToolItem) stack.getItem() ).getMaxItemDamage( stack );
|
||||
damage = ( (IToolItem) stack.getItem() ).getItemDamage( stack );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import gregtech.common.items.MetaTool;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
||||
@@ -175,7 +174,7 @@ public final class ItemList implements IItemList<IAEItemStack>
|
||||
|
||||
private ItemVariantList makeRecordMap( Item item )
|
||||
{
|
||||
if( item.isDamageable() || ( Platform.isModLoaded( "gregtech" ) && item instanceof MetaTool ) )
|
||||
if( item.isDamageable() || Platform.isGTDamageableItem( item ) )
|
||||
{
|
||||
return new FuzzyItemVariantList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user