mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Better accuracy for the Damaging lens and the Terra Blade.
This commit is contained in:
1 parent
1ad283405a
commit
80de6f718e
3 files changed
+44
-26
No files matched your search
@@ -68,7 +68,7 @@ public class BlockAlfPortal extends BlockModContainer implements IWandable, ILex
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return world.getBlockMetadata(x, y, z) != 0 ? 0 : 15;
|
||||
return world.getBlockMetadata(x, y, z) == 0 ? 0 : 15;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -36,6 +37,7 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.mana.BurstProperties;
|
||||
import vazkii.botania.api.mana.ILens;
|
||||
@@ -240,19 +242,6 @@ public class ItemLens extends ItemMod implements ILens {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DAMAGE : {
|
||||
if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && !(pos.entityHit instanceof EntityPlayer)) {
|
||||
EntityLivingBase living = (EntityLivingBase) pos.entityHit;
|
||||
if(living.hurtTime == 0) {
|
||||
int mana = burst.getMana();
|
||||
if(mana >= 16) {
|
||||
burst.setMana(mana - 16);
|
||||
if(!burst.isFake() && !entity.worldObj.isRemote)
|
||||
living.attackEntityFrom(DamageSource.magic, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case PHANTOM : {
|
||||
if(!isManaBlock) {
|
||||
dead = false;
|
||||
@@ -287,6 +276,25 @@ public class ItemLens extends ItemMod implements ILens {
|
||||
|
||||
boolean magnetized = entity.getEntityData().hasKey("Botania:Magnetized");
|
||||
switch(stack.getItemDamage()) {
|
||||
case DAMAGE : {
|
||||
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ);
|
||||
List<EntityLivingBase> entities = entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
|
||||
for(EntityLivingBase living : entities) {
|
||||
if(living instanceof EntityPlayer)
|
||||
continue;
|
||||
|
||||
if(living.hurtTime == 0) {
|
||||
int mana = burst.getMana();
|
||||
if(mana >= 16) {
|
||||
burst.setMana(mana - 16);
|
||||
if(!burst.isFake() && !entity.worldObj.isRemote)
|
||||
living.attackEntityFrom(DamageSource.magic, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MAGNET : {
|
||||
int x = (int) entity.posX;
|
||||
int y = (int) entity.posY;
|
||||
|
||||
@@ -11,12 +11,16 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
@@ -53,7 +57,7 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
|
||||
public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) {
|
||||
EntityManaBurst burst = new EntityManaBurst(player);
|
||||
|
||||
float motionModifier = 5F;
|
||||
float motionModifier = 7F;
|
||||
|
||||
burst.setColor(0x20FF20);
|
||||
burst.setMana(MANA_PER_DAMAGE);
|
||||
@@ -74,26 +78,32 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
|
||||
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
Entity entity = (Entity) burst;
|
||||
if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && !(pos.entityHit instanceof EntityPlayer)) {
|
||||
EntityLivingBase living = (EntityLivingBase) pos.entityHit;
|
||||
return dead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBurst(IManaBurst burst, ItemStack stack) {
|
||||
EntityThrowable entity = (EntityThrowable) burst;
|
||||
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ);
|
||||
List<EntityLivingBase> entities = entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
|
||||
for(EntityLivingBase living : entities) {
|
||||
if(living instanceof EntityPlayer)
|
||||
continue;
|
||||
|
||||
if(living.hurtTime == 0) {
|
||||
int cost = MANA_PER_DAMAGE / 3;
|
||||
int mana = burst.getMana();
|
||||
if(mana >= cost) {
|
||||
burst.setMana(mana - cost);
|
||||
float damage = 4F + BotaniaAPI.terrasteelToolMaterial.getDamageVsEntity();
|
||||
if(!burst.isFake() && !entity.worldObj.isRemote)
|
||||
if(!burst.isFake() && !entity.worldObj.isRemote) {
|
||||
living.attackEntityFrom(DamageSource.magic, damage);
|
||||
entity.setDead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBurst(IManaBurst burst, ItemStack stack) {
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user