Removed Purify Crafting Handler.

Added Crystal Growth ( for Nether, Certus, and Fluix. )
Added Macerator Crafting Handler.
Added Pulverizer Crafting Handler.
Implemented Grid Crafting Handler.
Formation Planes now eject items in a more consistent manner.
Formation Planes can now place, or eject into replaceable blocks ( air/grass/fluids )
This commit is contained in:
AlgorithmX2 2014-02-23 00:55:46 -06:00
parent 8b3071553d
commit 15f300c553
13 changed files with 314 additions and 106 deletions

2
api

@ -1 +1 @@
Subproject commit bc71f52a8780449688882fbaf851d392d93a3015
Subproject commit 6e7ac06d7c52a4d3a1d88269fea3767a52f1cbab

View file

@ -83,6 +83,7 @@ import appeng.helpers.QuartzWorldGen;
import appeng.helpers.TickHandler;
import appeng.items.materials.ItemMaterial;
import appeng.items.materials.MaterialType;
import appeng.items.misc.ItemCrystalSeed;
import appeng.items.parts.ItemFacade;
import appeng.items.parts.ItemPart;
import appeng.items.parts.PartType;
@ -116,7 +117,8 @@ import appeng.recipes.RecipeHandler;
import appeng.recipes.Recipes.ShapedRecipe;
import appeng.recipes.Recipes.ShapelessRecipe;
import appeng.recipes.handlers.Grind;
import appeng.recipes.handlers.Pureify;
import appeng.recipes.handlers.Macerator;
import appeng.recipes.handlers.Pulverizer;
import appeng.recipes.handlers.Shaped;
import appeng.recipes.handlers.Shapeless;
import appeng.recipes.handlers.Smelt;
@ -151,11 +153,15 @@ public class Registration
public void PreInit(FMLPreInitializationEvent event)
{
IRecipeHandlerRegistry recipeRegistery = AEApi.instance().registries().recipes();
recipeRegistery.addNewCraftHandler( "grind", Grind.class );
recipeRegistery.addNewCraftHandler( "pulverizer", Pulverizer.class );
recipeRegistery.addNewCraftHandler( "macerator", Macerator.class );
recipeRegistery.addNewCraftHandler( "smelt", Smelt.class );
recipeRegistery.addNewCraftHandler( "shaped", Shaped.class );
recipeRegistery.addNewCraftHandler( "shapeless", Shapeless.class );
recipeRegistery.addNewCraftHandler( "smelt", Smelt.class );
recipeRegistery.addNewCraftHandler( "pureify", Pureify.class );
RecipeSorter.register( "AE2-Shaped", ShapedRecipe.class, Category.SHAPED, "" );
RecipeSorter.register( "AE2-Shapeless", ShapelessRecipe.class, Category.SHAPELESS, "" );
@ -326,6 +332,7 @@ public class Registration
items.itemBiometricCard = addFeature( ToolBiometricCard.class );
items.itemFacade = addFeature( ItemFacade.class );
items.itemCrystalSeed = addFeature( ItemCrystalSeed.class );
addFeature( ToolDebugCard.class );
addFeature( ToolReplicatorCard.class );

View file

@ -5,9 +5,11 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import appeng.api.implementations.items.IGrowableCrystal;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform;
final public class EntityGrowingCrystal extends EntityItem
@ -32,6 +34,7 @@ final public class EntityGrowingCrystal extends EntityItem
public void onUpdate()
{
super.onUpdate();
age = 0;
if ( Platform.isClient() )
return;
@ -52,9 +55,10 @@ final public class EntityGrowingCrystal extends EntityItem
float multiplier = cry.getMultiplier( blk, mat );
if ( Platform.isServer() && mat.isLiquid() )
{
progress_1000 += Math.min( 1, getSpeed( j, i, k ) * multiplier );
progress_1000 += Math.max( 1, getSpeed( j, i, k ) * multiplier );
if ( progress_1000 > 1000 )
{
progress_1000 -= 1000;
setEntityItemStack( cry.triggerGrowth( is ) );
}
}
@ -65,7 +69,38 @@ final public class EntityGrowingCrystal extends EntityItem
private int getSpeed(int x, int y, int z)
{
return 10;
final int per = 80;
final float mul = 0.3f;
int qty = 0;
if ( isAccel( x + 1, y, z ) )
qty += per + qty * mul;
if ( isAccel( x, y + 1, z ) )
qty += per + qty * mul;
if ( isAccel( x, y, z + 1 ) )
qty += per + qty * mul;
if ( isAccel( x - 1, y, z ) )
qty += per + qty * mul;
if ( isAccel( x, y - 1, z ) )
qty += per + qty * mul;
if ( isAccel( x, y, z - 1 ) )
qty += per + qty * mul;
return qty;
}
private boolean isAccel(int x, int y, int z)
{
TileEntity te = worldObj.getTileEntity( x, y, z );
if ( te instanceof TileQuartzGrowthAccelerator )
return ((TileQuartzGrowthAccelerator) te).isPowered();
return false;
}
}

View file

@ -18,7 +18,7 @@ public class EntityIds
return SINGULARITY;
if ( droppedEntity == EntityChargedQuartz.class )
return CHARGED_QUARTZ;
if ( droppedEntity == EntityChargedQuartz.class )
if ( droppedEntity == EntityGrowingCrystal.class )
return GROWING_CRYSTAL;
throw new RuntimeException( "Missing entity id: " + droppedEntity.getName() );

View file

@ -12,4 +12,6 @@ public interface IIC2
ItemStack getItem(String string);
void maceratorRecipe(ItemStack in, ItemStack out);
}

