More compile things

This commit is contained in:
covers1624
2020-06-02 15:12:30 +09:30
parent 404ef5624b
commit 3f5c299d09
111 changed files with 838 additions and 873 deletions
@@ -107,7 +107,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
@Override
public void setProfile( final ItemStack itemStack, final GameProfile profile )
{
final CompoundNBT tag = Platform.openNbtData( itemStack );
final CompoundNBT tag = itemStack.getOrCreateTag();
if( profile != null )
{
@@ -124,7 +124,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
@Override
public GameProfile getProfile( final ItemStack is )
{
final CompoundNBT tag = Platform.openNbtData( is );
final CompoundNBT tag = is.getOrCreateTag();
if( tag.contains( "profile" ) )
{
return NBTUtil.readGameProfile( tag.getCompound( "profile" ) );
@@ -135,7 +135,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
@Override
public EnumSet<SecurityPermissions> getPermissions( final ItemStack is )
{
final CompoundNBT tag = Platform.openNbtData( is );
final CompoundNBT tag = is.getOrCreateTag();
final EnumSet<SecurityPermissions> result = EnumSet.noneOf( SecurityPermissions.class );
for( final SecurityPermissions sp : SecurityPermissions.values() )
@@ -152,14 +152,14 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
@Override
public boolean hasPermission( final ItemStack is, final SecurityPermissions permission )
{
final CompoundNBT tag = Platform.openNbtData( is );
final CompoundNBT tag = is.getOrCreateTag();
return tag.getBoolean( permission.name() );
}
@Override
public void removePermission( final ItemStack itemStack, final SecurityPermissions permission )
{
final CompoundNBT tag = Platform.openNbtData( itemStack );
final CompoundNBT tag = itemStack.getOrCreateTag();
if( tag.contains( permission.name() ) )
{
tag.remove( permission.name() );
@@ -169,7 +169,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
@Override
public void addPermission( final ItemStack itemStack, final SecurityPermissions permission )
{
final CompoundNBT tag = Platform.openNbtData( itemStack );
final CompoundNBT tag = itemStack.getOrCreateTag();
tag.putBoolean( permission.name(), true );
}
@@ -1,8 +1,7 @@
package appeng.items.tools;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -25,18 +25,15 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.Direction;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponent;
import net.minecraft.util.text.TextComponentUtils;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -54,18 +51,24 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
private static final AEColor[] DEFAULT_COLOR_CODE = new AEColor[] {
AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT,
AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT,
};
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
AEColor.TRANSPARENT,
};
public ToolMemoryCard()
{
this.setMaxStackSize( 1 );
super( new Properties().maxStackSize( 1 ) );
}
@Override
@OnlyIn( Dist.CLIENT )
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
public void addInformation( final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
{
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
@@ -113,15 +116,15 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
@Override
public void setMemoryCardContents( final ItemStack is, final String settingsName, final CompoundNBT data )
{
final CompoundNBT c = Platform.openNbtData( is );
c.setString( "Config", settingsName );
c.setTag( "Data", data );
final CompoundNBT c = is.getOrCreateTag();
c.putString( "Config", settingsName );
c.put( "Data", data );
}
@Override
public String getSettingsName( final ItemStack is )
{
final CompoundNBT c = Platform.openNbtData( is );
final CompoundNBT c = is.getOrCreateTag();
final String name = c.getString( "Config" );
return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
}
@@ -129,8 +132,8 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
@Override
public CompoundNBT getData( final ItemStack is )
{
final CompoundNBT c = Platform.openNbtData( is );
CompoundNBT o = c.getCompoundTag( "Data" );
final CompoundNBT c = is.getOrCreateTag();
CompoundNBT o = c.getCompound( "Data" );
if( o == null )
{
o = new CompoundNBT();
@@ -143,15 +146,21 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
final CompoundNBT tag = this.getData( is );
if( tag.hasKey( "colorCode" ) )
if( tag.contains( "colorCode" ) )
{
final int[] frequency = tag.getIntArray( "colorCode" );
final AEColor[] colorArray = AEColor.values();
return new AEColor[] {
colorArray[frequency[0]], colorArray[frequency[1]], colorArray[frequency[2]], colorArray[frequency[3]],
colorArray[frequency[4]], colorArray[frequency[5]], colorArray[frequency[6]], colorArray[frequency[7]],
};
colorArray[frequency[0]],
colorArray[frequency[1]],
colorArray[frequency[2]],
colorArray[frequency[3]],
colorArray[frequency[4]],
colorArray[frequency[5]],
colorArray[frequency[6]],
colorArray[frequency[7]],
};
}
return DEFAULT_COLOR_CODE;
@@ -187,19 +196,19 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
}
@Override
public EnumActionResult onItemUse( final PlayerEntity player, final World w, final BlockPos pos, final Hand hand, final Direction side, final float hx, final float hy, final float hz )
public ActionResultType onItemUse( ItemUseContext context )
{
if( player.isShiftKeyDown() )
if( context.getPlayer().isShiftKeyDown() )
{
if( !w.isRemote )
if( !context.getPlayer().world.isRemote )
{
this.clearCard( player, w, hand );
this.clearCard( context.getPlayer(), context.getWorld(), context.getHand() );
}
return EnumActionResult.SUCCESS;
return ActionResultType.SUCCESS;
}
else
{
return super.onItemUse( player, w, pos, hand, side, hx, hy, hz );
return super.onItemUse( context );
}
}
@@ -215,11 +224,10 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
}
return super.onItemRightClick( w, player, hand );
}
@Override
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockReader world, final BlockPos pos, final PlayerEntity player )
public boolean doesSneakBypassUse( ItemStack stack, IWorldReader world, BlockPos pos, PlayerEntity player )
{
return true;
}
@@ -228,6 +236,6 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem();
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
player.getHeldItem( hand ).setTagCompound( null );
player.getHeldItem( hand ).setTag( null );
}
}
@@ -1,8 +1,7 @@
package appeng.items.tools;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -21,17 +21,21 @@ package appeng.items.tools;
import net.minecraft.block.Block;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
@@ -57,8 +61,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
public ToolNetworkTool()
{
this.setMaxStackSize( 1 );
this.setHarvestLevel( "wrench", 0 );
super(new Item.Properties().maxStackSize( 1 ).addToolType( ToolType.get("wrench"), 0 ));
}
@Override
@@ -75,20 +78,20 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
{
final RayTraceResult mop = AppEng.proxy.getRTR();
if( mop == null || mop.typeOfHit == RayTraceResult.Type.MISS )
if( mop == null || mop.getType() == RayTraceResult.Type.MISS )
{
NetworkHandler.instance().sendToServer( new PacketClick( BlockPos.ORIGIN, null, 0, 0, 0, hand ) );
NetworkHandler.instance().sendToServer( new PacketClick( BlockPos.ZERO, null, 0, 0, 0, hand ) );
}
}
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
@Override
public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
public ActionResultType onItemUseFirst( ItemStack stack, ItemUseContext context )
{
final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos );
final TileEntity te = world.getTileEntity( pos );
final TileEntity te = context.getWorld().getTileEntity( context.getPos() );
if( te instanceof IPartHost )
{
@@ -98,17 +101,17 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
{
if( part.part instanceof INetworkToolAgent && !( (INetworkToolAgent) part.part ).showNetworkInfo( mop ) )
{
return EnumActionResult.FAIL;
return ActionResultType.FAIL;
}
else if( player.isShiftKeyDown() )
else if( context.getPlayer().isShiftKeyDown() )
{
return EnumActionResult.PASS;
return ActionResultType.PASS;
}
}
}
else if( te instanceof INetworkToolAgent && !( (INetworkToolAgent) te ).showNetworkInfo( mop ) )
{
return EnumActionResult.FAIL;
return ActionResultType.FAIL;
}
if( Platform.isClient() )
@@ -116,11 +119,11 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
NetworkHandler.instance().sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ, hand ) );
}
return EnumActionResult.SUCCESS;
return ActionResultType.SUCCESS;
}
@Override
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockReader world, final BlockPos pos, final PlayerEntity player )
public boolean doesSneakBypassUse( ItemStack stack, IWorldReader world, BlockPos pos, PlayerEntity player )
{
return true;
}
@@ -50,10 +50,10 @@ public class ToolChargedStaff extends AEBasePoweredItem
{
for( int x = 0; x < 2; x++ )
{
final AxisAlignedBB entityBoundingBox = target.getEntityBoundingBox();
final float dx = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minX );
final float dy = (float) ( Platform.getRandomFloat() * target.height + entityBoundingBox.minY );
final float dz = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minZ );
final AxisAlignedBB entityBoundingBox = target.getBoundingBox();
final float dx = (float) ( Platform.getRandomFloat() * target.getWidth() + entityBoundingBox.minX );
final float dy = (float) ( Platform.getRandomFloat() * target.getHeight() + entityBoundingBox.minY );
final float dz = (float) ( Platform.getRandomFloat() * target.getWidth() + entityBoundingBox.minZ );
AppEng.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.world, new PacketLightning( dx, dy, dz ) );
}
}
@@ -26,6 +26,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.SnowballItem;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.text.ITextComponent;
import org.apache.commons.lang3.text.WordUtils;
@@ -68,6 +70,7 @@ import appeng.api.util.DimensionalCoord;
import appeng.block.networking.BlockCableBus;
import appeng.block.paint.BlockPaint;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.helpers.IMouseWheelItem;
import appeng.hooks.IBlockTool;
@@ -104,13 +107,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public EnumActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
public ActionResultType onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
{
return this.onItemUse( p.getHeldItem( hand ), p, w, pos, hand, side, hitX, hitY, hitZ );
}
@Override
public EnumActionResult onItemUse( ItemStack is, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
public ActionResultType onItemUse( ItemStack is, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
{
final Block blk = w.getBlockState( pos ).getBlock();
@@ -137,11 +140,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( !Platform.hasPermissions( new DimensionalCoord( w, pos ), p ) )
{
return EnumActionResult.FAIL;
return ActionResultType.FAIL;
}
final double powerPerUse = 100;
if( !paintBall.isEmpty() && paintBall.getItem() instanceof ItemSnowball )
if( !paintBall.isEmpty() && paintBall.getItem() instanceof SnowballItem )
{
final TileEntity te = w.getTileEntity( pos );
// clean cables.
@@ -153,7 +156,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.MODULATE, new BaseActionSource() );
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
return EnumActionResult.SUCCESS;
return ActionResultType.SUCCESS;
}
}
}
@@ -166,7 +169,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.MODULATE, new BaseActionSource() );
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
( (TilePaint) painted ).cleanSide( side.getOpposite() );
return EnumActionResult.SUCCESS;
return ActionResultType.SUCCESS;
}
}
else if( !paintBall.isEmpty() )
@@ -179,7 +182,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
inv.extractItems( AEItemStack.fromItemStack( paintBall ), Actionable.MODULATE, new BaseActionSource() );
this.extractAEPower( is, powerPerUse, Actionable.MODULATE );
return EnumActionResult.SUCCESS;
return ActionResultType.SUCCESS;
}
}
}
@@ -190,7 +193,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
this.cycleColors( is, paintBall, 1 );
}
return EnumActionResult.FAIL;
return ActionResultType.FAIL;
}
@Override
@@ -220,7 +223,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return null;
}
if( paintBall.getItem() instanceof ItemSnowball )
if( paintBall.getItem() instanceof SnowballItem )
{
return AEColor.TRANSPARENT;
}
@@ -251,7 +254,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
final CompoundNBT c = is.getTag();
if( c != null && c.contains("color") )
{
final CompoundNBT color = c.getCompoundTag( "color" );
final CompoundNBT color = c.getCompound( "color" );
final ItemStack oldColor = ItemStack.read(color);
if( !oldColor.isEmpty() )
{
@@ -336,13 +339,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
final CompoundNBT data = is.getOrCreateTag();
if( newColor.isEmpty() )
{
data.removeTag( "color" );
data.remove( "color" );
}
else
{
final CompoundNBT color = new CompoundNBT();
newColor.write(color);
data.setTag( "color", color );
data.put( "color", color );
}
}
@@ -469,7 +472,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
}
if( requestedAddition.getItem() instanceof ItemSnowball )
if( requestedAddition.getItem() instanceof SnowballItem )
{
return false;
}
@@ -1,8 +1,7 @@
package appeng.items.tools.powered;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
@@ -35,6 +35,7 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
@@ -216,11 +217,11 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( target == null )
{
return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.FAIL, p.getHeldItem( hand ) );
}
else
{
if( target.typeOfHit == RayTraceResult.Type.BLOCK )
if( target.getType() == RayTraceResult.Type.BLOCK )
{
final BlockState state = w.getBlockState( target.getBlockPos() );
if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
@@ -237,7 +238,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
public EnumActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
public ActionResultType onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
{
return this.onItemUse( p.getHeldItem( hand ), p, w, pos, hand, side, hitX, hitY, hitZ );
}
@@ -20,7 +20,6 @@ package appeng.items.tools.powered;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -34,9 +33,9 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -48,7 +47,6 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
@@ -62,6 +60,7 @@ import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.core.localization.PlayerMessages;
@@ -89,15 +88,11 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
@OnlyIn( Dist.CLIENT )
@Override
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
public void addInformation( final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
{
super.addInformation( stack, world, lines, advancedTooltips );
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE
.registries()
.cell()
.getCellInventory( stack, null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final ICellInventoryHandler<IAEItemStack> cdi = Api.INSTANCE.registries().cell().getCellInventory( stack, null, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
Api.INSTANCE.client().addCellInformation( cdi, lines );
}
@@ -115,15 +110,10 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
}
final ICellInventoryHandler<IAEItemStack> inv = Api.INSTANCE
.registries()
.cell()
.getCellInventory( p.getHeldItem( hand ), null,
Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
final ICellInventoryHandler<IAEItemStack> inv = Api.INSTANCE.registries().cell().getCellInventory( p.getHeldItem( hand ), null, Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ) );
if( inv != null )
{
final IItemList<IAEItemStack> itemList = inv
.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
final IItemList<IAEItemStack> itemList = inv.getAvailableItems( Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList() );
IAEItemStack req = itemList.getFirstItem();
if( req instanceof IAEItemStack )
{
@@ -135,23 +125,23 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
if( Platform.isClient() )
{
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
aeAmmo.setStackSize( 1 );
final ItemStack ammo = aeAmmo.createItemStack();
if( ammo == null )
{
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if( aeAmmo == null )
{
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
final LookDirection dir = Platform.getPlayerRay( p );
final Vec3d Vec3d = dir.getA();
final Vec3d Vec3d1 = dir.getB();
@@ -170,7 +160,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
{
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
}
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
else
{
@@ -184,17 +174,16 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
{
p.sendMessage( PlayerMessages.AmmoDepleted.get() );
}
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
}
}
}
return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.FAIL, p.getHeldItem( hand ) );
}
private void shootPaintBalls( final ItemStack type, final World w, final PlayerEntity p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
{
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math
.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
Entity entity = null;
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
@@ -247,9 +236,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
try
{
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w,
new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec
.squareDistanceTo( vec ) + 1 ) ) );
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch( final Exception err )
{
@@ -263,7 +250,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final AEColor col = ipb.getColor( type );
// boolean lit = ipb.isLumen( type );
if( pos.typeOfHit == RayTraceResult.Type.ENTITY )
if( pos.getType() == RayTraceResult.Type.ENTITY )
{
final int id = pos.entityHit.getEntityId();
final PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
@@ -291,8 +278,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
final Block whatsThere = w.getBlockState( hitPos ).getBlock();
if( whatsThere.isReplaceable( w, hitPos ) && w.isAirBlock( hitPos ) )
{
Api.INSTANCE.definitions().blocks().paint().maybeBlock().ifPresent( paintBlock ->
{
Api.INSTANCE.definitions().blocks().paint().maybeBlock().ifPresent( paintBlock -> {
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
} );
}
@@ -314,8 +300,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
{
hasDestroyed = false;
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math
.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
Entity entity = null;
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
@@ -367,9 +352,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
try
{
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w,
new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec
.squareDistanceTo( vec ) + 1 ) ) );
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch( final Exception err )
{
@@ -457,7 +440,7 @@ public class ToolMatterCannon 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 );
@@ -471,7 +454,7 @@ public class ToolMatterCannon 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
@@ -26,6 +26,7 @@ import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -47,6 +48,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AEPartLocation;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.core.sync.GuiBridge;
import appeng.items.contents.CellConfig;
@@ -67,7 +69,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
{
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
}
@OnlyIn( Dist.CLIENT )
@@ -21,19 +21,19 @@ package appeng.items.tools.powered;
import java.util.List;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@@ -42,6 +42,7 @@ import appeng.api.config.ViewItems;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.util.IConfigManager;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.util.ConfigManager;
@@ -59,7 +60,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
{
Api.INSTANCE.registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player );
return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
}
@OnlyIn( Dist.CLIENT )
@@ -77,7 +78,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
if( stack.hasTag() )
{
final CompoundNBT tag = stack.getOrCreateTag();
final CompoundNBT tag = stack.getOrCreateTag();
if( tag != null )
{
final String encKey = tag.getString( "encryptionKey" );
@@ -119,9 +120,8 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public IConfigManager getConfigManager( final ItemStack target )
{
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
final CompoundNBT data = target.getOrCreateTag();
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) -> {
final CompoundNBT data = target.getOrCreateTag();
manager.writeToNBT( data );
} );
@@ -129,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( target.getOrCreateTag().copy() );
out.readFromNBT( target.getOrCreateTag().copy() );
return out;
}
@Override
public String getEncryptionKey( final ItemStack item )
{
final CompoundNBT tag = item.getOrCreateTag();
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 = item.getOrCreateTag();
tag.putString("encryptionKey", encKey);
tag.putString("name", name);
final CompoundNBT tag = item.getOrCreateTag();
tag.putString( "encryptionKey", encKey );
tag.putString( "name", name );
}
@Override
@@ -50,10 +50,10 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
public AEBasePoweredItem( final double powerCapacity )
{
this.setMaxStackSize( 1 );
this.setMaxDamage( 32 );
this.hasSubtypes = false;
this.setFull3D();
super(new Properties().maxStackSize( 1 ).maxDamage( 32 ));
//FIXME
// this.hasSubtypes = false;
// this.setFull3D();
this.powerCapacity = powerCapacity;
}