Atomic Reconstructor uses energy depending on recipe

This commit is contained in:
Ellpeck 2015-11-20 21:21:21 +01:00
parent 84db3bbcef
commit a1c852fba2
4 changed files with 27 additions and 25 deletions

View file

@ -175,7 +175,7 @@ public enum ConfigIntValues{
RECONSTRUCTOR_DISTANCE("Atomic Reconstructor: Distance", ConfigCategories.MACHINE_VALUES, 10, 1, 50, "The max distance the Reconstructor goes forward to find blocks to convert"), RECONSTRUCTOR_DISTANCE("Atomic Reconstructor: Distance", ConfigCategories.MACHINE_VALUES, 10, 1, 50, "The max distance the Reconstructor goes forward to find blocks to convert"),
RECONSTRCUTOR_RANGE("Atomic Reconstructor: Range", ConfigCategories.MACHINE_VALUES, 2, 1, 10, "The range of Converting blocks or items into other blocks or items"), RECONSTRCUTOR_RANGE("Atomic Reconstructor: Range", ConfigCategories.MACHINE_VALUES, 2, 1, 10, "The range of Converting blocks or items into other blocks or items"),
RECONSTRUCTOR_USE_PER_BLOCK("Atomic Reconstructor: Energy Use per Block", ConfigCategories.MACHINE_VALUES, 800, 0, 100000, "The amount of Energy the Reconstructor uses per Block converted"), RECONSTRUCTOR_USE_PER_BLOCK("Atomic Reconstructor: Energy Use per Block", ConfigCategories.MACHINE_VALUES, 800, 0, 100000, "The base amount of Energy the Reconstructor uses per Block converted"),
RECONSTRUCTOR_COOLDOWN_TIMER("Atomic Reconstrucor: Cooldown Timer", ConfigCategories.MACHINE_VALUES, 100, 0, 10000, "The amount of time the Reconstructor waits between shooting lasers"), RECONSTRUCTOR_COOLDOWN_TIMER("Atomic Reconstrucor: Cooldown Timer", ConfigCategories.MACHINE_VALUES, 100, 0, 10000, "The amount of time the Reconstructor waits between shooting lasers"),
TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"); TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client");

View file

