mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Moved lenses to API side
Bump API version to 13
This commit is contained in:
parent
09ecb708aa
commit
3403947af0
6 changed files with 32 additions and 21 deletions
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.api;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
import de.ellpeck.actuallyadditions.api.internal.IMethodHandler;
|
||||||
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.*;
|
import de.ellpeck.actuallyadditions.api.recipe.*;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -28,7 +29,7 @@ public class ActuallyAdditionsAPI{
|
||||||
|
|
||||||
public static final String MOD_ID = "actuallyadditions";
|
public static final String MOD_ID = "actuallyadditions";
|
||||||
public static final String API_ID = MOD_ID+"api";
|
public static final String API_ID = MOD_ID+"api";
|
||||||
public static final String API_VERSION = "12";
|
public static final String API_VERSION = "13";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this to handle things that aren't based in the API itself
|
* Use this to handle things that aren't based in the API itself
|
||||||
|
@ -59,6 +60,14 @@ public class ActuallyAdditionsAPI{
|
||||||
public static IBookletEntry entryCrossover;
|
public static IBookletEntry entryCrossover;
|
||||||
public static IBookletEntry allAndSearch;
|
public static IBookletEntry allAndSearch;
|
||||||
|
|
||||||
|
//These are getting initialized in Actually Additions' PreInit phase
|
||||||
|
//DO NOT CHANGE/OVERRIDE THESE!!
|
||||||
|
public static LensConversion lensDefaultConversion;
|
||||||
|
public static Lens lensDetonation;
|
||||||
|
public static Lens lensDeath;
|
||||||
|
public static Lens lensColor;
|
||||||
|
public static Lens lensDisruption;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Recipe to the Crusher Recipe Registry
|
* Adds a Recipe to the Crusher Recipe Registry
|
||||||
* The second output will be nothing
|
* The second output will be nothing
|
||||||
|
@ -162,7 +171,7 @@ public class ActuallyAdditionsAPI{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, LensConversion.DEFAULT_CONVERSION);
|
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,7 +188,7 @@ public class ActuallyAdditionsAPI{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){
|
public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){
|
||||||
addReconstructorLensConversionRecipe(input, output, energyUse, LensConversion.DEFAULT_CONVERSION);
|
addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,12 +21,10 @@ import net.minecraft.util.math.BlockPos;
|
||||||
* via the ActuallyAdditionsAPI.reconstructorLensConversionRecipes list.
|
* via the ActuallyAdditionsAPI.reconstructorLensConversionRecipes list.
|
||||||
*
|
*
|
||||||
* If you want to make a new type of conversion, just use your type in the recipe
|
* If you want to make a new type of conversion, just use your type in the recipe
|
||||||
* If you want to use the default type of conversion, use DEFAULT_CONVERSION below.
|
* If you want to use the default type of conversion, use ActuallyAdditionsAPI.lensDefaultConversion.
|
||||||
*/
|
*/
|
||||||
public class LensConversion extends Lens{
|
public class LensConversion extends Lens{
|
||||||
|
|
||||||
public static final LensConversion DEFAULT_CONVERSION = new LensConversion();
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemHoeAA;
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemHoeAA;
|
||||||
|
@ -215,9 +216,9 @@ public class InitItems{
|
||||||
itemSpawnerChanger = new ItemSpawnerChanger("itemSpawnerChanger");
|
itemSpawnerChanger = new ItemSpawnerChanger("itemSpawnerChanger");
|
||||||
itemMisc = new ItemMisc("itemMisc");
|
itemMisc = new ItemMisc("itemMisc");
|
||||||
itemCrateKeeper = new ItemGeneric("itemCrateKeeper");
|
itemCrateKeeper = new ItemGeneric("itemCrateKeeper");
|
||||||
itemColorLens = new ItemLens("itemColorLens", Lenses.LENS_COLOR);
|
itemColorLens = new ItemLens("itemColorLens", ActuallyAdditionsAPI.lensColor);
|
||||||
itemExplosionLens = new ItemLens("itemExplosionLens", Lenses.LENS_DETONATION);
|
itemExplosionLens = new ItemLens("itemExplosionLens", ActuallyAdditionsAPI.lensDetonation);
|
||||||
itemDamageLens = new ItemLens("itemDamageLens", Lenses.LENS_DEATH);
|
itemDamageLens = new ItemLens("itemDamageLens", ActuallyAdditionsAPI.lensDeath);
|
||||||
itemCrystal = new ItemCrystal("itemCrystal");
|
itemCrystal = new ItemCrystal("itemCrystal");
|
||||||
itemLaserWrench = new ItemLaserWrench("itemLaserWrench");
|
itemLaserWrench = new ItemLaserWrench("itemLaserWrench");
|
||||||
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade");
|
itemChestToCrateUpgrade = new ItemChestToCrateUpgrade("itemChestToCrateUpgrade");
|
||||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.actuallyadditions.mod.items;
|
||||||
import cofh.api.energy.IEnergyContainerItem;
|
import cofh.api.energy.IEnergyContainerItem;
|
||||||
import de.canitzp.rarmor.api.InventoryBase;
|
import de.canitzp.rarmor.api.InventoryBase;
|
||||||
import de.canitzp.rarmor.api.modules.IRarmorModule;
|
import de.canitzp.rarmor.api.modules.IRarmorModule;
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||||
|
@ -60,18 +61,17 @@ public class ItemRarmorModuleReconstructor extends ItemBase implements IRarmorMo
|
||||||
public void onModuleTickInArmor(World world, EntityPlayer player, ItemStack armorChestplate, ItemStack module, InventoryBase inventory){
|
public void onModuleTickInArmor(World world, EntityPlayer player, ItemStack armorChestplate, ItemStack module, InventoryBase inventory){
|
||||||
if(!world.isRemote && player.isSneaking() && player.onGround){
|
if(!world.isRemote && player.isSneaking() && player.onGround){
|
||||||
if(world.getTotalWorldTime()%50 == 0){
|
if(world.getTotalWorldTime()%50 == 0){
|
||||||
RayTraceResult result = WorldUtil.getNearestPositionWithAir(world, player, Lenses.LENS_CONVERSION.getDistance());
|
IAtomicReconstructor fake = this.getFakeReconstructor(world, player, armorChestplate);
|
||||||
|
RayTraceResult result = WorldUtil.getNearestPositionWithAir(world, player, fake.getLens().getDistance());
|
||||||
if(result != null){
|
if(result != null){
|
||||||
BlockPos pos = result.getBlockPos();
|
BlockPos pos = result.getBlockPos();
|
||||||
if(pos != null){
|
if(pos != null){
|
||||||
IAtomicReconstructor fake = this.getFakeReconstructor(world, player, armorChestplate);
|
|
||||||
|
|
||||||
int energyUse = TileEntityAtomicReconstructor.ENERGY_USE*2;
|
int energyUse = TileEntityAtomicReconstructor.ENERGY_USE*2;
|
||||||
if(fake.getEnergy() >= energyUse){
|
if(fake.getEnergy() >= energyUse){
|
||||||
fake.getLens().invoke(world.getBlockState(pos), pos, fake);
|
fake.getLens().invoke(world.getBlockState(pos), pos, fake);
|
||||||
|
|
||||||
EnumFacing hit = result.sideHit;
|
EnumFacing hit = result.sideHit;
|
||||||
TileEntityAtomicReconstructor.shootLaser(world, player.posX-player.width/2, player.posY+player.getYOffset()+player.getEyeHeight()/2, player.posZ-player.width/2, pos.getX()+hit.getFrontOffsetX(), pos.getY()+hit.getFrontOffsetY(), pos.getZ()+hit.getFrontOffsetZ(), Lenses.LENS_CONVERSION);
|
TileEntityAtomicReconstructor.shootLaser(world, player.posX-player.width/2, player.posY+player.getYOffset()+player.getEyeHeight()/2, player.posZ-player.width/2, pos.getX()+hit.getFrontOffsetX(), pos.getY()+hit.getFrontOffsetY(), pos.getZ()+hit.getFrontOffsetZ(), fake.getLens());
|
||||||
|
|
||||||
fake.extractEnergy(energyUse);
|
fake.extractEnergy(energyUse);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class ItemRarmorModuleReconstructor extends ItemBase implements IRarmorMo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Lens getLens(){
|
public Lens getLens(){
|
||||||
return Lenses.LENS_CONVERSION;
|
return ActuallyAdditionsAPI.lensDefaultConversion;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,16 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.items.lens;
|
package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||||
|
|
||||||
public class Lenses{
|
public class Lenses{
|
||||||
|
|
||||||
public static final LensConversion LENS_CONVERSION = LensConversion.DEFAULT_CONVERSION;
|
public static void init(){
|
||||||
public static final Lens LENS_DETONATION = new LensDetonation();
|
ActuallyAdditionsAPI.lensDefaultConversion = new LensConversion();
|
||||||
public static final Lens LENS_DEATH = new LensDeath();
|
ActuallyAdditionsAPI.lensDetonation = new LensDetonation();
|
||||||
public static final Lens LENS_COLOR = new LensColor();
|
ActuallyAdditionsAPI.lensDeath = new LensDeath();
|
||||||
public static final Lens LENS_DISRUPTION = new LensDisruption();
|
ActuallyAdditionsAPI.lensColor = new LensColor();
|
||||||
|
ActuallyAdditionsAPI.lensDisruption = new LensDisruption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import cofh.api.energy.EnergyStorage;
|
import cofh.api.energy.EnergyStorage;
|
||||||
import cofh.api.energy.IEnergyReceiver;
|
import cofh.api.energy.IEnergyReceiver;
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
|
@ -128,7 +129,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
return ((ILensItem)this.slots[0].getItem()).getLens();
|
return ((ILensItem)this.slots[0].getItem()).getLens();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.counter >= 500 ? Lenses.LENS_DISRUPTION : Lenses.LENS_CONVERSION;
|
return this.counter >= 500 ? ActuallyAdditionsAPI.lensDisruption : ActuallyAdditionsAPI.lensDefaultConversion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue