Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 362b001cb4 | |||
| b6fd4b3c0f | |||
| e364603a5a | |||
| c58bebc346 | |||
| 97f11f0c61 | |||
| 5c2fa72f95 | |||
| ebd8501301 | |||
| fa07247bd7 | |||
| 95d25ddf47 | |||
| 7a45e1faf4 | |||
| 1f88494832 |
@@ -86,6 +86,7 @@ configurations {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "com.jaquadro.minecraft.storagedrawers:StorageDrawers:1.12.2-5.4.2:api"
|
deobfCompile "com.jaquadro.minecraft.storagedrawers:StorageDrawers:1.12.2-5.4.2:api"
|
||||||
|
deobfCompile "gregtechce:gregtech:1.12.2:1.12.0.662"
|
||||||
|
|
||||||
// installable runtime dependencies
|
// installable runtime dependencies
|
||||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
|||||||
case PICKUP: // pickup / set-down.
|
case PICKUP: // pickup / set-down.
|
||||||
if (slot.getStack().isEmpty() && !player.inventory.getItemStack().isEmpty())
|
if (slot.getStack().isEmpty() && !player.inventory.getItemStack().isEmpty())
|
||||||
action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
|
action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
|
||||||
if (!slot.getStack().isEmpty() && player.inventory.getItemStack().isEmpty())
|
if (!slot.getStack().isEmpty() && player.inventory.getItemStack().getCount() <= 1)
|
||||||
action = InventoryAction.PICKUP_OR_SET_DOWN;
|
action = InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
break;
|
break;
|
||||||
case QUICK_MOVE:
|
case QUICK_MOVE:
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||||
{
|
{
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
if( !input[x].isEmpty() && input[x].getCount() * multiple > 64 )
|
if( !input[x].isEmpty() && input[x].getCount() * multiple > input[x].getMaxStackSize() )
|
||||||
{
|
{
|
||||||
canMultiplyInputs = false;
|
canMultiplyInputs = false;
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
||||||
{
|
{
|
||||||
final ItemStack out = outputSlot.getStack();
|
final ItemStack out = outputSlot.getStack();
|
||||||
if( !out.isEmpty() && out.getCount() * multiple > 64 )
|
if( !out.isEmpty() && out.getCount() * multiple > out.getMaxStackSize() )
|
||||||
{
|
{
|
||||||
canMultiplyOutputs = false;
|
canMultiplyOutputs = false;
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||||
{
|
{
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
if( !input[x].isEmpty() && input[x].getCount() + increase > 64 )
|
if( !input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize() )
|
||||||
{
|
{
|
||||||
canIncreaseInputs = false;
|
canIncreaseInputs = false;
|
||||||
}
|
}
|
||||||
@@ -377,7 +377,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
for( final OptionalSlotFake outputSlot : this.outputSlots )
|
||||||
{
|
{
|
||||||
final ItemStack out = outputSlot.getStack();
|
final ItemStack out = outputSlot.getStack();
|
||||||
if( !out.isEmpty() && out.getCount() + increase > 64 )
|
if( !out.isEmpty() && out.getCount() + increase > out.getMaxStackSize() )
|
||||||
{
|
{
|
||||||
canIncreaseOutputs = false;
|
canIncreaseOutputs = false;
|
||||||
}
|
}
|
||||||
@@ -450,11 +450,11 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
for( int x = 0; x < this.craftingSlots.length; x++ )
|
for( int x = 0; x < this.craftingSlots.length; x++ )
|
||||||
{
|
{
|
||||||
input[x] = this.craftingSlots[x].getStack();
|
input[x] = this.craftingSlots[x].getStack();
|
||||||
if( !input[x].isEmpty() && 64 - input[x].getCount() > maxInputStackGrowth )
|
if( !input[x].isEmpty() && input[x].getMaxStackSize() - input[x].getCount() > maxInputStackGrowth )
|
||||||
{
|
{
|
||||||
maxInputStackGrowth = 64 - input[x].getCount();
|
maxInputStackGrowth = input[x].getMaxStackSize() - input[x].getCount();
|
||||||
}
|
}
|
||||||
if( !input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > 64 )
|
if( !input[x].isEmpty() && input[x].getCount() + maxInputStackGrowth > input[x].getMaxStackSize() )
|
||||||
{
|
{
|
||||||
canGrowInputs = false;
|
canGrowInputs = false;
|
||||||
}
|
}
|
||||||
@@ -463,9 +463,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
|||||||
{
|
{
|
||||||
final ItemStack out = outputSlot.getStack();
|
final ItemStack out = outputSlot.getStack();
|
||||||
{
|
{
|
||||||
maxOutputStackGrowth = 64 - out.getCount();
|
maxOutputStackGrowth = out.getMaxStackSize() - out.getCount();
|
||||||
}
|
}
|
||||||
if( !out.isEmpty() && out.getCount() + maxOutputStackGrowth > 64 )
|
if( !out.isEmpty() && out.getCount() + maxOutputStackGrowth > out.getMaxStackSize() )
|
||||||
{
|
{
|
||||||
canGrowOutputs = false;
|
canGrowOutputs = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,22 +237,6 @@ public class PacketJEIRecipe extends AppEngPacket
|
|||||||
// Fall back using an existing item
|
// Fall back using an existing item
|
||||||
out = storage.extractItems( request, Actionable.SIMULATE, cct.getActionSource() );
|
out = storage.extractItems( request, Actionable.SIMULATE, cct.getActionSource() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( out == null )
|
|
||||||
{
|
|
||||||
IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList();
|
|
||||||
Iterator<IAEItemStack> iterator = inv.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getAvailableItems( items ).iterator();
|
|
||||||
while ( iterator.hasNext() )
|
|
||||||
{
|
|
||||||
final IAEItemStack o = iterator.next();
|
|
||||||
if( o.getDefinition().isItemEqual( request.getDefinition() ) && o.isCraftable() )
|
|
||||||
{
|
|
||||||
out = o;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( out != null )
|
if( out != null )
|
||||||
@@ -274,14 +258,14 @@ public class PacketJEIRecipe extends AppEngPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentItem = ad.simulateSimilarRemove(recipe[x][y].getCount(), this.recipe[x][y],FuzzyMode.IGNORE_ALL, null );
|
currentItem = ad.simulateSimilarRemove(recipe[x][y].getCount(), this.recipe[x][y],FuzzyMode.IGNORE_ALL, null );
|
||||||
if( currentItem.isEmpty() )
|
|
||||||
{
|
|
||||||
currentItem = this.recipe[x][y].copy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( currentItem.isEmpty() && this.recipe[x] != null)
|
||||||
|
{
|
||||||
|
currentItem = this.recipe[x][0].copy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ItemHandlerUtil.setStackInSlot( craftMatrix, x, currentItem );
|
ItemHandlerUtil.setStackInSlot( craftMatrix, x, currentItem );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.StorageFilter;
|
||||||
|
import appeng.parts.misc.PartStorageBus;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||||
@@ -62,12 +64,18 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
|||||||
private final IFluidHandler fluidHandler;
|
private final IFluidHandler fluidHandler;
|
||||||
private final IGridProxyable proxyable;
|
private final IGridProxyable proxyable;
|
||||||
private final FluidHandlerAdapter.InventoryCache cache;
|
private final FluidHandlerAdapter.InventoryCache cache;
|
||||||
|
private StorageFilter mode;
|
||||||
|
|
||||||
FluidHandlerAdapter( IFluidHandler fluidHandler, IGridProxyable proxy )
|
FluidHandlerAdapter( IFluidHandler fluidHandler, IGridProxyable proxy )
|
||||||
{
|
{
|
||||||
this.fluidHandler = fluidHandler;
|
this.fluidHandler = fluidHandler;
|
||||||
this.proxyable = proxy;
|
this.proxyable = proxy;
|
||||||
this.cache = new FluidHandlerAdapter.InventoryCache( this.fluidHandler );
|
if( this.proxyable instanceof PartStorageBus )
|
||||||
|
{
|
||||||
|
PartStorageBus partStorageBus = (PartStorageBus) this.proxyable;
|
||||||
|
this.mode = ( (StorageFilter) partStorageBus.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
||||||
|
}
|
||||||
|
this.cache = new FluidHandlerAdapter.InventoryCache( this.fluidHandler, this.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -196,13 +204,12 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
|||||||
{
|
{
|
||||||
private IAEFluidStack[] cachedAeStacks = new IAEFluidStack[0];
|
private IAEFluidStack[] cachedAeStacks = new IAEFluidStack[0];
|
||||||
private final IFluidHandler fluidHandler;
|
private final IFluidHandler fluidHandler;
|
||||||
private ArrayList<Integer> skipSlots;
|
private final StorageFilter mode;
|
||||||
|
|
||||||
|
public InventoryCache( IFluidHandler fluidHandler, StorageFilter mode )
|
||||||
public InventoryCache( IFluidHandler fluidHandler )
|
|
||||||
{
|
{
|
||||||
|
this.mode = mode;
|
||||||
this.fluidHandler = fluidHandler;
|
this.fluidHandler = fluidHandler;
|
||||||
this.skipSlots = new ArrayList<>(this.fluidHandler.getTankProperties().length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IAEFluidStack> update()
|
public List<IAEFluidStack> update()
|
||||||
@@ -215,23 +222,20 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
|||||||
if( slots > this.cachedAeStacks.length )
|
if( slots > this.cachedAeStacks.length )
|
||||||
{
|
{
|
||||||
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
||||||
this.skipSlots = new ArrayList<>(this.fluidHandler.getTankProperties().length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int slot = 0; slot < slots; slot++ )
|
for( int slot = 0; slot < slots; slot++ )
|
||||||
{
|
{
|
||||||
if (skipSlots.contains( slot ))
|
|
||||||
continue;
|
|
||||||
// Save the old stuff
|
// Save the old stuff
|
||||||
final IAEFluidStack oldAEFS = this.cachedAeStacks[slot];
|
final IAEFluidStack oldAEFS = this.cachedAeStacks[slot];
|
||||||
FluidStack newFS = tankProperties[slot].getContents();
|
FluidStack newFS = tankProperties[slot].getContents();
|
||||||
if (newFS != null) {
|
if( this.mode == StorageFilter.EXTRACTABLE_ONLY && newFS != null )
|
||||||
if (this.fluidHandler.drain( 1, false ) == null){
|
{
|
||||||
|
if( this.fluidHandler.drain( 1, false ) == null )
|
||||||
|
{
|
||||||
newFS = null;
|
newFS = null;
|
||||||
skipSlots.add( slot );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handlePossibleSlotChanges( slot, oldAEFS, newFS, changes );
|
this.handlePossibleSlotChanges( slot, oldAEFS, newFS, changes );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +255,6 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
||||||
this.skipSlots = new ArrayList<>( this.fluidHandler.getTankProperties().length );
|
|
||||||
}
|
}
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import appeng.integration.modules.gregtech.GTCEInventoryAdaptor;
|
|||||||
import appeng.util.*;
|
import appeng.util.*;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import gregtech.api.block.machines.BlockMachine;
|
||||||
|
import gregtech.api.metatileentity.MetaTileEntity;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
@@ -48,6 +50,7 @@ import net.minecraft.util.math.RayTraceResult;
|
|||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.RangedWrapper;
|
import net.minecraftforge.items.wrapper.RangedWrapper;
|
||||||
@@ -109,6 +112,8 @@ import appeng.util.inv.IInventoryDestination;
|
|||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
|
import static gregtech.api.block.machines.BlockMachine.getMetaTileEntity;
|
||||||
|
|
||||||
|
|
||||||
public class DualityInterface implements IGridTickable, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory, IConfigManagerHost, ICraftingProvider, IUpgradeableHost
|
public class DualityInterface implements IGridTickable, IStorageMonitorable, IInventoryDestination, IAEAppEngInventory, IConfigManagerHost, ICraftingProvider, IUpgradeableHost
|
||||||
{
|
{
|
||||||
@@ -1235,6 +1240,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
|||||||
final IBlockState directedBlockState = hostWorld.getBlockState( targ );
|
final IBlockState directedBlockState = hostWorld.getBlockState( targ );
|
||||||
final Block directedBlock = directedBlockState.getBlock();
|
final Block directedBlock = directedBlockState.getBlock();
|
||||||
ItemStack what = new ItemStack( directedBlock, 1, directedBlock.getMetaFromState( directedBlockState ) );
|
ItemStack what = new ItemStack( directedBlock, 1, directedBlock.getMetaFromState( directedBlockState ) );
|
||||||
|
|
||||||
|
if ( Loader.isModLoaded("gregtech") && directedBlock instanceof BlockMachine )
|
||||||
|
{
|
||||||
|
MetaTileEntity metaTileEntity = getMetaTileEntity(hostWorld, targ);
|
||||||
|
return metaTileEntity.getMetaFullName();
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Vec3d from = new Vec3d( hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5 );
|
Vec3d from = new Vec3d( hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5 );
|
||||||
|
|||||||
+40
-25
@@ -19,9 +19,9 @@
|
|||||||
package appeng.me.cache;
|
package appeng.me.cache;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.PriorityQueue;
|
|
||||||
|
|
||||||
|
import appeng.parts.automation.PartLevelEmitter;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import net.minecraft.crash.CrashReport;
|
import net.minecraft.crash.CrashReport;
|
||||||
@@ -46,6 +46,7 @@ public class TickManagerCache implements ITickManager
|
|||||||
private final HashMap<IGridNode, TickTracker> alertable = new HashMap<>();
|
private final HashMap<IGridNode, TickTracker> alertable = new HashMap<>();
|
||||||
private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<>();
|
private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<>();
|
||||||
private final HashMap<IGridNode, TickTracker> awake = new HashMap<>();
|
private final HashMap<IGridNode, TickTracker> awake = new HashMap<>();
|
||||||
|
private final HashMap<IGridNode, TickTracker> laterTicker = new HashMap<>();
|
||||||
private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<>();
|
private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<>();
|
||||||
|
|
||||||
private long currentTick = 0;
|
private long currentTick = 0;
|
||||||
@@ -86,7 +87,7 @@ public class TickManagerCache implements ITickManager
|
|||||||
{
|
{
|
||||||
this.currentTick++;
|
this.currentTick++;
|
||||||
|
|
||||||
while( !this.upcomingTicks.isEmpty() )
|
while ( !this.upcomingTicks.isEmpty() )
|
||||||
{
|
{
|
||||||
tt = this.upcomingTicks.peek();
|
tt = this.upcomingTicks.peek();
|
||||||
|
|
||||||
@@ -99,36 +100,50 @@ public class TickManagerCache implements ITickManager
|
|||||||
this.upcomingTicks.poll();
|
this.upcomingTicks.poll();
|
||||||
|
|
||||||
final int diff = (int) ( this.currentTick - tt.getLastTick() );
|
final int diff = (int) ( this.currentTick - tt.getLastTick() );
|
||||||
final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff );
|
|
||||||
|
|
||||||
switch( mod )
|
if( tt.getGridTickable() instanceof PartLevelEmitter )
|
||||||
|
{
|
||||||
|
laterTicker.put( tt.getNode(), tt );
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
case FASTER:
|
|
||||||
tt.setCurrentRate( tt.getCurrentRate() - 2 );
|
|
||||||
break;
|
|
||||||
case IDLE:
|
|
||||||
tt.setCurrentRate( tt.getRequest().maxTickRate );
|
|
||||||
break;
|
|
||||||
case SAME:
|
|
||||||
break;
|
|
||||||
case SLEEP:
|
|
||||||
this.sleepDevice( tt.getNode() );
|
|
||||||
break;
|
|
||||||
case SLOWER:
|
|
||||||
tt.setCurrentRate( tt.getCurrentRate() + 1 );
|
|
||||||
break;
|
|
||||||
case URGENT:
|
|
||||||
tt.setCurrentRate( 0 );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff );
|
||||||
|
|
||||||
|
switch ( mod )
|
||||||
|
{
|
||||||
|
case FASTER:
|
||||||
|
tt.setCurrentRate( tt.getCurrentRate() - 2 );
|
||||||
|
break;
|
||||||
|
case IDLE:
|
||||||
|
tt.setCurrentRate( tt.getRequest().maxTickRate );
|
||||||
|
break;
|
||||||
|
case SAME:
|
||||||
|
break;
|
||||||
|
case SLEEP:
|
||||||
|
this.sleepDevice( tt.getNode() );
|
||||||
|
break;
|
||||||
|
case SLOWER:
|
||||||
|
tt.setCurrentRate( tt.getCurrentRate() + 1 );
|
||||||
|
break;
|
||||||
|
case URGENT:
|
||||||
|
tt.setCurrentRate( 0 );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if( this.awake.containsKey( tt.getNode() ) )
|
if( this.awake.containsKey( tt.getNode() ) )
|
||||||
{
|
{
|
||||||
this.addToQueue( tt );
|
this.addToQueue( tt );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Iterator<Map.Entry<IGridNode, TickTracker>> ltIterator = laterTicker.entrySet().iterator();
|
||||||
|
while ( ltIterator.hasNext() )
|
||||||
|
{
|
||||||
|
Map.Entry<IGridNode, TickTracker> tickTracker = ltIterator.next();
|
||||||
|
tickTracker.getValue().getGridTickable().tickingRequest( tickTracker.getKey(), 1 );
|
||||||
|
ltIterator.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( final Throwable t )
|
catch( final Throwable t )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package appeng.me.storage;
|
package appeng.me.storage;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.api.config.StorageFilter;
|
||||||
import appeng.api.networking.security.IActionSource;
|
import appeng.api.networking.security.IActionSource;
|
||||||
import appeng.api.networking.ticking.TickRateModulation;
|
import appeng.api.networking.ticking.TickRateModulation;
|
||||||
|
|
||||||
@@ -30,4 +31,8 @@ public interface ITickingMonitor
|
|||||||
|
|
||||||
void setActionSource( IActionSource actionSource );
|
void setActionSource( IActionSource actionSource );
|
||||||
|
|
||||||
|
default void setMode( StorageFilter setting )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,15 @@
|
|||||||
package appeng.parts.automation;
|
package appeng.parts.automation;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
|
import appeng.api.networking.ticking.IGridTickable;
|
||||||
|
import appeng.api.networking.ticking.TickRateModulation;
|
||||||
|
import appeng.api.networking.ticking.TickingRequest;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -82,7 +88,7 @@ import appeng.util.Platform;
|
|||||||
import appeng.util.inv.InvOperation;
|
import appeng.util.inv.InvOperation;
|
||||||
|
|
||||||
|
|
||||||
public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherHost, IStackWatcherHost, ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider
|
public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherHost, IStackWatcherHost, ICraftingWatcherHost, IMEMonitorHandlerReceiver<IAEItemStack>, ICraftingProvider, IGridTickable
|
||||||
{
|
{
|
||||||
|
|
||||||
@PartModels
|
@PartModels
|
||||||
@@ -118,6 +124,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
private double centerX;
|
private double centerX;
|
||||||
private double centerY;
|
private double centerY;
|
||||||
private double centerZ;
|
private double centerZ;
|
||||||
|
private IBaseMonitor<IAEItemStack> changedMonitor;
|
||||||
|
|
||||||
@Reflected
|
@Reflected
|
||||||
public PartLevelEmitter( final ItemStack is )
|
public PartLevelEmitter( final ItemStack is )
|
||||||
@@ -400,7 +407,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
@Override
|
@Override
|
||||||
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource actionSource )
|
public void postChange( final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change, final IActionSource actionSource )
|
||||||
{
|
{
|
||||||
this.updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
|
this.changedMonitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -576,4 +583,22 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
return this.isLevelEmitterOn() ? MODEL_ON_OFF : MODEL_OFF_OFF;
|
return this.isLevelEmitterOn() ? MODEL_ON_OFF : MODEL_OFF_OFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public TickingRequest getTickingRequest( @Nonnull IGridNode node )
|
||||||
|
{
|
||||||
|
return new TickingRequest( 1,1,false,false );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall )
|
||||||
|
{
|
||||||
|
if (this.changedMonitor != null)
|
||||||
|
{
|
||||||
|
this.updateReportingValue((IMEMonitor<IAEItemStack>) changedMonitor);
|
||||||
|
}
|
||||||
|
return TickRateModulation.URGENT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.StorageFilter;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
@@ -59,12 +59,18 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
private final IItemHandler itemHandler;
|
private final IItemHandler itemHandler;
|
||||||
private final IGridProxyable proxyable;
|
private final IGridProxyable proxyable;
|
||||||
private final InventoryCache cache;
|
private final InventoryCache cache;
|
||||||
|
private StorageFilter mode;
|
||||||
|
|
||||||
ItemHandlerAdapter( IItemHandler itemHandler, IGridProxyable proxy )
|
ItemHandlerAdapter( IItemHandler itemHandler, IGridProxyable proxy )
|
||||||
{
|
{
|
||||||
this.itemHandler = itemHandler;
|
this.itemHandler = itemHandler;
|
||||||
this.proxyable = proxy;
|
this.proxyable = proxy;
|
||||||
this.cache = new InventoryCache( this.itemHandler );
|
if( this.proxyable instanceof PartStorageBus )
|
||||||
|
{
|
||||||
|
PartStorageBus partStorageBus = (PartStorageBus) this.proxyable;
|
||||||
|
this.mode = ( (StorageFilter) partStorageBus.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
||||||
|
}
|
||||||
|
this.cache = new InventoryCache( this.itemHandler, this.mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -270,12 +276,12 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
{
|
{
|
||||||
private IAEItemStack[] cachedAeStacks = new IAEItemStack[0];
|
private IAEItemStack[] cachedAeStacks = new IAEItemStack[0];
|
||||||
private final IItemHandler itemHandler;
|
private final IItemHandler itemHandler;
|
||||||
private ArrayList<Integer> skipSlots;
|
private final StorageFilter mode;
|
||||||
|
|
||||||
public InventoryCache( IItemHandler itemHandler )
|
public InventoryCache( IItemHandler itemHandler, StorageFilter mode )
|
||||||
{
|
{
|
||||||
|
this.mode = mode;
|
||||||
this.itemHandler = itemHandler;
|
this.itemHandler = itemHandler;
|
||||||
this.skipSlots = new ArrayList<>(this.itemHandler.getSlots());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
|
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
|
||||||
@@ -293,20 +299,18 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
if( slots > this.cachedAeStacks.length )
|
if( slots > this.cachedAeStacks.length )
|
||||||
{
|
{
|
||||||
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
||||||
this.skipSlots = new ArrayList<>(this.itemHandler.getSlots());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int slot = 0; slot < slots; slot++ )
|
for( int slot = 0; slot < slots; slot++ )
|
||||||
{
|
{
|
||||||
if (skipSlots.contains( slot ))
|
|
||||||
continue;
|
|
||||||
// Save the old stuff
|
// Save the old stuff
|
||||||
final IAEItemStack oldAeIS = this.cachedAeStacks[slot];
|
final IAEItemStack oldAeIS = this.cachedAeStacks[slot];
|
||||||
ItemStack newIS = this.itemHandler.getStackInSlot( slot );
|
ItemStack newIS = this.itemHandler.getStackInSlot( slot );
|
||||||
if (!newIS.isEmpty()) {
|
if( this.mode == StorageFilter.EXTRACTABLE_ONLY && !newIS.isEmpty() )
|
||||||
if (this.itemHandler.extractItem( slot,1,true ).isEmpty()){
|
{
|
||||||
|
if( this.itemHandler.extractItem( slot, 1, true ).isEmpty() )
|
||||||
|
{
|
||||||
newIS = ItemStack.EMPTY;
|
newIS = ItemStack.EMPTY;
|
||||||
skipSlots.add( slot );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.handlePossibleSlotChanges( slot, oldAeIS, newIS, changes );
|
this.handlePossibleSlotChanges( slot, oldAeIS, newIS, changes );
|
||||||
@@ -329,7 +333,6 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
|||||||
|
|
||||||
// Reduce the cache size
|
// Reduce the cache size
|
||||||
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
this.cachedAeStacks = Arrays.copyOf( this.cachedAeStacks, slots );
|
||||||
this.skipSlots = new ArrayList<>(this.itemHandler.getSlots());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return changes;
|
return changes;
|
||||||
|
|||||||
@@ -484,6 +484,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
{
|
{
|
||||||
this.monitor = (ITickingMonitor) inv;
|
this.monitor = (ITickingMonitor) inv;
|
||||||
this.monitor.setActionSource( new MachineSource( this ) );
|
this.monitor.setActionSource( new MachineSource( this ) );
|
||||||
|
this.monitor.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( inv != null )
|
if( inv != null )
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class AdaptorItemRepository extends InventoryAdaptor
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasSlots()
|
public boolean hasSlots()
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user