Compare commits
20 Commits
rv6.stable.7
...
rv6-1.12
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e0250de37 | |||
| d730503378 | |||
| f3349b0a2d | |||
| f667e9a5f0 | |||
| 2c0a2975de | |||
| 2e3d6b721a | |||
| 94e294f4e9 | |||
| 91620a0042 | |||
| ffc79b5494 | |||
| ce7c29d0ac | |||
| 6ece190ac4 | |||
| 00a596ea8f | |||
| 1fc1d5517d | |||
| d5fc7a5b21 | |||
| 1f85d0f607 | |||
| 34c490f92b | |||
| 5efa6d6251 | |||
| 4269a66a4b | |||
| 401f1ebb3e | |||
| df2a7c1858 |
@@ -0,0 +1,15 @@
|
||||
name: 'Lock threads'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: '180'
|
||||
pr-lock-inactive-days: '180'
|
||||
@@ -128,7 +128,7 @@ Here are a few things to keep in mind that will help get your PR approved.
|
||||
* HTTPS `git clone https://github.com/<your username>/Applied-Energistics-2.git`
|
||||
3. Change code base
|
||||
4. Add changes to git `git add -A`
|
||||
5. Commit changes to your clone `git commit -m "<summery of made changes>"`
|
||||
5. Commit changes to your clone `git commit -m "<summary of made changes>"`
|
||||
6. Push to your fork `git push`
|
||||
7. Create a Pull-Request on GitHub
|
||||
8. Wait for review
|
||||
|
||||
@@ -123,7 +123,7 @@ public interface IGridBlock
|
||||
/**
|
||||
* Determines what item stack is used to render this node in the GUI.
|
||||
*
|
||||
* @return the render item stack to use to render this node, null is valid, and will not show this node.
|
||||
* @return the render item stack to use to render this node. Returning an empty ItemStack will not show this node.
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack getMachineRepresentation();
|
||||
|
||||
@@ -291,6 +291,9 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
||||
|
||||
/**
|
||||
* Used to determine which parts can be placed on what cables.
|
||||
*
|
||||
* Dense cables are not allowed for functional (getGridNode returns a node) parts.
|
||||
* Doing so will result in crashes.
|
||||
*
|
||||
* @param what placed part
|
||||
*
|
||||
@@ -365,4 +368,4 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class CraftingTreeNode
|
||||
|
||||
for( IAEItemStack fuzz : itemList )
|
||||
{
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.createItemStack(), this.world ) )
|
||||
if( this.parent.details.isValidItemForSlot( this.getSlot(), fuzz.copy().setStackSize( 1 ).createItemStack(), this.world ) )
|
||||
{
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize( l );
|
||||
|
||||
@@ -105,7 +105,7 @@ public class BlockQuartzGlass extends AEBaseBlock
|
||||
}
|
||||
}
|
||||
|
||||
return w.getBlockState( pos ).shouldSideBeRendered( w, adjacentPos, side );
|
||||
return super.shouldSideBeRendered( state, w, pos, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GrinderRecipes
|
||||
final ItemStack s2 = CTModule.toStack( secondary2Output );
|
||||
if( !s2.isEmpty() )
|
||||
{
|
||||
builder.withFirstOptional( s2, secondary2Chance == null ? 1.0f : secondary2Chance );
|
||||
builder.withSecondOptional( s2, secondary2Chance == null ? 1.0f : secondary2Chance );
|
||||
}
|
||||
CTModule.MODIFICATIONS.add( new Add( builder.build() ) );
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class GrinderRecipeCategory implements IRecipeCategory<GrinderRecipeWrapper>, IR
|
||||
this.localizedName = I18n.format( "tile.appliedenergistics2.grindstone.name" );
|
||||
|
||||
ResourceLocation location = new ResourceLocation( AppEng.MOD_ID, "textures/guis/grinder.png" );
|
||||
this.background = guiHelper.createDrawable( location, 11, 16, 154, 64 );
|
||||
this.background = guiHelper.createDrawable( location, 11, 16, 154, 70 );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -203,7 +203,7 @@ public class JEIPlugin implements IModPlugin
|
||||
{
|
||||
Optional<Item> itemFacade = definitions.items().facade().maybeItem();
|
||||
Optional<ItemStack> cableAnchor = definitions.parts().cableAnchor().maybeStack( 1 );
|
||||
if( itemFacade.isPresent() && cableAnchor.isPresent() )
|
||||
if( itemFacade.isPresent() && cableAnchor.isPresent() && AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_FACADE_CRAFTING ) )
|
||||
{
|
||||
registry.addRecipeRegistryPlugin( new FacadeRegistryPlugin( (ItemFacade) itemFacade.get(), cableAnchor.get() ) );
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import appeng.api.util.IReadOnlyCollection;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.util.ReadOnlyCollection;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
|
||||
|
||||
public class Grid implements IGrid
|
||||
@@ -219,7 +220,10 @@ public class Grid implements IGrid
|
||||
@Override
|
||||
public MENetworkEvent postEvent( final MENetworkEvent ev )
|
||||
{
|
||||
return this.eventBus.postEvent( this, ev );
|
||||
CraftingGridCache.pauseRebuilds();
|
||||
final MENetworkEvent ret = this.eventBus.postEvent( this, ev );
|
||||
CraftingGridCache.unpauseRebuilds();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,6 +55,7 @@ import appeng.api.util.IReadOnlyCollection;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.pathfinding.IPathItem;
|
||||
import appeng.util.IWorldCallable;
|
||||
import appeng.util.ReadOnlyCollection;
|
||||
@@ -164,6 +165,8 @@ public class GridNode implements IGridNode, IPathItem
|
||||
{
|
||||
final Object tracker = new Object();
|
||||
|
||||
CraftingGridCache.pauseRebuilds();
|
||||
|
||||
Deque<GridNode> nextRun = new ArrayDeque<>();
|
||||
nextRun.add( this );
|
||||
|
||||
@@ -203,6 +206,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
}
|
||||
}
|
||||
}
|
||||
CraftingGridCache.unpauseRebuilds();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -114,6 +114,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
private IStorageGrid storageGrid;
|
||||
private IEnergyGrid energyGrid;
|
||||
private boolean updateList = false;
|
||||
private static int pauseRebuilds = 0;
|
||||
private static Set<CraftingGridCache> rebuildNeeded = new HashSet<>();
|
||||
|
||||
public CraftingGridCache( final IGrid grid )
|
||||
{
|
||||
@@ -240,8 +242,34 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||
// nothing!
|
||||
}
|
||||
|
||||
public static void pauseRebuilds()
|
||||
{
|
||||
pauseRebuilds++;
|
||||
}
|
||||
|
||||
public static void unpauseRebuilds()
|
||||
{
|
||||
pauseRebuilds--;
|
||||
if (pauseRebuilds == 0 && rebuildNeeded.size() > 0)
|
||||
{
|
||||
ImmutableSet<CraftingGridCache> needed = ImmutableSet.copyOf(rebuildNeeded);
|
||||
rebuildNeeded.clear();
|
||||
for ( CraftingGridCache cache: needed )
|
||||
{
|
||||
cache.updatePatterns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePatterns()
|
||||
{
|
||||
// coalesce change events during a grid traversal to a single rebuild
|
||||
if (pauseRebuilds != 0)
|
||||
{
|
||||
rebuildNeeded.add(this);
|
||||
return;
|
||||
}
|
||||
|
||||
final Map<IAEItemStack, ImmutableList<ICraftingPatternDetails>> oldItems = this.craftableItems;
|
||||
|
||||
// erase list.
|
||||
|
||||
+39
-35
@@ -47,6 +47,7 @@ public class TickManagerCache implements ITickManager
|
||||
private final HashMap<IGridNode, TickTracker> sleeping = new HashMap<>();
|
||||
private final HashMap<IGridNode, TickTracker> awake = new HashMap<>();
|
||||
private final PriorityQueue<TickTracker> upcomingTicks = new PriorityQueue<>();
|
||||
|
||||
private long currentTick = 0;
|
||||
|
||||
public TickManagerCache( final IGrid g )
|
||||
@@ -80,50 +81,52 @@ public class TickManagerCache implements ITickManager
|
||||
public void onUpdateTick()
|
||||
{
|
||||
TickTracker tt = null;
|
||||
|
||||
try
|
||||
{
|
||||
this.currentTick++;
|
||||
|
||||
while( !this.upcomingTicks.isEmpty() )
|
||||
{
|
||||
tt = this.upcomingTicks.peek();
|
||||
final int diff = (int) ( this.currentTick - tt.getLastTick() );
|
||||
if( diff >= tt.getCurrentRate() )
|
||||
|
||||
// Stop once it reaches a TickTracker running at a later tick
|
||||
if( tt.getNextTick() > this.currentTick )
|
||||
{
|
||||
// remove tt..
|
||||
this.upcomingTicks.poll();
|
||||
final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff );
|
||||
|
||||
switch( mod )
|
||||
{
|
||||
case FASTER:
|
||||
tt.setRate( tt.getCurrentRate() - 2 );
|
||||
break;
|
||||
case IDLE:
|
||||
tt.setRate( tt.getRequest().maxTickRate );
|
||||
break;
|
||||
case SAME:
|
||||
break;
|
||||
case SLEEP:
|
||||
this.sleepDevice( tt.getNode() );
|
||||
break;
|
||||
case SLOWER:
|
||||
tt.setRate( tt.getCurrentRate() + 1 );
|
||||
break;
|
||||
case URGENT:
|
||||
tt.setRate( 0 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( this.awake.containsKey( tt.getNode() ) )
|
||||
{
|
||||
this.addToQueue( tt );
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
this.upcomingTicks.poll();
|
||||
|
||||
final int diff = (int) ( this.currentTick - tt.getLastTick() );
|
||||
final TickRateModulation mod = tt.getGridTickable().tickingRequest( tt.getNode(), diff );
|
||||
|
||||
switch( mod )
|
||||
{
|
||||
return; // done!
|
||||
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() ) )
|
||||
{
|
||||
this.addToQueue( tt );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,6 +258,7 @@ public class TickManagerCache implements ITickManager
|
||||
final TickTracker gt = this.sleeping.get( node );
|
||||
this.sleeping.remove( node );
|
||||
this.awake.put( node, gt );
|
||||
this.upcomingTicks.remove( gt );
|
||||
this.addToQueue( gt );
|
||||
|
||||
return true;
|
||||
|
||||
+22
-21
@@ -37,7 +37,6 @@ public class TickTracker implements Comparable<TickTracker>
|
||||
private final TickingRequest request;
|
||||
private final IGridTickable gt;
|
||||
private final IGridNode node;
|
||||
private final TickManagerCache host;
|
||||
|
||||
private final long LastFiveTicksTime = 0;
|
||||
|
||||
@@ -51,7 +50,6 @@ public class TickTracker implements Comparable<TickTracker>
|
||||
this.node = node;
|
||||
this.setCurrentRate( ( req.minTickRate + req.maxTickRate ) / 2 );
|
||||
this.setLastTick( currentTick );
|
||||
this.host = tickManagerCache;
|
||||
}
|
||||
|
||||
public long getAvgNanos()
|
||||
@@ -59,27 +57,25 @@ public class TickTracker implements Comparable<TickTracker>
|
||||
return( this.LastFiveTicksTime / 5 );
|
||||
}
|
||||
|
||||
public void setRate( final int rate )
|
||||
{
|
||||
this.setCurrentRate( rate );
|
||||
|
||||
if( this.getCurrentRate() < this.getRequest().minTickRate )
|
||||
{
|
||||
this.setCurrentRate( this.getRequest().minTickRate );
|
||||
}
|
||||
|
||||
if( this.getCurrentRate() > this.getRequest().maxTickRate )
|
||||
{
|
||||
this.setCurrentRate( this.getRequest().maxTickRate );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( @Nonnull final TickTracker t )
|
||||
{
|
||||
final int nextTick = (int) ( ( this.getLastTick() - this.host.getCurrentTick() ) + this.getCurrentRate() );
|
||||
final int ts_nextTick = (int) ( ( t.getLastTick() - this.host.getCurrentTick() ) + t.getCurrentRate() );
|
||||
return nextTick - ts_nextTick;
|
||||
int next = Long.compare( this.getNextTick(), t.getNextTick() );
|
||||
|
||||
if( next != 0 )
|
||||
{
|
||||
return next;
|
||||
}
|
||||
|
||||
int last = Long.compare( this.getLastTick(), t.getLastTick() );
|
||||
|
||||
if( last != 0 )
|
||||
{
|
||||
return last;
|
||||
}
|
||||
|
||||
return Integer.compare( this.getCurrentRate(), t.getCurrentRate() );
|
||||
|
||||
}
|
||||
|
||||
public void addEntityCrashInfo( final CrashReportCategory crashreportcategory )
|
||||
@@ -111,7 +107,12 @@ public class TickTracker implements Comparable<TickTracker>
|
||||
|
||||
public void setCurrentRate( final int currentRate )
|
||||
{
|
||||
this.currentRate = currentRate;
|
||||
this.currentRate = Math.min( this.getRequest().maxTickRate, Math.max( this.getRequest().minTickRate, currentRate ) );
|
||||
}
|
||||
|
||||
public long getNextTick()
|
||||
{
|
||||
return this.lastTick + this.currentRate;
|
||||
}
|
||||
|
||||
public long getLastTick()
|
||||
|
||||
@@ -179,25 +179,29 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
final IMEMonitor<IAEItemStack> cell = this.getProxy()
|
||||
.getStorage()
|
||||
.getInventory(
|
||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
||||
|
||||
if( allItems )
|
||||
{
|
||||
final IAEItemStack input = this.getDisplayed().copy();
|
||||
IItemHandler inv = new PlayerMainInvWrapper( player.inventory );
|
||||
|
||||
for( int x = 0; x < inv.getSlots(); x++ )
|
||||
if( this.getDisplayed() != null )
|
||||
{
|
||||
final ItemStack targetStack = inv.getStackInSlot( x );
|
||||
if( input.equals( targetStack ) )
|
||||
final IAEItemStack input = this.getDisplayed().copy();
|
||||
IItemHandler inv = new PlayerMainInvWrapper( player.inventory );
|
||||
|
||||
for( int x = 0; x < inv.getSlots(); x++ )
|
||||
{
|
||||
final ItemStack canExtract = inv.extractItem( x, targetStack.getCount(), true );
|
||||
if( !canExtract.isEmpty() )
|
||||
final ItemStack targetStack = inv.getStackInSlot( x );
|
||||
if( input.equals( targetStack ) )
|
||||
{
|
||||
input.setStackSize( canExtract.getCount() );
|
||||
final IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, input, new PlayerSource( player, this ) );
|
||||
inv.extractItem( x, failedToInsert == null ? canExtract.getCount() : canExtract.getCount() - (int) failedToInsert.getStackSize(),
|
||||
false );
|
||||
final ItemStack canExtract = inv.extractItem( x, targetStack.getCount(), true );
|
||||
if( !canExtract.isEmpty() )
|
||||
{
|
||||
input.setStackSize( canExtract.getCount() );
|
||||
final IAEItemStack failedToInsert = Platform.poweredInsert( energy, cell, input, new PlayerSource( player, this ) );
|
||||
inv.extractItem( x,
|
||||
failedToInsert == null ? canExtract.getCount() : canExtract.getCount() - (int) failedToInsert.getStackSize(),
|
||||
false );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,12 +38,14 @@ final class AESharedItemStack implements Comparable<AESharedItemStack>
|
||||
private final ItemStack itemStack;
|
||||
private final int itemId;
|
||||
private final int itemDamage;
|
||||
private final int hashCode;
|
||||
|
||||
public AESharedItemStack( final ItemStack itemStack )
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
this.itemId = Item.getIdFromItem( itemStack.getItem() );
|
||||
this.itemDamage = itemStack.getItemDamage();
|
||||
this.hashCode = this.makeHashCode();
|
||||
}
|
||||
|
||||
Bounds getBounds( final FuzzyMode fuzzy, final boolean ignoreMeta )
|
||||
@@ -69,7 +71,7 @@ final class AESharedItemStack implements Comparable<AESharedItemStack>
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTagCompound() ? this.itemStack.getTagCompound() : 0 );
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,6 +146,11 @@ final class AESharedItemStack implements Comparable<AESharedItemStack>
|
||||
return System.identityHashCode( this.itemStack.getTagCompound() ) - System.identityHashCode( b.getTagCompound() );
|
||||
}
|
||||
|
||||
private int makeHashCode()
|
||||
{
|
||||
return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTagCompound() ? this.itemStack.getTagCompound() : 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the lower and upper bounds for a specific shared itemstack.
|
||||
*/
|
||||
|
||||
@@ -10,22 +10,22 @@
|
||||
{
|
||||
"faces": {
|
||||
"down": {
|
||||
"texture": "#block"
|
||||
"texture": "#block", "cullface": "down"
|
||||
},
|
||||
"east": {
|
||||
"texture": "#block"
|
||||
"texture": "#block", "cullface": "east"
|
||||
},
|
||||
"north": {
|
||||
"texture": "#block"
|
||||
"texture": "#block", "cullface": "north"
|
||||
},
|
||||
"south": {
|
||||
"texture": "#block"
|
||||
"texture": "#block", "cullface": "south"
|
||||
},
|
||||
"up": {
|
||||
"texture": "#block"
|
||||
"texture": "#block", "cullface": "up"
|
||||
},
|
||||
"west": {
|
||||
"texture": "#block"
|
||||
"texture": "#block", "cullface": "west"
|
||||
}
|
||||
},
|
||||
"from": [
|
||||
@@ -43,6 +43,7 @@
|
||||
"faces": {
|
||||
"down": {
|
||||
"texture": "#quartz",
|
||||
"cullface": "down",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
@@ -50,6 +51,7 @@
|
||||
},
|
||||
"east": {
|
||||
"texture": "#quartz",
|
||||
"cullface": "east",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
@@ -57,6 +59,7 @@
|
||||
},
|
||||
"north": {
|
||||
"texture": "#quartz",
|
||||
"cullface": "north",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
@@ -64,6 +67,7 @@
|
||||
},
|
||||
"south": {
|
||||
"texture": "#quartz",
|
||||
"cullface": "south",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
@@ -71,6 +75,7 @@
|
||||
},
|
||||
"up": {
|
||||
"texture": "#quartz",
|
||||
"cullface": "up",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
@@ -78,6 +83,7 @@
|
||||
},
|
||||
"west": {
|
||||
"texture": "#quartz",
|
||||
"cullface": "west",
|
||||
"uvlightmap": {
|
||||
"block": 0.007,
|
||||
"sky": 0.007
|
||||
|
||||
Reference in New Issue
Block a user