View file

@ -17,7 +17,6 @@ public class IC2 implements IIntegrationModule, IIC2
@Override
public void Init()
{
// TODO Auto-generated method stub
}
@ -25,27 +24,10 @@ public class IC2 implements IIntegrationModule, IIC2
public void PostInit()
{
AEApi.instance().registries().matterCannon().registerAmmo( getItem( "uraniumDrop" ), 238.0289 );
/*
* // certus quartz maceratorRecipe( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ),
* AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
*
* maceratorRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 ),
* AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ) );
*
* // fluix maceratorRecipe( AEApi.instance().materials().materialFluixCrystal.stack( 1 ),
* AEApi.instance().materials().materialFluixDust.stack( 1 ) );
*
* // nether quartz maceratorRecipe( new ItemStack( Itemq ),
* AEApi.instance().materials().materialNetherQuartzDust.stack( 1 ) );
*/
}
/*
* private void compressorRecipe(ItemStack in, ItemStack out) { ic2.api.recipe.Recipes.compressor.addRecipe( new
* RecipeInputItemStack( in, in.stackSize ), null, out ); }
*/
private void maceratorRecipe(ItemStack in, ItemStack out)
@Override
public void maceratorRecipe(ItemStack in, ItemStack out)
{
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, out );
}

View file

@ -1,14 +1,27 @@
package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.implementations.items.IGrowableCrystal;
import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.entity.EntityGrowingCrystal;
import appeng.entity.EntityIds;
import appeng.items.AEBaseItem;
import cpw.mods.fml.common.registry.EntityRegistry;
public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
@ -19,6 +32,12 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public ItemCrystalSeed() {
super( ItemCrystalSeed.class );
setHasSubtypes( true );
setMaxStackSize( 8 );
setfeature( EnumSet.of( AEFeature.Core ) );
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ),
AppEng.instance, 16, 4, true );
}
@Override
@ -26,13 +45,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
int damage = is.getItemDamage();
if ( damage <= 600 )
if ( damage < 600 )
return getUnlocalizedName() + ".Certus";
if ( damage <= 1200 )
if ( damage < 1200 )
return getUnlocalizedName() + ".Nether";
if ( damage <= 1800 )
if ( damage < 1800 )
return getUnlocalizedName() + ".Fluix";
return getUnlocalizedName();
@ -41,21 +60,47 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
@Override
public ItemStack triggerGrowth(ItemStack is)
{
is.setItemDamage( is.getItemDamage() + 1 );
int newDamage = is.getItemDamage() + 1;
if ( is.getItemDamage() > 1800 ) // max!
return is;
if ( is.getItemDamage() == 600 )
if ( newDamage == 600 )
return AEApi.instance().materials().materialPureifiedCertusQuartzCrystal.stack( is.stackSize );
if ( is.getItemDamage() == 1200 )
if ( newDamage == 1200 )
return AEApi.instance().materials().materialPureifiedNetherQuartzCrystal.stack( is.stackSize );
if ( is.getItemDamage() == 1800 )
if ( newDamage == 1800 )
return AEApi.instance().materials().materialPureifiedFluixCrystal.stack( is.stackSize );
if ( newDamage > 1800 )
return null;
is.setItemDamage( newDamage );
return is;
}
@Override
public boolean isDamageable()
{
return true;
}
@Override
public boolean isDamaged(ItemStack stack)
{
if ( stack.getItemDamage() % 200 == 0 )
return false;
return true;
}
@Override
public int getDisplayDamage(ItemStack stack)
{
return stack.getItemDamage() % 200;
}
@Override
public int getMaxDamage(ItemStack stack)
{
return 200;
}
@Override
public IIcon getIconFromDamage(int damage)
{
@ -64,11 +109,17 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
if ( damage < 600 )
list = certus;
if ( damage < 1200 )
else if ( damage < 1200 )
{
damage -= 600;
list = nether;
}
if ( damage < 1800 )
else if ( damage < 1800 )
{
damage -= 1200;
list = fluix;
}
if ( list == null )
return Items.diamond.getIconFromDamage( 0 );
@ -84,7 +135,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
@Override
public float getMultiplier(Block blk, Material mat)
{
return 1.0f;
return 0.5f;
}
@Override
@ -93,16 +144,56 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
String preFix = "appliedenergistics2:GrowthSeed.";
certus[0] = ir.registerIcon( preFix + "Certus" );
certus[1] = ir.registerIcon( preFix + "Certus1" );
certus[2] = ir.registerIcon( preFix + "Certus2" );
certus[1] = ir.registerIcon( preFix + "Certus2" );
certus[2] = ir.registerIcon( preFix + "Certus3" );
nether[0] = ir.registerIcon( preFix + "Nether" );
nether[1] = ir.registerIcon( preFix + "Nether1" );
nether[2] = ir.registerIcon( preFix + "Nether2" );
nether[1] = ir.registerIcon( preFix + "Nether2" );
nether[2] = ir.registerIcon( preFix + "Nether3" );
fluix[0] = ir.registerIcon( preFix + "Fluix" );
fluix[1] = ir.registerIcon( preFix + "Fluix1" );
fluix[2] = ir.registerIcon( preFix + "Fluix2" );
fluix[1] = ir.registerIcon( preFix + "Fluix2" );
fluix[2] = ir.registerIcon( preFix + "Fluix3" );
}
@Override
public boolean hasCustomEntity(ItemStack stack)
{
return true;
}
@Override
public Entity createEntity(World world, Entity location, ItemStack itemstack)
{
EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.posX, location.posY, location.posZ, itemstack );
egc.motionX = location.motionX;
egc.motionY = location.motionY;
egc.motionZ = location.motionZ;
if ( location instanceof EntityItem && egc instanceof EntityItem )
((EntityItem) egc).delayBeforeCanPickup = ((EntityItem) location).delayBeforeCanPickup;
return egc;
}
@Override
public void getSubItems(Item i, CreativeTabs t, List l)
{
// lvl 0
l.add( new ItemStack( this, 1, 0 ) );
l.add( new ItemStack( this, 1, 600 ) );
l.add( new ItemStack( this, 1, 1200 ) );
// lvl 1
l.add( new ItemStack( this, 1, 200 + 0 ) );
l.add( new ItemStack( this, 1, 200 + 600 ) );
l.add( new ItemStack( this, 1, 200 + 1200 ) );
// lvl 2
l.add( new ItemStack( this, 1, 400 + 0 ) );
l.add( new ItemStack( this, 1, 400 + 600 ) );
l.add( new ItemStack( this, 1, 400 + 1200 ) );
}
}

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -353,7 +354,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
int y = te.yCoord + side.offsetY;
int z = te.zCoord + side.offsetZ;
blocked = !w.getBlock( x, y, z ).isAir( w, x, y, z );
blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
}
@Override
@ -376,7 +377,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
int y = te.yCoord + side.offsetY;
int z = te.zCoord + side.offsetZ;
if ( w.getBlock( x, y, z ).isAir( w, x, y, z ) )
if ( w.getBlock( x, y, z ).isReplaceable( w, x, y, z ) )
{
if ( i instanceof ItemBlock || i instanceof IPlantable )
{
@ -440,16 +441,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
if ( type == Actionable.MODULATE )
{
is.stackSize = (int) maxStorage;
List<ItemStack> out = new ArrayList( 1 );
out.add( is );
if ( type == Actionable.MODULATE )
Platform.spawnDrops( w, x, y, z, out );
{
EntityItem ei = new EntityItem( w, // w
((side.offsetX != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetX * -0.3 + (double) x, // spawn
((side.offsetY != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetY * -0.3 + (double) y, // spawn
((side.offsetZ != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetZ * -0.3 + (double) z, // spawn
is.copy() );
ei.motionX = side.offsetX * 0.2;
ei.motionY = side.offsetY * 0.2;
ei.motionZ = side.offsetZ * 0.2;
w.spawnEntityInWorld( ei );
}
}
}
}
}
blocked = !w.getBlock( x, y, z ).isAir( w, x, y, z );
blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
if ( worked )
{

View file

@ -2,6 +2,8 @@ package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
@ -11,17 +13,30 @@ import appeng.api.recipes.IIngredient;
public class Grind implements ICraftHandler
{
IIngredient pro_input;
IIngredient pro_output[];
@Override
public void setup(List<List<IIngredient>> input,
List<List<IIngredient>> output) throws RecipeError {
// TODO Auto-generated method stub
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
{
pro_input = input.get( 0 ).get( 0 );
pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
return;
}
}
new RecipeError( "Grind must have a single input, and single output." );
}
@Override
public void register() throws RegistrationError, MissingIngredientError {
// TODO Auto-generated method stub
public void register() throws RegistrationError, MissingIngredientError
{
for (ItemStack is : pro_input.getItemStackSet())
AEApi.instance().registries().grinder().addRecipe( is, pro_output[0].getItemStack(), 8 );
}
}

View file

@ -0,0 +1,47 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.core.AppEng;
import appeng.integration.abstraction.IIC2;
public class Macerator implements ICraftHandler
{
IIngredient pro_input;
IIngredient pro_output[];
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
{
pro_input = input.get( 0 ).get( 0 );
pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
return;
}
}
new RecipeError( "Grind must have a single input, and single output." );
}
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( "IC2" ) )
{
IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( "IC2" );
for (ItemStack is : pro_input.getItemStackSet())
ic2.maceratorRecipe( is, pro_output[0].getItemStack() );
}
}
}

View file

@ -0,0 +1,52 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import cpw.mods.fml.common.event.FMLInterModComms;
public class Pulverizer implements ICraftHandler
{
IIngredient pro_input;
IIngredient pro_output[];
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
{
pro_input = input.get( 0 ).get( 0 );
pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
return;
}
}
new RecipeError( "Grind must have a single input, and single output." );
}
@Override
public void register() throws RegistrationError, MissingIngredientError
{
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger( "energy", 800 );
toSend.setTag( "primaryOutput", new NBTTagCompound() );
pro_output[0].getItemStack().writeToNBT( toSend.getCompoundTag( "primaryOutput" ) );
for (ItemStack is : pro_input.getItemStackSet())
{
toSend.setTag( "input", new NBTTagCompound() );
is.writeToNBT( toSend.getCompoundTag( "input" ) );
FMLInterModComms.sendMessage( "ThermalExpansion", "PulverizerRecipe", toSend );
}
}
}

