Some additional fixes from other branch.
This commit is contained in:
@@ -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