Added skystone, skystone block, skystone brick, skystone small brick, certus quartz, certus quartz pillar, chiseled certus quartz and fluix stars

To integrate these into the current system, some changes to the background had to be done, especially to the feature handler. It now uses an interface to work against which you can implement to get your own feature handler instead modifying the base one and add several special cases code
This commit is contained in:
thatsIch
2014-11-18 16:47:30 +01:00
parent 1572351a54
commit 56aad10ffe
46 changed files with 2624 additions and 1401 deletions
@@ -18,9 +18,12 @@
package appeng.items.tools.powered;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.Entity;
@@ -39,6 +42,7 @@ import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -73,11 +77,13 @@ import appeng.me.storage.CellInventoryHandler;
import appeng.tile.misc.TilePaint;
import appeng.util.Platform;
public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
public ToolMassCannon() {
super( ToolMassCannon.class, null );
public ToolMassCannon()
{
super( ToolMassCannon.class, Optional.<String> absent() );
setFeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
maxStoredPower = AEConfig.instance.matterCannonBattery;
}
@@ -90,7 +96,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
@@ -98,7 +104,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
if ( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ((ICellInventoryHandler) cdi).getCellInv();
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() );
@@ -108,13 +114,13 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public ItemStack onItemRightClick(ItemStack item, World w, EntityPlayer p)
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
{
if ( this.getAECurrentPower( item ) > 1600 )
{
int shots = 1;
CellUpgrades cu = (CellUpgrades) getUpgradesInventory( item );
CellUpgrades cu = ( CellUpgrades ) getUpgradesInventory( item );
if ( cu != null )
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
@@ -125,8 +131,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
IAEStack aeAmmo = itemList.getFirstItem();
if ( aeAmmo instanceof IAEItemStack )
{
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
for (int sh = 0; sh < shots; sh++)
shots = Math.min( shots, ( int ) aeAmmo.getStackSize() );
for ( int sh = 0; sh < shots; sh++ )
{
extractAEPower( item, 1600 );
@@ -134,7 +140,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return item;
aeAmmo.setStackSize( 1 );
ItemStack ammo = ((IAEItemStack) aeAmmo).getItemStack();
ItemStack ammo = ( ( IAEItemStack ) aeAmmo ).getItemStack();
if ( ammo == null )
return item;
@@ -144,14 +150,14 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return item;
float f = 1.0F;
float f1 = p.prevRotationPitch + (p.rotationPitch - p.prevRotationPitch) * f;
float f2 = p.prevRotationYaw + (p.rotationYaw - p.prevRotationYaw) * f;
double d0 = p.prevPosX + (p.posX - p.prevPosX) * f;
double d1 = p.prevPosY + (p.posY - p.prevPosY) * f + 1.62D - p.yOffset;
double d2 = p.prevPosZ + (p.posZ - p.prevPosZ) * f;
float f1 = p.prevRotationPitch + ( p.rotationPitch - p.prevRotationPitch ) * f;
float f2 = p.prevRotationYaw + ( p.rotationYaw - p.prevRotationYaw ) * f;
double d0 = p.prevPosX + ( p.posX - p.prevPosX ) * f;
double d1 = p.prevPosY + ( p.posY - p.prevPosY ) * f + 1.62D - p.yOffset;
double d2 = p.prevPosZ + ( p.posZ - p.prevPosZ ) * f;
Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
float f3 = MathHelper.cos( -f2 * 0.017453292F - ( float ) Math.PI );
float f4 = MathHelper.sin( -f2 * 0.017453292F - ( float ) Math.PI );
float f5 = -MathHelper.cos( -f1 * 0.017453292F );
float f6 = MathHelper.sin( -f1 * 0.017453292F );
float f7 = f4 * f5;
@@ -165,7 +171,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if ( penetration <= 0 )
{
ItemStack type = ((IAEItemStack) aeAmmo).getItemStack();
ItemStack type = ( ( IAEItemStack ) aeAmmo ).getItemStack();
if ( type.getItem() instanceof ItemPaintBall )
{
shootPaintBalls( type, w, p, vec3, vec31, direction, d0, d1, d2 );
@@ -190,7 +196,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return item;
}
private void shootPaintBalls(ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2)
private void shootPaintBalls( ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
{
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ),
@@ -201,11 +207,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
double closest = 9999999.0D;
int l;
for (l = 0; l < list.size(); ++l)
for ( l = 0; l < list.size(); ++l )
{
Entity entity1 = (Entity) list.get( l );
Entity entity1 = ( Entity ) list.get( l );
if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
if ( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
if ( entity1.isEntityAlive() )
{
@@ -246,18 +252,18 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
try
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord,
(float) direction.yCoord, (float) direction.zCoord, (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1) ) );
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, ( float ) direction.xCoord,
( float ) direction.yCoord, ( float ) direction.zCoord, ( byte ) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch (Exception err)
catch ( Exception err )
{
AELog.error( err );
}
if ( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
{
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
ItemPaintBall ipb = ( ItemPaintBall ) type.getItem();
AEColor col = ipb.getColor( type );
// boolean lit = ipb.isLumen( type );
@@ -270,7 +276,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
if ( pos.entityHit instanceof EntitySheep )
{
EntitySheep sh = (EntitySheep) pos.entityHit;
EntitySheep sh = ( EntitySheep ) pos.entityHit;
sh.setFleeceColor( col.ordinal() );
}
@@ -300,17 +306,17 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
pos.hitVec.xCoord -= x;
pos.hitVec.yCoord -= y;
pos.hitVec.zCoord -= z;
((TilePaint) te).addBlot( type, side.getOpposite(), pos.hitVec );
( ( TilePaint ) te ).addBlot( type, side.getOpposite(), pos.hitVec );
}
}
}
}
private void standardAmmo(float penetration, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2)
private void standardAmmo( float penetration, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
{
boolean hasDestroyedSomething = true;
while (penetration > 0 && hasDestroyedSomething)
while ( penetration > 0 && hasDestroyedSomething )
{
hasDestroyedSomething = false;
@@ -323,11 +329,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
double closest = 9999999.0D;
int l;
for (l = 0; l < list.size(); ++l)
for ( l = 0; l < list.size(); ++l )
{
Entity entity1 = (Entity) list.get( l );
Entity entity1 = ( Entity ) list.get( l );
if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
if ( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
if ( entity1.isEntityAlive() )
{
@@ -367,11 +373,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
try
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord,
(float) direction.yCoord, (float) direction.zCoord, (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1) ) );
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, ( float ) direction.xCoord,
( float ) direction.yCoord, ( float ) direction.zCoord, ( byte ) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch (Exception err)
catch ( Exception err )
{
AELog.error( err );
}
@@ -383,10 +389,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
if ( pos.typeOfHit == MovingObjectType.ENTITY )
{
int dmg = (int) Math.ceil( penetration / 20.0f );
int dmg = ( int ) Math.ceil( penetration / 20.0f );
if ( pos.entityHit instanceof EntityLivingBase )
{
EntityLivingBase el = (EntityLivingBase) pos.entityHit;
EntityLivingBase el = ( EntityLivingBase ) pos.entityHit;
penetration -= dmg;
el.knockBack( p, 0, -direction.xCoord, -direction.zCoord );
// el.knockBack( p, 0, vec3.xCoord,
@@ -434,81 +440,63 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public boolean storableInStorageCell()
public boolean isEditable( ItemStack is )
{
return true;
}
@Override
public boolean isStorageCell(ItemStack i)
{
return true;
}
@Override
public double getIdleDrain()
{
return 0.5;
}
@Override
public IInventory getUpgradesInventory(ItemStack is)
public IInventory getUpgradesInventory( ItemStack is )
{
return new CellUpgrades( is, 4 );
}
@Override
public IInventory getConfigInventory(ItemStack is)
public IInventory getConfigInventory( ItemStack is )
{
return new CellConfig( is );
}
@Override
public FuzzyMode getFuzzyMode(ItemStack is)
public FuzzyMode getFuzzyMode( ItemStack is )
{
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
}
catch (Throwable t)
catch ( Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
@Override
public boolean isEditable(ItemStack is)
{
return true;
}
@Override
public int getBytes(ItemStack cellItem)
public int getBytes( ItemStack cellItem )
{
return 512;
}
@Override
public int BytePerType(ItemStack cell)
public int BytePerType( ItemStack cell )
{
return 8;
}
@Override
public int getTotalTypes(ItemStack cellItem)
public int getTotalTypes( ItemStack cellItem )
{
return 1;
}
@Override
public boolean isBlackListed(ItemStack cellItem, IAEItemStack requestedAddition)
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
{
float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
if ( pen > 0 )
@@ -519,4 +507,22 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return true;
}
@Override
public boolean storableInStorageCell()
{
return true;
}
@Override
public boolean isStorageCell( ItemStack i )
{
return true;
}
@Override
public double getIdleDrain()
{
return 0.5;
}
}