Fix another stupid obfuscation bug :x

This commit is contained in:
Ellpeck 2016-01-06 18:10:01 +01:00
parent a135ecf32c
commit 5ef8626a40
6 changed files with 23 additions and 17 deletions

View file

@ -38,7 +38,7 @@ public interface IAtomicReconstructor{
/** /**
* Returns the world of the reconstructor * Returns the world of the reconstructor
*/ */
World getWorldObj(); World getWorld();
/** /**
* Extracts a specified amount of energy from the Reconstructor's RF storage * Extracts a specified amount of energy from the Reconstructor's RF storage

View file

@ -56,18 +56,18 @@ public class LensColor extends Lens{
@Override @Override
public boolean invoke(Position hitBlock, IAtomicReconstructor tile){ public boolean invoke(Position hitBlock, IAtomicReconstructor tile){
if(hitBlock != null){ if(hitBlock != null){
if(Util.arrayContains(CONVERTABLE_BLOCKS, hitBlock.getBlock(tile.getWorldObj())) >= 0 && tile.getEnergy() >= ENERGY_USE){ if(Util.arrayContains(CONVERTABLE_BLOCKS, hitBlock.getBlock(tile.getWorld())) >= 0 && tile.getEnergy() >= ENERGY_USE){
int meta = hitBlock.getMetadata(tile.getWorldObj()); int meta = hitBlock.getMetadata(tile.getWorld());
if(meta >= 15){ if(meta >= 15){
hitBlock.setMetadata(tile.getWorldObj(), 0, 2); hitBlock.setMetadata(tile.getWorld(), 0, 2);
} }
else{ else{
hitBlock.setMetadata(tile.getWorldObj(), meta+1, 2); hitBlock.setMetadata(tile.getWorld(), meta+1, 2);
} }
tile.extractEnergy(ENERGY_USE); tile.extractEnergy(ENERGY_USE);
} }
ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorld().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
for(EntityItem item : items){ for(EntityItem item : items){
if(item.getEntityItem() != null && tile.getEnergy() >= ENERGY_USE){ if(item.getEntityItem() != null && tile.getEnergy() >= ENERGY_USE){
if(Util.arrayContains(CONVERTABLE_BLOCKS, item.getEntityItem().getItem()) >= 0 || Util.arrayContains(CONVERTABLE_BLOCKS, Block.getBlockFromItem(item.getEntityItem().getItem())) >= 0){ if(Util.arrayContains(CONVERTABLE_BLOCKS, item.getEntityItem().getItem()) >= 0 || Util.arrayContains(CONVERTABLE_BLOCKS, Block.getBlockFromItem(item.getEntityItem().getItem())) >= 0){

View file

@ -28,13 +28,13 @@ public class LensDeath extends Lens{
if(tile.getEnergy() >= use){ if(tile.getEnergy() >= use){
tile.extractEnergy(use); tile.extractEnergy(use);
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)tile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)tile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
for(EntityLivingBase entity : entities){ for(EntityLivingBase entity : entities){
entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F); entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F);
} }
} }
return hitBlock != null && !hitBlock.getBlock(tile.getWorldObj()).isAir(tile.getWorldObj(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ()); return hitBlock != null && !hitBlock.getBlock(tile.getWorld()).isAir(tile.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ());
} }
@Override @Override

View file

@ -18,10 +18,10 @@ public class LensDetonation extends Lens{
@Override @Override
public boolean invoke(Position hitBlock, IAtomicReconstructor tile){ public boolean invoke(Position hitBlock, IAtomicReconstructor tile){
if(hitBlock != null && !hitBlock.getBlock(tile.getWorldObj()).isAir(tile.getWorldObj(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){ if(hitBlock != null && !hitBlock.getBlock(tile.getWorld()).isAir(tile.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
int use = 250000; int use = 250000;
if(tile.getEnergy() >= use){ if(tile.getEnergy() >= use){
tile.getWorldObj().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true); tile.getWorld().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
tile.extractEnergy(use); tile.extractEnergy(use);
} }
return true; return true;

View file

@ -28,7 +28,7 @@ public class LensNone extends Lens{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public boolean invoke(Position hitBlock, IAtomicReconstructor tile){ public boolean invoke(Position hitBlock, IAtomicReconstructor tile){
if(hitBlock != null && !hitBlock.getBlock(tile.getWorldObj()).isAir(tile.getWorldObj(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){ if(hitBlock != null && !hitBlock.getBlock(tile.getWorld()).isAir(tile.getWorld(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
int range = 2; int range = 2;
//Converting the Blocks //Converting the Blocks
@ -36,19 +36,19 @@ public class LensNone extends Lens{
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++){
Position pos = new Position(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ); Position pos = new Position(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
List<LensNoneRecipe> recipes = LensNoneRecipeHandler.getRecipesFor(new ItemStack(pos.getBlock(tile.getWorldObj()), 1, pos.getMetadata(tile.getWorldObj()))); List<LensNoneRecipe> recipes = LensNoneRecipeHandler.getRecipesFor(new ItemStack(pos.getBlock(tile.getWorld()), 1, pos.getMetadata(tile.getWorld())));
for(LensNoneRecipe recipe : recipes){ for(LensNoneRecipe recipe : recipes){
if(recipe != null && tile.getEnergy() >= recipe.energyUse){ if(recipe != null && tile.getEnergy() >= recipe.energyUse){
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);
if(output.getItem() instanceof ItemBlock){ if(output.getItem() instanceof ItemBlock){
tile.getWorldObj().playAuxSFX(2001, pos.getX(), pos.getY(), pos.getZ(), Block.getIdFromBlock(pos.getBlock(tile.getWorldObj()))+(pos.getMetadata(tile.getWorldObj()) << 12)); tile.getWorld().playAuxSFX(2001, pos.getX(), pos.getY(), pos.getZ(), Block.getIdFromBlock(pos.getBlock(tile.getWorld()))+(pos.getMetadata(tile.getWorld()) << 12));
pos.setBlock(tile.getWorldObj(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2); pos.setBlock(tile.getWorld(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2);
} }
else{ else{
EntityItem item = new EntityItem(tile.getWorldObj(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy()); EntityItem item = new EntityItem(tile.getWorld(), pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, output.copy());
tile.getWorldObj().spawnEntityInWorld(item); tile.getWorld().spawnEntityInWorld(item);
} }
tile.extractEnergy(recipe.energyUse); tile.extractEnergy(recipe.energyUse);
break; break;
@ -60,7 +60,7 @@ public class LensNone extends Lens{
} }
//Converting the Items //Converting the Items
ArrayList<EntityItem> items = (ArrayList<EntityItem>)tile.getWorldObj().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>)tile.getWorld().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){
ItemStack stack = item.getEntityItem(); ItemStack stack = item.getEntityItem();
if(stack != null){ if(stack != null){

View file

@ -27,6 +27,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver, IRedstoneToggle, IEnergyDisplay, IAtomicReconstructor{ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver, IRedstoneToggle, IEnergyDisplay, IAtomicReconstructor{
@ -183,6 +184,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
return this.zCoord; return this.zCoord;
} }
@Override
public World getWorld(){
return this.getWorldObj();
}
@Override @Override
public void extractEnergy(int amount){ public void extractEnergy(int amount){
this.storage.extractEnergy(amount, false); this.storage.extractEnergy(amount, false);