From 64966ad66e4532886053fbfd75a08a39fba92ab2 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 14 May 2016 14:14:06 +0200 Subject: [PATCH] Added the possibility for different types of lenses to be conversion lenses --- .../api/ActuallyAdditionsAPI.java | 18 ++- .../api/internal/IAtomicReconstructor.java | 3 + .../api/internal/IMethodHandler.java | 5 +- .../actuallyadditions/api/lens/Lens.java | 1 - .../api/lens/LensConversion.java | 46 ++++++++ .../api/recipe/LensConversionRecipe.java | 8 +- .../items/ItemRarmorModuleReconstructor.java | 13 ++- .../mod/items/lens/LensConversion.java | 108 ------------------ .../mod/items/lens/Lenses.java | 3 +- .../mod/misc/MethodHandler.java | 77 +++++++++++++ .../tile/TileEntityAtomicReconstructor.java | 8 +- 11 files changed, 168 insertions(+), 122 deletions(-) create mode 100644 src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java delete mode 100644 src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensConversion.java diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java index 7846b0a38..9b909af3d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/ActuallyAdditionsAPI.java @@ -13,8 +13,8 @@ package de.ellpeck.actuallyadditions.api; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; +import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.api.recipe.*; -import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -154,9 +154,15 @@ public class ActuallyAdditionsAPI{ * @param input The input as an ItemStack * @param output The output as an ItemStack * @param energyUse The amount of RF used per conversion + * @param type The type of lens used for the conversion. To use the default type, use method below. + * Note how this always has to be the same instance of the lens type that the item also has for it to work! */ + public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){ + reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse, type)); + } + public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse){ - reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse)); + addReconstructorLensConversionRecipe(input, output, energyUse, LensConversion.DEFAULT_CONVERSION); } /** @@ -165,9 +171,15 @@ public class ActuallyAdditionsAPI{ * @param input The input's OreDictionary name * @param output The output's OreDictionary name * @param energyUse The amount of RF used per conversion + * @param type The type of lens used for the conversion. To use the default type, use method below + * Note how this always has to be the same instance of the lens type that the item also has for it to work! */ + public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse, LensConversion type){ + reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse, type)); + } + public static void addReconstructorLensConversionRecipe(String input, String output, int energyUse){ - reconstructorLensConversionRecipes.add(new LensConversionRecipe(input, output, energyUse)); + addReconstructorLensConversionRecipe(input, output, energyUse, LensConversion.DEFAULT_CONVERSION); } /** diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java index b4625cc17..32f4a7fe3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IAtomicReconstructor.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.api.internal; +import de.ellpeck.actuallyadditions.api.lens.Lens; import net.minecraft.world.World; /** @@ -49,4 +50,6 @@ public interface IAtomicReconstructor{ * Gets the amount of energy the Reconstructor has stored in its RF storage */ int getEnergy(); + + Lens getLens(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java index cd8f8116c..e2406dbf3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/internal/IMethodHandler.java @@ -1,9 +1,10 @@ package de.ellpeck.actuallyadditions.api.internal; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.math.BlockPos; /** * This is the internal method handler. @@ -21,4 +22,6 @@ public interface IMethodHandler{ void addEffectToStack(ItemStack stack, PotionEffect effect); PotionEffect[] getEffectsFromStack(ItemStack stack); + + boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java index 0e54094d8..ba920d659 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java @@ -17,7 +17,6 @@ import net.minecraft.util.math.BlockPos; /** * This is the base class for a Reconstructor Lens Type (NOT THE ITEM!) - * You need to call register() to register the type */ public abstract class Lens{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java new file mode 100644 index 000000000..7ed3475e9 --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/LensConversion.java @@ -0,0 +1,46 @@ +/* + * This file ("LensNone.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://ellpeck.de/actaddlicense/ + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2016 Ellpeck + */ + +package de.ellpeck.actuallyadditions.api.lens; + + +import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; +import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; + +/** + * This is the base class for a Reconstructor Lens Type that converts two items + * 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 use the default type of conversion, use DEFAULT_CONVERSION below. + */ +public class LensConversion extends Lens{ + + public static final LensConversion DEFAULT_CONVERSION = new LensConversion(); + + @SuppressWarnings("unchecked") + @Override + public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ + return ActuallyAdditionsAPI.methodHandler.invokeConversionLens(hitState, hitBlock, tile); + } + + @Override + public float[] getColor(){ + return new float[]{27F/255F, 109F/255F, 1F}; + } + + @Override + public int getDistance(){ + return 10; + } + +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java index 739c27e03..42b4e9657 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/LensConversionRecipe.java @@ -10,6 +10,7 @@ package de.ellpeck.actuallyadditions.api.recipe; +import de.ellpeck.actuallyadditions.api.lens.LensConversion; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -20,21 +21,24 @@ import java.util.List; public class LensConversionRecipe{ public int energyUse; + public LensConversion type; private String input; private String output; private ItemStack inputStack; private ItemStack outputStack; - public LensConversionRecipe(ItemStack input, ItemStack output, int energyUse){ + public LensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type){ this.inputStack = input; this.outputStack = output; this.energyUse = energyUse; + this.type = type; } - public LensConversionRecipe(String input, String output, int energyUse){ + public LensConversionRecipe(String input, String output, int energyUse, LensConversion type){ this.input = input; this.output = output; this.energyUse = energyUse; + this.type = type; } public List getOutputs(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemRarmorModuleReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemRarmorModuleReconstructor.java index 93fbe876a..4ad304bc3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemRarmorModuleReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemRarmorModuleReconstructor.java @@ -4,6 +4,8 @@ import cofh.api.energy.IEnergyContainerItem; import de.canitzp.rarmor.api.InventoryBase; import de.canitzp.rarmor.api.modules.IRarmorModule; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; +import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.items.lens.Lenses; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; @@ -58,7 +60,7 @@ public class ItemRarmorModuleReconstructor extends ItemBase implements IRarmorMo public void onModuleTickInArmor(World world, EntityPlayer player, ItemStack armorChestplate, ItemStack module, InventoryBase inventory){ if(!world.isRemote && player.isSneaking() && player.onGround){ if(world.getTotalWorldTime()%50 == 0){ - RayTraceResult result = WorldUtil.getNearestPositionWithAir(world, player, Lenses.LENS_NONE.getDistance()); + RayTraceResult result = WorldUtil.getNearestPositionWithAir(world, player, Lenses.LENS_CONVERSION.getDistance()); if(result != null){ BlockPos pos = result.getBlockPos(); if(pos != null){ @@ -66,10 +68,10 @@ public class ItemRarmorModuleReconstructor extends ItemBase implements IRarmorMo int energyUse = TileEntityAtomicReconstructor.ENERGY_USE*2; if(fake.getEnergy() >= energyUse){ - Lenses.LENS_NONE.invoke(world.getBlockState(pos), pos, fake); + Lenses.LENS_CONVERSION.invoke(world.getBlockState(pos), pos, fake); 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_NONE); + 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); fake.extractEnergy(energyUse); } @@ -119,6 +121,11 @@ public class ItemRarmorModuleReconstructor extends ItemBase implements IRarmorMo return 0; } } + + @Override + public Lens getLens(){ + return Lenses.LENS_CONVERSION; + } }; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensConversion.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensConversion.java deleted file mode 100644 index 1902ab974..000000000 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensConversion.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file ("LensNone.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://ellpeck.de/actaddlicense/ - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2016 Ellpeck - */ - -package de.ellpeck.actuallyadditions.mod.items.lens; - - -import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; -import de.ellpeck.actuallyadditions.api.lens.Lens; -import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; -import de.ellpeck.actuallyadditions.mod.config.ConfigValues; -import de.ellpeck.actuallyadditions.mod.util.PosUtil; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; - -import java.util.ArrayList; -import java.util.List; - -public class LensConversion extends Lens{ - - @SuppressWarnings("unchecked") - @Override - public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ - if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock)){ - int range = 2; - - //Converting the Blocks - for(int reachX = -range; reachX < range+1; reachX++){ - for(int reachZ = -range; reachZ < range+1; reachZ++){ - for(int reachY = -range; reachY < range+1; reachY++){ - BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ); - List recipes = LensRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject()))); - for(LensConversionRecipe recipe : recipes){ - if(recipe != null && tile.getEnergy() >= recipe.energyUse){ - List outputs = recipe.getOutputs(); - if(outputs != null && !outputs.isEmpty()){ - ItemStack output = outputs.get(0); - if(output.getItem() instanceof ItemBlock){ - if(!ConfigValues.lessBlockBreakingEffects){ - tile.getWorldObject().playAuxSFX(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos))); - } - PosUtil.setBlock(pos, tile.getWorldObject(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2); - } - else{ - EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy()); - tile.getWorldObject().spawnEntityInWorld(item); - } - tile.extractEnergy(recipe.energyUse); - break; - } - } - } - } - } - } - - //Converting the Items - ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range)); - for(EntityItem item : items){ - ItemStack stack = item.getEntityItem(); - if(!item.isDead && stack != null){ - List recipes = LensRecipeHandler.getRecipesFor(stack); - for(LensConversionRecipe recipe : recipes){ - if(recipe != null && tile.getEnergy() >= recipe.energyUse){ - List outputs = recipe.getOutputs(); - if(outputs != null && !outputs.isEmpty()){ - ItemStack outputCopy = outputs.get(0).copy(); - outputCopy.stackSize = stack.stackSize; - - item.setDead(); - - EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy); - tile.getWorldObject().spawnEntityInWorld(newItem); - - tile.extractEnergy(recipe.energyUse); - break; - } - } - } - } - } - return true; - } - return false; - } - - @Override - public float[] getColor(){ - return new float[]{27F/255F, 109F/255F, 1F}; - } - - @Override - public int getDistance(){ - return 10; - } - -} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java index 1dcbb660b..5f5a48d45 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/Lenses.java @@ -11,10 +11,11 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.api.lens.LensConversion; public class Lenses{ - public static final Lens LENS_NONE = new LensConversion(); + public static final LensConversion LENS_CONVERSION = LensConversion.DEFAULT_CONVERSION; public static final Lens LENS_DETONATION = new LensDetonation(); public static final Lens LENS_DEATH = new LensDeath(); public static final Lens LENS_COLOR = new LensColor(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java index 0c71f1ae7..7ab847f44 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/MethodHandler.java @@ -4,16 +4,28 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.booklet.BookletPage; import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; +import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.internal.IEntrySet; import de.ellpeck.actuallyadditions.api.internal.IMethodHandler; import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient; +import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe; import de.ellpeck.actuallyadditions.mod.booklet.entry.EntrySet; +import de.ellpeck.actuallyadditions.mod.config.ConfigValues; +import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler; +import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import java.util.ArrayList; +import java.util.List; public class MethodHandler implements IMethodHandler{ @@ -101,4 +113,69 @@ public class MethodHandler implements IMethodHandler{ } return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null; } + + @Override + public boolean invokeConversionLens(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ + if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock)){ + int range = 2; + + //Converting the Blocks + for(int reachX = -range; reachX < range+1; reachX++){ + for(int reachZ = -range; reachZ < range+1; reachZ++){ + for(int reachY = -range; reachY < range+1; reachY++){ + BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ); + List recipes = LensRecipeHandler.getRecipesFor(new ItemStack(PosUtil.getBlock(pos, tile.getWorldObject()), 1, PosUtil.getMetadata(pos, tile.getWorldObject()))); + for(LensConversionRecipe recipe : recipes){ + if(recipe != null && recipe.type == tile.getLens() && tile.getEnergy() >= recipe.energyUse){ + List outputs = recipe.getOutputs(); + if(outputs != null && !outputs.isEmpty()){ + ItemStack output = outputs.get(0); + if(output.getItem() instanceof ItemBlock){ + if(!ConfigValues.lessBlockBreakingEffects){ + tile.getWorldObject().playAuxSFX(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos))); + } + PosUtil.setBlock(pos, tile.getWorldObject(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2); + } + else{ + EntityItem item = new EntityItem(tile.getWorldObject(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy()); + tile.getWorldObject().spawnEntityInWorld(item); + } + tile.extractEnergy(recipe.energyUse); + break; + } + } + } + } + } + } + + //Converting the Items + ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range)); + for(EntityItem item : items){ + ItemStack stack = item.getEntityItem(); + if(!item.isDead && stack != null){ + List recipes = LensRecipeHandler.getRecipesFor(stack); + for(LensConversionRecipe recipe : recipes){ + if(recipe != null && recipe.type == tile.getLens() && tile.getEnergy() >= recipe.energyUse){ + List outputs = recipe.getOutputs(); + if(outputs != null && !outputs.isEmpty()){ + ItemStack outputCopy = outputs.get(0).copy(); + outputCopy.stackSize = stack.stackSize; + + item.setDead(); + + EntityItem newItem = new EntityItem(tile.getWorldObject(), item.posX, item.posY, item.posZ, outputCopy); + tile.getWorldObject().spawnEntityInWorld(newItem); + + tile.extractEnergy(recipe.energyUse); + break; + } + } + } + } + } + return true; + } + return false; + } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index 49c5760e6..482a76c22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -15,6 +15,7 @@ import cofh.api.energy.IEnergyReceiver; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.api.lens.Lens; +import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.lens.Lenses; import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; @@ -104,7 +105,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple this.storage.extractEnergy(ENERGY_USE, false); //The Lens the Reconstructor currently has installed - Lens currentLens = this.getCurrentLens(); + Lens currentLens = this.getLens(); int distance = currentLens.getDistance(); for(int i = 0; i < distance; i++){ BlockPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, i); @@ -120,13 +121,14 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple } } - public Lens getCurrentLens(){ + @Override + public Lens getLens(){ if(this.slots[0] != null){ if(this.slots[0].getItem() instanceof ILensItem){ return ((ILensItem)this.slots[0].getItem()).getLens(); } } - return this.counter >= 500 ? Lenses.LENS_DISRUPTION : Lenses.LENS_NONE; + return this.counter >= 500 ? Lenses.LENS_DISRUPTION : Lenses.LENS_CONVERSION; } @Override