@ -22,23 +22,23 @@ public class ReconstructorRecipeHandler{
public static ArrayList<Recipe> recipes = new ArrayList<Recipe>(); public static ArrayList<Recipe> recipes = new ArrayList<Recipe>();
public static void init(){ public static void init(){
addRecipe("blockRedstone", "blockCrystalRed"); addRecipe("blockRedstone", "blockCrystalRed", 200);
addRecipe("blockLapis", "blockCrystalBlue"); addRecipe("blockLapis", "blockCrystalBlue", 200);
addRecipe("blockDiamond", "blockCrystalLightBlue"); addRecipe("blockDiamond", "blockCrystalLightBlue", 600);
addRecipe("blockEmerald", "blockCrystalGreen"); addRecipe("blockEmerald", "blockCrystalGreen", 1000);
addRecipe("blockCoal", "blockCrystalBlack"); addRecipe("blockCoal", "blockCrystalBlack", 400);
addRecipe("blockIron", "blockCrystalWhite"); addRecipe("blockIron", "blockCrystalWhite", 300);
addRecipe("dustRedstone", "crystalRed"); addRecipe("dustRedstone", "crystalRed", 20);
addRecipe("gemLapis", "crystalBlue"); addRecipe("gemLapis", "crystalBlue", 20);
addRecipe("gemDiamond", "crystalLightBlue"); addRecipe("gemDiamond", "crystalLightBlue", 60);
addRecipe("gemEmerald", "crystalGreen"); addRecipe("gemEmerald", "crystalGreen", 100);
addRecipe("coal", "crystalBlack"); addRecipe("coal", "crystalBlack", 40);
addRecipe("ingotIron", "crystalWhite"); addRecipe("ingotIron", "crystalWhite", 30);
} }
public static void addRecipe(String input, String output){ public static void addRecipe(String input, String output, int energyUse){
recipes.add(new Recipe(input, output)); recipes.add(new Recipe(input, output, energyUse));
} }
public static Recipe getRecipe(ItemStack input){ public static Recipe getRecipe(ItemStack input){
@ -57,10 +57,12 @@ public class ReconstructorRecipeHandler{
public String input; public String input;
public String output; public String output;
public int energyUse;
public Recipe(String input, String output){ public Recipe(String input, String output, int energyUse){
this.input = input; this.input = input;
this.output = output; this.output = output;
this.energyUse = energyUse;
} }
public ItemStack getFirstOutput(){ public ItemStack getFirstOutput(){

View file

@ -42,14 +42,14 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
public void updateEntity(){ public void updateEntity(){
super.updateEntity(); super.updateEntity();
if(!this.worldObj.isRemote){ if(!this.worldObj.isRemote){
int usePerBlock = ConfigIntValues.RECONSTRUCTOR_USE_PER_BLOCK.getValue(); int baseUse = ConfigIntValues.RECONSTRUCTOR_USE_PER_BLOCK.getValue();
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.storage.getEnergyStored() >= usePerBlock){ if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.storage.getEnergyStored() >= baseUse){
if(this.currentTime > 0){ if(this.currentTime > 0){
this.currentTime--; this.currentTime--;
if(this.currentTime <= 0){ if(this.currentTime <= 0){
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)); ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
//Extract energy for shooting the laser itself too! //Extract energy for shooting the laser itself too!
this.storage.extractEnergy(usePerBlock*2, false); this.storage.extractEnergy(baseUse, false);
int distance = ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue(); int distance = ConfigIntValues.RECONSTRUCTOR_DISTANCE.getValue();
for(int i = 0; i < distance; i++){ for(int i = 0; i < distance; i++){
@ -66,10 +66,10 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
for(int reachX = -range; reachX < range+1; reachX++){ for(int reachX = -range; reachX < range+1; reachX++){
for(int reachZ = -range; reachZ < range+1; reachZ++){ for(int reachZ = -range; reachZ < range+1; reachZ++){
for(int reachY = -range; reachY < range+1; reachY++){ for(int reachY = -range; reachY < range+1; reachY++){
if(this.storage.getEnergyStored() >= usePerBlock){ if(this.storage.getEnergyStored() >= baseUse){
WorldPos pos = new WorldPos(worldObj, coordsBlock.getX()+reachX, coordsBlock.getY()+reachY, coordsBlock.getZ()+reachZ); WorldPos pos = new WorldPos(worldObj, coordsBlock.getX()+reachX, coordsBlock.getY()+reachY, coordsBlock.getZ()+reachZ);
ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(new ItemStack(pos.getBlock(), pos.getMetadata())); ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(new ItemStack(pos.getBlock(), pos.getMetadata()));
if(recipe != null){ if(recipe != null && this.storage.getEnergyStored() >= baseUse+recipe.energyUse){
ItemStack output = recipe.getFirstOutput(); ItemStack output = recipe.getFirstOutput();
if(output != null){ if(output != null){
if(output.getItem() instanceof ItemBlock){ if(output.getItem() instanceof ItemBlock){
@ -80,7 +80,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
EntityItem item = new EntityItem(worldObj, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy()); EntityItem item = new EntityItem(worldObj, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
worldObj.spawnEntityInWorld(item); worldObj.spawnEntityInWorld(item);
} }
this.storage.extractEnergy(usePerBlock, false); this.storage.extractEnergy(baseUse+recipe.energyUse, false);
} }
} }
} }
@ -91,7 +91,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
//Converting the Items //Converting the Items
ArrayList<EntityItem> items = (ArrayList<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(coordsBlock.getX()-range, coordsBlock.getY()-range, coordsBlock.getZ()-range, coordsBlock.getX()+range, coordsBlock.getY()+range, coordsBlock.getZ()+range)); ArrayList<EntityItem> items = (ArrayList<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(coordsBlock.getX()-range, coordsBlock.getY()-range, coordsBlock.getZ()-range, coordsBlock.getX()+range, coordsBlock.getY()+range, coordsBlock.getZ()+range));
for(EntityItem item : items){ for(EntityItem item : items){
if(this.storage.getEnergyStored() >= usePerBlock){ if(this.storage.getEnergyStored() >= baseUse){
ItemStack stack = item.getEntityItem(); ItemStack stack = item.getEntityItem();
if(stack != null){ if(stack != null){
ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(stack); ReconstructorRecipeHandler.Recipe recipe = ReconstructorRecipeHandler.getRecipe(stack);
@ -102,7 +102,7 @@ public class TileEntityAtomicReconstructor extends TileEntityBase implements IEn
outputCopy.stackSize = stack.stackSize; outputCopy.stackSize = stack.stackSize;
item.setEntityItemStack(outputCopy); item.setEntityItemStack(outputCopy);
this.storage.extractEnergy(usePerBlock, false); this.storage.extractEnergy(baseUse, false);
} }
} }
} }

View file

@ -596,7 +596,7 @@ booklet.actuallyadditions.chapter.blackLotus.text.1=Think of this: <n>You need t
booklet.actuallyadditions.chapter.blackLotus.text.2=<i>No, not that one, Vaz booklet.actuallyadditions.chapter.blackLotus.text.2=<i>No, not that one, Vaz
booklet.actuallyadditions.chapter.crystals.name=Crystals and Reconstructor booklet.actuallyadditions.chapter.crystals.name=Crystals and Reconstructor
booklet.actuallyadditions.chapter.crystals.text.1=For many Crafting Operations in <imp>Actually Additions<r>, you will need <item>Crystals<r> or <item>Crystal Blocks<r>. <n>These can be made using an <item>Atomic Reconstructor<r>. Just place one down facing in any direction and it will <imp>shoot out a red laser<r>. When placing some of the blocks shown on the following pages in front of the laser, they will be <imp>converted into Crystals<r>. <n>During each conversion, it uses <imp><power> RF<r>. booklet.actuallyadditions.chapter.crystals.text.1=For many Crafting Operations in <imp>Actually Additions<r>, you will need <item>Crystals<r> or <item>Crystal Blocks<r>. <n>These can be made using an <item>Atomic Reconstructor<r>. Just place one down facing in any direction and it will <imp>shoot out a red laser<r>. When placing some of the blocks shown on the following pages in front of the laser, they will be <imp>converted into Crystals<r>. <n>During the shooting of a laser and one conversion, it uses at least <imp><power> RF<r>, but the rate varies depending on the converted block.
booklet.actuallyadditions.chapter.crystals.text.2=The way this works is that the laser <imp>searches for a block<r>, and when it finds one, it converts <imp>all blocks and items on the ground<r> in that area into their Crystal forms (if they have one!). <n><n>When trying to power the Reconstructor, at first you will notice that <imp>many power sources require crystals<r> to be crafted. Not to worry, though, as you can <imp>use<r> <item>Coal Generators<r> to create your first couple of crystals before you can <imp>upgrade to better sources<r>. booklet.actuallyadditions.chapter.crystals.text.2=The way this works is that the laser <imp>searches for a block<r>, and when it finds one, it converts <imp>all blocks and items on the ground<r> in that area into their Crystal forms (if they have one!). <n><n>When trying to power the Reconstructor, at first you will notice that <imp>many power sources require crystals<r> to be crafted. Not to worry, though, as you can <imp>use<r> <item>Coal Generators<r> to create your first couple of crystals before you can <imp>upgrade to better sources<r>.
booklet.actuallyadditions.chapter.crystals.text.4=When you have crafted a couple of items, you might want to find a way to <imp>automate this<r>. <n>There is a very simple way to do accomplish this: <n>Place the <item>Atomic Reconstructor<r> down facing into a <item>Precision Dropper<r> (to find it, look it up in the <imp>All Items and Search<r> Entry!). <n>Next, place a <item>Ranged Collector<r> in the area that has the converted items set as a whitelist. <n>Now you can just chuck your raw materials into the Dropper to convert them! booklet.actuallyadditions.chapter.crystals.text.4=When you have crafted a couple of items, you might want to find a way to <imp>automate this<r>. <n>There is a very simple way to do accomplish this: <n>Place the <item>Atomic Reconstructor<r> down facing into a <item>Precision Dropper<r> (to find it, look it up in the <imp>All Items and Search<r> Entry!). <n>Next, place a <item>Ranged Collector<r> in the area that has the converted items set as a whitelist. <n>Now you can just chuck your raw materials into the Dropper to convert them!