1.15 port
This commit is contained in:
@@ -19,29 +19,14 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
|
||||
|
||||
public class AEGlassMaterial extends Material
|
||||
public class AEGlassMaterial
|
||||
{
|
||||
|
||||
public static final AEGlassMaterial INSTANCE = ( new AEGlassMaterial( MapColor.AIR ) );
|
||||
public static final Material INSTANCE = new Material( MaterialColor.AIR, false, false, true, false, true, false, false, PushReaction.NORMAL );
|
||||
|
||||
public AEGlassMaterial( final MapColor color )
|
||||
{
|
||||
super( color );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaque()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@ import javax.annotation.Nullable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -214,7 +214,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
public void writeToNBT( final CompoundNBT data )
|
||||
{
|
||||
this.config.writeToNBT( data, "config" );
|
||||
this.patterns.writeToNBT( data, "patterns" );
|
||||
@@ -222,33 +222,33 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.upgrades.writeToNBT( data, "upgrades" );
|
||||
this.cm.writeToNBT( data );
|
||||
this.craftingTracker.writeToNBT( data );
|
||||
data.setInteger( "priority", this.priority );
|
||||
data.putInt( "priority", this.priority );
|
||||
|
||||
final NBTTagList waitingToSend = new NBTTagList();
|
||||
final ListNBT waitingToSend = new ListNBT();
|
||||
if( this.waitingToSend != null )
|
||||
{
|
||||
for( final ItemStack is : this.waitingToSend )
|
||||
{
|
||||
final NBTTagCompound item = new NBTTagCompound();
|
||||
is.writeToNBT( item );
|
||||
waitingToSend.appendTag( item );
|
||||
final CompoundNBT item = new CompoundNBT();
|
||||
is.write( item );
|
||||
waitingToSend.add( item );
|
||||
}
|
||||
}
|
||||
data.setTag( "waitingToSend", waitingToSend );
|
||||
data.put( "waitingToSend", waitingToSend );
|
||||
}
|
||||
|
||||
public void readFromNBT( final NBTTagCompound data )
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
{
|
||||
this.waitingToSend = null;
|
||||
final NBTTagList waitingList = data.getTagList( "waitingToSend", 10 );
|
||||
final ListNBT waitingList = data.getList( "waitingToSend", 10 );
|
||||
if( waitingList != null )
|
||||
{
|
||||
for( int x = 0; x < waitingList.tagCount(); x++ )
|
||||
for( int x = 0; x < waitingList.size(); x++ )
|
||||
{
|
||||
final NBTTagCompound c = waitingList.getCompoundTagAt( x );
|
||||
final CompoundNBT c = waitingList.getCompound( x );
|
||||
if( c != null )
|
||||
{
|
||||
final ItemStack is = new ItemStack( c );
|
||||
final ItemStack is = ItemStack.read( c );
|
||||
this.addToSendList( is );
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
this.config.readFromNBT( data, "config" );
|
||||
this.patterns.readFromNBT( data, "patterns" );
|
||||
this.storage.readFromNBT( data, "storage" );
|
||||
this.priority = data.getInteger( "priority" );
|
||||
this.priority = data.getInt( "priority" );
|
||||
this.cm.readFromNBT( data );
|
||||
this.readConfig();
|
||||
this.updateCraftingList();
|
||||
@@ -584,7 +584,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.hasWorkToDo() ? ( couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER ) : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
private void pushItemsOut( final EnumSet<EnumFacing> possibleDirections )
|
||||
private void pushItemsOut( final EnumSet<Direction> possibleDirections )
|
||||
{
|
||||
if( !this.hasItemsToSend() )
|
||||
{
|
||||
@@ -599,7 +599,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
{
|
||||
ItemStack whatToSend = i.next();
|
||||
|
||||
for( final EnumFacing s : possibleDirections )
|
||||
for( final Direction s : possibleDirections )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
if( te == null )
|
||||
@@ -894,7 +894,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table )
|
||||
public boolean pushPattern( final ICraftingPatternDetails patternDetails, final CraftingInventory table )
|
||||
{
|
||||
if( this.hasItemsToSend() || !this.gridProxy.isActive() || !this.craftingList.contains( patternDetails ) )
|
||||
{
|
||||
@@ -904,8 +904,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorld();
|
||||
|
||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
for( final EnumFacing s : possibleDirections )
|
||||
final EnumSet<Direction> possibleDirections = this.iHost.getTargets();
|
||||
for( final Direction s : possibleDirections )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
if( te instanceof IInterfaceHost )
|
||||
@@ -979,13 +979,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( this.isBlocking() )
|
||||
{
|
||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
final EnumSet<Direction> possibleDirections = this.iHost.getTargets();
|
||||
final TileEntity tile = this.iHost.getTileEntity();
|
||||
final World w = tile.getWorld();
|
||||
|
||||
boolean allAreBusy = true;
|
||||
|
||||
for( final EnumFacing s : possibleDirections )
|
||||
for( final Direction s : possibleDirections )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
|
||||
|
||||
@@ -1016,7 +1016,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return this.cm.getSetting( Settings.BLOCK ) == YesNo.YES;
|
||||
}
|
||||
|
||||
private boolean acceptsItems( final InventoryAdaptor ad, final InventoryCrafting table )
|
||||
private boolean acceptsItems( final InventoryAdaptor ad, final CraftingInventory table )
|
||||
{
|
||||
for( int x = 0; x < table.getSizeInventory(); x++ )
|
||||
{
|
||||
@@ -1147,8 +1147,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return ( (ICustomNameObject) this.iHost ).getCustomInventoryName();
|
||||
}
|
||||
|
||||
final EnumSet<EnumFacing> possibleDirections = this.iHost.getTargets();
|
||||
for( final EnumFacing direction : possibleDirections )
|
||||
final EnumSet<Direction> possibleDirections = this.iHost.getTargets();
|
||||
for( final Direction direction : possibleDirections )
|
||||
{
|
||||
final BlockPos targ = hostTile.getPos().offset( direction );
|
||||
final TileEntity directedTile = hostWorld.getTileEntity( targ );
|
||||
@@ -1181,15 +1181,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
continue;
|
||||
}
|
||||
|
||||
final IBlockState directedBlockState = hostWorld.getBlockState( targ );
|
||||
final BlockState directedBlockState = hostWorld.getBlockState( targ );
|
||||
final Block directedBlock = directedBlockState.getBlock();
|
||||
ItemStack what = new ItemStack( directedBlock, 1, directedBlock.getMetaFromState( directedBlockState ) );
|
||||
ItemStack what = new ItemStack( directedBlock, 1 );
|
||||
try
|
||||
{
|
||||
Vec3d from = new Vec3d( hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5 );
|
||||
from = from.addVector( direction.getFrontOffsetX() * 0.501, direction.getFrontOffsetY() * 0.501, direction.getFrontOffsetZ() * 0.501 );
|
||||
final Vec3d to = from.addVector( direction.getFrontOffsetX(), direction.getFrontOffsetY(), direction.getFrontOffsetZ() );
|
||||
final RayTraceResult mop = hostWorld.rayTraceBlocks( from, to, true );
|
||||
from = from.add( direction.getXOffset() * 0.501, direction.getYOffset() * 0.501, direction.getZOffset() * 0.501 );
|
||||
final Vec3d to = from.add( direction.getXOffset(), direction.getYOffset(), direction.getZOffset() );
|
||||
final RayTraceResult mop = hostWorld.rayTraceBlocks( from, to );
|
||||
if( mop != null && !BAD_BLOCKS.contains( directedBlock ) )
|
||||
{
|
||||
if( mop.getBlockPos().equals( directedTile.getPos() ) )
|
||||
@@ -1209,13 +1209,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
if( what.getItem() != Items.AIR )
|
||||
{
|
||||
return what.getUnlocalizedName();
|
||||
return what.getTranslationKey();
|
||||
}
|
||||
|
||||
final Item item = Item.getItemFromBlock( directedBlock );
|
||||
if( item == Items.AIR )
|
||||
{
|
||||
return directedBlock.getUnlocalizedName();
|
||||
return directedBlock.getTranslationKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1254,13 +1254,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCapability( Capability<?> capabilityClass, EnumFacing facing )
|
||||
public boolean hasCapability( Capability<?> capabilityClass, Direction facing )
|
||||
{
|
||||
return capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public <T> T getCapability( Capability<T> capabilityClass, EnumFacing facing )
|
||||
public <T> T getCapability( Capability<T> capabilityClass, Direction facing )
|
||||
{
|
||||
if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.helpers;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.crafting.ICraftingProvider;
|
||||
@@ -34,7 +34,7 @@ public interface IInterfaceHost extends ICraftingProvider, IUpgradeableHost, ICr
|
||||
|
||||
DualityInterface getInterfaceDuality();
|
||||
|
||||
EnumSet<EnumFacing> getTargets();
|
||||
EnumSet<Direction> getTargets();
|
||||
|
||||
TileEntity getTileEntity();
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import appeng.util.Platform;
|
||||
@@ -40,30 +40,30 @@ public class InvalidPatternHelper
|
||||
|
||||
public InvalidPatternHelper( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound encodedValue = is.getTagCompound();
|
||||
final CompoundNBT encodedValue = is.getTag();
|
||||
|
||||
if( encodedValue == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "No pattern here!" );
|
||||
}
|
||||
|
||||
final NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
final NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
final ListNBT inTag = encodedValue.getList( "in", 10 );
|
||||
final ListNBT outTag = encodedValue.getList( "out", 10 );
|
||||
this.isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
|
||||
this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" );
|
||||
|
||||
for( int i = 0; i < outTag.tagCount(); i++ )
|
||||
for( int i = 0; i < outTag.size(); i++ )
|
||||
{
|
||||
this.outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) );
|
||||
this.outputs.add( new PatternIngredient( outTag.getCompound( i ) ) );
|
||||
}
|
||||
|
||||
for( int i = 0; i < inTag.tagCount(); i++ )
|
||||
for( int i = 0; i < inTag.size(); i++ )
|
||||
{
|
||||
NBTTagCompound in = inTag.getCompoundTagAt( i );
|
||||
CompoundNBT in = inTag.getCompound( i );
|
||||
|
||||
// skip empty slots in the crafting grid
|
||||
if( in.hasNoTags() )
|
||||
if( in.isEmpty() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -100,9 +100,9 @@ public class InvalidPatternHelper
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public PatternIngredient( NBTTagCompound tag )
|
||||
public PatternIngredient( CompoundNBT tag )
|
||||
{
|
||||
this.stack = new ItemStack( tag );
|
||||
this.stack = ItemStack.read( tag );
|
||||
|
||||
if( this.stack.isEmpty() )
|
||||
{
|
||||
@@ -124,7 +124,7 @@ public class InvalidPatternHelper
|
||||
|
||||
public int getDamage()
|
||||
{
|
||||
return this.isValid() ? this.stack.getItemDamage() : this.damage;
|
||||
return this.isValid() ? this.stack.getDamage() : this.damage;
|
||||
}
|
||||
|
||||
public int getCount()
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
@@ -28,12 +28,12 @@ import appeng.api.util.IOrientable;
|
||||
public class LocationRotation implements IOrientable
|
||||
{
|
||||
|
||||
private final IBlockAccess w;
|
||||
private final IBlockReader w;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int z;
|
||||
|
||||
public LocationRotation( final IBlockAccess world, final int x, final int y, final int z )
|
||||
public LocationRotation( final IBlockReader world, final int x, final int y, final int z )
|
||||
{
|
||||
this.w = world;
|
||||
this.x = x;
|
||||
@@ -48,24 +48,24 @@ public class LocationRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getForward()
|
||||
public Direction getForward()
|
||||
{
|
||||
if( this.getUp().getFrontOffsetY() == 0 )
|
||||
if( this.getUp().getYOffset() == 0 )
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
return Direction.UP;
|
||||
}
|
||||
return EnumFacing.SOUTH;
|
||||
return Direction.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
public Direction getUp()
|
||||
{
|
||||
final int num = Math.abs( this.x + this.y + this.z ) % 6;
|
||||
return EnumFacing.VALUES[num];
|
||||
return Direction.values()[num];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
public void setOrientation( final Direction forward, final Direction up )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumFacing.Axis;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
@@ -34,11 +34,11 @@ import appeng.decorative.solid.BlockQuartzPillar;
|
||||
public class MetaRotation implements IOrientable
|
||||
{
|
||||
|
||||
private final IProperty<EnumFacing> facingProp;
|
||||
private final IBlockAccess w;
|
||||
private final Property<Direction> facingProp;
|
||||
private final IBlockReader w;
|
||||
private final BlockPos pos;
|
||||
|
||||
public MetaRotation( final IBlockAccess world, final BlockPos pos, final IProperty<EnumFacing> facingProp )
|
||||
public MetaRotation( final IBlockReader world, final BlockPos pos, final Property<Direction> facingProp )
|
||||
{
|
||||
this.w = world;
|
||||
this.pos = pos;
|
||||
@@ -52,27 +52,27 @@ public class MetaRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getForward()
|
||||
public Direction getForward()
|
||||
{
|
||||
if( this.getUp().getFrontOffsetY() == 0 )
|
||||
if( this.getUp().getYOffset() == 0 )
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
return Direction.UP;
|
||||
}
|
||||
return EnumFacing.SOUTH;
|
||||
return Direction.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
public Direction getUp()
|
||||
{
|
||||
final IBlockState state = this.w.getBlockState( this.pos );
|
||||
final BlockState state = this.w.getBlockState( this.pos );
|
||||
|
||||
if( this.facingProp != null )
|
||||
{
|
||||
return state.getValue( this.facingProp );
|
||||
return state.get( this.facingProp );
|
||||
}
|
||||
|
||||
// TODO 1.10.2-R - Temp
|
||||
Axis a = state.getValue( BlockQuartzPillar.AXIS_ORIENTATION );
|
||||
Axis a = state.get( BlockQuartzPillar.AXIS );
|
||||
|
||||
if( a == null )
|
||||
{
|
||||
@@ -82,28 +82,28 @@ public class MetaRotation implements IOrientable
|
||||
switch( a )
|
||||
{
|
||||
case X:
|
||||
return EnumFacing.EAST;
|
||||
return Direction.EAST;
|
||||
case Z:
|
||||
return EnumFacing.SOUTH;
|
||||
return Direction.SOUTH;
|
||||
default:
|
||||
case Y:
|
||||
return EnumFacing.UP;
|
||||
return Direction.UP;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
public void setOrientation( final Direction forward, final Direction up )
|
||||
{
|
||||
if( this.w instanceof World )
|
||||
{
|
||||
if( this.facingProp != null )
|
||||
{
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( this.facingProp, up ) );
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).with( this.facingProp, up ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO 1.10.2-R - Temp
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockQuartzPillar.AXIS_ORIENTATION, up.getAxis() ) );
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).with( BlockQuartzPillar.AXIS, up.getAxis() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.Future;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -53,20 +53,20 @@ public class MultiCraftingTracker
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public void readFromNBT( final NBTTagCompound extra )
|
||||
public void readFromNBT( final CompoundNBT extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
final NBTTagCompound link = extra.getCompoundTag( "links-" + x );
|
||||
final CompoundNBT link = extra.getCompound( "links-" + x );
|
||||
|
||||
if( link != null && !link.hasNoTags() )
|
||||
if( link != null && !link.isEmpty() )
|
||||
{
|
||||
this.setLink( x, AEApi.instance().storage().loadCraftingLink( link, this.owner ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT( final NBTTagCompound extra )
|
||||
public void writeToNBT( final CompoundNBT extra )
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
@@ -74,9 +74,9 @@ public class MultiCraftingTracker
|
||||
|
||||
if( link != null )
|
||||
{
|
||||
final NBTTagCompound ln = new NBTTagCompound();
|
||||
final CompoundNBT ln = new CompoundNBT();
|
||||
link.writeToNBT( ln );
|
||||
extra.setTag( "links-" + x, ln );
|
||||
extra.put( "links-" + x, ln );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
|
||||
@@ -39,19 +39,19 @@ public class NullRotation implements IOrientable
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getForward()
|
||||
public Direction getForward()
|
||||
{
|
||||
return EnumFacing.SOUTH;
|
||||
return Direction.SOUTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getUp()
|
||||
public Direction getUp()
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
return Direction.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( final EnumFacing forward, final EnumFacing up )
|
||||
public void setOrientation( final Direction forward, final Direction up )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -52,8 +52,8 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
{
|
||||
|
||||
private final ItemStack patternItem;
|
||||
private final InventoryCrafting crafting = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
private final InventoryCrafting testFrame = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
private final CraftingInventory crafting = new CraftingInventory( new ContainerNull(), 3, 3 );
|
||||
private final CraftingInventory testFrame = new CraftingInventory( new ContainerNull(), 3, 3 );
|
||||
private final ItemStack correctOutput;
|
||||
private final IRecipe standardRecipe;
|
||||
private final IAEItemStack[] condensedInputs;
|
||||
@@ -69,15 +69,15 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
public PatternHelper( final ItemStack is, final World w )
|
||||
{
|
||||
final NBTTagCompound encodedValue = is.getTagCompound();
|
||||
final CompoundNBT encodedValue = is.getTag();
|
||||
|
||||
if( encodedValue == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "No pattern here!" );
|
||||
}
|
||||
|
||||
final NBTTagList inTag = encodedValue.getTagList( "in", 10 );
|
||||
final NBTTagList outTag = encodedValue.getTagList( "out", 10 );
|
||||
final ListNBT inTag = encodedValue.getList( "in", 10 );
|
||||
final ListNBT outTag = encodedValue.getList( "out", 10 );
|
||||
this.isCrafting = encodedValue.getBoolean( "crafting" );
|
||||
|
||||
this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" );
|
||||
@@ -87,19 +87,19 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
final List<IAEItemStack> in = new ArrayList<>();
|
||||
final List<IAEItemStack> out = new ArrayList<>();
|
||||
|
||||
for( int x = 0; x < inTag.tagCount(); x++ )
|
||||
for( int x = 0; x < inTag.size(); x++ )
|
||||
{
|
||||
NBTTagCompound ingredient = inTag.getCompoundTagAt( x );
|
||||
final ItemStack gs = new ItemStack( ingredient );
|
||||
CompoundNBT ingredient = inTag.getCompound( x );
|
||||
final ItemStack gs = ItemStack.read( ingredient );
|
||||
|
||||
if( !ingredient.hasNoTags() && gs.isEmpty() )
|
||||
if( !ingredient.isEmpty() && gs.isEmpty() )
|
||||
{
|
||||
throw new IllegalArgumentException( "No pattern here!" );
|
||||
}
|
||||
|
||||
this.crafting.setInventorySlotContents( x, gs );
|
||||
|
||||
if( !gs.isEmpty() && ( !this.isCrafting || !gs.hasTagCompound() ) )
|
||||
if( !gs.isEmpty() && ( !this.isCrafting || !gs.hasTag() ) )
|
||||
{
|
||||
this.markItemAs( x, gs, TestStatus.ACCEPT );
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
if( this.isCrafting )
|
||||
{
|
||||
this.standardRecipe = CraftingManager.findMatchingRecipe( this.crafting, w );
|
||||
this.standardRecipe = w.getServer().getRecipeManager().getRecipe( IRecipeType.CRAFTING, this.crafting, w ).orElse( null );
|
||||
|
||||
if( this.standardRecipe != null )
|
||||
{
|
||||
@@ -127,12 +127,12 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
this.standardRecipe = null;
|
||||
this.correctOutput = ItemStack.EMPTY;
|
||||
|
||||
for( int x = 0; x < outTag.tagCount(); x++ )
|
||||
for( int x = 0; x < outTag.size(); x++ )
|
||||
{
|
||||
NBTTagCompound resultItemTag = outTag.getCompoundTagAt( x );
|
||||
final ItemStack gs = new ItemStack( resultItemTag );
|
||||
CompoundNBT resultItemTag = outTag.getCompound( x );
|
||||
final ItemStack gs = ItemStack.read( resultItemTag );
|
||||
|
||||
if( !resultItemTag.hasNoTags() && gs.isEmpty() )
|
||||
if( !resultItemTag.isEmpty() && gs.isEmpty() )
|
||||
{
|
||||
throw new IllegalArgumentException( "No pattern here!" );
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
private void markItemAs( final int slotIndex, final ItemStack i, final TestStatus b )
|
||||
{
|
||||
if( b == TestStatus.TEST || i.hasTagCompound() )
|
||||
if( b == TestStatus.TEST || i.hasTag() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -270,22 +270,25 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
else if( AEConfig.instance().isFeatureEnabled( AEFeature.CRAFTING_MANAGER_FALLBACK ) )
|
||||
{
|
||||
final ItemStack testOutput = CraftingManager.findMatchingResult( this.testFrame, w );
|
||||
|
||||
if( Platform.itemComparisons().isSameItem( this.correctOutput, testOutput ) )
|
||||
{
|
||||
this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
|
||||
this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
// TODO: REMOVE
|
||||
|
||||
if( AELog.isCraftingDebugLogEnabled() )
|
||||
{
|
||||
this.warnAboutCraftingManager( true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
this.warnAboutCraftingManager( false );
|
||||
// final ItemStack testOutput = CraftingManager.findMatchingResult( this.testFrame, w );
|
||||
//
|
||||
// if( Platform.itemComparisons().isSameItem( this.correctOutput, testOutput ) )
|
||||
// {
|
||||
// this.testFrame.setInventorySlotContents( slotIndex, this.crafting.getStackInSlot( slotIndex ) );
|
||||
// this.markItemAs( slotIndex, i, TestStatus.ACCEPT );
|
||||
//
|
||||
// if( AELog.isCraftingDebugLogEnabled() )
|
||||
// {
|
||||
// this.warnAboutCraftingManager( true );
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// this.warnAboutCraftingManager( false );
|
||||
}
|
||||
|
||||
this.markItemAs( slotIndex, i, TestStatus.DECLINE );
|
||||
@@ -329,7 +332,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput( final InventoryCrafting craftingInv, final World w )
|
||||
public ItemStack getOutput( final CraftingInventory craftingInv, final World w )
|
||||
{
|
||||
if( !this.isCrafting )
|
||||
{
|
||||
@@ -364,7 +367,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
return TestStatus.DECLINE;
|
||||
}
|
||||
|
||||
if( i.hasTagCompound() )
|
||||
if( i.hasTag() )
|
||||
{
|
||||
return TestStatus.TEST;
|
||||
}
|
||||
@@ -421,7 +424,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
|
||||
AELog.warn( "Using CraftingManager fallback: Recipe <%s> for output <%s> rejected inputs [%s]. %s",
|
||||
this.standardRecipe.getRegistryName(), this.standardRecipe.getRecipeOutput(), joinActualInputs, foundAlternativeRecipe );
|
||||
this.standardRecipe.getId(), this.standardRecipe.getRecipeOutput(), joinActualInputs, foundAlternativeRecipe );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -459,7 +462,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
|
||||
public TestLookup( final int slot, final ItemStack i )
|
||||
{
|
||||
this( slot, i.getItem(), i.getItemDamage() );
|
||||
this( slot, i.getItem(), i.getDamage() );
|
||||
}
|
||||
|
||||
public TestLookup( final int slot, final Item item, final int dmg )
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.helpers;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -30,12 +30,12 @@ import appeng.api.util.AEColor;
|
||||
public class Splotch
|
||||
{
|
||||
|
||||
private final EnumFacing side;
|
||||
private final Direction side;
|
||||
private final boolean lumen;
|
||||
private final AEColor color;
|
||||
private final int pos;
|
||||
|
||||
public Splotch( final AEColor col, final boolean lit, final EnumFacing side, final Vec3d position )
|
||||
public Splotch( final AEColor col, final boolean lit, final Direction side, final Vec3d position )
|
||||
{
|
||||
this.color = col;
|
||||
this.lumen = lit;
|
||||
@@ -43,13 +43,13 @@ public class Splotch
|
||||
final double x;
|
||||
final double y;
|
||||
|
||||
if( side == EnumFacing.SOUTH || side == EnumFacing.NORTH )
|
||||
if( side == Direction.SOUTH || side == Direction.NORTH )
|
||||
{
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
}
|
||||
|
||||
else if( side == EnumFacing.UP || side == EnumFacing.DOWN )
|
||||
else if( side == Direction.UP || side == Direction.DOWN )
|
||||
{
|
||||
x = position.x;
|
||||
y = position.z;
|
||||
@@ -74,7 +74,7 @@ public class Splotch
|
||||
this.pos = data.readByte();
|
||||
final int val = data.readByte();
|
||||
|
||||
this.side = EnumFacing.VALUES[val & 0x07];
|
||||
this.side = Direction.VALUES[val & 0x07];
|
||||
this.color = AEColor.values()[( val >> 3 ) & 0x0F];
|
||||
this.lumen = ( ( val >> 7 ) & 0x01 ) > 0;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class Splotch
|
||||
return Math.abs( this.pos + val );
|
||||
}
|
||||
|
||||
public EnumFacing getSide()
|
||||
public Direction getSide()
|
||||
{
|
||||
return this.side;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.helpers;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
private final ItemStack effectiveItem;
|
||||
private final IWirelessTermHandler wth;
|
||||
private final String encryptionKey;
|
||||
private final EntityPlayer myPlayer;
|
||||
private final PlayerEntity myPlayer;
|
||||
private IGrid targetGrid;
|
||||
private IStorageGrid sg;
|
||||
private IMEMonitor<IAEItemStack> itemStorage;
|
||||
@@ -65,7 +65,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
|
||||
private double myRange = Double.MAX_VALUE;
|
||||
private final int inventorySlot;
|
||||
|
||||
public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z )
|
||||
public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final PlayerEntity ep, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
this.encryptionKey = wh.getEncryptionKey( is );
|
||||
this.effectiveItem = is;
|
||||
|
||||
Reference in New Issue
Block a user