Manastorm Charge. Kaboom, baby.

This commit is contained in:
Lizbeth Rika committed 2015-07-25 02:59:29 +01:00
1 parent 604a94a6e8
commit e934524587
13 files changed
+242 -1

No files matched your search

@@ -77,6 +77,7 @@ import vazkii.botania.client.render.block.RenderSpreader;
import vazkii.botania.client.render.block.RenderTinyPotato;
import vazkii.botania.client.render.entity.RenderCorporeaSpark;
import vazkii.botania.client.render.entity.RenderDoppleganger;
import vazkii.botania.client.render.entity.RenderManaStorm;
import vazkii.botania.client.render.entity.RenderPinkWither;
import vazkii.botania.client.render.entity.RenderPixie;
import vazkii.botania.client.render.entity.RenderPoolMinecart;
@@ -142,6 +143,7 @@ import vazkii.botania.common.core.version.VersionChecker;
import vazkii.botania.common.entity.EntityCorporeaSpark;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.entity.EntityEnderAirBottle;
import vazkii.botania.common.entity.EntityManaStorm;
import vazkii.botania.common.entity.EntityPinkWither;
import vazkii.botania.common.entity.EntityPixie;
import vazkii.botania.common.entity.EntityPoolMinecart;
@@ -304,6 +306,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityEnderAirBottle.class, new RenderSnowball(ModItems.manaResource, 15));
RenderingRegistry.registerEntityRenderingHandler(EntityPoolMinecart.class, new RenderPoolMinecart());
RenderingRegistry.registerEntityRenderingHandler(EntityPinkWither.class, new RenderPinkWither());
RenderingRegistry.registerEntityRenderingHandler(EntityManaStorm.class, new RenderManaStorm());
ShaderHelper.initShaders();
}
@@ -0,0 +1,47 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 25, 2015, 2:32:31 AM (GMT)]
*/
package vazkii.botania.client.render.entity;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.entity.EntityManaStorm;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class RenderManaStorm extends Render {
@Override
public void doRender(Entity e, double x, double y, double z, float something, float pticks) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
EntityManaStorm storm = (EntityManaStorm) e;
float maxScale = 1.95F;
float scale = 0.05F + ((float) storm.burstsFired / EntityManaStorm.TOTAL_BURSTS - (float) ((storm.deathTime == 0 ? 0 : (storm.deathTime + pticks)) / EntityManaStorm.DEATH_TIME)) * maxScale;
RenderHelper.renderStar(0x00FF00, scale, scale, scale, e.getUniqueID().getMostSignificantBits());
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return null;
}
}
@@ -0,0 +1,41 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 25, 2015, 12:24:10 AM (GMT)]
*/
package vazkii.botania.common.block;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.IManaTrigger;
import vazkii.botania.common.entity.EntityManaStorm;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockManaBomb extends BlockMod implements IManaTrigger {
public BlockManaBomb() {
super(Material.wood);
setHardness(12.0F);
setStepSound(soundTypeWood);
setBlockName(LibBlockNames.MANA_BOMB);
}
@Override
public void onBurstCollision(IManaBurst burst, World world, int x, int y, int z) {
if(!burst.isFake() && !world.isRemote) {
world.playAuxSFX(2001, x, y, z, getIdFromBlock(this));
world.setBlockToAir(x, y, z);
EntityManaStorm storm = new EntityManaStorm(world);
storm.setPosition(x + 0.5, y + 0.5, z + 0.5);
world.spawnEntityInWorld(storm);
}
}
}
@@ -238,6 +238,7 @@ public final class ModBlocks {
public static Block cocoon;
public static Block lightRelay;
public static Block lightLauncher;
public static Block manaBomb;
public static void init() {
flower = new BlockModFlower();
@@ -317,6 +318,7 @@ public final class ModBlocks {
cocoon = new BlockCocoon();
lightRelay = new BlockLightRelay();
lightLauncher = new BlockLightLauncher();
manaBomb = new BlockManaBomb();
ModFluffBlocks.init();
@@ -237,6 +237,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addBlock(ModBlocks.distributor);
addBlock(ModBlocks.manaVoid);
addBlock(ModBlocks.manaDetector);
addBlock(ModBlocks.manaBomb);
addBlock(ModBlocks.ghostRail);
addItem(ModItems.poolMinecart);
addBlock(ModBlocks.pump);
@@ -0,0 +1,99 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 25, 2015, 12:35:51 AM (GMT)]
*/
package vazkii.botania.common.entity;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.lens.ItemLens;
public class EntityManaStorm extends Entity {
private static final String TAG_TIME = "time";
private static final String TAG_BURSTS_FIRED = "burstsFired";
private static final String TAG_DEATH_TIME = "deathTime";
public static final int TOTAL_BURSTS = 250;
public static final int DEATH_TIME = 200;
public int liveTime;
public int burstsFired;
public int deathTime;
public EntityManaStorm(World p_i1582_1_) {
super(p_i1582_1_);
}
@Override
protected void entityInit() {
// NO-OP
}
@Override
public void onUpdate() {
super.onUpdate();
liveTime++;
int diffTime = Math.max(1, 30 - (int) ((float) liveTime / 45f));
if(burstsFired < TOTAL_BURSTS && liveTime % diffTime == 0) {
if(!worldObj.isRemote)
spawnBurst();
burstsFired++;
}
if(burstsFired >= TOTAL_BURSTS) {
deathTime++;
if(deathTime >= DEATH_TIME) {
setDead();
worldObj.createExplosion(this, posX, posY, posZ, 10F, true);
}
}
}
public void spawnBurst() {
EntityManaBurst burst = new EntityManaBurst(worldObj);
burst.setPosition(posX, posY, posZ);
float motionModifier = 0.5F;
burst.setColor(0x20FF20);
burst.setMana(120);
burst.setStartingMana(420);
burst.setMinManaLoss(50);
burst.setManaLossPerTick(1F);
burst.setGravity(0F);
ItemStack lens = new ItemStack(ModItems.lens, 1, ItemLens.STORM);
burst.setSourceLens(lens);
Vector3 motion = new Vector3(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize().multiply(motionModifier);
burst.setMotion(motion.x, motion.y, motion.z);
worldObj.spawnEntityInWorld(burst);
}
@Override
protected void readEntityFromNBT(NBTTagCompound cmp) {
liveTime = cmp.getInteger(TAG_TIME);
burstsFired = cmp.getInteger(TAG_BURSTS_FIRED);
deathTime = cmp.getInteger(TAG_DEATH_TIME);
}
@Override
protected void writeEntityToNBT(NBTTagCompound cmp) {
cmp.setInteger(TAG_TIME, liveTime);
cmp.setInteger(TAG_BURSTS_FIRED, burstsFired);
cmp.setInteger(TAG_DEATH_TIME, deathTime);
}
}
@@ -36,6 +36,7 @@ public final class ModEntities {
EntityRegistry.registerModEntity(EntityPoolMinecart.class, LibEntityNames.POOL_MINECART, id++, Botania.instance, 80, 3, true);
EntityRegistry.registerModEntity(EntityPinkWither.class, LibEntityNames.PINK_WITHER, id++, Botania.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityPlayerMover.class, LibEntityNames.PLAYER_MOVER, id++, Botania.instance, 40, 3, true);
EntityRegistry.registerModEntity(EntityManaStorm.class, LibEntityNames.MANA_STORM, id++, Botania.instance, 64, 10, false);
}
}
@@ -29,6 +29,7 @@ import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILens;
import vazkii.botania.api.mana.ITinyPlanetExcempt;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
@@ -38,7 +39,7 @@ import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemLens extends ItemMod implements ILens {
public class ItemLens extends ItemMod implements ILens, ITinyPlanetExcempt {
public static final int SUBTYPES = 19;
@@ -61,6 +62,8 @@ public class ItemLens extends ItemMod implements ILens {
PISTON = 16,
LIGHT = 17,
WARP = 18;
public static final int STORM = 5000;
private static final int PROP_NONE = 0,
PROP_POWER = 1,
@@ -72,6 +75,7 @@ public class ItemLens extends ItemMod implements ILens {
private static final int[] props = new int[SUBTYPES];
private static final Lens[] lenses = new Lens[SUBTYPES];
private static Lens fallbackLens = new Lens();
private static Lens stormLens = new LensStorm();
static {
setProps(NORMAL, PROP_NONE);
@@ -276,6 +280,9 @@ public class ItemLens extends ItemMod implements ILens {
}
public static Lens getLens(int index) {
if(index == STORM)
return stormLens;
Lens lens = lenses[index];
return lens == null ? fallbackLens : lens;
}
@@ -309,4 +316,9 @@ public class ItemLens extends ItemMod implements ILens {
return sourceLens;
}
@Override
public boolean shouldPull(ItemStack stack) {
return stack.getItemDamage() != STORM;
}
}
@@ -0,0 +1,32 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 25, 2015, 2:10:26 AM (GMT)]
*/
package vazkii.botania.common.item.lens;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import vazkii.botania.api.internal.IManaBurst;
public class LensStorm extends Lens {
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
if(!burst.isFake()) {
ChunkCoordinates coords = burst.getBurstSourceChunkCoordinates();
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.blockX != coords.posX || pos.blockY != coords.posY || pos.blockZ != coords.posZ))
entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, 5F, true);
} else dead = false;
return dead;
}
}
@@ -92,6 +92,7 @@ public final class LibBlockNames {
public static final String COCOON = "cocoon";
public static final String LIGHT_RELAY = "lightRelay";
public static final String LIGHT_LAUNCHER = "lightLauncher";
public static final String MANA_BOMB = "manaBomb";
public static final String SUBTILE_PUREDAISY = "puredaisy";
public static final String SUBTILE_MANASTAR = "manastar";
@@ -30,5 +30,6 @@ public final class LibEntityNames {
public static final String POOL_MINECART = LibResources.PREFIX_MOD + "poolMinecart";
public static final String PINK_WITHER = LibResources.PREFIX_MOD + "pinkWither";
public static final String PLAYER_MOVER = LibResources.PREFIX_MOD + "playerMover";
public static final String MANA_STORM = LibResources.PREFIX_MOD + "manaStorm";
}