mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Made the Damage Lens cost extra energy
This commit is contained in:
parent
a5dfbc426c
commit
d5462f693f
1 changed files with 81 additions and 81 deletions
|
@ -54,7 +54,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
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(ENERGY_USE, false);
|
this.storage.extractEnergy(ENERGY_USE, false);
|
||||||
if(this.storage.getEnergyStored() >= ENERGY_USE){
|
|
||||||
|
|
||||||
//The Lens the Reconstructor currently has installed
|
//The Lens the Reconstructor currently has installed
|
||||||
ReconstructorRecipeHandler.LensType currentLens = this.getCurrentLens();
|
ReconstructorRecipeHandler.LensType currentLens = this.getCurrentLens();
|
||||||
|
@ -62,16 +61,22 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
for(int i = 0; i < distance; i++){
|
for(int i = 0; i < distance; i++){
|
||||||
WorldPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
|
WorldPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, i);
|
||||||
|
|
||||||
float damage = currentLens == ReconstructorRecipeHandler.LensType.JUST_DAMAGE ? 20F : 5F;
|
float damage = 5F;
|
||||||
|
if(currentLens == ReconstructorRecipeHandler.LensType.JUST_DAMAGE){
|
||||||
|
int use = 150; //Per Block (because it doesn't only activate when something is hit like the other lenses!)
|
||||||
|
if(this.storage.getEnergyStored() >= use){
|
||||||
|
damage = 20F;
|
||||||
|
this.storage.extractEnergy(use, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.damagePlayer(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), damage);
|
this.damagePlayer(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), damage);
|
||||||
|
|
||||||
if(hitBlock != null){
|
if(hitBlock != null && !hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
||||||
if(!hitBlock.getBlock().isAir(hitBlock.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
|
||||||
this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
|
this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);
|
||||||
|
|
||||||
//Detonation
|
//Detonation
|
||||||
if(currentLens == ReconstructorRecipeHandler.LensType.DETONATION){
|
if(currentLens == ReconstructorRecipeHandler.LensType.DETONATION){
|
||||||
int use = ENERGY_USE+500000;
|
int use = 500000;
|
||||||
if(this.storage.getEnergyStored() >= use){
|
if(this.storage.getEnergyStored() >= use){
|
||||||
this.worldObj.newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
this.worldObj.newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
||||||
this.storage.extractEnergy(use, false);
|
this.storage.extractEnergy(use, false);
|
||||||
|
@ -85,11 +90,10 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
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() >= ENERGY_USE){
|
|
||||||
WorldPos pos = new WorldPos(worldObj, hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
WorldPos pos = new WorldPos(worldObj, hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
|
||||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
|
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(new ItemStack(pos.getBlock(), 1, pos.getMetadata()));
|
||||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
||||||
if(recipe != null && this.storage.getEnergyStored() >= ENERGY_USE+recipe.energyUse && recipe.type == currentLens){
|
if(recipe != null && this.storage.getEnergyStored() >= recipe.energyUse && recipe.type == currentLens){
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
if(outputs != null && !outputs.isEmpty()){
|
if(outputs != null && !outputs.isEmpty()){
|
||||||
ItemStack output = outputs.get(0);
|
ItemStack output = outputs.get(0);
|
||||||
|
@ -101,7 +105,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
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(ENERGY_USE+recipe.energyUse, false);
|
this.storage.extractEnergy(recipe.energyUse, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,24 +113,22 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//Converting the Items
|
//Converting the Items
|
||||||
ArrayList<EntityItem> items = (ArrayList<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range));
|
ArrayList<EntityItem> items = (ArrayList<EntityItem>)worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range));
|
||||||
for(EntityItem item : items){
|
for(EntityItem item : items){
|
||||||
if(this.storage.getEnergyStored() >= ENERGY_USE){
|
|
||||||
ItemStack stack = item.getEntityItem();
|
ItemStack stack = item.getEntityItem();
|
||||||
if(stack != null){
|
if(stack != null){
|
||||||
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(stack);
|
ArrayList<ReconstructorRecipeHandler.Recipe> recipes = ReconstructorRecipeHandler.getRecipes(stack);
|
||||||
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
for(ReconstructorRecipeHandler.Recipe recipe : recipes){
|
||||||
if(recipe != null && this.storage.getEnergyStored() >= ENERGY_USE+recipe.energyUse && recipe.type == currentLens){
|
if(recipe != null && this.storage.getEnergyStored() >= recipe.energyUse && recipe.type == currentLens){
|
||||||
List<ItemStack> outputs = recipe.getOutputs();
|
List<ItemStack> outputs = recipe.getOutputs();
|
||||||
if(outputs != null && !outputs.isEmpty()){
|
if(outputs != null && !outputs.isEmpty()){
|
||||||
ItemStack outputCopy = outputs.get(0).copy();
|
ItemStack outputCopy = outputs.get(0).copy();
|
||||||
outputCopy.stackSize = stack.stackSize;
|
outputCopy.stackSize = stack.stackSize;
|
||||||
item.setEntityItemStack(outputCopy);
|
item.setEntityItemStack(outputCopy);
|
||||||
|
|
||||||
this.storage.extractEnergy(ENERGY_USE+recipe.energyUse, false);
|
this.storage.extractEnergy(recipe.energyUse, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +136,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(i >= distance-1){
|
else if(i >= distance-1){
|
||||||
|
@ -143,13 +144,12 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
else{
|
||||||
this.currentTime = 100;
|
this.currentTime = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReconstructorRecipeHandler.LensType getCurrentLens(){
|
public ReconstructorRecipeHandler.LensType getCurrentLens(){
|
||||||
|
|
Loading…
Reference in a new issue