View file

@ -1,45 +0,0 @@
package appeng.recipes.handlers;
import java.util.List;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
public class Pureify implements ICraftHandler
{
IIngredient in;
IIngredient out;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
{
List<IIngredient> inputList = input.get( 0 );
List<IIngredient> outputList = output.get( 0 );
if ( inputList.size() == 1 && outputList.size() == 1 )
{
in = inputList.get( 0 );
out = outputList.get( 0 );
return;
}
}
throw new RecipeError( "Pureify recipe can only have a single input and output." );
}
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( in.getItemStackSet() == null )
throw new RegistrationError( in.toString() + ": Pureify Input is not a valid item." );
if ( out.getItemStack().getItem() == null )
throw new RegistrationError( out.toString() + ": Pureify Output is not a valid item." );
}
}

View file

@ -15,6 +15,7 @@ import appeng.me.GridAccessException;
import appeng.tile.events.AETileEventHandler;
import appeng.tile.events.TileEventType;
import appeng.tile.grid.AENetworkTile;
import appeng.util.Platform;
public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPowerChannelState
{
@ -66,7 +67,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
public TileQuartzGrowthAccelerator() {
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
gridProxy.setFlags( GridFlags.CANNOT_CARRY );
gridProxy.setIdlePowerUsage( 2 );
gridProxy.setIdlePowerUsage( 8 );
addNewHandler( new TileChargerHandler() );
}
@ -80,13 +81,25 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
@Override
public boolean isPowered()
{
if ( Platform.isServer() )
{
try
{
return gridProxy.getEnergy().isNetworkPowered();
}
catch (GridAccessException e)
{
return false;
}
}
return hasPower;
}
@Override
public boolean isActive()
{
return hasPower;
return isPowered();
}
}