Some additional fixes from other branch.
This commit is contained in:
@@ -22,7 +22,6 @@ package appeng.items.contents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class CellConfig extends AppEngInternalInventory
|
||||
@@ -34,12 +33,12 @@ public class CellConfig extends AppEngInternalInventory
|
||||
{
|
||||
super( null, 63 );
|
||||
this.is = is;
|
||||
this.readFromNBT( Platform.openNbtData( is ), "list" );
|
||||
this.readFromNBT(is.getOrCreateTag(), "list" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onContentsChanged( int slot )
|
||||
{
|
||||
this.writeToNBT( Platform.openNbtData( this.is ), "list" );
|
||||
this.writeToNBT(this.is.getOrCreateTag(), "list" );
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ package appeng.items.contents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.parts.automation.StackUpgradeInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class CellUpgrades extends StackUpgradeInventory
|
||||
@@ -33,12 +32,12 @@ public final class CellUpgrades extends StackUpgradeInventory
|
||||
{
|
||||
super( is, null, upgrades );
|
||||
this.is = is;
|
||||
this.readFromNBT( Platform.openNbtData( is ), "upgrades" );
|
||||
this.readFromNBT(is.getOrCreateTag(), "upgrades" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onContentsChanged( int slot )
|
||||
{
|
||||
this.writeToNBT( Platform.openNbtData( this.is ), "upgrades" );
|
||||
this.writeToNBT(this.is.getOrCreateTag(), "upgrades" );
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
@@ -45,16 +44,16 @@ public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
|
||||
this.gh = gHost;
|
||||
this.inv = new AppEngInternalInventory( this, 9 );
|
||||
this.inv.setFilter( new NetworkToolInventoryFilter() );
|
||||
if( is.hasTagCompound() ) // prevent crash when opening network status screen.
|
||||
if( is.hasTag() ) // prevent crash when opening network status screen.
|
||||
{
|
||||
this.inv.readFromNBT( Platform.openNbtData( is ), "inv" );
|
||||
this.inv.readFromNBT(is.getOrCreateTag(), "inv" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
this.inv.writeToNBT( Platform.openNbtData( this.is ), "inv" );
|
||||
this.inv.writeToNBT(this.is.getOrCreateTag(), "inv" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,6 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.me.helpers.MEMonitorHandler;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell, IInventorySlotAware
|
||||
@@ -98,7 +97,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
{
|
||||
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
|
||||
{
|
||||
final CompoundNBT data = Platform.openNbtData( PortableCellViewer.this.target );
|
||||
final CompoundNBT data = this.target.getOrCreateTag();
|
||||
manager.writeToNBT( data );
|
||||
} );
|
||||
|
||||
@@ -106,7 +105,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
|
||||
out.readFromNBT( Platform.openNbtData( this.target ).copy() );
|
||||
out.readFromNBT( this.target.getOrCreateTag().copy() );
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
if( mt == MaterialType.NAME_PRESS )
|
||||
{
|
||||
final CompoundNBT c = Platform.openNbtData( stack );
|
||||
final CompoundNBT c = stack.getOrCreateTag();
|
||||
lines.add( c.getString( "InscribeName" ) );
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
public MaterialType getTypeByStack( final ItemStack is )
|
||||
{
|
||||
MaterialType type = this.dmgToMaterial.get( is.getItemDamage() );
|
||||
MaterialType type = this.dmgToMaterial.get( is.getDamage() );
|
||||
return ( type != null ) ? type : MaterialType.INVALID_TYPE;
|
||||
}
|
||||
|
||||
@@ -279,8 +279,8 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
try
|
||||
{
|
||||
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class )
|
||||
.newInstance( w, location.posX,
|
||||
location.posY, location.posZ, itemstack );
|
||||
.newInstance( w, location.getPosX(),
|
||||
location.getPosY(), location.getPosZ(), itemstack );
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
|
||||
@@ -43,7 +43,6 @@ import appeng.api.recipes.ResolverResult;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.entity.EntityGrowingCrystal;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
@@ -76,7 +75,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
crystalSeedStack.setItemDamage( certus2 );
|
||||
crystalSeedStack = newStyle( crystalSeedStack );
|
||||
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
|
||||
return new ResolverResult( itemName, crystalSeedStack.getItemDamage(), crystalSeedStack.getTagCompound() );
|
||||
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTagCompound() );
|
||||
} )
|
||||
.orElse( null );
|
||||
|
||||
@@ -90,16 +89,16 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
static int getProgress( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
if( is.hasTag() )
|
||||
{
|
||||
return is.getTagCompound().getInteger( "progress" );
|
||||
}
|
||||
else
|
||||
{
|
||||
final int progress;
|
||||
final CompoundNBT comp = Platform.openNbtData( is );
|
||||
comp.setInteger( "progress", progress = is.getItemDamage() );
|
||||
is.setItemDamage( ( is.getItemDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
|
||||
final CompoundNBT comp = is.getOrCreateTag();
|
||||
comp.setInteger( "progress", progress = is.getDamage() );
|
||||
is.setItemDamage( ( is.getDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
|
||||
return progress;
|
||||
}
|
||||
}
|
||||
@@ -147,9 +146,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
private void setProgress( final ItemStack is, final int newDamage )
|
||||
{
|
||||
final CompoundNBT comp = Platform.openNbtData( is );
|
||||
final CompoundNBT comp = is.getOrCreateTag();
|
||||
comp.setInteger( "progress", newDamage );
|
||||
is.setItemDamage( is.getItemDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
|
||||
is.setItemDamage( is.getDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,7 +224,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
@Override
|
||||
public Entity createEntity( final World world, final Entity location, final ItemStack itemstack )
|
||||
{
|
||||
final EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.posX, location.posY, location.posZ, itemstack );
|
||||
final EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.getPosX(), location.getPosY(), location.getPosZ(), itemstack );
|
||||
|
||||
egc.motionX = location.motionX;
|
||||
egc.motionY = location.motionY;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
if( details == null )
|
||||
{
|
||||
if( !stack.hasTagCompound() )
|
||||
if( !stack.hasTag() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
private String getExtraName( final ItemStack is )
|
||||
{
|
||||
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
|
||||
return ( is.getDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
|
||||
}
|
||||
|
||||
public AEColor getColor( final ItemStack is )
|
||||
{
|
||||
int dmg = is.getItemDamage();
|
||||
int dmg = is.getDamage();
|
||||
if( dmg >= DAMAGE_THRESHOLD )
|
||||
{
|
||||
dmg -= DAMAGE_THRESHOLD;
|
||||
@@ -87,7 +87,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
public static boolean isLumen( final ItemStack is )
|
||||
{
|
||||
final int dmg = is.getItemDamage();
|
||||
final int dmg = is.getDamage();
|
||||
return dmg >= DAMAGE_THRESHOLD;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ public class ItemPaintBallRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
final AEColor col = ( (ItemPaintBall) stack.getItem() ).getColor( stack );
|
||||
|
||||
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
final int colorValue = stack.getDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
final int r = ( colorValue >> 16 ) & 0xff;
|
||||
final int g = ( colorValue >> 8 ) & 0xff;
|
||||
final int b = ( colorValue ) & 0xff;
|
||||
|
||||
if( stack.getItemDamage() >= 20 )
|
||||
if( stack.getDamage() >= 20 )
|
||||
{
|
||||
final float fail = 0.7f;
|
||||
final int full = (int) ( 255 * 0.3 );
|
||||
|
||||
@@ -151,12 +151,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
final Block block = Block.getBlockFromItem( itemStack.getItem() );
|
||||
if( block == Blocks.AIR || itemStack.hasTagCompound() )
|
||||
if( block == Blocks.AIR || itemStack.hasTag() )
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final int metadata = itemStack.getItem().getMetadata( itemStack.getItemDamage() );
|
||||
final int metadata = itemStack.getItem().getMetadata( itemStack.getDamage() );
|
||||
|
||||
// Try to get the block state based on the item stack's meta. If this fails, don't consider it for a facade
|
||||
// This for example fails for Pistons because they hardcoded an invalid meta value in vanilla
|
||||
@@ -191,8 +191,8 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
final ItemStack is = new ItemStack( this );
|
||||
final CompoundNBT data = new CompoundNBT();
|
||||
data.setString( TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString() );
|
||||
data.setInteger( TAG_DAMAGE, itemStack.getItemDamage() );
|
||||
data.putString(TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString());
|
||||
data.setInteger( TAG_DAMAGE, itemStack.getDamage() );
|
||||
is.setTagCompound( data );
|
||||
return is;
|
||||
}
|
||||
@@ -225,7 +225,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
int itemDamage;
|
||||
|
||||
// Handle legacy facades
|
||||
if( nbt.hasKey( "x" ) )
|
||||
if( nbt.contains("x") )
|
||||
{
|
||||
int[] data = nbt.getIntArray( "x" );
|
||||
if( data.length != 2 )
|
||||
@@ -285,7 +285,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getItemDamage() );
|
||||
AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getDamage() );
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
}
|
||||
@@ -323,7 +323,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
final CompoundNBT facadeTag = new CompoundNBT();
|
||||
facadeTag.setString( TAG_ITEM_ID, item.getRegistryName().toString() );
|
||||
facadeTag.putString(TAG_ITEM_ID, item.getRegistryName().toString());
|
||||
facadeTag.setInteger( TAG_DAMAGE, ids[1] );
|
||||
facadeStack.setTagCompound( facadeTag );
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
final AEColor[] variants = AEColor.values();
|
||||
|
||||
final int itemDamage = is.getItemDamage();
|
||||
final int itemDamage = is.getDamage();
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
@@ -211,7 +211,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
|
||||
final PartTypeWithVariant pt = this.registered.get( is.getItemDamage() );
|
||||
final PartTypeWithVariant pt = this.registered.get( is.getDamage() );
|
||||
if( pt != null )
|
||||
{
|
||||
return pt.part;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
private ModelResourceLocation getItemMeshDefinition( ItemStack is )
|
||||
{
|
||||
PartType partType = this.item.getTypeByStack( is );
|
||||
int variant = this.item.variantOf( is.getItemDamage() );
|
||||
int variant = this.item.variantOf( is.getDamage() );
|
||||
return partType.getItemModels().get( variant );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
@@ -154,7 +154,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
@Override
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,6 @@ import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.spatial.StorageHelper;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorageCell
|
||||
@@ -107,7 +106,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
@Override
|
||||
public WorldCoord getStoredSize( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
if( is.hasTag() )
|
||||
{
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
return new WorldCoord( c.getInteger( NBT_SIZE_X_KEY ), c.getInteger( NBT_SIZE_Y_KEY ), c.getInteger( NBT_SIZE_Z_KEY ) );
|
||||
@@ -118,7 +117,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
@Override
|
||||
public int getStoredDimensionID( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
if( is.hasTag() )
|
||||
{
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
return c.getInteger( NBT_CELL_ID_KEY );
|
||||
@@ -180,7 +179,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
|
||||
private void setStorageCell( final ItemStack is, int id, BlockPos size )
|
||||
{
|
||||
final CompoundNBT c = Platform.openNbtData( is );
|
||||
final CompoundNBT c = is.getOrCreateTag();
|
||||
|
||||
c.setInteger( NBT_CELL_ID_KEY, id );
|
||||
c.setInteger( NBT_SIZE_X_KEY, size.getX() );
|
||||
|
||||
@@ -33,7 +33,6 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioritylist.FuzzyPriorityList;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
@@ -144,7 +143,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
@@ -158,6 +157,6 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
@Override
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,10 +249,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
public ItemStack getColor( final ItemStack is )
|
||||
{
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
if( c != null && c.hasKey( "color" ) )
|
||||
if( c != null && c.contains("color") )
|
||||
{
|
||||
final CompoundNBT color = c.getCompoundTag( "color" );
|
||||
final ItemStack oldColor = new ItemStack( color );
|
||||
final ItemStack oldColor = ItemStack.read(color);
|
||||
if( !oldColor.isEmpty() )
|
||||
{
|
||||
return oldColor;
|
||||
@@ -333,7 +333,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
private void setColor( final ItemStack is, final ItemStack newColor )
|
||||
{
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = is.getOrCreateTag();
|
||||
if( newColor.isEmpty() )
|
||||
{
|
||||
data.removeTag( "color" );
|
||||
@@ -341,7 +341,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
else
|
||||
{
|
||||
final CompoundNBT color = new CompoundNBT();
|
||||
newColor.writeToNBT( color );
|
||||
newColor.write(color);
|
||||
data.setTag( "color", color );
|
||||
}
|
||||
}
|
||||
@@ -530,7 +530,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
@@ -544,7 +544,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
@Override
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -166,7 +166,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = is.getOrCreateTag().getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
@@ -180,7 +180,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
@Override
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
is.getOrCreateTag().putString("FuzzyMode", fzMode.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -45,7 +45,6 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolWirelessTerminal extends AEBasePoweredItem implements IWirelessTermHandler
|
||||
@@ -76,9 +75,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
if( stack.hasTagCompound() )
|
||||
if( stack.hasTag() )
|
||||
{
|
||||
final CompoundNBT tag = Platform.openNbtData( stack );
|
||||
final CompoundNBT tag = stack.getOrCreateTag();
|
||||
if( tag != null )
|
||||
{
|
||||
final String encKey = tag.getString( "encryptionKey" );
|
||||
@@ -95,7 +94,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.add( I18n.translateToLocal( "AppEng.GuiITooltip.Unlinked" ) );
|
||||
lines.add( I18n.format( "AppEng.GuiITooltip.Unlinked" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
{
|
||||
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
|
||||
{
|
||||
final CompoundNBT data = Platform.openNbtData( target );
|
||||
final CompoundNBT data = target.getOrCreateTag();
|
||||
manager.writeToNBT( data );
|
||||
} );
|
||||
|
||||
@@ -130,23 +129,23 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
|
||||
out.readFromNBT( Platform.openNbtData( target ).copy() );
|
||||
out.readFromNBT( target.getOrCreateTag().copy() );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncryptionKey( final ItemStack item )
|
||||
{
|
||||
final CompoundNBT tag = Platform.openNbtData( item );
|
||||
final CompoundNBT tag = item.getOrCreateTag();
|
||||
return tag.getString( "encryptionKey" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncryptionKey( final ItemStack item, final String encKey, final String name )
|
||||
{
|
||||
final CompoundNBT tag = Platform.openNbtData( item );
|
||||
tag.setString( "encryptionKey", encKey );
|
||||
tag.setString( "name", name );
|
||||
final CompoundNBT tag = item.getOrCreateTag();
|
||||
tag.putString("encryptionKey", encKey);
|
||||
tag.putString("name", name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -88,9 +88,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
super.getCheckedSubItems( creativeTab, itemStacks );
|
||||
|
||||
final ItemStack charged = new ItemStack( this, 1 );
|
||||
final CompoundNBT tag = Platform.openNbtData( charged );
|
||||
tag.setDouble( CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
|
||||
tag.setDouble( MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
|
||||
final CompoundNBT tag = charged.getOrCreateTag();
|
||||
tag.putDouble(CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ));
|
||||
tag.putDouble(MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ));
|
||||
|
||||
itemStacks.add( charged );
|
||||
}
|
||||
@@ -129,10 +129,10 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = is.getOrCreateTag();
|
||||
final double toAdd = Math.min( amount, required );
|
||||
|
||||
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage + toAdd );
|
||||
data.putDouble(CURRENT_POWER_NBT_KEY, currentStorage + toAdd);
|
||||
}
|
||||
|
||||
return Math.max( 0, overflow );
|
||||
@@ -146,9 +146,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = is.getOrCreateTag();
|
||||
|
||||
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage - fulfillable );
|
||||
data.putDouble(CURRENT_POWER_NBT_KEY, currentStorage - fulfillable);
|
||||
}
|
||||
|
||||
return fulfillable;
|
||||
@@ -163,7 +163,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
@Override
|
||||
public double getAECurrentPower( final ItemStack is )
|
||||
{
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = is.getOrCreateTag();
|
||||
|
||||
return data.getDouble( CURRENT_POWER_NBT_KEY );
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
public ItemStack getContainerItem( final ItemStack itemStack )
|
||||
{
|
||||
ItemStack copy = itemStack.copy();
|
||||
copy.setItemDamage( itemStack.getItemDamage() + 1 );
|
||||
copy.setItemDamage( itemStack.getDamage() + 1 );
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user