More compile things

This commit is contained in:
covers1624
2020-06-02 15:12:30 +09:30
parent 404ef5624b
commit 3f5c299d09
111 changed files with 838 additions and 873 deletions
+7 -6
View File
@@ -31,6 +31,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import appeng.api.exceptions.FailedConnectionException;
@@ -285,7 +286,7 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public World getWorld()
public IWorld getWorld()
{
return this.gridProxy.getLocation().getWorld();
}
@@ -331,8 +332,8 @@ public class GridNode implements IGridNode, IPathItem
{
if( this.myGrid == null )
{
final CompoundNBT node = nodeData.getCompoundTag( name );
this.playerID = node.getInteger( "p" );
final CompoundNBT node = nodeData.getCompound( name );
this.playerID = node.getInt( "p" );
this.setLastSecurityKey( node.getLong( "k" ) );
final long storageID = node.getLong( "g" );
@@ -356,11 +357,11 @@ public class GridNode implements IGridNode, IPathItem
node.putLong( "k", this.getLastSecurityKey() );
node.putLong( "g", this.myStorage.getID() );
nodeData.setTag( name, node );
nodeData.put( name, node );
}
else
{
nodeData.removeTag( name );
nodeData.remove( name );
}
}
@@ -512,7 +513,7 @@ public class GridNode implements IGridNode, IPathItem
}
}
private IGridHost findGridHost( final World world, final int x, final int y, final int z )
private IGridHost findGridHost( final IWorld world, final int x, final int y, final int z )
{
final BlockPos pos = new BlockPos( x, y, z );
if( world.isBlockLoaded( pos ) )
+2 -1
View File
@@ -77,6 +77,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.crafting.CraftingJob;
import appeng.crafting.CraftingLink;
import appeng.crafting.CraftingLinkNexus;
@@ -470,7 +471,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
{
for( final IAEItemStack ais : this.craftableItems.keySet() )
{
if( ais.getItem() == whatToCraft.getItem() && ( !ais.getItem().getHasSubtypes() || ais.getItemDamage() == whatToCraft.getItemDamage() ) )
if( ais.getItem() == whatToCraft.getItem() && ( !ais.getItem().isDamageable() || ais.getItemDamage() == whatToCraft.getItemDamage() ) )
{
// TODO: check if OK
// TODO: this is slightly hacky, but fine as long as we only deal with itemstacks
+1
View File
@@ -50,6 +50,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.me.helpers.BaseActionSource;
import appeng.me.helpers.GenericInterestManager;
import appeng.me.helpers.MachineSource;
+1
View File
@@ -47,6 +47,7 @@ import appeng.api.networking.pathing.IPathingGrid;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.core.stats.IAdvancementTrigger;
+1 -1
View File
@@ -26,7 +26,7 @@ import com.google.common.base.Preconditions;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.ReportedException;
import net.minecraft.crash.ReportedException;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
+7 -7
View File
@@ -90,17 +90,17 @@ public class TickTracker implements Comparable<TickTracker>
part.addEntityCrashInfo( crashreportcategory );
}
crashreportcategory.addCrashSection( "CurrentTickRate", this.getCurrentRate() );
crashreportcategory.addCrashSection( "MinTickRate", this.getRequest().minTickRate );
crashreportcategory.addCrashSection( "MaxTickRate", this.getRequest().maxTickRate );
crashreportcategory.addCrashSection( "MachineType", this.getGridTickable().getClass().getName() );
crashreportcategory.addCrashSection( "GridBlockType", this.getNode().getGridBlock().getClass().getName() );
crashreportcategory.addCrashSection( "ConnectedSides", this.getNode().getConnectedSides() );
crashreportcategory.addDetail( "CurrentTickRate", this.getCurrentRate() );
crashreportcategory.addDetail( "MinTickRate", this.getRequest().minTickRate );
crashreportcategory.addDetail( "MaxTickRate", this.getRequest().maxTickRate );
crashreportcategory.addDetail( "MachineType", this.getGridTickable().getClass().getName() );
crashreportcategory.addDetail( "GridBlockType", this.getNode().getGridBlock().getClass().getName() );
crashreportcategory.addDetail( "ConnectedSides", this.getNode().getConnectedSides() );
final DimensionalCoord dc = this.getNode().getGridBlock().getLocation();
if( dc != null )
{
crashreportcategory.addCrashSection( "Location", dc );
crashreportcategory.addDetail( "Location", dc );
}
}
@@ -34,10 +34,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.fml.hooks.BasicEventHooks;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.PowerMultiplier;
@@ -65,6 +64,7 @@ import appeng.api.storage.data.IItemList;
import appeng.api.util.WorldCoord;
import appeng.container.ContainerNull;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.crafting.CraftBranchFailure;
import appeng.crafting.CraftingJob;
import appeng.crafting.CraftingLink;
@@ -390,7 +390,6 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
}
}
private void markDirty()
@@ -779,9 +778,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( details.isCraftable() )
{
FMLCommonHandler.instance()
.firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ),
details.getOutput( ic, this.getWorld() ), ic );
BasicEventHooks.firePlayerCraftingEvent( Platform.getPlayer( (ServerWorld) getWorld() ), details.getOutput( ic, this.getWorld() ), ic );
for( int x = 0; x < ic.getSizeInventory(); x++ )
{
@@ -1003,19 +1000,18 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
final int hash = System.identityHashCode( this );
final int hmm = this.finalOutput == null ? 0 : this.finalOutput.hashCode();
return Long.toString( now, Character.MAX_RADIX ) + '-' + Integer.toString( hash, Character.MAX_RADIX ) + '-' + Integer.toString( hmm,
Character.MAX_RADIX );
return Long.toString( now, Character.MAX_RADIX ) + '-' + Integer.toString( hash, Character.MAX_RADIX ) + '-' + Integer.toString( hmm, Character.MAX_RADIX );
}
private CompoundNBT generateLinkData( final String craftingID, final boolean standalone, final boolean req )
{
final CompoundNBT tag = new CompoundNBT();
tag.putString("CraftID", craftingID);
tag.putBoolean("canceled", false);
tag.putBoolean("done", false);
tag.putBoolean("standalone", standalone);
tag.putBoolean("req", req);
tag.putString( "CraftID", craftingID );
tag.putBoolean( "canceled", false );
tag.putBoolean( "done", false );
tag.putBoolean( "standalone", standalone );
tag.putBoolean( "req", req );
return tag;
}
@@ -1144,16 +1140,16 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public void writeToNBT( final CompoundNBT data )
{
data.setTag( "finalOutput", this.writeItem( this.finalOutput ) );
data.setTag( "inventory", this.writeList( this.inventory.getItemList() ) );
data.putBoolean("waiting", this.waiting);
data.putBoolean("isComplete", this.isComplete);
data.put( "finalOutput", this.writeItem( this.finalOutput ) );
data.put( "inventory", this.writeList( this.inventory.getItemList() ) );
data.putBoolean( "waiting", this.waiting );
data.putBoolean( "isComplete", this.isComplete );
if( this.myLastLink != null )
{
final CompoundNBT link = new CompoundNBT();
this.myLastLink.writeToNBT( link );
data.setTag( "link", link );
data.put( "link", link );
}
final ListNBT list = new ListNBT();
@@ -1161,11 +1157,11 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
{
final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
item.putLong( "craftingProgress", e.getValue().value );
list.appendTag( item );
list.add( item );
}
data.setTag( "tasks", list );
data.put( "tasks", list );
data.setTag( "waitingFor", this.writeList( this.waitingFor ) );
data.put( "waitingFor", this.writeList( this.waitingFor ) );
data.putLong( "elapsedTime", this.getElapsedTime() );
data.putLong( "startItemCount", this.getStartItemCount() );
@@ -1178,7 +1174,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( finalOutput2 != null )
{
finalOutput2.write(out);
finalOutput2.writeToNBT( out );
}
return out;
@@ -1190,7 +1186,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
for( final IAEItemStack ais : myList )
{
out.appendTag( this.writeItem( ais ) );
out.add( this.writeItem( ais ) );
}
return out;
@@ -1214,8 +1210,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
public void readFromNBT( final CompoundNBT data )
{
this.finalOutput = AEItemStack.fromNBT( (CompoundNBT) data.getTag( "finalOutput" ) );
for( final IAEItemStack ais : this.readList( (ListNBT) data.getTag( "inventory" ) ) )
this.finalOutput = AEItemStack.fromNBT( data.getCompound( "finalOutput" ) );
for( final IAEItemStack ais : this.readList( data.getList( "inventory", 10 ) ) )
{
this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc );
}
@@ -1223,17 +1219,17 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.waiting = data.getBoolean( "waiting" );
this.isComplete = data.getBoolean( "isComplete" );
if( data.contains("link") )
if( data.contains( "link" ) )
{
final CompoundNBT link = data.getCompoundTag( "link" );
final CompoundNBT link = data.getCompound( "link" );
this.myLastLink = new CraftingLink( link, this );
this.submitLink( this.myLastLink );
}
final ListNBT list = data.getTagList( "tasks", 10 );
for( int x = 0; x < list.tagCount(); x++ )
final ListNBT list = data.getList( "tasks", 10 );
for( int x = 0; x < list.size(); x++ )
{
final CompoundNBT item = list.getCompoundTagAt( x );
final CompoundNBT item = list.getCompound( x );
final IAEItemStack pattern = AEItemStack.fromNBT( item );
if( pattern != null && pattern.getItem() instanceof ICraftingPatternItem )
{
@@ -1248,7 +1244,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
}
}
this.waitingFor = this.readList( (ListNBT) data.getTag( "waitingFor" ) );
this.waitingFor = this.readList( data.getList( "waitingFor", 10 ) );
for( final IAEItemStack is : this.waitingFor )
{
this.postCraftingStatusChange( is.copy() );
@@ -1289,9 +1285,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return out;
}
for( int x = 0; x < tag.tagCount(); x++ )
for( int x = 0; x < tag.size(); x++ )
{
final IAEItemStack ais = AEItemStack.fromNBT( tag.getCompoundTagAt( x ) );
final IAEItemStack ais = AEItemStack.fromNBT( tag.getCompound( x ) );
if( ais != null )
{
out.add( ais );
@@ -28,6 +28,7 @@ import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.util.WorldCoord;
import appeng.core.Api;
import appeng.me.cluster.IAECluster;
import appeng.me.cluster.IAEMultiBlock;
import appeng.me.cluster.MBCalculator;
@@ -22,14 +22,13 @@ package appeng.me.cluster.implementations;
import java.util.Iterator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.DimensionManager;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import appeng.api.AEApi;
import appeng.api.events.LocatableEventAnnounce;
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
import appeng.api.exceptions.FailedConnectionException;
@@ -39,6 +38,7 @@ import appeng.api.networking.IGridNode;
import appeng.api.util.AEPartLocation;
import appeng.api.util.WorldCoord;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.me.cache.helpers.ConnectionWrapper;
import appeng.me.cluster.IAECluster;
import appeng.tile.qnb.TileQuantumBridge;
@@ -156,10 +156,7 @@ public class QuantumCluster implements ILocatable, IAECluster
}
}
sideA.connection = sideB.connection = new ConnectionWrapper( Api.INSTANCE
.grid()
.createGridConnection( sideA.getNode(),
sideB.getNode() ) );
sideA.connection = sideB.connection = new ConnectionWrapper( Api.INSTANCE.grid().createGridConnection( sideA.getNode(), sideB.getNode() ) );
}
catch( final FailedConnectionException e )
{
@@ -196,11 +193,11 @@ public class QuantumCluster implements ILocatable, IAECluster
final World theWorld = qc.center.getWorld();
if( !qc.isDestroyed )
{
final Chunk c = theWorld.getChunkFromBlockCoords( qc.center.getPos() );
if( c.isLoaded() )
ChunkPos cPos = new ChunkPos( qc.center.getPos() );
if( theWorld.getChunkProvider().isChunkLoaded( cPos ) )
{
final int id = theWorld.provider.getDimension();
final World cur = DimensionManager.getWorld( id );
final DimensionType id = theWorld.dimension.getType();
final World cur = theWorld.getServer().getWorld( id );
final TileEntity te = theWorld.getTileEntity( qc.center.getPos() );
return te != qc.center || theWorld != cur;
@@ -265,14 +262,12 @@ public class QuantumCluster implements ILocatable, IAECluster
@Override
public Iterator<IGridHost> getTiles()
{
return new ChainedIterator<>( this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3], this.getRing()[4], this
.getRing()[5], this.getRing()[6], this.getRing()[7], this.center );
return new ChainedIterator<>( this.getRing()[0], this.getRing()[1], this.getRing()[2], this.getRing()[3], this.getRing()[4], this.getRing()[5], this.getRing()[6], this.getRing()[7], this.center );
}
public boolean isCorner( final TileQuantumBridge tileQuantumBridge )
{
return this.getRing()[0] == tileQuantumBridge || this.getRing()[2] == tileQuantumBridge || this.getRing()[4] == tileQuantumBridge || this
.getRing()[6] == tileQuantumBridge;
return this.getRing()[0] == tileQuantumBridge || this.getRing()[2] == tileQuantumBridge || this.getRing()[4] == tileQuantumBridge || this.getRing()[6] == tileQuantumBridge;
}
@Override
@@ -88,7 +88,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
this.container = container;
this.tagCompound = o.getOrCreateTag();
this.storedItems = this.tagCompound.getShort( ITEM_TYPE_TAG );
this.storedItemCount = this.tagCompound.getInteger( ITEM_COUNT_TAG );
this.storedItemCount = this.tagCompound.getInt( ITEM_COUNT_TAG );
this.cellItems = null;
}
@@ -121,8 +121,8 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
final CompoundNBT g = new CompoundNBT();
v.writeToNBT( g );
this.tagCompound.setTag( ITEM_SLOT_KEYS[x], g );
this.tagCompound.setInteger( ITEM_SLOT_COUNT_KEYS[x], (int) v.getStackSize() );
this.tagCompound.put( ITEM_SLOT_KEYS[x], g );
this.tagCompound.putInt( ITEM_SLOT_COUNT_KEYS[x], (int) v.getStackSize() );
x++;
}
@@ -132,28 +132,28 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
this.storedItems = (short) this.cellItems.size();
if( this.cellItems.isEmpty() )
{
this.tagCompound.removeTag( ITEM_TYPE_TAG );
this.tagCompound.remove( ITEM_TYPE_TAG );
}
else
{
this.tagCompound.setShort( ITEM_TYPE_TAG, this.storedItems );
this.tagCompound.putShort( ITEM_TYPE_TAG, this.storedItems );
}
this.storedItemCount = itemCount;
if( itemCount == 0 )
{
this.tagCompound.removeTag( ITEM_COUNT_TAG );
this.tagCompound.remove( ITEM_COUNT_TAG );
}
else
{
this.tagCompound.setInteger( ITEM_COUNT_TAG, itemCount );
this.tagCompound.putInt( ITEM_COUNT_TAG, itemCount );
}
// clean any old crusty stuff...
for( ; x < oldStoredItems && x < this.maxItemTypes; x++ )
{
this.tagCompound.removeTag( ITEM_SLOT_KEYS[x] );
this.tagCompound.removeTag( ITEM_SLOT_COUNT_KEYS[x] );
this.tagCompound.remove( ITEM_SLOT_KEYS[x] );
this.tagCompound.remove( ITEM_SLOT_COUNT_KEYS[x] );
}
this.isPersisted = true;
@@ -195,8 +195,8 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
for( int slot = 0; slot < types; slot++ )
{
CompoundNBT compoundTag = this.tagCompound.getCompoundTag( ITEM_SLOT_KEYS[slot] );
int stackSize = this.tagCompound.getInteger( ITEM_SLOT_COUNT_KEYS[slot] );
CompoundNBT compoundTag = this.tagCompound.getCompound( ITEM_SLOT_KEYS[slot] );
int stackSize = this.tagCompound.getInt( ITEM_SLOT_COUNT_KEYS[slot] );
needsUpdate |= !this.loadCellItem( compoundTag, stackSize );
}
@@ -31,6 +31,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.items.contents.CellConfig;
import appeng.util.item.AEItemStack;
@@ -29,9 +29,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.StorageFilter;
@@ -43,6 +41,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IFluidStorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITickingMonitor
@@ -75,7 +74,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
@Override
public IAEFluidStack injectItems( final IAEFluidStack input, final Actionable type, final IActionSource src )
{
final int filled = this.handler.fill( input.getFluidStack(), type == Actionable.MODULATE );
final int filled = this.handler.fill( input.getFluidStack(), type.getFluidAction() );
if( filled == 0 )
{
@@ -100,9 +99,9 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
@Override
public IAEFluidStack extractItems( final IAEFluidStack request, final Actionable type, final IActionSource src )
{
final FluidStack removed = this.handler.drain( request.getFluidStack(), type == Actionable.MODULATE );
final FluidStack removed = this.handler.drain( request.getFluidStack(), type.getFluidAction() );
if( removed == null || removed.amount == 0 )
if( removed == null || removed.getAmount() == 0 )
{
return null;
}
@@ -113,7 +112,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
}
final IAEFluidStack o = request.copy();
o.setStackSize( removed.amount );
o.setStackSize( removed.getAmount() );
return o;
}
@@ -162,8 +161,8 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
}
else
{
final int newSize = newIS == null ? 0 : newIS.amount;
final int diff = newSize - ( oldIS == null ? 0 : oldIS.amount );
final int newSize = newIS == null ? 0 : newIS.getAmount();
final int diff = newSize - ( oldIS == null ? 0 : oldIS.getAmount() );
IAEFluidStack stack = null;
@@ -41,6 +41,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.ItemSlot;
@@ -28,6 +28,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
public class NullInventory<T extends IAEStack<T>> implements IMEInventoryHandler<T>
@@ -32,6 +32,7 @@ import appeng.api.storage.IStorageChannel;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.Api;
import appeng.me.GridAccessException;
import appeng.tile.misc.TileSecurityStation;