More compile things
This commit is contained in:
@@ -26,9 +26,8 @@ package appeng.api.parts;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
|
||||||
@@ -79,7 +78,7 @@ public interface IFacadeContainer
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
boolean readFromStream( ByteBuf data ) throws IOException;
|
boolean readFromStream( PacketBuffer data ) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read from NBT
|
* read from NBT
|
||||||
@@ -95,7 +94,7 @@ public interface IFacadeContainer
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
void writeToStream( ByteBuf data ) throws IOException;
|
void writeToStream( PacketBuffer data ) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if there are no facades.
|
* @return true if there are no facades.
|
||||||
|
|||||||
@@ -22,13 +22,11 @@ package appeng.facade;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.parts.IFacadeContainer;
|
import appeng.api.parts.IFacadeContainer;
|
||||||
import appeng.api.parts.IFacadePart;
|
import appeng.api.parts.IFacadePart;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
@@ -117,28 +115,25 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean readFromStream( final ByteBuf out ) throws IOException
|
public boolean readFromStream( final PacketBuffer out ) throws IOException
|
||||||
{
|
{
|
||||||
final int facadeSides = out.readByte();
|
final int facadeSides = out.readByte();
|
||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
final int[] ids = new int[2];
|
|
||||||
for( int x = 0; x < this.facades; x++ )
|
for( int x = 0; x < this.facades; x++ )
|
||||||
{
|
{
|
||||||
final AEPartLocation side = AEPartLocation.fromOrdinal( x );
|
final AEPartLocation side = AEPartLocation.fromOrdinal( x );
|
||||||
final int ix = ( 1 << x );
|
final int ix = ( 1 << x );
|
||||||
if( ( facadeSides & ix ) == ix )
|
if( ( facadeSides & ix ) == ix )
|
||||||
{
|
{
|
||||||
ids[0] = out.readInt();
|
final int id = Math.abs( out.readInt() );
|
||||||
//ids[1] = out.readInt();
|
|
||||||
ids[0] = Math.abs( ids[0] );
|
|
||||||
|
|
||||||
Optional<Item> maybeFacadeItem = Api.INSTANCE.definitions().items().facade().maybeItem();
|
Optional<Item> maybeFacadeItem = Api.INSTANCE.definitions().items().facade().maybeItem();
|
||||||
if( maybeFacadeItem.isPresent() )
|
if( maybeFacadeItem.isPresent() )
|
||||||
{
|
{
|
||||||
final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
|
final ItemFacade ifa = (ItemFacade) maybeFacadeItem.get();
|
||||||
final ItemStack facade = ifa.createFromIDs( ids );
|
final ItemStack facade = ifa.createFromID( id );
|
||||||
if( facade != null )
|
if( facade != null )
|
||||||
{
|
{
|
||||||
changed = changed || this.storage.getFacade( x ) == null;
|
changed = changed || this.storage.getFacade( x ) == null;
|
||||||
@@ -180,7 +175,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToStream( final ByteBuf out ) throws IOException
|
public void writeToStream( final PacketBuffer out ) throws IOException
|
||||||
{
|
{
|
||||||
int facadeSides = 0;
|
int facadeSides = 0;
|
||||||
for( int x = 0; x < this.facades; x++ )
|
for( int x = 0; x < this.facades; x++ )
|
||||||
@@ -198,9 +193,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
if( part != null )
|
if( part != null )
|
||||||
{
|
{
|
||||||
final int itemID = Item.getIdFromItem( part.getItem() );
|
final int itemID = Item.getIdFromItem( part.getItem() );
|
||||||
//final int dmgValue = part.getItemDamage();
|
|
||||||
out.writeInt( itemID * ( part.notAEFacade() ? -1 : 1 ) );
|
out.writeInt( itemID * ( part.notAEFacade() ? -1 : 1 ) );
|
||||||
//out.writeInt( dmgValue );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockRenderType;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
@@ -42,6 +43,7 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.exceptions.MissingDefinitionException;
|
import appeng.api.exceptions.MissingDefinitionException;
|
||||||
@@ -59,7 +61,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static final String TAG_ITEM_ID = "item";
|
private static final String TAG_ITEM_ID = "item";
|
||||||
private static final String TAG_DAMAGE = "damage";
|
|
||||||
|
|
||||||
private List<ItemStack> subTypes = null;
|
private List<ItemStack> subTypes = null;
|
||||||
|
|
||||||
@@ -105,9 +106,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
if( this.subTypes == null )
|
if( this.subTypes == null )
|
||||||
{
|
{
|
||||||
this.subTypes = new ArrayList<>( 1000 );
|
this.subTypes = new ArrayList<>( 1000 );
|
||||||
for( final Object blk : Block.REGISTRY )
|
for( final Block b : ForgeRegistries.BLOCKS )
|
||||||
{
|
{
|
||||||
final Block b = (Block) blk;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Item item = Item.getItemFromBlock( b );
|
final Item item = Item.getItemFromBlock( b );
|
||||||
@@ -135,16 +135,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasSimpleModel( BlockState blockState )
|
|
||||||
{
|
|
||||||
if( blockState.getRenderType() != EnumBlockRenderType.MODEL || blockState instanceof IExtendedBlockState )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return blockState.isFullCube();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack createFacadeForItem( final ItemStack itemStack, final boolean returnItem )
|
public ItemStack createFacadeForItem( final ItemStack itemStack, final boolean returnItem )
|
||||||
{
|
{
|
||||||
if( itemStack.isEmpty() )
|
if( itemStack.isEmpty() )
|
||||||
@@ -175,7 +165,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
|
|
||||||
final boolean areTileEntitiesEnabled = FacadeConfig.instance().allowTileEntityFacades();
|
final boolean areTileEntitiesEnabled = FacadeConfig.instance().allowTileEntityFacades();
|
||||||
final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed( block, metadata );
|
final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed( block, metadata );
|
||||||
final boolean isModel = blockState.getRenderType() == EnumBlockRenderType.MODEL;
|
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
|
||||||
|
|
||||||
final BlockState defaultState = block.getDefaultState();
|
final BlockState defaultState = block.getDefaultState();
|
||||||
final boolean isTileEntity = block.hasTileEntity( defaultState );
|
final boolean isTileEntity = block.hasTileEntity( defaultState );
|
||||||
@@ -194,8 +184,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
final ItemStack is = new ItemStack( this );
|
final ItemStack is = new ItemStack( this );
|
||||||
final CompoundNBT data = new CompoundNBT();
|
final CompoundNBT data = new CompoundNBT();
|
||||||
data.putString(TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString());
|
data.putString(TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString());
|
||||||
data.setInteger( TAG_DAMAGE, itemStack.getDamage() );
|
is.setTag( data );
|
||||||
is.setTagCompound( data );
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
@@ -224,7 +213,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResourceLocation itemId;
|
ResourceLocation itemId;
|
||||||
int itemDamage;
|
|
||||||
|
|
||||||
// Handle legacy facades
|
// Handle legacy facades
|
||||||
if( nbt.contains("x") )
|
if( nbt.contains("x") )
|
||||||
@@ -235,30 +223,28 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item item = Item.REGISTRY.getObjectById( data[0] );
|
Item item = Registry.ITEM.getByValue( data[0] );
|
||||||
if( item == null )
|
if( item == null )
|
||||||
{
|
{
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
itemId = item.getRegistryName();
|
itemId = item.getRegistryName();
|
||||||
itemDamage = data[1];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// First item is numeric item id, second is damage
|
// First item is numeric item id
|
||||||
itemId = new ResourceLocation( nbt.getString( TAG_ITEM_ID ) );
|
itemId = new ResourceLocation( nbt.getString( TAG_ITEM_ID ) );
|
||||||
itemDamage = nbt.getInteger( TAG_DAMAGE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item baseItem = Item.REGISTRY.getObject( itemId );
|
Item baseItem = ForgeRegistries.ITEMS.getValue( itemId );
|
||||||
|
|
||||||
if( baseItem == null )
|
if( baseItem == null )
|
||||||
{
|
{
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ItemStack( baseItem, 1, itemDamage );
|
return new ItemStack( baseItem, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -308,7 +294,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
return this.subTypes.get( 0 );
|
return this.subTypes.get( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack createFromIDs( final int[] ids )
|
public ItemStack createFromID( final int id )
|
||||||
{
|
{
|
||||||
ItemStack facadeStack = Api.INSTANCE
|
ItemStack facadeStack = Api.INSTANCE
|
||||||
.definitions()
|
.definitions()
|
||||||
@@ -318,7 +304,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to create a facade, while facades are being deactivated." ) );
|
.orElseThrow( () -> new MissingDefinitionException( "Tried to create a facade, while facades are being deactivated." ) );
|
||||||
|
|
||||||
// Convert back to a registry name...
|
// Convert back to a registry name...
|
||||||
Item item = Registry.ITEM.getByValue( ids[0] );
|
Item item = Registry.ITEM.getByValue( id );
|
||||||
if( item == null )
|
if( item == null )
|
||||||
{
|
{
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
@@ -326,7 +312,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
|
|
||||||
final CompoundNBT facadeTag = new CompoundNBT();
|
final CompoundNBT facadeTag = new CompoundNBT();
|
||||||
facadeTag.putString(TAG_ITEM_ID, item.getRegistryName().toString());
|
facadeTag.putString(TAG_ITEM_ID, item.getRegistryName().toString());
|
||||||
//facadeTag.setInteger( TAG_DAMAGE, ids[1] );
|
|
||||||
facadeStack.setTag( facadeTag );
|
facadeStack.setTag( facadeTag );
|
||||||
|
|
||||||
return facadeStack;
|
return facadeStack;
|
||||||
|
|||||||
@@ -25,11 +25,8 @@ import java.util.EnumSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
@@ -37,6 +34,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
@@ -46,7 +44,6 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.YesNo;
|
import appeng.api.config.YesNo;
|
||||||
import appeng.api.exceptions.FailedConnectionException;
|
import appeng.api.exceptions.FailedConnectionException;
|
||||||
import appeng.api.implementations.parts.IPartCable;
|
import appeng.api.implementations.parts.IPartCable;
|
||||||
@@ -69,6 +66,7 @@ import appeng.client.render.cablebus.CableBusRenderState;
|
|||||||
import appeng.client.render.cablebus.CableCoreType;
|
import appeng.client.render.cablebus.CableCoreType;
|
||||||
import appeng.client.render.cablebus.FacadeRenderState;
|
import appeng.client.render.cablebus.FacadeRenderState;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.facade.FacadeContainer;
|
import appeng.facade.FacadeContainer;
|
||||||
import appeng.helpers.AEMultiTile;
|
import appeng.helpers.AEMultiTile;
|
||||||
import appeng.me.GridConnection;
|
import appeng.me.GridConnection;
|
||||||
@@ -550,7 +548,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
private void updateRedstone()
|
private void updateRedstone()
|
||||||
{
|
{
|
||||||
final TileEntity te = this.getTile();
|
final TileEntity te = this.getTile();
|
||||||
this.hasRedstone = te.getWorld().isBlockIndirectlyGettingPowered( te.getPos() ) != 0 ? YesNo.YES : YesNo.NO;
|
this.hasRedstone = te.getWorld().getRedstonePowerFromNeighbors( te.getPos() ) != 0 ? YesNo.YES : YesNo.NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDynamicRender()
|
private void updateDynamicRender()
|
||||||
@@ -575,7 +573,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
{
|
{
|
||||||
final EnumSet<Direction> sides = EnumSet.allOf( Direction.class );
|
final EnumSet<Direction> sides = EnumSet.allOf( Direction.class );
|
||||||
|
|
||||||
for( final Direction s : Direction.VALUES )
|
for( final Direction s : Direction.values() )
|
||||||
{
|
{
|
||||||
if( this.getPart( s ) != null || this.isBlocked( s ) )
|
if( this.getPart( s ) != null || this.isBlocked( s ) )
|
||||||
{
|
{
|
||||||
@@ -930,7 +928,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToStream( final ByteBuf data ) throws IOException
|
public void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
int sides = 0;
|
int sides = 0;
|
||||||
for( int x = 0; x < 7; x++ )
|
for( int x = 0; x < 7; x++ )
|
||||||
@@ -951,8 +949,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
{
|
{
|
||||||
final ItemStack is = p.getItemStack( PartItemStack.NETWORK );
|
final ItemStack is = p.getItemStack( PartItemStack.NETWORK );
|
||||||
|
|
||||||
data.writeShort( Item.getIdFromItem( is.getItem() ) );
|
data.writeVarInt( Item.getIdFromItem( is.getItem() ) );
|
||||||
data.writeShort( is.getItemDamage() );
|
|
||||||
|
|
||||||
p.writeToStream( data );
|
p.writeToStream( data );
|
||||||
}
|
}
|
||||||
@@ -961,7 +958,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
this.getFacadeContainer().writeToStream( data );
|
this.getFacadeContainer().writeToStream( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean readFromStream( final ByteBuf data ) throws IOException
|
public boolean readFromStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
final byte sides = data.readByte();
|
final byte sides = data.readByte();
|
||||||
|
|
||||||
@@ -974,13 +971,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
{
|
{
|
||||||
IPart p = this.getPart( side );
|
IPart p = this.getPart( side );
|
||||||
|
|
||||||
final short itemID = data.readShort();
|
final int itemID = data.readVarInt();
|
||||||
final short dmgValue = data.readShort();
|
|
||||||
|
|
||||||
final Item myItem = Item.getItemById( itemID );
|
final Item myItem = Item.getItemById( itemID );
|
||||||
|
|
||||||
final ItemStack current = p != null ? p.getItemStack( PartItemStack.NETWORK ) : null;
|
final ItemStack current = p != null ? p.getItemStack( PartItemStack.NETWORK ) : null;
|
||||||
if( current != null && current.getItem() == myItem && current.getItemDamage() == dmgValue )
|
if( current != null && current.getItem() == myItem )
|
||||||
{
|
{
|
||||||
if( p.readFromStream( data ) )
|
if( p.readFromStream( data ) )
|
||||||
{
|
{
|
||||||
@@ -990,7 +986,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.removePart( side, false );
|
this.removePart( side, false );
|
||||||
side = this.addPart( new ItemStack( myItem, 1, dmgValue ), side, null, null );
|
side = this.addPart( new ItemStack( myItem, 1 ), side, null, null );
|
||||||
if( side != null )
|
if( side != null )
|
||||||
{
|
{
|
||||||
p = this.getPart( side );
|
p = this.getPart( side );
|
||||||
@@ -1018,7 +1014,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
|
|
||||||
public void writeToNBT( final CompoundNBT data )
|
public void writeToNBT( final CompoundNBT data )
|
||||||
{
|
{
|
||||||
data.setInteger( "hasRedstone", this.hasRedstone.ordinal() );
|
data.putInt( "hasRedstone", this.hasRedstone.ordinal() );
|
||||||
|
|
||||||
final IFacadeContainer fc = this.getFacadeContainer();
|
final IFacadeContainer fc = this.getFacadeContainer();
|
||||||
for( final AEPartLocation s : AEPartLocation.values() )
|
for( final AEPartLocation s : AEPartLocation.values() )
|
||||||
@@ -1029,13 +1025,13 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
if( part != null )
|
if( part != null )
|
||||||
{
|
{
|
||||||
final CompoundNBT def = new CompoundNBT();
|
final CompoundNBT def = new CompoundNBT();
|
||||||
part.getItemStack( PartItemStack.WORLD ).writeToNBT( def );
|
part.getItemStack( PartItemStack.WORLD ).write( def );
|
||||||
|
|
||||||
final CompoundNBT extra = new CompoundNBT();
|
final CompoundNBT extra = new CompoundNBT();
|
||||||
part.writeToNBT( extra );
|
part.writeToNBT( extra );
|
||||||
|
|
||||||
data.setTag( "def:" + this.getSide( part ).ordinal(), def );
|
data.put( "def:" + this.getSide( part ).ordinal(), def );
|
||||||
data.setTag( "extra:" + this.getSide( part ).ordinal(), extra );
|
data.put( "extra:" + this.getSide( part ).ordinal(), extra );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1062,21 +1058,21 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
|
|
||||||
public void readFromNBT( final CompoundNBT data )
|
public void readFromNBT( final CompoundNBT data )
|
||||||
{
|
{
|
||||||
if( data.hasKey( "hasRedstone" ) )
|
if( data.contains( "hasRedstone" ) )
|
||||||
{
|
{
|
||||||
this.hasRedstone = YesNo.values()[data.getInteger( "hasRedstone" )];
|
this.hasRedstone = YesNo.values()[data.getInt( "hasRedstone" )];
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int x = 0; x < 7; x++ )
|
for( int x = 0; x < 7; x++ )
|
||||||
{
|
{
|
||||||
AEPartLocation side = AEPartLocation.fromOrdinal( x );
|
AEPartLocation side = AEPartLocation.fromOrdinal( x );
|
||||||
|
|
||||||
final CompoundNBT def = data.getCompoundTag( "def:" + side.ordinal() );
|
final CompoundNBT def = data.getCompound( "def:" + side.ordinal() );
|
||||||
final CompoundNBT extra = data.getCompoundTag( "extra:" + side.ordinal() );
|
final CompoundNBT extra = data.getCompound( "extra:" + side.ordinal() );
|
||||||
if( def != null && extra != null )
|
if( def != null && extra != null )
|
||||||
{
|
{
|
||||||
IPart p = this.getPart( side );
|
IPart p = this.getPart( side );
|
||||||
final ItemStack iss = new ItemStack( def );
|
final ItemStack iss = ItemStack.read( def );
|
||||||
if( iss.isEmpty() )
|
if( iss.isEmpty() )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -227,14 +227,14 @@ public abstract class PartAbstractFormationPlane<T extends IAEStack<T>> extends
|
|||||||
public void readFromNBT( final CompoundNBT data )
|
public void readFromNBT( final CompoundNBT data )
|
||||||
{
|
{
|
||||||
super.readFromNBT( data );
|
super.readFromNBT( data );
|
||||||
this.priority = data.getInteger( "priority" );
|
this.priority = data.getInt( "priority" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT( final CompoundNBT data )
|
public void writeToNBT( final CompoundNBT data )
|
||||||
{
|
{
|
||||||
super.writeToNBT( data );
|
super.writeToNBT( data );
|
||||||
data.setInteger( "priority", this.getPriority() );
|
data.putInt( "priority", this.getPriority() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,12 +24,10 @@ import java.util.List;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.item.I
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.EntityItem;temEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@@ -37,9 +35,8 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
@@ -60,6 +57,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
|||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.settings.TickRates;
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||||
@@ -228,25 +226,24 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
@Override
|
@Override
|
||||||
public void onEntityCollision( final Entity entity )
|
public void onEntityCollision( final Entity entity )
|
||||||
{
|
{
|
||||||
if( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.getProxy().isActive() )
|
if( this.isAccepting && entity instanceof ItemEntity && entity.isAlive() && Platform.isServer() && this.getProxy().isActive() )
|
||||||
{
|
{
|
||||||
boolean capture = false;
|
boolean capture = false;
|
||||||
final BlockPos pos = this.getTile().getPos();
|
final BlockPos pos = this.getTile().getPos();
|
||||||
|
|
||||||
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it
|
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it
|
||||||
// "touching" the plane
|
// "touching" the plane
|
||||||
double posYMiddle = ( entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY ) / 2.0D;
|
double posYMiddle = ( entity.getBoundingBox().minY + entity.getBoundingBox().maxY ) / 2.0D;
|
||||||
|
|
||||||
switch( this.getSide() )
|
switch( this.getSide() )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
case UP:
|
case UP:
|
||||||
if( entity.posX > pos.getX() && entity.posX < pos.getX() + 1 )
|
if( entity.getPosX() > pos.getX() && entity.getPosX() < pos.getX() + 1 )
|
||||||
{
|
{
|
||||||
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
|
if( entity.getPosZ() > pos.getZ() && entity.getPosZ() < pos.getZ() + 1 )
|
||||||
{
|
{
|
||||||
if( ( entity.posY > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this
|
if( ( entity.getPosY() > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.getPosY() < pos.getY() + 0.1 && this.getSide() == AEPartLocation.DOWN ) )
|
||||||
.getSide() == AEPartLocation.DOWN ) )
|
|
||||||
{
|
{
|
||||||
capture = true;
|
capture = true;
|
||||||
}
|
}
|
||||||
@@ -255,12 +252,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
case NORTH:
|
case NORTH:
|
||||||
if( entity.posX > pos.getX() && entity.posX < pos.getX() + 1 )
|
if( entity.getPosX() > pos.getX() && entity.getPosX() < pos.getX() + 1 )
|
||||||
{
|
{
|
||||||
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
|
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
|
||||||
{
|
{
|
||||||
if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this
|
if( ( entity.getPosZ() > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.getPosZ() < pos.getZ() + 0.1 && this.getSide() == AEPartLocation.NORTH ) )
|
||||||
.getSide() == AEPartLocation.NORTH ) )
|
|
||||||
{
|
{
|
||||||
capture = true;
|
capture = true;
|
||||||
}
|
}
|
||||||
@@ -269,12 +265,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
case WEST:
|
case WEST:
|
||||||
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
|
if( entity.getPosZ() > pos.getZ() && entity.getPosZ() < pos.getZ() + 1 )
|
||||||
{
|
{
|
||||||
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
|
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
|
||||||
{
|
{
|
||||||
if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this
|
if( ( entity.getPosX() > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.getPosX() < pos.getX() + 0.1 && this.getSide() == AEPartLocation.WEST ) )
|
||||||
.getSide() == AEPartLocation.WEST ) )
|
|
||||||
{
|
{
|
||||||
capture = true;
|
capture = true;
|
||||||
}
|
}
|
||||||
@@ -292,8 +287,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
|
|
||||||
if( changed )
|
if( changed )
|
||||||
{
|
{
|
||||||
AppEng.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(),
|
AppEng.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(), new PacketTransitionEffect( entity.getPosX(), entity.getPosY(), entity.getPosZ(), this.getSide(), false ) );
|
||||||
new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,13 +300,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores an {@link EntityItem} inside the network and either marks it as dead or sets it to the leftover stackSize.
|
* Stores an {@link ItemEntity} inside the network and either marks it as dead or sets it to the leftover stackSize.
|
||||||
*
|
*
|
||||||
* @param entityItem {@link EntityItem} to store
|
* @param entityItem {@link ItemEntity} to store
|
||||||
*/
|
*/
|
||||||
private boolean storeEntityItem( final ItemEntity entityItem )
|
private boolean storeEntityItem( final ItemEntity entityItem )
|
||||||
{
|
{
|
||||||
if( !entityItem.isDead )
|
if( entityItem.isAlive() )
|
||||||
{
|
{
|
||||||
final IAEItemStack overflow = this.storeItemStack( entityItem.getItem() );
|
final IAEItemStack overflow = this.storeItemStack( entityItem.getItem() );
|
||||||
|
|
||||||
@@ -336,8 +330,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
{
|
{
|
||||||
final IStorageGrid storage = this.getProxy().getStorage();
|
final IStorageGrid storage = this.getProxy().getStorage();
|
||||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||||
final IAEItemStack overflow = Platform.poweredInsert( energy,
|
final IAEItemStack overflow = Platform.poweredInsert( energy, storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ), itemToStore, this.mySrc );
|
||||||
storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ), itemToStore, this.mySrc );
|
|
||||||
|
|
||||||
this.isAccepting = overflow == null;
|
this.isAccepting = overflow == null;
|
||||||
|
|
||||||
@@ -361,11 +354,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
*
|
*
|
||||||
* @return true, if the entity was changed otherwise false.
|
* @return true, if the entity was changed otherwise false.
|
||||||
*/
|
*/
|
||||||
private boolean handleOverflow( final EntityItem entityItem, final IAEItemStack overflow )
|
private boolean handleOverflow( final ItemEntity entityItem, final IAEItemStack overflow )
|
||||||
{
|
{
|
||||||
if( overflow == null || overflow.getStackSize() == 0 )
|
if( overflow == null || overflow.getStackSize() == 0 )
|
||||||
{
|
{
|
||||||
entityItem.setDead();
|
entityItem.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +404,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final TileEntity te = this.getTile();
|
final TileEntity te = this.getTile();
|
||||||
final WorldServer w = (WorldServer) te.getWorld();
|
final ServerWorld w = (ServerWorld) te.getWorld();
|
||||||
|
|
||||||
final BlockPos pos = te.getPos().offset( this.getSide().getFacing() );
|
final BlockPos pos = te.getPos().offset( this.getSide().getFacing() );
|
||||||
final IEnergyGrid energy = this.getProxy().getEnergy();
|
final IEnergyGrid energy = this.getProxy().getEnergy();
|
||||||
@@ -430,8 +423,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
{
|
{
|
||||||
energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||||
this.breakBlockAndStoreItems( w, pos );
|
this.breakBlockAndStoreItems( w, pos );
|
||||||
AppEng.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w,
|
AppEng.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) );
|
||||||
new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -473,21 +465,18 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
/**
|
/**
|
||||||
* Checks if this plane can handle the block at the specific coordinates.
|
* Checks if this plane can handle the block at the specific coordinates.
|
||||||
*/
|
*/
|
||||||
private boolean canHandleBlock( final WorldServer w, final BlockPos pos )
|
private boolean canHandleBlock( final ServerWorld w, final BlockPos pos )
|
||||||
{
|
{
|
||||||
final BlockState state = w.getBlockState( pos );
|
final BlockState state = w.getBlockState( pos );
|
||||||
final Material material = state.getMaterial();
|
final Material material = state.getMaterial();
|
||||||
final float hardness = state.getBlockHardness( w, pos );
|
final float hardness = state.getBlockHardness( w, pos );
|
||||||
final boolean ignoreMaterials = material == Material.AIR || material == Material.LAVA || material == Material.WATER || material.isLiquid();
|
final boolean ignoreMaterials = material == Material.AIR || material == Material.LAVA || material == Material.WATER || material.isLiquid();
|
||||||
final boolean ignoreBlocks = state.getBlock() == Blocks.BEDROCK || state.getBlock() == Blocks.END_PORTAL || state
|
final boolean ignoreBlocks = state.getBlock() == Blocks.BEDROCK || state.getBlock() == Blocks.END_PORTAL || state.getBlock() == Blocks.END_PORTAL_FRAME || state.getBlock() == Blocks.COMMAND_BLOCK;
|
||||||
.getBlock() == Blocks.END_PORTAL_FRAME || state.getBlock() == Blocks.COMMAND_BLOCK;
|
|
||||||
|
|
||||||
return !ignoreMaterials && !ignoreBlocks && hardness >= 0f && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody(
|
return !ignoreMaterials && !ignoreBlocks && hardness >= 0f && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody( Platform.getPlayer( w ), pos );
|
||||||
Platform.getPlayer( w ),
|
|
||||||
pos );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<ItemStack> obtainBlockDrops( final WorldServer w, final BlockPos pos )
|
protected List<ItemStack> obtainBlockDrops( final ServerWorld w, final BlockPos pos )
|
||||||
{
|
{
|
||||||
final ItemStack[] out = Platform.getBlockDrops( w, pos );
|
final ItemStack[] out = Platform.getBlockDrops( w, pos );
|
||||||
return Lists.newArrayList( out );
|
return Lists.newArrayList( out );
|
||||||
@@ -496,7 +485,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
/**
|
/**
|
||||||
* Checks if this plane can handle the block at the specific coordinates.
|
* Checks if this plane can handle the block at the specific coordinates.
|
||||||
*/
|
*/
|
||||||
protected float calculateEnergyUsage( final WorldServer w, final BlockPos pos, final List<ItemStack> items )
|
protected float calculateEnergyUsage( final ServerWorld w, final BlockPos pos, final List<ItemStack> items )
|
||||||
{
|
{
|
||||||
final BlockState state = w.getBlockState( pos );
|
final BlockState state = w.getBlockState( pos );
|
||||||
final float hardness = state.getBlockHardness( w, pos );
|
final float hardness = state.getBlockHardness( w, pos );
|
||||||
@@ -530,8 +519,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
for( final ItemStack itemStack : itemStacks )
|
for( final ItemStack itemStack : itemStacks )
|
||||||
{
|
{
|
||||||
final IAEItemStack itemToTest = AEItemStack.fromItemStack( itemStack );
|
final IAEItemStack itemToTest = AEItemStack.fromItemStack( itemStack );
|
||||||
final IAEItemStack overflow = storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
|
final IAEItemStack overflow = storage.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ).injectItems( itemToTest, Actionable.SIMULATE, this.mySrc );
|
||||||
.injectItems( itemToTest, Actionable.SIMULATE, this.mySrc );
|
|
||||||
if( overflow == null || itemToTest.getStackSize() > overflow.getStackSize() )
|
if( overflow == null || itemToTest.getStackSize() > overflow.getStackSize() )
|
||||||
{
|
{
|
||||||
canStore = true;
|
canStore = true;
|
||||||
@@ -547,16 +535,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
return canStore;
|
return canStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void breakBlockAndStoreItems( final WorldServer w, final BlockPos pos )
|
private void breakBlockAndStoreItems( final ServerWorld w, final BlockPos pos )
|
||||||
{
|
{
|
||||||
w.destroyBlock( pos, true );
|
w.destroyBlock( pos, true );
|
||||||
|
|
||||||
final AxisAlignedBB box = new AxisAlignedBB( pos ).grow( 0.2 );
|
final AxisAlignedBB box = new AxisAlignedBB( pos ).grow( 0.2 );
|
||||||
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
|
for( final Object ei : w.getEntitiesWithinAABB( ItemEntity.class, box ) )
|
||||||
{
|
{
|
||||||
if( ei instanceof EntityItem )
|
if( ei instanceof ItemEntity )
|
||||||
{
|
{
|
||||||
final EntityItem entityItem = (EntityItem) ei;
|
final ItemEntity entityItem = (ItemEntity) ei;
|
||||||
this.storeEntityItem( entityItem );
|
this.storeEntityItem( entityItem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -581,5 +569,4 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
|||||||
{
|
{
|
||||||
return MODELS.getModel( this.getConnections(), this.isPowered(), this.isActive() );
|
return MODELS.getModel( this.getConnections(), this.isPowered(), this.isActive() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
|||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.settings.TickRates;
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
@@ -105,7 +106,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
{
|
{
|
||||||
super.readFromNBT( extra );
|
super.readFromNBT( extra );
|
||||||
this.craftingTracker.readFromNBT( extra );
|
this.craftingTracker.readFromNBT( extra );
|
||||||
this.nextSlot = extra.getInteger( "nextSlot" );
|
this.nextSlot = extra.getInt( "nextSlot" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,7 +114,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
{
|
{
|
||||||
super.writeToNBT( extra );
|
super.writeToNBT( extra );
|
||||||
this.craftingTracker.writeToNBT( extra );
|
this.craftingTracker.writeToNBT( extra );
|
||||||
extra.setInteger( "nextSlot", this.nextSlot );
|
extra.putInt( "nextSlot", this.nextSlot );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.ServerWorld;
|
import net.minecraft.world.ServerWorld;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import appeng.api.storage.IMEMonitor;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.settings.TickRates;
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
|
|||||||
@@ -23,19 +23,18 @@ import java.util.Collection;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.particles.RedstoneParticleData;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
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.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.LevelType;
|
import appeng.api.config.LevelType;
|
||||||
import appeng.api.config.RedstoneMode;
|
import appeng.api.config.RedstoneMode;
|
||||||
@@ -71,6 +70,7 @@ import appeng.api.storage.data.IItemList;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.Reflected;
|
import appeng.helpers.Reflected;
|
||||||
@@ -290,11 +290,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
{
|
{
|
||||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null )
|
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null )
|
||||||
{
|
{
|
||||||
this.getProxy()
|
this.getProxy().getStorage().getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) ).addListener( this, this.getProxy().getGrid() );
|
||||||
.getStorage()
|
|
||||||
.getInventory( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) )
|
|
||||||
.addListener( this,
|
|
||||||
this.getProxy().getGrid() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -362,8 +358,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
@Override
|
@Override
|
||||||
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final IStorageChannel chan )
|
public void onStackChange( final IItemList o, final IAEStack fullStack, final IAEStack diffStack, final IActionSource src, final IStorageChannel chan )
|
||||||
{
|
{
|
||||||
if( chan == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this
|
if( chan == Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this.getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
|
||||||
.getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
|
|
||||||
{
|
{
|
||||||
this.lastReportedValue = fullStack.getStackSize();
|
this.lastReportedValue = fullStack.getStackSize();
|
||||||
this.updateState();
|
this.updateState();
|
||||||
@@ -451,8 +446,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
|
final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
|
||||||
final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
|
final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
|
||||||
|
|
||||||
world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
|
world.addParticle( RedstoneParticleData.REDSTONE_DUST, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D );
|
||||||
new int[0] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +511,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
super.writeToNBT( data );
|
super.writeToNBT( data );
|
||||||
data.putLong( "lastReportedValue", this.lastReportedValue );
|
data.putLong( "lastReportedValue", this.lastReportedValue );
|
||||||
data.putLong( "reportingValue", this.reportingValue );
|
data.putLong( "reportingValue", this.reportingValue );
|
||||||
data.putBoolean("prevState", this.prevState);
|
data.putBoolean( "prevState", this.prevState );
|
||||||
this.config.writeToNBT( data, "config" );
|
this.config.writeToNBT( data, "config" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,7 +527,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table )
|
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final CraftingInventory table )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.parts.automation;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
@@ -103,7 +104,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
|||||||
{
|
{
|
||||||
final World w = self.getWorld();
|
final World w = self.getWorld();
|
||||||
|
|
||||||
if( w.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
|
if( w.getChunkProvider().isChunkLoaded( new ChunkPos( pos ) ) )
|
||||||
{
|
{
|
||||||
return w.getTileEntity( pos );
|
return w.getTileEntity( pos );
|
||||||
}
|
}
|
||||||
@@ -145,11 +146,9 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
|||||||
{
|
{
|
||||||
final TileEntity self = this.getHost().getTile();
|
final TileEntity self = this.getHost().getTile();
|
||||||
final BlockPos selfPos = self.getPos().offset( this.getSide().getFacing() );
|
final BlockPos selfPos = self.getPos().offset( this.getSide().getFacing() );
|
||||||
final int xCoordinate = selfPos.getX();
|
|
||||||
final int zCoordinate = selfPos.getZ();
|
|
||||||
final World world = self.getWorld();
|
final World world = self.getWorld();
|
||||||
|
|
||||||
return world != null && world.getChunkProvider().getLoadedChunk( xCoordinate >> 4, zCoordinate >> 4 ) != null;
|
return world != null && world.getChunkProvider().isChunkLoaded( new ChunkPos( selfPos ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
|||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.helpers.IGridProxyable;
|
import appeng.me.helpers.IGridProxyable;
|
||||||
import appeng.me.storage.ITickingMonitor;
|
import appeng.me.storage.ITickingMonitor;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import java.util.List;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@@ -36,7 +36,6 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
@@ -58,6 +57,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.helpers.DualityInterface;
|
import appeng.helpers.DualityInterface;
|
||||||
@@ -230,7 +230,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table )
|
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final CraftingInventory table )
|
||||||
{
|
{
|
||||||
return this.duality.pushPattern( patternDetails, table );
|
return this.duality.pushPattern( patternDetails, table );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import appeng.api.storage.IStorageChannel;
|
|||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.helpers.IPriorityHost;
|
import appeng.helpers.IPriorityHost;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.parts.automation.PartUpgradeable;
|
import appeng.parts.automation.PartUpgradeable;
|
||||||
@@ -163,14 +164,14 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
|
|||||||
public void readFromNBT( final CompoundNBT data )
|
public void readFromNBT( final CompoundNBT data )
|
||||||
{
|
{
|
||||||
super.readFromNBT( data );
|
super.readFromNBT( data );
|
||||||
this.priority = data.getInteger( "priority" );
|
this.priority = data.getInt( "priority" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT( final CompoundNBT data )
|
public void writeToNBT( final CompoundNBT data )
|
||||||
{
|
{
|
||||||
super.writeToNBT( data );
|
super.writeToNBT( data );
|
||||||
data.setInteger( "priority", this.priority );
|
data.putInt( "priority", this.priority );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ import appeng.api.util.AECableType;
|
|||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.capabilities.Capabilities;
|
import appeng.capabilities.Capabilities;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.core.settings.TickRates;
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
@@ -194,7 +196,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
{
|
{
|
||||||
super.readFromNBT( data );
|
super.readFromNBT( data );
|
||||||
this.Config.readFromNBT( data, "config" );
|
this.Config.readFromNBT( data, "config" );
|
||||||
this.priority = data.getInteger( "priority" );
|
this.priority = data.getInt( "priority" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -202,7 +204,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
{
|
{
|
||||||
super.writeToNBT( data );
|
super.writeToNBT( data );
|
||||||
this.Config.writeToNBT( data, "config" );
|
this.Config.writeToNBT( data, "config" );
|
||||||
data.setInteger( "priority", this.priority );
|
data.putInt( "priority", this.priority );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -378,10 +380,11 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
Direction targetSide = this.getSide().getFacing().getOpposite();
|
Direction targetSide = this.getSide().getFacing().getOpposite();
|
||||||
|
|
||||||
// Prioritize a handler to directly link to another ME network
|
// Prioritize a handler to directly link to another ME network
|
||||||
IStorageMonitorableAccessor accessor = target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide );
|
final LazyOptional<IStorageMonitorableAccessor> accessorOpt = target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide );
|
||||||
|
|
||||||
if( accessor != null )
|
if( accessorOpt.isPresent() )
|
||||||
{
|
{
|
||||||
|
IStorageMonitorableAccessor accessor = accessorOpt.orElse( null );
|
||||||
IStorageMonitorable inventory = accessor.getInventory( this.mySrc );
|
IStorageMonitorable inventory = accessor.getInventory( this.mySrc );
|
||||||
if( inventory != null )
|
if( inventory != null )
|
||||||
{
|
{
|
||||||
@@ -396,16 +399,17 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check via cap for IItemHandler
|
// Check via cap for IItemHandler
|
||||||
IItemHandler handlerExt = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
final LazyOptional<IItemHandler> handlerExtOpt = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
||||||
if( handlerExt != null )
|
if( handlerExtOpt.isPresent() )
|
||||||
{
|
{
|
||||||
return new ItemHandlerAdapter( handlerExt, this );
|
return new ItemHandlerAdapter( handlerExtOpt.orElse( null ), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO, LazyOptionals are cacheable this might need changing?
|
||||||
private int createHandlerHash( TileEntity target )
|
private int createHandlerHash( TileEntity target )
|
||||||
{
|
{
|
||||||
if( target == null )
|
if( target == null )
|
||||||
@@ -415,15 +419,18 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
|
|
||||||
final Direction targetSide = this.getSide().getFacing().getOpposite();
|
final Direction targetSide = this.getSide().getFacing().getOpposite();
|
||||||
|
|
||||||
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) )
|
final LazyOptional<IStorageMonitorableAccessor> accessorOpt = target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide );
|
||||||
|
|
||||||
|
if( accessorOpt.isPresent() )
|
||||||
{
|
{
|
||||||
return Objects.hash( target, target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) );
|
return Objects.hash( target, accessorOpt.orElse( null ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
final IItemHandler itemHandler = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
final LazyOptional<IItemHandler> itemHandlerOpt = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
||||||
|
|
||||||
if( itemHandler != null )
|
if( itemHandlerOpt.isPresent() )
|
||||||
{
|
{
|
||||||
|
IItemHandler itemHandler = itemHandlerOpt.orElse( null );
|
||||||
return Objects.hash( target, itemHandler, itemHandler.getSlots() );
|
return Objects.hash( target, itemHandler, itemHandler.getSlots() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import appeng.api.parts.IPartModel;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.helpers.Reflected;
|
import appeng.helpers.Reflected;
|
||||||
import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import appeng.api.util.AECableType;
|
|||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.items.parts.ItemPart;
|
import appeng.items.parts.ItemPart;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.parts.AEBasePart;
|
import appeng.parts.AEBasePart;
|
||||||
@@ -283,7 +284,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
howMany = Math.max( gc.getUsedChannels(), howMany );
|
howMany = Math.max( gc.getUsedChannels(), howMany );
|
||||||
}
|
}
|
||||||
|
|
||||||
data.setByte( "usedChannels", (byte) howMany );
|
data.putByte( "usedChannels", (byte) howMany );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ package appeng.parts.p2p;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
@@ -68,17 +68,18 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
|||||||
|
|
||||||
private IEnergyStorage getAttachedEnergyStorage()
|
private IEnergyStorage getAttachedEnergyStorage()
|
||||||
{
|
{
|
||||||
|
LazyOptional<IEnergyStorage> energyStorageOpt = LazyOptional.empty();
|
||||||
if( this.isActive() )
|
if( this.isActive() )
|
||||||
{
|
{
|
||||||
final TileEntity self = this.getTile();
|
final TileEntity self = this.getTile();
|
||||||
final TileEntity te = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
|
final TileEntity te = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
|
||||||
|
|
||||||
if( te != null && te.hasCapability( Capabilities.FORGE_ENERGY, this.getSide().getOpposite().getFacing() ) )
|
if( te != null )
|
||||||
{
|
{
|
||||||
return te.getCapability( Capabilities.FORGE_ENERGY, this.getSide().getOpposite().getFacing() );
|
energyStorageOpt = te.getCapability( Capabilities.FORGE_ENERGY, this.getSide().getOpposite().getFacing() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL_ENERGY_STORAGE;
|
return energyStorageOpt.orElse( NULL_ENERGY_STORAGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -206,6 +207,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class OutputEnergyStorage implements IEnergyStorage
|
private class OutputEnergyStorage implements IEnergyStorage
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -252,6 +254,7 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class NullEnergyStorage implements IEnergyStorage
|
private static class NullEnergyStorage implements IEnergyStorage
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -290,6 +293,5 @@ public class PartP2PFEPower extends PartP2PTunnel<PartP2PFEPower>
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ import java.util.Deque;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||||
import net.minecraftforge.fluids.capability.FluidTankProperties;
|
import net.minecraftforge.fluids.capability.FluidTankProperties;
|
||||||
@@ -194,10 +194,10 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
|||||||
throw new IllegalStateException( "Invalid Recursion detected." );
|
throw new IllegalStateException( "Invalid Recursion detected." );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.min( resource.amount, requestTotal );
|
return Math.min( resource.getAmount(), requestTotal );
|
||||||
}
|
}
|
||||||
|
|
||||||
int available = resource.amount;
|
int available = resource.getAmount();
|
||||||
|
|
||||||
i = list.iterator();
|
i = list.iterator();
|
||||||
int used = 0;
|
int used = 0;
|
||||||
@@ -207,10 +207,10 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
|||||||
final PartP2PFluids l = i.next();
|
final PartP2PFluids l = i.next();
|
||||||
|
|
||||||
final FluidStack insert = resource.copy();
|
final FluidStack insert = resource.copy();
|
||||||
insert.amount = (int) Math.ceil( insert.amount * ( (double) l.tmpUsed / (double) requestTotal ) );
|
insert.setAmount( (int) Math.ceil( insert.getAmount() * ( (double) l.tmpUsed / (double) requestTotal ) ) );
|
||||||
if( insert.amount > available )
|
if( insert.getAmount() > available )
|
||||||
{
|
{
|
||||||
insert.amount = available;
|
insert.setAmount( available );
|
||||||
}
|
}
|
||||||
|
|
||||||
final IFluidHandler tank = l.getTarget();
|
final IFluidHandler tank = l.getTarget();
|
||||||
@@ -223,7 +223,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
|||||||
l.tmpUsed = 0;
|
l.tmpUsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
available -= insert.amount;
|
available -= insert.getAmount();
|
||||||
used += l.tmpUsed;
|
used += l.tmpUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,4 +306,4 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import appeng.api.util.AECableType;
|
|||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.me.cache.P2PCache;
|
import appeng.me.cache.P2PCache;
|
||||||
import appeng.me.cache.helpers.TunnelCollection;
|
import appeng.me.cache.helpers.TunnelCollection;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import appeng.api.parts.IPartModel;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.Api;
|
||||||
import appeng.core.settings.TickRates;
|
import appeng.core.settings.TickRates;
|
||||||
import appeng.hooks.TickHandler;
|
import appeng.hooks.TickHandler;
|
||||||
import appeng.items.parts.PartModels;
|
import appeng.items.parts.PartModels;
|
||||||
|
|||||||
@@ -37,15 +37,14 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
|
||||||
import appeng.api.util.ICommonTile;
|
import appeng.api.util.ICommonTile;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.api.util.IConfigurableObject;
|
import appeng.api.util.IConfigurableObject;
|
||||||
@@ -180,7 +179,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||||||
{
|
{
|
||||||
final CompoundNBT data = new CompoundNBT();
|
final CompoundNBT data = new CompoundNBT();
|
||||||
|
|
||||||
final ByteBuf stream = Unpooled.buffer();
|
final PacketBuffer stream = new PacketBuffer( Unpooled.buffer() );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -273,7 +272,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
if( this.canBeRotated() )
|
if( this.canBeRotated() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.implementations.tiles.IColorableTile;
|
import appeng.api.implementations.tiles.IColorableTile;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
@@ -73,7 +73,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeByte( this.paintedColor.ordinal() );
|
data.writeByte( this.paintedColor.ordinal() );
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -36,7 +37,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
|||||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.config.RedstoneMode;
|
import appeng.api.config.RedstoneMode;
|
||||||
@@ -206,7 +206,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeBoolean( this.isPowered );
|
data.writeBoolean( this.isPowered );
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
@@ -98,7 +99,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeInt( this.rotation );
|
data.writeInt( this.rotation );
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import io.netty.buffer.ByteBuf;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.config.PowerUnits;
|
import appeng.api.config.PowerUnits;
|
||||||
@@ -97,7 +97,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
final AEItemStack is = AEItemStack.fromItemStack( this.inv.getStackInSlot( 0 ) );
|
final AEItemStack is = AEItemStack.fromItemStack( this.inv.getStackInSlot( 0 ) );
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ import io.netty.buffer.ByteBuf;
|
|||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
@@ -180,7 +180,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
int slot = this.isSmash() ? 64 : 0;
|
int slot = this.isSmash() ? 64 : 0;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -39,7 +40,6 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
@@ -194,7 +194,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeBoolean( this.omniDirectional );
|
data.writeBoolean( this.omniDirectional );
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
@@ -139,7 +140,7 @@ public class TilePaint extends AEBaseTile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
this.writeBuffer( data );
|
this.writeBuffer( data );
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.EnumSet;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
|
||||||
import appeng.api.implementations.IPowerChannelState;
|
import appeng.api.implementations.IPowerChannelState;
|
||||||
@@ -71,7 +72,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToStream( final ByteBuf data ) throws IOException
|
public void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.SortDir;
|
import appeng.api.config.SortDir;
|
||||||
@@ -150,7 +150,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeBoolean( this.getProxy().isActive() );
|
data.writeBoolean( this.getProxy().isActive() );
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntityFurnace;
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
@@ -91,7 +92,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeBoolean( this.getBurnTime() > 0 );
|
data.writeBoolean( this.getBurnTime() > 0 );
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
@@ -98,7 +99,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
this.getCableBus().writeToStream( data );
|
this.getCableBus().writeToStream( data );
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ import java.util.EnumSet;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.implementations.IPowerChannelState;
|
import appeng.api.implementations.IPowerChannelState;
|
||||||
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
@@ -95,7 +95,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
this.setClientFlags( 0 );
|
this.setClientFlags( 0 );
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.definitions.IBlockDefinition;
|
import appeng.api.definitions.IBlockDefinition;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||||
@@ -87,7 +87,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
int out = this.constructed;
|
int out = this.constructed;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.EnumSet;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
|
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
@@ -226,7 +227,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeByte( this.displayBits );
|
data.writeByte( this.displayBits );
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraftforge.common.capabilities.Capability;
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
@@ -42,7 +43,6 @@ import net.minecraftforge.fluids.capability.IFluidHandler;
|
|||||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
@@ -383,7 +383,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ import io.netty.buffer.ByteBuf;
|
|||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||||
@@ -104,7 +104,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
int newState = 0;
|
int newState = 0;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
@@ -47,7 +48,7 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable
|
|||||||
private float prevLidAngle;
|
private float prevLidAngle;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeToStream( final ByteBuf data ) throws IOException
|
protected void writeToStream( final PacketBuffer data ) throws IOException
|
||||||
{
|
{
|
||||||
super.writeToStream( data );
|
super.writeToStream( data );
|
||||||
data.writeBoolean( this.getPlayerOpen() > 0 );
|
data.writeBoolean( this.getPlayerOpen() > 0 );
|
||||||
|
|||||||
@@ -56,9 +56,11 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||||
import net.minecraftforge.fml.common.thread.SidedThreadGroups;
|
import net.minecraftforge.fml.common.thread.SidedThreadGroups;
|
||||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
@@ -653,23 +655,20 @@ public class Platform
|
|||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public static PlayerEntity getPlayer(final ServerWorld w )
|
public static PlayerEntity getPlayer(final ServerWorld w )
|
||||||
// {
|
{
|
||||||
// if( w == null )
|
Objects.requireNonNull( w );
|
||||||
// {
|
|
||||||
// throw new InvalidParameterException( "World is null." );
|
final PlayerEntity wrp = FAKE_PLAYERS.get( w );
|
||||||
// }
|
if( wrp != null )
|
||||||
//
|
{
|
||||||
// final PlayerEntity wrp = FAKE_PLAYERS.get( w );
|
return wrp;
|
||||||
// if( wrp != null )
|
}
|
||||||
// {
|
|
||||||
// return wrp;
|
final PlayerEntity p = FakePlayerFactory.getMinecraft( w );
|
||||||
// }
|
FAKE_PLAYERS.put( w, p );
|
||||||
//
|
return p;
|
||||||
// final PlayerEntity p = FakePlayerFactory.getMinecraft( w );
|
}
|
||||||
// FAKE_PLAYERS.put( w, p );
|
|
||||||
// return p;
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// public static int MC2MEColor( final int color )
|
// public static int MC2MEColor( final int color )
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ package appeng.util.item;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemContainer;
|
import appeng.api.storage.data.IItemContainer;
|
||||||
|
import appeng.core.Api;
|
||||||
|
|
||||||
|
|
||||||
public class ItemModList implements IItemContainer<IAEItemStack>
|
public class ItemModList implements IItemContainer<IAEItemStack>
|
||||||
|
|||||||
Reference in New Issue
Block a user