mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Added the hardmode gaia guardian.
This commit is contained in:
1 parent
afb1b87db3
commit
b901f1a9d1
18 files changed
+207
-64
No files matched your search
@@ -40,6 +40,7 @@ public final class ShaderHelper {
|
||||
public static int halo = 0;
|
||||
public static int dopplegangerBar = 0;
|
||||
public static int terraPlateRune = 0;
|
||||
public static int filmGrain = 0;
|
||||
|
||||
public static void initShaders() {
|
||||
if(!useShaders())
|
||||
@@ -52,6 +53,7 @@ public final class ShaderHelper {
|
||||
halo = createProgram(null, LibResources.SHADER_HALO_FRAG);
|
||||
dopplegangerBar = createProgram(null, LibResources.SHADER_DOPLLEGANGER_BAR_FRAG);
|
||||
terraPlateRune = createProgram(null, LibResources.SHADER_TERRA_PLATE_RUNE_FRAG);
|
||||
filmGrain = createProgram(null, LibResources.SHADER_FILM_GRAIN);
|
||||
}
|
||||
|
||||
public static void useShader(int shader, ShaderCallback callback) {
|
||||
|
||||
@@ -280,12 +280,18 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
private static boolean noclipEnabled = false;
|
||||
private static boolean corruptSparkle = false;
|
||||
|
||||
@Override
|
||||
public void setSparkleFXNoClip(boolean noclip) {
|
||||
noclipEnabled = noclip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSparkleFXCorrupt(boolean corrupt) {
|
||||
corruptSparkle = corrupt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
if(!doParticle() && !fake)
|
||||
@@ -295,6 +301,8 @@ public class ClientProxy extends CommonProxy {
|
||||
sparkle.fake = sparkle.noClip = fake;
|
||||
if(noclipEnabled)
|
||||
sparkle.noClip = true;
|
||||
if(corruptSparkle)
|
||||
sparkle.corrupt = true;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(sparkle);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.ObfuscationHelper;
|
||||
@@ -32,6 +33,7 @@ public class FXSparkle extends EntityFX {
|
||||
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
|
||||
|
||||
public static Queue<FXSparkle> queuedRenders = new ArrayDeque();
|
||||
public static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque();
|
||||
|
||||
// Queue values
|
||||
float f;
|
||||
@@ -70,8 +72,16 @@ public class FXSparkle extends EntityFX {
|
||||
for(FXSparkle sparkle : queuedRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
tessellator.draw();
|
||||
|
||||
ShaderHelper.useShader(ShaderHelper.filmGrain);
|
||||
tessellator.startDrawingQuads();
|
||||
for(FXSparkle sparkle : queuedCorruptRenders)
|
||||
sparkle.renderQueued(tessellator);
|
||||
tessellator.draw();
|
||||
ShaderHelper.releaseShader();
|
||||
|
||||
queuedRenders.clear();
|
||||
queuedCorruptRenders.clear();
|
||||
}
|
||||
|
||||
private void renderQueued(Tessellator tessellator) {
|
||||
@@ -111,7 +121,9 @@ public class FXSparkle extends EntityFX {
|
||||
this.f4 = f4;
|
||||
this.f5 = f5;
|
||||
|
||||
queuedRenders.add(this);
|
||||
if(corrupt)
|
||||
queuedCorruptRenders.add(this);
|
||||
else queuedRenders.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,6 +248,7 @@ public class FXSparkle extends EntityFX {
|
||||
} else return false;
|
||||
}
|
||||
|
||||
public boolean corrupt = false;
|
||||
public boolean fake = false;
|
||||
public int multiplier = 2;
|
||||
public boolean shrink = true;
|
||||
|
||||
@@ -121,5 +121,6 @@ public final class LibResources {
|
||||
public static final String SHADER_HALO_FRAG = PREFIX_SHADER + "halo.frag";
|
||||
public static final String SHADER_DOPLLEGANGER_BAR_FRAG = PREFIX_SHADER + "doppleganger_bar.frag";
|
||||
public static final String SHADER_TERRA_PLATE_RUNE_FRAG = PREFIX_SHADER + "terra_plate_rune.frag";
|
||||
public static final String SHADER_FILM_GRAIN = PREFIX_SHADER + "film_grain.frag";
|
||||
|
||||
}
|
||||
@@ -153,6 +153,10 @@ public class CommonProxy {
|
||||
public void setSparkleFXNoClip(boolean noclip) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void setSparkleFXCorrupt(boolean corrupt) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
sparkleFX(world, x, y, z, r, g, b, size, m, false);
|
||||
@@ -169,7 +173,7 @@ public class CommonProxy {
|
||||
public void setWispFXDepthTest(boolean depth) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size) {
|
||||
wispFX(world, x, y, z, r, g, b, size, 0F);
|
||||
}
|
||||
|
||||
@@ -225,6 +225,7 @@ public final class ModCraftingRecipes {
|
||||
public static IRecipe recipeThornChakram;
|
||||
public static IRecipe recipeDirtPathSlab;
|
||||
public static List<IRecipe> recipesPatterns;
|
||||
public static IRecipe recipeGaiaIngot;
|
||||
|
||||
public static void init() {
|
||||
// Lexicon Recipe
|
||||
@@ -1486,6 +1487,13 @@ public final class ModCraftingRecipes {
|
||||
|
||||
recipesPatterns = BotaniaAPI.getLatestAddedRecipes(count);
|
||||
}
|
||||
|
||||
// Gaia Spirit Ingot Recipe
|
||||
addOreDictRecipe(new ItemStack(ModItems.manaResource, 1, 14),
|
||||
" S ", "SIS", " S ",
|
||||
'S', LibOreDict.LIFE_ESSENCE,
|
||||
'I', LibOreDict.TERRA_STEEL);
|
||||
recipeGaiaIngot = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Storage Block Recipes
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
|
||||
|
||||
@@ -80,6 +80,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
private static final String TAG_SOURCE_Y = "sourceY";
|
||||
private static final String TAG_SOURCE_Z = "sourcesZ";
|
||||
private static final String TAG_MOB_SPAWN_TICKS = "mobSpawnTicks";
|
||||
private static final String TAG_HARD_MODE = "hardMode";
|
||||
|
||||
private static final int[][] PYLON_LOCATIONS = new int[][] {
|
||||
{ 4, 1, 4 },
|
||||
@@ -102,7 +103,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
experienceValue = 825;
|
||||
}
|
||||
|
||||
public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, int par4, int par5, int par6) {
|
||||
public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, int par4, int par5, int par6, boolean hard) {
|
||||
Block block = par3World.getBlock(par4, par5, par6);
|
||||
if(block == Blocks.beacon && !par3World.isRemote) {
|
||||
if(par3World.difficultySetting == EnumDifficulty.PEACEFUL) {
|
||||
@@ -130,6 +131,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
e.setHealth(1F);
|
||||
e.setSource(par4, par5, par6);
|
||||
e.setMobSpawnTicks(MOB_SPAWN_TICKS);
|
||||
e.setHardMode(hard);
|
||||
par3World.playSoundAtEntity(e, "mob.enderdragon.growl", 10F, 0.1F);
|
||||
par3World.spawnEntityInWorld(e);
|
||||
return true;
|
||||
@@ -153,6 +155,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
dataWatcher.addObject(24, 0); // Source Y
|
||||
dataWatcher.addObject(25, 0); // Source Z
|
||||
dataWatcher.addObject(26, 0); // Ticks spawning mobs
|
||||
dataWatcher.addObject(27, (byte) 0); // Hard Mode
|
||||
}
|
||||
|
||||
public int getInvulTime() {
|
||||
@@ -178,6 +181,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
return dataWatcher.getWatchableObjectInt(26);
|
||||
}
|
||||
|
||||
public boolean isHardMode() {
|
||||
return dataWatcher.getWatchableObjectByte(27) == 1;
|
||||
}
|
||||
|
||||
public void setInvulTime(int time) {
|
||||
dataWatcher.updateObject(20, time);
|
||||
}
|
||||
@@ -200,6 +207,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
dataWatcher.updateObject(26, ticks);
|
||||
}
|
||||
|
||||
public void setHardMode(boolean hardMode) {
|
||||
dataWatcher.updateObject(27, (byte) (hardMode ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeEntityToNBT(par1nbtTagCompound);
|
||||
@@ -211,6 +222,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
par1nbtTagCompound.setInteger(TAG_SOURCE_X, source.posX);
|
||||
par1nbtTagCompound.setInteger(TAG_SOURCE_Y, source.posY);
|
||||
par1nbtTagCompound.setInteger(TAG_SOURCE_Z, source.posZ);
|
||||
|
||||
par1nbtTagCompound.setBoolean(TAG_HARD_MODE, isHardMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,12 +237,14 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
int y = par1nbtTagCompound.getInteger(TAG_SOURCE_Y);
|
||||
int z = par1nbtTagCompound.getInteger(TAG_SOURCE_Z);
|
||||
setSource(x, y, z);
|
||||
|
||||
setHardMode(par1nbtTagCompound.getBoolean(TAG_HARD_MODE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
|
||||
if((par1DamageSource.damageType.equals("player") || par1DamageSource.getEntity() instanceof EntityPixie) && par1DamageSource.getEntity() != null && !(par1DamageSource.getEntity() instanceof FakePlayer) && getInvulTime() == 0)
|
||||
return super.attackEntityFrom(par1DamageSource, par2);
|
||||
return super.attackEntityFrom(par1DamageSource, par2 * (isHardMode() ? 0.6F : 1F));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -254,16 +269,16 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
setAggroed(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDeath(DamageSource p_70645_1_) {
|
||||
super.onDeath(p_70645_1_);
|
||||
EntityLivingBase entitylivingbase = this.func_94060_bK();
|
||||
if(entitylivingbase instanceof EntityPlayer) {
|
||||
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianKill, 1);
|
||||
if(!anyWithArmor)
|
||||
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianNoArmor, 1);
|
||||
}
|
||||
EntityLivingBase entitylivingbase = this.func_94060_bK();
|
||||
if(entitylivingbase instanceof EntityPlayer) {
|
||||
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianKill, 1);
|
||||
if(!anyWithArmor)
|
||||
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianNoArmor, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -281,8 +296,28 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean par1, int par2) {
|
||||
if(par1)
|
||||
entityDropItem(new ItemStack(ModItems.manaResource, 8, 5), 1F);
|
||||
if(par1) {
|
||||
boolean hard = isHardMode();
|
||||
entityDropItem(new ItemStack(ModItems.manaResource, hard ? 16 : 8, 5), 1F);
|
||||
|
||||
if(hard) {
|
||||
// TODO Add Will Drops
|
||||
if(Math.random() < 0.25)
|
||||
entityDropItem(new ItemStack(ModItems.overgrowthSeed, rand.nextInt(3) + 1), 1F);
|
||||
if(Math.random() < 0.5) {
|
||||
boolean voidLotus = Math.random() < 0.3F;
|
||||
entityDropItem(new ItemStack(ModItems.blackLotus, voidLotus ? 1 : rand.nextInt(3) + 1, voidLotus ? 1 : 0), 1F);
|
||||
}
|
||||
if(Math.random() < 0.9)
|
||||
entityDropItem(new ItemStack(ModItems.manaResource, 16 + rand.nextInt(12)), 1F);
|
||||
if(Math.random() < 0.7)
|
||||
entityDropItem(new ItemStack(ModItems.manaResource, 8 + rand.nextInt(6), 1), 1F);
|
||||
if(Math.random() < 0.5)
|
||||
entityDropItem(new ItemStack(ModItems.manaResource, 4 + rand.nextInt(3), 1), 1F);
|
||||
if(Math.random() < 0.3)
|
||||
entityDropItem(new ItemStack(ModItems.rune, 2 + rand.nextInt(3), rand.nextInt(16)), 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -293,7 +328,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
setDead();
|
||||
|
||||
ChunkCoordinates source = getSource();
|
||||
|
||||
boolean hard = isHardMode();
|
||||
|
||||
float range = 32F;
|
||||
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(source.posX + 0.5 - range, source.posY + 0.5 - range, source.posZ + 0.5 - range, source.posX + 0.5 + range, source.posY + 0.5 + range, source.posZ + 0.5 + range));
|
||||
|
||||
@@ -311,33 +347,34 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
double z = source.posZ - 0.5 - Math.sin(rad) * range;
|
||||
|
||||
Botania.proxy.wispFX(worldObj, x, y, z, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m);
|
||||
|
||||
}
|
||||
|
||||
if(players.isEmpty() && !worldObj.playerEntities.isEmpty())
|
||||
setDead();
|
||||
else for(EntityPlayer player : players) {
|
||||
if(player.inventory.armorInventory[0] != null || player.inventory.armorInventory[1] != null || player.inventory.armorInventory[2] != null || player.inventory.armorInventory[3] != null)
|
||||
anyWithArmor = true;
|
||||
|
||||
List<PotionEffect> remove = new ArrayList();
|
||||
Collection<PotionEffect> active = player.getActivePotionEffects();
|
||||
for(PotionEffect effect : active)
|
||||
if(effect.getDuration() < 200 && !ReflectionHelper.<Boolean, Potion>getPrivateValue(Potion.class, Potion.potionTypes[effect.getPotionID()], LibObfuscation.IS_BAD_EFFECT))
|
||||
remove.add(effect);
|
||||
else {
|
||||
for(EntityPlayer player : players) {
|
||||
if(player.inventory.armorInventory[0] != null || player.inventory.armorInventory[1] != null || player.inventory.armorInventory[2] != null || player.inventory.armorInventory[3] != null)
|
||||
anyWithArmor = true;
|
||||
|
||||
active.removeAll(remove);
|
||||
List<PotionEffect> remove = new ArrayList();
|
||||
Collection<PotionEffect> active = player.getActivePotionEffects();
|
||||
for(PotionEffect effect : active)
|
||||
if(effect.getDuration() < 200 && !ReflectionHelper.<Boolean, Potion>getPrivateValue(Potion.class, Potion.potionTypes[effect.getPotionID()], LibObfuscation.IS_BAD_EFFECT))
|
||||
remove.add(effect);
|
||||
|
||||
player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode;
|
||||
active.removeAll(remove);
|
||||
|
||||
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5) >= range) {
|
||||
Vector3 sourceVector = new Vector3(source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5);
|
||||
Vector3 playerVector = Vector3.fromEntityCenter(player);
|
||||
Vector3 motion = sourceVector.copy().sub(playerVector).copy().normalize();
|
||||
player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode;
|
||||
|
||||
player.motionX = motion.x;
|
||||
player.motionY = 0.2;
|
||||
player.motionZ = motion.z;
|
||||
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5) >= range) {
|
||||
Vector3 sourceVector = new Vector3(source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5);
|
||||
Vector3 playerVector = Vector3.fromEntityCenter(player);
|
||||
Vector3 motion = sourceVector.copy().sub(playerVector).copy().normalize();
|
||||
|
||||
player.motionX = motion.x;
|
||||
player.motionY = 0.2;
|
||||
player.motionZ = motion.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +383,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
|
||||
int invul = getInvulTime();
|
||||
int mobTicks = getMobSpawnTicks();
|
||||
|
||||
boolean spawnMissiles = hard && ticksExisted % 15 < 4;
|
||||
|
||||
if(invul > 0 && mobTicks == MOB_SPAWN_TICKS) {
|
||||
if(invul < SPAWN_TICKS && invul > SPAWN_TICKS / 2 && worldObj.rand.nextInt(SPAWN_TICKS - invul + 1) == 0)
|
||||
for(int i = 0; i < 2; i++)
|
||||
@@ -375,7 +413,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
switch(worldObj.rand.nextInt(2)) {
|
||||
case 0 : {
|
||||
entity = new EntityZombie(worldObj);
|
||||
if(worldObj.rand.nextInt(12) == 0)
|
||||
if(worldObj.rand.nextInt(hard ? 9 : 12) == 0)
|
||||
entity = new EntityWitch(worldObj);
|
||||
|
||||
break;
|
||||
@@ -385,12 +423,12 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
((EntitySkeleton) entity).setCurrentItemOrArmor(0, new ItemStack(Items.bow));
|
||||
if(worldObj.rand.nextInt(8) == 0) {
|
||||
((EntitySkeleton) entity).setSkeletonType(1);
|
||||
((EntitySkeleton) entity).setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
|
||||
((EntitySkeleton) entity).setCurrentItemOrArmor(0, new ItemStack(hard ? ModItems.elementiumSword : Items.stone_sword));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3 : {
|
||||
for(int j = 0; j < 1 + worldObj.rand.nextInt(5); j++) {
|
||||
for(int j = 0; j < 1 + worldObj.rand.nextInt(hard ? 8 : 5); j++) {
|
||||
EntityPixie pixie = new EntityPixie(worldObj);
|
||||
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
|
||||
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
|
||||
@@ -405,6 +443,11 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
worldObj.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
if(hard && ticksExisted % 3 < 2) {
|
||||
spawnMissile();
|
||||
spawnMissiles = false;
|
||||
}
|
||||
}
|
||||
|
||||
setMobSpawnTicks(mobTicks - 1);
|
||||
@@ -433,18 +476,21 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
worldObj.spawnEntityInWorld(landmine);
|
||||
}
|
||||
|
||||
for(int i = 0; i < (spawnPixies ? worldObj.rand.nextInt(3) : 1); i++) {
|
||||
for(int i = 0; i < (spawnPixies ? worldObj.rand.nextInt(hard ? 6 : 3) : 1); i++) {
|
||||
EntityPixie pixie = new EntityPixie(worldObj);
|
||||
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
|
||||
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
|
||||
worldObj.spawnEntityInWorld(pixie);
|
||||
}
|
||||
|
||||
setTPDelay(dying ? 40 : 60);
|
||||
setTPDelay(hard ? dying ? 20 : 45 : dying ? 40 : 60);
|
||||
spawnLandmines = true;
|
||||
spawnPixies = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(spawnMissiles)
|
||||
spawnMissile();
|
||||
} else {
|
||||
range = 3F;
|
||||
players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range));
|
||||
@@ -453,6 +499,17 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void spawnMissile() {
|
||||
if(!worldObj.isRemote) {
|
||||
EntityMagicMissile missile = new EntityMagicMissile(this, true);
|
||||
missile.setPosition(posX + (Math.random() - 0.5 * 0.1), posY + 2.4 + (Math.random() - 0.5 * 0.1), posZ + (Math.random() - 0.5 * 0.1));
|
||||
if(missile.getTarget()) {
|
||||
worldObj.playSoundAtEntity(this, "botania:missile", 0.6F, 0.8F + (float) Math.random() * 0.2F);
|
||||
worldObj.spawnEntityInWorld(missile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EntityEnderman code below ============================================================================
|
||||
|
||||
@@ -579,7 +636,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
int hpFractUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "hpFract");
|
||||
|
||||
float time = getInvulTime();
|
||||
float grainIntensity = time > 20 ? 1F : time / 20F;
|
||||
float grainIntensity = time > 20 ? 1F : Math.max(isHardMode() ? 0.5F : 0F, time / 20F);
|
||||
|
||||
ARBShaderObjects.glUniform1fARB(grainIntensityUniform, grainIntensity);
|
||||
ARBShaderObjects.glUniform1fARB(hpFractUniform, getHealth() / getMaxHealth());
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -31,17 +32,32 @@ import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
public class EntityMagicMissile extends EntityThrowable {
|
||||
|
||||
EntityLivingBase target;
|
||||
double lockX, lockY = -1, lockZ;
|
||||
|
||||
public EntityMagicMissile(World world) {
|
||||
super(world);
|
||||
setSize(0F, 0F);
|
||||
}
|
||||
|
||||
public EntityMagicMissile(EntityPlayer player) {
|
||||
this(player.worldObj);
|
||||
ReflectionHelper.setPrivateValue(EntityThrowable.class, this, player, LibObfuscation.THROWER);
|
||||
public EntityMagicMissile(EntityLivingBase thrower, boolean evil) {
|
||||
this(thrower.worldObj);
|
||||
ReflectionHelper.setPrivateValue(EntityThrowable.class, this, thrower, LibObfuscation.THROWER);
|
||||
setEvil(evil);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
dataWatcher.addObject(25, (byte) 0);
|
||||
}
|
||||
|
||||
public void setEvil(boolean evil) {
|
||||
dataWatcher.updateObject(25, (byte) (evil ? 1 : 0));
|
||||
}
|
||||
|
||||
public boolean isEvil() {
|
||||
return dataWatcher.getWatchableObjectByte(25) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
@@ -51,6 +67,7 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean evil = isEvil();
|
||||
Vector3 thisVec = Vector3.fromEntityCenter(this);
|
||||
Vector3 oldPos = new Vector3(lastTickPosX, lastTickPosY, lastTickPosZ);
|
||||
Vector3 diff = thisVec.copy().sub(oldPos);
|
||||
@@ -58,30 +75,42 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
int steps = (int) (diff.mag() / step.mag());
|
||||
Vector3 particlePos = oldPos.copy();
|
||||
|
||||
Botania.proxy.setSparkleFXCorrupt(evil);
|
||||
for(int i = 0; i < steps; i++) {
|
||||
Botania.proxy.sparkleFX(worldObj, particlePos.x, particlePos.y, particlePos.z, 1F, 0.4F, 1F, 0.8F, 2);
|
||||
Botania.proxy.sparkleFX(worldObj, particlePos.x, particlePos.y, particlePos.z, 1F, evil ? 0F : 0.4F, 1F, 0.8F, 2);
|
||||
if(worldObj.rand.nextInt(steps) <= 1)
|
||||
Botania.proxy.sparkleFX(worldObj, particlePos.x + (Math.random() - 0.5) * 0.4, particlePos.y + (Math.random() - 0.5) * 0.4, particlePos.z + (Math.random() - 0.5) * 0.4, 1F, 0.4F, 1F, 0.8F, 2);
|
||||
Botania.proxy.sparkleFX(worldObj, particlePos.x + (Math.random() - 0.5) * 0.4, particlePos.y + (Math.random() - 0.5) * 0.4, particlePos.z + (Math.random() - 0.5) * 0.4, 1F, evil ? 0F : 0.4F, 1F, 0.8F, 2);
|
||||
|
||||
particlePos.add(step);
|
||||
}
|
||||
Botania.proxy.setSparkleFXCorrupt(false);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
Vector3 targetVec = Vector3.fromEntityCenter(target);
|
||||
Vector3 motionVec = targetVec.copy().sub(thisVec).normalize().multiply(0.6);
|
||||
if(lockY == -1) {
|
||||
lockX = target.posX;
|
||||
lockY = target.posY;
|
||||
lockZ = target.posZ;
|
||||
}
|
||||
|
||||
Vector3 targetVec = evil ? new Vector3(lockX, lockY, lockZ) : Vector3.fromEntityCenter(target);
|
||||
Vector3 diffVec = targetVec.copy().sub(thisVec);
|
||||
Vector3 motionVec = diffVec.copy().normalize().multiply(evil ? 0.5 : 0.6);
|
||||
motionX = motionVec.x;
|
||||
motionY = motionVec.y;
|
||||
if(ticksExisted < 10)
|
||||
motionY = Math.abs(motionY);
|
||||
motionZ = motionVec.z;
|
||||
|
||||
|
||||
List<EntityLivingBase> targetList = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX - 0.5, posY - 0.5, posZ - 0.5, posX + 0.5, posY + 0.5, posZ + 0.5));
|
||||
if(targetList.contains(target) && target != null) {
|
||||
EntityLivingBase thrower = getThrower();
|
||||
EntityPlayer player = thrower instanceof EntityPlayer ? (EntityPlayer) thrower : null;
|
||||
target.attackEntityFrom(player == null ? DamageSource.generic : DamageSource.causePlayerDamage(player), 7);
|
||||
target.attackEntityFrom(player == null ? DamageSource.causeMobDamage(thrower) : DamageSource.causePlayerDamage(player), evil ? 12 : 7);
|
||||
setDead();
|
||||
}
|
||||
|
||||
if(evil && diffVec.mag() < 1)
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,15 +120,15 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
target = null;
|
||||
|
||||
double range = 12;
|
||||
List<IMob> entities = worldObj.getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range));
|
||||
List entities = worldObj.getEntitiesWithinAABB(isEvil() ? EntityPlayer.class : IMob.class, AxisAlignedBB.getBoundingBox(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range));
|
||||
while(entities.size() > 0) {
|
||||
IMob mob = entities.get(worldObj.rand.nextInt(entities.size()));
|
||||
if(!(mob instanceof EntityLivingBase)) { // Just in case...
|
||||
entities.remove(mob);
|
||||
Entity e = (Entity) entities.get(worldObj.rand.nextInt(entities.size()));
|
||||
if(!(e instanceof EntityLivingBase)) { // Just in case...
|
||||
entities.remove(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
target = (EntityLivingBase) mob;
|
||||
target = (EntityLivingBase) e;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -331,6 +331,7 @@ public final class ModItems {
|
||||
OreDictionary.registerOre(LibOreDict.PLACEHOLDER, new ItemStack(manaResource, 1, 11));
|
||||
OreDictionary.registerOre(LibOreDict.RED_STRING, new ItemStack(manaResource, 1, 12));
|
||||
OreDictionary.registerOre(LibOreDict.DREAMWOOD_TWIG, new ItemStack(manaResource, 1, 13));
|
||||
OreDictionary.registerOre(LibOreDict.GAIA_INGOT, new ItemStack(manaResource, 1, 14));
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.VIAL, new ItemStack(vial, 1, 0));
|
||||
OreDictionary.registerOre(LibOreDict.FLASK, new ItemStack(vial, 1, 1));
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class ItemTerrasteelHelm extends ItemTerrasteelArmor implements IManaDisc
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
|
||||
super.onArmorTick(world, player, stack);
|
||||
if(!hasArmorSet(player)) {
|
||||
if(hasArmorSet(player)) {
|
||||
int food = player.getFoodStats().getFoodLevel();
|
||||
if(food > 0 && food < 18 && player.shouldHeal() && player.ticksExisted % 80 == 0)
|
||||
player.heal(1F);
|
||||
|
||||
@@ -35,7 +35,7 @@ import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class ItemManaResource extends ItemMod implements IFlowerComponent, IElvenItem, IPickupAchievement {
|
||||
|
||||
final int types = 14;
|
||||
final int types = 15;
|
||||
IIcon[] icons;
|
||||
|
||||
public ItemManaResource() {
|
||||
@@ -46,8 +46,8 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
if(par1ItemStack.getItemDamage() == 4)
|
||||
return EntityDoppleganger.spawn(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6);
|
||||
if(par1ItemStack.getItemDamage() == 4 || par1ItemStack.getItemDamage() == 14)
|
||||
return EntityDoppleganger.spawn(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6, par1ItemStack.getItemDamage() == 14);
|
||||
|
||||
return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class ItemManaResource extends ItemMod implements IFlowerComponent, IElve
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
|
||||
if(par1ItemStack.getItemDamage() == 5)
|
||||
if(par1ItemStack.getItemDamage() == 5 || par1ItemStack.getItemDamage() == 14)
|
||||
return Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F);
|
||||
|
||||
return 0xFFFFFF;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ItemMissileRod extends ItemMod implements IManaUsingItem {
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if(count != getMaxItemUseDuration(stack) && count % 2 == 0 && !player.worldObj.isRemote && ManaItemHandler.requestManaExact(stack, player, COST_PER, false)) {
|
||||
EntityMagicMissile missile = new EntityMagicMissile(player);
|
||||
EntityMagicMissile missile = new EntityMagicMissile(player, false);
|
||||
missile.setPosition(player.posX + (Math.random() - 0.5 * 0.1), player.posY + 2.4 + (Math.random() - 0.5 * 0.1), player.posZ + (Math.random() - 0.5 * 0.1));
|
||||
if(missile.getTarget()) {
|
||||
player.worldObj.playSoundAtEntity(player, "botania:missile", 0.6F, 0.8F + (float) Math.random() * 0.2F);
|
||||
|
||||
@@ -155,6 +155,7 @@ public final class LibItemNames {
|
||||
"prismarineShard",
|
||||
"placeholder",
|
||||
"redString",
|
||||
"dreamwoodTwig"
|
||||
"dreamwoodTwig",
|
||||
"gaiaIngot"
|
||||
};
|
||||
}
|
||||
@@ -32,6 +32,7 @@ public final class LibOreDict {
|
||||
public static final String PLACEHOLDER = "bPlaceholder";
|
||||
public static final String RED_STRING = "bRedString";
|
||||
public static final String DREAMWOOD_TWIG = "dreamwoodTwig";
|
||||
public static final String GAIA_INGOT = "gaiaIngot";
|
||||
|
||||
public static final String VIAL = "bVial";
|
||||
public static final String FLASK = "bFlask";
|
||||
|
||||
Reference in new issue
Block a user