Add visual indication of where the Atomic Reconstructor hits

This commit is contained in:
Ellpeck 2016-10-19 18:38:57 +02:00
parent 1d5a40804d
commit e3e5910443

View file

@ -34,9 +34,11 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -138,6 +140,7 @@ public class MethodHandler implements IMethodHandler{
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++){
BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ); BlockPos pos = new BlockPos(hitBlock.getX()+reachX, hitBlock.getY()+reachY, hitBlock.getZ()+reachZ);
if(!tile.getWorldObject().isAirBlock(pos)){
IBlockState state = tile.getWorldObject().getBlockState(pos); IBlockState state = tile.getWorldObject().getBlockState(pos);
List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state))); List<LensConversionRecipe> recipes = LensRecipeHandler.getRecipesFor(new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)));
for(LensConversionRecipe recipe : recipes){ for(LensConversionRecipe recipe : recipes){
@ -166,6 +169,12 @@ public class MethodHandler implements IMethodHandler{
} }
} }
} }
else{
if(tile.getWorldObject() instanceof WorldServer){
((WorldServer)tile.getWorldObject()).spawnParticle(EnumParticleTypes.END_ROD, false, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, 1, 0, 0, 0, 0D);
}
}
}
} }
} }