1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
+7 -7
View File
@@ -27,9 +27,9 @@ import java.util.Deque;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -214,7 +214,7 @@ public class GridNode implements IGridNode, IPathItem
this.compressedData |= ( this.gridProxy.getGridColor().ordinal() << 3 );
for( final EnumFacing dir : this.gridProxy.getConnectableSides() )
for( final Direction dir : this.gridProxy.getConnectableSides() )
{
this.compressedData |= ( 1 << ( dir.ordinal() + 8 ) );
}
@@ -327,11 +327,11 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void loadFromNBT( final String name, final NBTTagCompound nodeData )
public void loadFromNBT( final String name, final CompoundNBT nodeData )
{
if( this.myGrid == null )
{
final NBTTagCompound node = nodeData.getCompoundTag( name );
final CompoundNBT node = nodeData.getCompoundTag( name );
this.playerID = node.getInteger( "p" );
this.setLastSecurityKey( node.getLong( "k" ) );
@@ -346,11 +346,11 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public void saveToNBT( final String name, final NBTTagCompound nodeData )
public void saveToNBT( final String name, final CompoundNBT nodeData )
{
if( this.myStorage != null )
{
final NBTTagCompound node = new NBTTagCompound();
final CompoundNBT node = new CompoundNBT();
node.setInteger( "p", this.playerID );
node.setLong( "k", this.getLastSecurityKey() );
+7 -7
View File
@@ -26,7 +26,7 @@ import java.lang.ref.WeakReference;
import java.util.WeakHashMap;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridStorage;
@@ -38,7 +38,7 @@ public class GridStorage implements IGridStorage
{
private final long myID;
private final NBTTagCompound data;
private final CompoundNBT data;
private final GridStorageSearch mySearchEntry; // keep myself in the list until I'm
private final WeakHashMap<GridStorage, Boolean> divided = new WeakHashMap<>();
private WeakReference<IGrid> internalGrid = null;
@@ -55,7 +55,7 @@ public class GridStorage implements IGridStorage
{
this.myID = id;
this.mySearchEntry = gss;
this.data = new NBTTagCompound();
this.data = new CompoundNBT();
}
/**
@@ -69,7 +69,7 @@ public class GridStorage implements IGridStorage
{
this.myID = id;
this.mySearchEntry = gss;
NBTTagCompound myTag = null;
CompoundNBT myTag = null;
try
{
@@ -78,7 +78,7 @@ public class GridStorage implements IGridStorage
}
catch( final Throwable t )
{
myTag = new NBTTagCompound();
myTag = new CompoundNBT();
}
this.data = myTag;
@@ -91,7 +91,7 @@ public class GridStorage implements IGridStorage
{
this.myID = 0;
this.mySearchEntry = null;
this.data = new NBTTagCompound();
this.data = new CompoundNBT();
}
public String getValue()
@@ -127,7 +127,7 @@ public class GridStorage implements IGridStorage
}
@Override
public NBTTagCompound dataObject()
public CompoundNBT dataObject()
{
return this.data;
}
+5 -5
View File
@@ -26,8 +26,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntityMP;
import appeng.api.AEApi;
import appeng.api.networking.GridFlags;
@@ -351,10 +351,10 @@ public class PathGridCache implements IPathingGrid
{
for( final IGridNode n : this.requireChannels )
{
EntityPlayer player = AEApi.instance().registries().players().findPlayer( n.getPlayerID() );
if( player instanceof EntityPlayerMP )
PlayerEntity player = AEApi.instance().registries().players().findPlayer( n.getPlayerID() );
if( player instanceof PlayerEntityMP )
{
currentBracket.trigger( (EntityPlayerMP) player );
currentBracket.trigger( (PlayerEntityMP) player );
}
}
}
+2 -2
View File
@@ -27,7 +27,7 @@ import java.util.List;
import com.google.common.base.Preconditions;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
@@ -150,7 +150,7 @@ public class SecurityCache implements ISecurityGrid
}
@Override
public boolean hasPermission( final EntityPlayer player, final SecurityPermissions perm )
public boolean hasPermission( final PlayerEntity player, final SecurityPermissions perm )
{
Preconditions.checkNotNull( player );
Preconditions.checkNotNull( perm );
@@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -1007,9 +1007,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
Character.MAX_RADIX );
}
private NBTTagCompound generateLinkData( final String craftingID, final boolean standalone, final boolean req )
private CompoundNBT generateLinkData( final String craftingID, final boolean standalone, final boolean req )
{
final NBTTagCompound tag = new NBTTagCompound();
final CompoundNBT tag = new CompoundNBT();
tag.setString( "CraftID", craftingID );
tag.setBoolean( "canceled", false );
@@ -1142,7 +1142,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
return is;
}
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
data.setTag( "finalOutput", this.writeItem( this.finalOutput ) );
data.setTag( "inventory", this.writeList( this.inventory.getItemList() ) );
@@ -1151,7 +1151,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( this.myLastLink != null )
{
final NBTTagCompound link = new NBTTagCompound();
final CompoundNBT link = new CompoundNBT();
this.myLastLink.writeToNBT( link );
data.setTag( "link", link );
}
@@ -1159,7 +1159,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
final NBTTagList list = new NBTTagList();
for( final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet() )
{
final NBTTagCompound item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) );
item.setLong( "craftingProgress", e.getValue().value );
list.appendTag( item );
}
@@ -1172,9 +1172,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
data.setLong( "remainingItemCount", this.getRemainingItemCount() );
}
private NBTTagCompound writeItem( final IAEItemStack finalOutput2 )
private CompoundNBT writeItem( final IAEItemStack finalOutput2 )
{
final NBTTagCompound out = new NBTTagCompound();
final CompoundNBT out = new CompoundNBT();
if( finalOutput2 != null )
{
@@ -1212,9 +1212,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
this.updateName();
}
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
this.finalOutput = AEItemStack.fromNBT( (NBTTagCompound) data.getTag( "finalOutput" ) );
this.finalOutput = AEItemStack.fromNBT( (CompoundNBT) data.getTag( "finalOutput" ) );
for( final IAEItemStack ais : this.readList( (NBTTagList) data.getTag( "inventory" ) ) )
{
this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc );
@@ -1225,7 +1225,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
if( data.hasKey( "link" ) )
{
final NBTTagCompound link = data.getCompoundTag( "link" );
final CompoundNBT link = data.getCompoundTag( "link" );
this.myLastLink = new CraftingLink( link, this );
this.submitLink( this.myLastLink );
}
@@ -1233,7 +1233,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
final NBTTagList list = data.getTagList( "tasks", 10 );
for( int x = 0; x < list.tagCount(); x++ )
{
final NBTTagCompound item = list.getCompoundTagAt( x );
final CompoundNBT item = list.getCompoundTagAt( x );
final IAEItemStack pattern = AEItemStack.fromNBT( item );
if( pattern != null && pattern.getItem() instanceof ICraftingPatternItem )
{
@@ -21,7 +21,7 @@ package appeng.me.cluster.implementations;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.AEApi;
@@ -162,7 +162,7 @@ public class QuantumCalculator extends MBCalculator
return te instanceof TileQuantumBridge;
}
private boolean isBlockAtLocation( final IBlockAccess w, final BlockPos pos, final IBlockDefinition def )
private boolean isBlockAtLocation( final IBlockReader w, final BlockPos pos, final IBlockDefinition def )
{
return def.maybeBlock().map( block -> block == w.getBlockState( pos ).getBlock() ).orElse( false );
}
@@ -24,10 +24,10 @@ import java.util.EnumSet;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import appeng.api.AEApi;
import appeng.api.networking.GridFlags;
@@ -62,14 +62,14 @@ public class AENetworkProxy implements IGridBlock
private final boolean worldNode;
private final String nbtName; // name
private AEColor myColor = AEColor.TRANSPARENT;
private NBTTagCompound data = null; // input
private CompoundNBT data = null; // input
private ItemStack myRepInstance = ItemStack.EMPTY;
private boolean isReady = false;
private IGridNode node = null;
private EnumSet<EnumFacing> validSides;
private EnumSet<Direction> validSides;
private EnumSet<GridFlags> flags = EnumSet.noneOf( GridFlags.class );
private double idleDraw = 1.0;
private EntityPlayer owner;
private PlayerEntity owner;
public AENetworkProxy( final IGridProxyable te, final String nbtName, final ItemStack visual, final boolean inWorld )
{
@@ -77,7 +77,7 @@ public class AENetworkProxy implements IGridBlock
this.nbtName = nbtName;
this.worldNode = inWorld;
this.myRepInstance = visual;
this.validSides = EnumSet.allOf( EnumFacing.class );
this.validSides = EnumSet.allOf( Direction.class );
}
public void setVisualRepresentation( final ItemStack is )
@@ -85,7 +85,7 @@ public class AENetworkProxy implements IGridBlock
this.myRepInstance = is;
}
public void writeToNBT( final NBTTagCompound tag )
public void writeToNBT( final CompoundNBT tag )
{
if( this.node != null )
{
@@ -93,7 +93,7 @@ public class AENetworkProxy implements IGridBlock
}
}
public void setValidSides( final EnumSet<EnumFacing> validSides )
public void setValidSides( final EnumSet<Direction> validSides )
{
this.validSides = validSides;
if( this.node != null )
@@ -155,7 +155,7 @@ public class AENetworkProxy implements IGridBlock
return this.node;
}
public void readFromNBT( final NBTTagCompound tag )
public void readFromNBT( final CompoundNBT tag )
{
this.data = tag;
if( this.node != null && this.data != null )
@@ -342,7 +342,7 @@ public class AENetworkProxy implements IGridBlock
}
@Override
public EnumSet<EnumFacing> getConnectableSides()
public EnumSet<Direction> getConnectableSides()
{
return this.validSides;
}
@@ -434,7 +434,7 @@ public class AENetworkProxy implements IGridBlock
return eg;
}
public void setOwner( final EntityPlayer player )
public void setOwner( final PlayerEntity player )
{
this.owner = player;
}
@@ -21,7 +21,7 @@ package appeng.me.helpers;
import java.util.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.IActionSource;
@@ -31,7 +31,7 @@ public class BaseActionSource implements IActionSource
{
@Override
public Optional<EntityPlayer> player()
public Optional<PlayerEntity> player()
{
return Optional.empty();
}
@@ -21,7 +21,7 @@ package appeng.me.helpers;
import java.util.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.IActionSource;
@@ -38,7 +38,7 @@ public class MachineSource implements IActionSource
}
@Override
public Optional<EntityPlayer> player()
public Optional<PlayerEntity> player()
{
return Optional.empty();
}
@@ -23,7 +23,7 @@ import java.util.Optional;
import com.google.common.base.Preconditions;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.IActionSource;
@@ -32,10 +32,10 @@ import appeng.api.networking.security.IActionSource;
public class PlayerSource implements IActionSource
{
private final EntityPlayer player;
private final PlayerEntity player;
private final IActionHost via;
public PlayerSource( final EntityPlayer p, final IActionHost v )
public PlayerSource( final PlayerEntity p, final IActionHost v )
{
Preconditions.checkNotNull( p );
this.player = p;
@@ -43,7 +43,7 @@ public class PlayerSource implements IActionSource
}
@Override
public Optional<EntityPlayer> player()
public Optional<PlayerEntity> player()
{
return Optional.of( this.player );
}
@@ -20,7 +20,7 @@ package appeng.me.storage;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
@@ -50,7 +50,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
protected static final String ITEM_PRE_FORMATTED_FUZZY = "FP";
private static final String[] ITEM_SLOT_KEYS = new String[MAX_ITEM_TYPES];
private static final String[] ITEM_SLOT_COUNT_KEYS = new String[MAX_ITEM_TYPES];
private final NBTTagCompound tagCompound;
private final CompoundNBT tagCompound;
protected final ISaveProvider container;
private int maxItemTypes = MAX_ITEM_TYPES;
private short storedItems = 0;
@@ -120,7 +120,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
{
itemCount += v.getStackSize();
final NBTTagCompound g = new NBTTagCompound();
final CompoundNBT g = new CompoundNBT();
v.writeToNBT( g );
this.tagCompound.setTag( ITEM_SLOT_KEYS[x], g );
this.tagCompound.setInteger( ITEM_SLOT_COUNT_KEYS[x], (int) v.getStackSize() );
@@ -196,7 +196,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
for( int slot = 0; slot < types; slot++ )
{
NBTTagCompound compoundTag = this.tagCompound.getCompoundTag( ITEM_SLOT_KEYS[slot] );
CompoundNBT compoundTag = this.tagCompound.getCompoundTag( ITEM_SLOT_KEYS[slot] );
int stackSize = this.tagCompound.getInteger( ITEM_SLOT_COUNT_KEYS[slot] );
needsUpdate |= !this.loadCellItem( compoundTag, stackSize );
}
@@ -214,7 +214,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
* @param stackSize
* @return true when successfully loaded
*/
protected abstract boolean loadCellItem( NBTTagCompound compoundTag, int stackSize );
protected abstract boolean loadCellItem( CompoundNBT compoundTag, int stackSize );
@Override
public IItemList<T> getAvailableItems( final IItemList<T> out )
@@ -4,7 +4,7 @@ package appeng.me.storage;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import appeng.api.config.Actionable;
import appeng.api.exceptions.AppEngException;
@@ -253,7 +253,7 @@ public class BasicCellInventory<T extends IAEStack<T>> extends AbstractCellInven
}
@Override
protected boolean loadCellItem( NBTTagCompound compoundTag, int stackSize )
protected boolean loadCellItem( CompoundNBT compoundTag, int stackSize )
{
// Now load the item stack
final T t;
@@ -20,7 +20,7 @@ package appeng.me.storage;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
@@ -143,7 +143,7 @@ public class BasicCellInventoryHandler<T extends IAEStack<T>> extends MEInventor
return this.getWhitelist();
}
NBTTagCompound openNbtData()
CompoundNBT openNbtData()
{
return Platform.openNbtData( this.getCellInv().getItemStack() );
}
@@ -247,7 +247,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>, ITickingMo
private void postDifference( final Iterable<IAEItemStack> a )
{
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
// AELog.info( a.getItemStack().getTranslationKey() + " @ " + a.getStackSize() );
if( a != null )
{
final Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.listeners.entrySet().iterator();