Ported to 1.7
This commit is contained in:
@@ -3,7 +3,7 @@ package appeng.me;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ import java.util.concurrent.Callable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.GridNotification;
|
||||
@@ -106,7 +106,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
node.setLong( "k", lastSecurityKey );
|
||||
node.setLong( "g", myStorage.getID() );
|
||||
|
||||
nodeData.setCompoundTag( name, node );
|
||||
nodeData.setTag( name, node );
|
||||
}
|
||||
else
|
||||
nodeData.removeTag( name );
|
||||
@@ -345,7 +345,7 @@ public class GridNode implements IGridNode, IPathItem
|
||||
{
|
||||
if ( world.blockExists( x, y, z ) )
|
||||
{
|
||||
TileEntity te = world.getBlockTileEntity( x, y, z );
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
if ( te instanceof IGridHost )
|
||||
return (IGridHost) te;
|
||||
}
|
||||
|
||||
+2
-5
@@ -8,9 +8,6 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
import appeng.core.AELog;
|
||||
@@ -55,7 +52,7 @@ public class GridStorage implements IGridStorage
|
||||
|
||||
try
|
||||
{
|
||||
byte[] dbata = Base64.decode( input );
|
||||
byte[] dbata = javax.xml.bind.DatatypeConverter.parseBase64Binary( input );
|
||||
myTag = CompressedStreamTools.readCompressed( new ByteArrayInputStream( dbata ) );
|
||||
}
|
||||
catch (Throwable t)
|
||||
@@ -88,7 +85,7 @@ public class GridStorage implements IGridStorage
|
||||
{
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
CompressedStreamTools.writeCompressed( data, out );
|
||||
return new String( Base64.encode( out.toByteArray() ), "UTF-8" );
|
||||
return javax.xml.bind.DatatypeConverter.printBase64Binary( out.toByteArray() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
|
||||
Vendored
+1
-1
@@ -56,7 +56,7 @@ public class SecurityCache implements IGridCache, ISecurityGrid
|
||||
@Override
|
||||
public boolean hasPermission(EntityPlayer player, SecurityPermissions perm)
|
||||
{
|
||||
return hasPermission( WorldSettings.getInstance().getPlayerID( player.username ), perm );
|
||||
return hasPermission( WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ), perm );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@ package appeng.me.cluster;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.Platform;
|
||||
@@ -60,7 +60,7 @@ public abstract class MBCalculator
|
||||
|
||||
public boolean isValidTileAt(World w, int x, int y, int z)
|
||||
{
|
||||
return isValidTile( w.getBlockTileEntity( x, y, z ) );
|
||||
return isValidTile( w.getTileEntity( x, y, z ) );
|
||||
}
|
||||
|
||||
public void calculateMultiblock(World worldObj, WorldCoord loc)
|
||||
@@ -173,7 +173,7 @@ public abstract class MBCalculator
|
||||
{
|
||||
for (int z = minz; z <= maxz; z++)
|
||||
{
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( isValidTile( te ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class QuantumCalculator extends MBCalculator
|
||||
{
|
||||
for (int z = min.z; z <= max.z; z++)
|
||||
{
|
||||
TileQuantumBridge te = (TileQuantumBridge) w.getBlockTileEntity( x, y, z );
|
||||
TileQuantumBridge te = (TileQuantumBridge) w.getTileEntity( x, y, z );
|
||||
|
||||
byte flags = 0;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class QuantumCalculator extends MBCalculator
|
||||
{
|
||||
for (int z = min.z; z <= max.z; z++)
|
||||
{
|
||||
IAEMultiBlock te = (IAEMultiBlock) w.getBlockTileEntity( x, y, z );
|
||||
IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( x, y, z );
|
||||
|
||||
if ( !te.isValid() )
|
||||
return false;
|
||||
|
||||
@@ -3,9 +3,8 @@ package appeng.me.cluster.implementations;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.events.LocatableEventAnnounce;
|
||||
@@ -19,6 +18,7 @@ import appeng.me.cache.helpers.ConnectionWrapper;
|
||||
import appeng.me.cluster.IAECluster;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import appeng.util.iterators.ChainedIterator;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
@@ -62,7 +62,7 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
{
|
||||
if ( !qc.isDestroyed )
|
||||
{
|
||||
Chunk c = qc.center.worldObj.getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord );
|
||||
Chunk c = qc.center.getWorldObj().getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord );
|
||||
if ( c.isChunkLoaded )
|
||||
return false;
|
||||
}
|
||||
@@ -70,10 +70,10 @@ public class QuantumCluster implements ILocatable, IAECluster
|
||||
return true;
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void onUnload(WorldEvent.Unload e)
|
||||
{
|
||||
if ( center.worldObj == e.world )
|
||||
if ( center.getWorldObj() == e.world )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SpatialPylonCalculator extends MBCalculator
|
||||
{
|
||||
for (int z = min.z; z <= max.z; z++)
|
||||
{
|
||||
TileSpatialPylon te = (TileSpatialPylon) w.getBlockTileEntity( x, y, z );
|
||||
TileSpatialPylon te = (TileSpatialPylon) w.getTileEntity( x, y, z );
|
||||
te.updateStatus( c );
|
||||
c.line.add( (te) );
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class SpatialPylonCalculator extends MBCalculator
|
||||
{
|
||||
for (int z = min.z; z <= max.z; z++)
|
||||
{
|
||||
IAEMultiBlock te = (IAEMultiBlock) w.getBlockTileEntity( x, y, z );
|
||||
IAEMultiBlock te = (IAEMultiBlock) w.getTileEntity( x, y, z );
|
||||
|
||||
if ( !te.isValid() )
|
||||
return false;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.EnumSet;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.GridNotification;
|
||||
@@ -82,7 +82,7 @@ public class AENetworkProxy implements IGridBlock
|
||||
}
|
||||
else if ( node != null && owner != null )
|
||||
{
|
||||
node.setPlayerID( WorldSettings.getInstance().getPlayerID( owner.username ) );
|
||||
node.setPlayerID( WorldSettings.getInstance().getPlayerID( owner.getCommandSenderName() ) );
|
||||
owner = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package appeng.me.storage;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
|
||||
@@ -8,8 +8,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -99,31 +97,32 @@ public class CellInventory implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
NBTTagCompound g = new NBTTagCompound();
|
||||
v.writeToNBT( g );
|
||||
tagCompound.setCompoundTag( ITEM_SLOT_ARR[x], g );
|
||||
tagCompound.setTag( ITEM_SLOT_ARR[x], g );
|
||||
}
|
||||
|
||||
NBTBase tagSlotCount = tagCompound.getTag( ITEM_SLOTCOUNT_ARR[x] );
|
||||
if ( tagSlotCount instanceof NBTTagInt )
|
||||
((NBTTagInt) tagSlotCount).data = (int) v.getStackSize();
|
||||
else
|
||||
tagCompound.setInteger( ITEM_SLOTCOUNT_ARR[x], (int) v.getStackSize() );
|
||||
/*
|
||||
* NBTBase tagSlotCount = tagCompound.getTag( ITEM_SLOTCOUNT_ARR[x] ); if ( tagSlotCount instanceof
|
||||
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
|
||||
*/
|
||||
tagCompound.setInteger( ITEM_SLOTCOUNT_ARR[x], (int) v.getStackSize() );
|
||||
|
||||
x++;
|
||||
}
|
||||
|
||||
NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG );
|
||||
NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG );
|
||||
// NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG );
|
||||
// NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG );
|
||||
short oldStoreditems = storedItems;
|
||||
|
||||
if ( tagType instanceof NBTTagShort )
|
||||
((NBTTagShort) tagType).data = storedItems = (short) cellItems.size();
|
||||
else
|
||||
tagCompound.setShort( ITEM_TYPE_TAG, storedItems = (short) cellItems.size() );
|
||||
/*
|
||||
* if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size();
|
||||
* else
|
||||
*/
|
||||
tagCompound.setShort( ITEM_TYPE_TAG, storedItems = (short) cellItems.size() );
|
||||
|
||||
if ( tagCount instanceof NBTTagInt )
|
||||
((NBTTagInt) tagCount).data = storedItemCount = itemCount;
|
||||
else
|
||||
tagCompound.setInteger( ITEM_COUNT_TAG, storedItemCount = itemCount );
|
||||
/*
|
||||
* if ( tagCount instanceof NBTTagInt ) ((NBTTagInt) tagCount).data = storedItemCount = itemCount; else
|
||||
*/
|
||||
tagCompound.setInteger( ITEM_COUNT_TAG, storedItemCount = itemCount );
|
||||
|
||||
// clean any old crusty stuff...
|
||||
for (; x < oldStoreditems && x < MAX_ITEM_TYPES; x++)
|
||||
@@ -327,9 +326,9 @@ public class CellInventory implements IMEInventory<IAEItemStack>
|
||||
|
||||
public static boolean isBlackListed(IAEItemStack input)
|
||||
{
|
||||
if ( blackList.contains( (OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET) | input.getItem().itemID ) )
|
||||
if ( blackList.contains( (OreDictionary.WILDCARD_VALUE << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) ) )
|
||||
return true;
|
||||
return blackList.contains( (input.getItemDamage() << Platform.DEF_OFFSET) | input.getItem().itemID );
|
||||
return blackList.contains( (input.getItemDamage() << Platform.DEF_OFFSET) | Item.getIdFromItem( input.getItem() ) );
|
||||
}
|
||||
|
||||
private boolean isEmpty(IMEInventory meinv)
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
|
||||
Reference in New Issue
Block a user