Lots of MOP guards. closes #41

This commit is contained in:
Vincent Lee committed 2016-01-15 11:27:32 -06:00
1 parent bee13337ad
commit 2c15b6150c
19 files changed
+22 -22

No files matched your search

@@ -352,7 +352,7 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
GlStateManager.scale(1F, -1F, -1F);
MovingObjectPosition pos = mc.objectMouseOver;
if (!name.isEmpty() && pos != null && potato.getPos().equals(pos.getBlockPos())) {
if (!name.isEmpty() && pos != null && pos.getBlockPos() != null && potato.getPos().equals(pos.getBlockPos())) {
GlStateManager.pushMatrix();
GlStateManager.translate(0F, -0.6F, 0F);
GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
@@ -44,7 +44,7 @@ public class TileEnderEye extends TileMod {
continue;
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(worldObj, player, true, 64);
if(pos != null && pos.getBlockPos().equals(getPos())) {
if(pos != null && pos.getBlockPos() != null && pos.getBlockPos().equals(getPos())) {
looking = true;
break;
}
@@ -100,7 +100,7 @@ public class ItemSextant extends ItemMod {
if(!par3EntityPlayer.isSneaking()) {
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(par2World, par3EntityPlayer, false, 128);
if(pos != null && pos.entityHit == null) {
if(pos != null && pos.entityHit == null && pos.getBlockPos() != null) {
if(!par2World.isRemote) {
ItemNBTHelper.setInt(par1ItemStack, TAG_SOURCE_X, pos.getBlockPos().getX());
ItemNBTHelper.setInt(par1ItemStack, TAG_SOURCE_Y, pos.getBlockPos().getY());
@@ -66,7 +66,7 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
public static void renderHUD(ScaledResolution resolution, EntityPlayer player) {
Minecraft mc = Minecraft.getMinecraft();
MovingObjectPosition pos = mc.objectMouseOver;
if(pos == null)
if(pos == null || pos.getBlockPos() == null)
return;
Block block = player.worldObj.getBlockState(pos.getBlockPos()).getBlock();
int meta = block.getMetaFromState(player.worldObj.getBlockState(pos.getBlockPos())); // todo 1.8 use states
@@ -43,7 +43,7 @@ public class ItemSwapRing extends ItemBauble {
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(entity.worldObj, entity, true, 4.5F);
ToolType typeToFind = null;
if(player.isSwingInProgress && pos != null) {
if(player.isSwingInProgress && pos != null && pos.getBlockPos() != null) {
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
if(block != null) {
@@ -22,7 +22,7 @@ public class LensBounce extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(!isManaBlock && pos.entityHit == null) {
if(!isManaBlock && pos.entityHit == null && pos.getBlockPos() != null) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!coords.equals(pos.getBlockPos())) {
Vector3 currentMovementVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ);
@@ -23,7 +23,7 @@ public class LensExplosive extends Lens {
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(!burst.isFake()) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && !coords.equals(pos.getBlockPos()))
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())))
entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, burst.getMana() / 50F, true);
} else dead = false;
@@ -26,7 +26,7 @@ public class LensFire extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock) {
if(pos.getBlockPos() != null && !coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock) {
EnumFacing dir = pos.sideHit;
BlockPos pos_ = pos.getBlockPos().offset(dir);
@@ -27,7 +27,7 @@ public class LensFirework extends Lens {
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(!burst.isFake()) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && !pos.getBlockPos().equals(coords)) {
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !pos.getBlockPos().equals(coords))) {
ItemStack fireworkStack = generateFirework(burst.getColor());
EntityFireworkRocket rocket = new EntityFireworkRocket(entity.worldObj, entity.posX, entity.posY, entity.posZ, fireworkStack);
@@ -26,7 +26,7 @@ public class LensLight extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock) {
if((pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())) && !burst.isFake() && !isManaBlock) {
BlockPos pos_ = pos.getBlockPos().offset(pos.sideHit);
Block blockAt = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
@@ -42,7 +42,7 @@ public class LensPaint extends Lens {
sheep.setFleeceColor(EnumDyeColor.byMetadata(storedColor == 16 ? sheep.worldObj.rand.nextInt(16) : storedColor));
}
dead = true;
} else {
} else if (pos.getBlockPos() != null) {
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
if(BotaniaAPI.paintableBlocks.containsKey(block)) {
IBlockState state = entity.worldObj.getBlockState(pos.getBlockPos());
@@ -24,7 +24,7 @@ public class LensPiston extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock && !entity.worldObj.isRemote) {
if(pos.getBlockPos() != null && !coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock && !entity.worldObj.isRemote) {
BlockPos pos_ = pos.getBlockPos().offset(pos.sideHit);
if(entity.worldObj.isAirBlock(pos_) || entity.worldObj.getBlockState(pos_).getBlock().isReplaceable(entity.worldObj, pos_)) {
@@ -26,7 +26,7 @@ public class LensRedirect extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!entity.worldObj.isRemote && pos.entityHit == null && coords.getY() != -1 && !pos.getBlockPos().equals(coords)) {
if(!entity.worldObj.isRemote && pos.entityHit == null && coords.getY() != -1 && (pos.getBlockPos() == null || !pos.getBlockPos().equals(coords))) {
TileEntity tile = entity.worldObj.getTileEntity(pos.getBlockPos());
if(tile != null && tile instanceof IRedirectable) {
if(!burst.isFake()) {
@@ -22,7 +22,7 @@ public class LensStorm extends Lens {
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(!burst.isFake()) {
BlockPos coords = burst.getBurstSourceBlockPos();
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && !coords.equals(pos.getBlockPos()))
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())))
entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, 5F, true);
} else dead = false;
@@ -22,7 +22,7 @@ public class LensWarp extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(burst.isFake())
if(burst.isFake() || pos.getBlockPos() == null)
return dead;
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
@@ -23,7 +23,7 @@ public class LensWeight extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(!burst.isFake()) {
if(!burst.isFake() && pos.getBlockPos() != null) {
int harvestLevel = ConfigHandler.harvestLevelWeight;
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
@@ -91,12 +91,12 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
int cost = Math.min(cursorCount, (int) Math.pow(Math.E, cursorCount * 0.25));
if(heldItemStack == null && event.action == Action.RIGHT_CLICK_BLOCK && player.isSneaking()) {
if(originCoords.getY() == -1 && lookPos != null) {
if(originCoords.getY() == -1 && lookPos != null && lookPos.getBlockPos() != null) {
setOriginPos(lokiRing, lookPos.getBlockPos());
setCursorList(lokiRing, null);
if(player instanceof EntityPlayerMP)
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
} else if(lookPos != null) {
} else if(lookPos != null && lookPos.getBlockPos() != null) {
if(originCoords.equals(lookPos.getBlockPos())) {
setOriginPos(lokiRing, new BlockPos(0, -1, 0));
if(player instanceof EntityPlayerMP)
@@ -120,7 +120,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
}
}
}
} else if(heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null && player.isSneaking()) {
} else if(heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null && lookPos.getBlockPos() != null && player.isSneaking()) {
for(BlockPos cursor : cursors) {
BlockPos pos = lookPos.getBlockPos().add(cursor);
Item item = heldItemStack.getItem();
@@ -173,7 +173,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
MovingObjectPosition lookPos = Minecraft.getMinecraft().objectMouseOver;
if(lookPos != null && !player.worldObj.isAirBlock(lookPos.getBlockPos()) && lookPos.entityHit == null) {
if(lookPos != null && lookPos.getBlockPos() != null && !player.worldObj.isAirBlock(lookPos.getBlockPos()) && lookPos.entityHit == null) {
List<BlockPos> list = getCursorList(stack);
BlockPos origin = getOriginPos(stack);
@@ -395,7 +395,7 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
int meta = getBlockMeta(stack);
MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver;
if(pos != null) {
if(pos != null && pos.getBlockPos() != null) {
BlockPos bPos = pos.getBlockPos();
Block targetBlock = null;
int targetMeta = 0;
@@ -66,7 +66,7 @@ public class ItemSmeltRod extends ItemMod implements IManaUsingItem {
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(p.worldObj, p, false, 32);
if(pos != null) {
if(pos != null && pos.getBlockPos() != null) {
IBlockState state = p.worldObj.getBlockState(pos.getBlockPos());
ItemStack blockStack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));