Added the Flare Chakram, a fire version of the Thorn Chakram.

This commit is contained in:
Vasco Lavos committed 2015-08-27 22:29:38 +01:00
1 parent 64082b160c
commit 8b8e86ed38
10 files changed
+165 -8

No files matched your search

@@ -83,6 +83,7 @@ import vazkii.botania.client.render.entity.RenderPinkWither;
import vazkii.botania.client.render.entity.RenderPixie;
import vazkii.botania.client.render.entity.RenderPoolMinecart;
import vazkii.botania.client.render.entity.RenderSpark;
import vazkii.botania.client.render.entity.RenderThornChakram;
import vazkii.botania.client.render.item.RenderBow;
import vazkii.botania.client.render.item.RenderFloatingFlowerItem;
import vazkii.botania.client.render.item.RenderLens;
@@ -304,7 +305,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityVineBall.class, new RenderSnowball(ModItems.vineBall));
RenderingRegistry.registerEntityRenderingHandler(EntityDoppleganger.class, new RenderDoppleganger());
RenderingRegistry.registerEntityRenderingHandler(EntitySpark.class, new RenderSpark());
RenderingRegistry.registerEntityRenderingHandler(EntityThornChakram.class, new RenderSnowball(ModItems.thornChakram));
RenderingRegistry.registerEntityRenderingHandler(EntityThornChakram.class, new RenderThornChakram());
RenderingRegistry.registerEntityRenderingHandler(EntityCorporeaSpark.class, new RenderCorporeaSpark());
RenderingRegistry.registerEntityRenderingHandler(EntityEnderAirBottle.class, new RenderSnowball(ModItems.manaResource, 15));
RenderingRegistry.registerEntityRenderingHandler(EntityPoolMinecart.class, new RenderPoolMinecart());
@@ -0,0 +1,78 @@
/**
* 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 @ [Aug 27, 2015, 10:02:12 PM (GMT)]
*/
package vazkii.botania.client.render.entity;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.ItemPotion;
import net.minecraft.potion.PotionHelper;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.common.entity.EntityThornChakram;
import vazkii.botania.common.item.ModItems;
// Basically a bit of an extension of RenderSnowball
public class RenderThornChakram extends Render {
@Override
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
EntityThornChakram c = (EntityThornChakram) p_76986_1_;
boolean fire = c.isFire();
IIcon iicon = ModItems.thornChakram.getIconFromDamage(fire ? 1 : 0);
if(iicon != null) {
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.bindEntityTexture(p_76986_1_);
Tessellator tessellator = Tessellator.instance;
this.func_77026_a(tessellator, iicon, fire ? 240 : -1);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return TextureMap.locationItemsTexture;
}
private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_, int light) {
float f = p_77026_2_.getMinU();
float f1 = p_77026_2_.getMaxU();
float f2 = p_77026_2_.getMinV();
float f3 = p_77026_2_.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
p_77026_1_.startDrawingQuads();
p_77026_1_.setNormal(0.0F, 1.0F, 0.0F);
if(light != -1)
p_77026_1_.setBrightness(light);
p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
p_77026_1_.draw();
}
}
@@ -279,6 +279,7 @@ public final class ModCraftingRecipes {
public static IRecipe recipeStarSword;
public static IRecipe recipeExchangeRod;
public static IRecipe recipeGreaterMagnetRing;
public static IRecipe recipeFireChakram;
// Garden of Glass
public static IRecipe recipeRootToSapling;
@@ -1906,6 +1907,14 @@ public final class ModCraftingRecipes {
addShapelessOreDictRecipe(new ItemStack(ModItems.magnetRingGreater), LibOreDict.TERRA_STEEL, new ItemStack(ModItems.magnetRing));
recipeGreaterMagnetRing = BotaniaAPI.getLatestAddedRecipe();
// Flare Chakram Recipe
addOreDictRecipe(new ItemStack(ModItems.thornChakram, 2, 1),
"BBB", "CPC", "BBB",
'B', new ItemStack(Items.blaze_powder),
'P', LibOreDict.PIXIE_DUST,
'C', new ItemStack(ModItems.thornChakram));
recipeFireChakram = BotaniaAPI.getLatestAddedRecipe();
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Storage Block/Nugget Recipes
@@ -41,7 +41,10 @@ public class EntityThornChakram extends EntityThrowable {
@Override
protected void entityInit() {
dataWatcher.addObject(30, 0);
dataWatcher.addObject(31, (byte) 0);
dataWatcher.setObjectWatched(30);
dataWatcher.setObjectWatched(31);
}
@Override
@@ -51,6 +54,14 @@ public class EntityThornChakram extends EntityThrowable {
double mz = motionZ;
super.onUpdate();
if(isFire()) {
double r = 0.1;
double m = 0.1;
for(int i = 0; i < 3; i++)
worldObj.spawnParticle("flame", posX + r * (Math.random() - 0.5), posY + r * (Math.random() - 0.5), posZ + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));
}
int bounces = getTimesBounced();
if(bounces >= MAX_BOUNCES || ticksExisted > 60) {
EntityLivingBase thrower = getThrower();
@@ -92,10 +103,13 @@ public class EntityThornChakram extends EntityThrowable {
if(noClip)
return;
boolean fire = isFire();
EntityLivingBase thrower = getThrower();
if(pos.entityHit != null && pos.entityHit instanceof EntityLivingBase && pos.entityHit != thrower) {
((EntityLivingBase) pos.entityHit).attackEntityFrom(thrower != null ? thrower instanceof EntityPlayer ? DamageSource.causePlayerDamage((EntityPlayer) thrower) : DamageSource.causeMobDamage(thrower) : DamageSource.generic, 12);
if(worldObj.rand.nextInt(3) == 0)
if(fire)
((EntityLivingBase) pos.entityHit).setFire(5);
else if(worldObj.rand.nextInt(3) == 0)
((EntityLivingBase) pos.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 60, 0));
} else {
int bounces = getTimesBounced();
@@ -118,12 +132,20 @@ public class EntityThornChakram extends EntityThrowable {
return 0F;
}
int getTimesBounced() {
public int getTimesBounced() {
return dataWatcher.getWatchableObjectInt(30);
}
void setTimesBounced(int times) {
public void setTimesBounced(int times) {
dataWatcher.updateObject(30, times);
}
public boolean isFire() {
return dataWatcher.getWatchableObjectByte(31) != 0;
}
public void setFire(boolean fire) {
dataWatcher.updateObject(31, (byte) (fire ? 1 : 0));
}
}
@@ -9,11 +9,18 @@
* File Created @ [Jan 25, 2015, 6:42:47 PM (GMT)]
*/
package vazkii.botania.common.item;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.achievement.ICraftAchievement;
import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.entity.EntityThornChakram;
@@ -21,9 +28,34 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemThornChakram extends ItemMod implements ICraftAchievement {
IIcon iconFire;
public ItemThornChakram() {
setUnlocalizedName(LibItemNames.THORN_CHAKRAM);
setMaxStackSize(6);
setHasSubtypes(true);
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list) {
for(int i = 0; i < 2; i++)
list.add(new ItemStack(item, 1, i));
}
@Override
public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = IconHelper.forItem(par1IconRegister, this, 0);
iconFire = IconHelper.forItem(par1IconRegister, this, 1);
}
@Override
public IIcon getIconFromDamage(int dmg) {
return dmg == 0 ? itemIcon : iconFire;
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName() + stack.getItemDamage();
}
@Override
@@ -32,8 +64,12 @@ public class ItemThornChakram extends ItemMod implements ICraftAchievement {
p_77659_2_.playSoundAtEntity(p_77659_3_, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if(!p_77659_2_.isRemote)
p_77659_2_.spawnEntityInWorld(new EntityThornChakram(p_77659_2_, p_77659_3_));
if(!p_77659_2_.isRemote) {
EntityThornChakram c = new EntityThornChakram(p_77659_2_, p_77659_3_);
c.setFire(p_77659_1_.getItemDamage() != 0);
p_77659_2_.spawnEntityInWorld(c);
}
return p_77659_1_;
}
@@ -188,6 +188,7 @@ public final class LexiconData {
public static LexiconEntry worldSeed;
public static LexiconEntry spellCloth;
public static LexiconEntry thornChakram;
public static LexiconEntry fireChakram;
public static LexiconEntry overgrowthSeed;
public static LexiconEntry livingwoodBow;
public static LexiconEntry crystalBow;
@@ -736,6 +737,9 @@ public final class LexiconData {
thornChakram = new BLexiconEntry(LibLexicon.TOOL_THORN_CHAKRAM, categoryTools);
thornChakram.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeThornChakram));
fireChakram = new ALexiconEntry(LibLexicon.TOOL_FIRE_CHAKRAM, categoryTools);
fireChakram.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeFireChakram));
overgrowthSeed = new BLexiconEntry(LibLexicon.TOOL_OVERGROWTH_SEED, categoryTools);
overgrowthSeed.setLexiconPages(new PageText("0")).setIcon(new ItemStack(ModItems.overgrowthSeed));
@@ -157,6 +157,7 @@ public final class LibLexicon {
public static final String TOOL_WORLD_SEED = "worldSeed";
public static final String TOOL_SPELL_CLOTH = "spellCloth";
public static final String TOOL_THORN_CHAKRAM = "thornChakram";
public static final String TOOL_FIRE_CHAKRAM = "fireChakram";
public static final String TOOL_OVERGROWTH_SEED = "overgrowthSeed";
public static final String TOOL_LIVINGWOOD_BOW = "livingwoodBow";
public static final String TOOL_CRYSTAL_BOW = "crystalBow";