AE2 First Commit, the dawn of 1.7 hast arrived.
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
package appeng.items.materials;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.implementations.IStorageComponent;
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
public class ItemMaterial extends AEBaseItem implements IStorageComponent
|
||||
{
|
||||
|
||||
final MaterialType material;
|
||||
|
||||
public ItemMaterial(MaterialType type) {
|
||||
super( ItemMaterial.class, type.name() );
|
||||
setfeature( type.getFeature() );
|
||||
material = type;
|
||||
|
||||
if ( type.getOreName() != null )
|
||||
OreDictionary.registerOre( type.getOreName(), this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack is)
|
||||
{
|
||||
return material.hasCustomEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World w, Entity location, ItemStack itemstack)
|
||||
{
|
||||
Class<? extends Entity> droppedEntity = material.getCustomEntityClass();
|
||||
Entity eqi;
|
||||
|
||||
try
|
||||
{
|
||||
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class ).newInstance( w, location.posX,
|
||||
location.posY, location.posZ, itemstack );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
|
||||
eqi.motionX = location.motionX;
|
||||
eqi.motionY = location.motionY;
|
||||
eqi.motionZ = location.motionZ;
|
||||
|
||||
if ( location instanceof EntityItem && eqi instanceof EntityItem )
|
||||
((EntityItem) eqi).delayBeforeCanPickup = ((EntityItem) location).delayBeforeCanPickup;
|
||||
|
||||
return eqi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes(ItemStack is)
|
||||
{
|
||||
switch (material)
|
||||
{
|
||||
case Cell1kPart:
|
||||
return 1024;
|
||||
case Cell4kPart:
|
||||
return 1024 * 4;
|
||||
case Cell16kPart:
|
||||
return 1024 * 16;
|
||||
case Cell64kPart:
|
||||
return 1024 * 64;
|
||||
default:
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageComponent(ItemStack is)
|
||||
{
|
||||
switch (material)
|
||||
{
|
||||
case Cell1kPart:
|
||||
case Cell4kPart:
|
||||
case Cell16kPart:
|
||||
case Cell64kPart:
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package appeng.items.materials;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.client.render.entity.EntityIds;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.entity.EntityChargedQuartz;
|
||||
import appeng.entity.EntitySingularity;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
|
||||
public enum MaterialType
|
||||
{
|
||||
CertusQuartzCrystal(AEFeature.Core), CertusQuartzCrystalCharged(AEFeature.Core, EntityChargedQuartz.class),
|
||||
|
||||
CertusQuartzDust, NetherQuartzDust(AEFeature.Core, "dustNetherQuartz"), Flour(AEFeature.Flour, "dustWheat"), GoldDust(AEFeature.Core, "dustGold"), IronDust(
|
||||
AEFeature.Core, "dustIron"), IronNugget(AEFeature.Core, "nuggetIron"),
|
||||
|
||||
Silicon(AEFeature.Core, "itemSilicon"), MatterBall,
|
||||
|
||||
FluixCrystal(AEFeature.Core, "crystalFLuix"), FluixDust(AEFeature.Core, "dustFluix"), FluixPearl(AEFeature.Core, "pearlFluix"),
|
||||
|
||||
PureifiedCertusQuartzCrystal, PureifiedNetherQuartzCrystal, PureifiedFluixCrystal,
|
||||
|
||||
LogicProcessorAsm(AEFeature.QuartzKnife), LogicProcessor,
|
||||
|
||||
CalcProcessor, EngProcessor,
|
||||
|
||||
// Basic Cards
|
||||
BasicCard, CardRedstone, CardCapacity,
|
||||
|
||||
// Adv Cards
|
||||
AdvCard, CardFuzzy, CardSpeed,
|
||||
|
||||
Cell2SpatialPart(AEFeature.SpatialIO), Cell16SpatialPart(AEFeature.SpatialIO), Cell128SpatialPart(AEFeature.SpatialIO),
|
||||
|
||||
Cell1kPart(AEFeature.StorageCells), Cell4kPart(AEFeature.StorageCells), Cell16kPart(AEFeature.StorageCells), Cell64kPart(AEFeature.StorageCells), EmptyStorageCell(
|
||||
AEFeature.StorageCells),
|
||||
|
||||
WoodenGear(AEFeature.GrindStone, "gearWood"),
|
||||
|
||||
Wireless(AEFeature.WirelessAccessTerminal), WirelessBooster(AEFeature.WirelessAccessTerminal),
|
||||
|
||||
BlankPattern, FormationCore, AnnihilationCore,
|
||||
|
||||
EnderDust(AEFeature.QuantumNetworkBridge, "dustEnder"), Singularity(AEFeature.QuantumNetworkBridge), QESingularity(AEFeature.QuantumNetworkBridge,
|
||||
EntitySingularity.class);
|
||||
|
||||
private String oreName;
|
||||
private EnumSet<AEFeature> features;
|
||||
private Class<? extends Entity> droppedEntity;
|
||||
|
||||
MaterialType() {
|
||||
features = EnumSet.of( AEFeature.Core );
|
||||
}
|
||||
|
||||
MaterialType(AEFeature part) {
|
||||
features = EnumSet.of( part );
|
||||
}
|
||||
|
||||
MaterialType(AEFeature part, Class<? extends Entity> c) {
|
||||
features = EnumSet.of( part );
|
||||
droppedEntity = c;
|
||||
|
||||
EntityRegistry.registerModEntity( droppedEntity, droppedEntity.getSimpleName(), EntityIds.get( droppedEntity ), AppEng.instance, 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType(AEFeature part, String oreDictionary) {
|
||||
features = EnumSet.of( part );
|
||||
oreName = oreDictionary;
|
||||
if ( OreDictionary.getOres( oreDictionary ).size() > 0 )
|
||||
features.add( AEFeature.DuplicateItems );
|
||||
}
|
||||
|
||||
public EnumSet<AEFeature> getFeature()
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
public String getOreName()
|
||||
{
|
||||
return oreName;
|
||||
}
|
||||
|
||||
public boolean hasCustomEntity()
|
||||
{
|
||||
return droppedEntity != null;
|
||||
}
|
||||
|
||||
public Class<? extends Entity> getCustomEntityClass()
|
||||
{
|
||||
return droppedEntity;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user