Added the Soul Snare renderer and recipe and basically everything soul snare

This commit is contained in:
WayofTime 2016-01-08 14:56:36 -05:00
parent c015e3421f
commit 74718f5042
18 changed files with 273 additions and 23 deletions

View file

@ -15,6 +15,7 @@ Version 2.0.0-4
- Added a Lesser Soul Gem in order to hold onto more souls
- SSSSSSSSoooooooouuuuuuulllllllllsssssss
- Added Soul Forge block
- Added soul snare and recipe - has 10% chance for monster to drop its soul
- Fixed binding of togglable sigils

View file

@ -20,7 +20,7 @@ public class BlockSoulForge extends BlockContainer
{
super(Material.iron);
setUnlocalizedName(Constants.Mod.MODID + ".soulforge");
setUnlocalizedName(Constants.Mod.MODID + ".soulForge");
setHardness(2.0F);
setResistance(5.0F);
setStepSound(soundTypeMetal);

View file

@ -0,0 +1,62 @@
package WayofTime.bloodmagic.client.render.entity;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
public class RenderEntitySoulSnare extends Render<EntitySoulSnare>
{
protected final Item field_177084_a;
private final RenderItem field_177083_e;
public RenderEntitySoulSnare(RenderManager renderManagerIn, Item p_i46137_2_, RenderItem p_i46137_3_)
{
super(renderManagerIn);
this.field_177084_a = p_i46137_2_;
this.field_177083_e = p_i46137_3_;
}
/**
* Actually renders the given argument. This is a synthetic bridge method,
* always casting down its argument and then handing it off to a worker
* function which does the actual work. In all probabilty, the class Render
* is generic (Render<T extends Entity>) and this method has signature
* public void func_76986_a(T entity, double d, double d1, double d2, float
* f, float f1). But JAD is pre 1.5 so doe
*/
public void doRender(EntitySoulSnare entity, double x, double y, double z, float entityYaw, float partialTicks)
{
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y, (float) z);
GlStateManager.enableRescaleNormal();
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
this.bindTexture(TextureMap.locationBlocksTexture);
this.field_177083_e.func_181564_a(this.func_177082_d(entity), ItemCameraTransforms.TransformType.GROUND);
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
public ItemStack func_177082_d(EntitySoulSnare entityIn)
{
return new ItemStack(this.field_177084_a, 1, 0);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called
* unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntitySoulSnare entity)
{
return TextureMap.locationBlocksTexture;
}
}

View file

@ -0,0 +1,17 @@
package WayofTime.bloodmagic.client.render.entity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.client.registry.IRenderFactory;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.registry.ModItems;
public class SoulSnareRenderFactory implements IRenderFactory<EntitySoulSnare>
{
@Override
public Render<? super EntitySoulSnare> createRenderFor(RenderManager manager)
{
return new RenderEntitySoulSnare(manager, ModItems.soulSnare, Minecraft.getMinecraft().getRenderItem());
}
}

View file

@ -0,0 +1,55 @@
package WayofTime.bloodmagic.entity.projectile;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.bloodmagic.registry.ModPotions;
public class EntitySoulSnare extends EntityThrowable
{
public EntitySoulSnare(World worldIn)
{
super(worldIn);
}
public EntitySoulSnare(World worldIn, EntityLivingBase throwerIn)
{
super(worldIn, throwerIn);
}
public EntitySoulSnare(World worldIn, double x, double y, double z)
{
super(worldIn, x, y, z);
}
/**
* Called when this EntityThrowable hits a block or entity.
*/
@Override
protected void onImpact(MovingObjectPosition mop)
{
if (mop.entityHit != null)
{
if (mop.entityHit instanceof EntityLivingBase && mop.entityHit.worldObj.rand.nextDouble() < 0.1)
{
((EntityLivingBase) mop.entityHit).addPotionEffect(new PotionEffect(ModPotions.soulSnare.id, 300, 0));
}
mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) 0);
}
for (int j = 0; j < 8; ++j)
{
this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
}

View file

@ -1,5 +1,16 @@
package WayofTime.bloodmagic.item;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
@ -13,19 +24,6 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class ItemBindable extends Item implements IBindable
{
private int lpUsed;

View file

@ -0,0 +1,72 @@
package WayofTime.bloodmagic.item.soul;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class ItemSoulSnare extends Item
{
public static String[] names = { "base" };
public ItemSoulSnare()
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".soulSnare.");
setCreativeTab(BloodMagic.tabBloodMagic);
setHasSubtypes(true);
setMaxStackSize(16);
}
@Override
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
if (!playerIn.capabilities.isCreativeMode)
{
--itemStackIn.stackSize;
}
worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
worldIn.spawnEntityInWorld(new EntitySoulSnare(worldIn, playerIn));
}
return itemStackIn;
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
{
for (int i = 0; i < names.length; i++)
list.add(new ItemStack(id, 1, i));
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(TextHelper.localize("tooltip.BloodMagic.soulSnare.desc1"));
tooltip.add(TextHelper.localize("tooltip.BloodMagic.soulSnare.desc2"));
super.addInformation(stack, player, tooltip, advanced);
}
}

View file

@ -145,8 +145,12 @@ public class ItemSoulSword extends ItemSword implements ISoulWeapon
if (getActivated(stack))
{
ISoul soul = ((ISoul) ModItems.monsterSoul);
ItemStack soulStack = soul.createSoul(0, looting * 0.5 + 1);
soulList.add(soulStack);
for (int i = 0; i <= looting; i++)
{
ItemStack soulStack = soul.createSoul(0, (getDamageOfActivatedSword(stack) - 7) / 2 * attackingEntity.worldObj.rand.nextDouble() + 0.5);
soulList.add(soulStack);
}
}
return soulList;

View file

@ -5,10 +5,13 @@ import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.client.render.RenderAlchemyArray;
import WayofTime.bloodmagic.client.render.RenderAltar;
import WayofTime.bloodmagic.client.render.entity.SoulSnareRenderFactory;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
@ -45,6 +48,12 @@ public class ClientProxy extends CommonProxy
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderAltar());
}
@Override
public void registerRenderers()
{
RenderingRegistry.registerEntityRenderingHandler(EntitySoulSnare.class, new SoulSnareRenderFactory());
}
@Override
public void init()
{

View file

@ -17,7 +17,7 @@ public class CommonProxy
Object obj = new EventHandler();
MinecraftForge.EVENT_BUS.register(obj);
FMLCommonHandler.instance().bus().register(obj);
registerRenderers();
}
public void init()
@ -29,4 +29,9 @@ public class CommonProxy
{
}
public void registerRenderers()
{
}
}

View file

@ -1,8 +1,9 @@
package WayofTime.bloodmagic.registry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
public class ModEntities
{
@ -11,5 +12,6 @@ public class ModEntities
int id = 0;
EntityRegistry.registerModEntity(EntityBloodLight.class, "BloodLight", id++, BloodMagic.instance, 64, 20, true);
EntityRegistry.registerModEntity(EntitySoulSnare.class, "SoulSnare", id++, BloodMagic.instance, 64, 1, true);
}
}

View file

@ -48,6 +48,7 @@ import WayofTime.bloodmagic.item.sigil.ItemSigilWater;
import WayofTime.bloodmagic.item.sigil.ItemSigilWhirlwind;
import WayofTime.bloodmagic.item.soul.ItemMonsterSoul;
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
import WayofTime.bloodmagic.item.soul.ItemSoulSnare;
import WayofTime.bloodmagic.item.soul.ItemSoulSword;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
@ -113,6 +114,7 @@ public class ModItems
public static Item arcaneAshes;
public static Item monsterSoul;
public static Item soulGem;
public static Item soulSnare;
public static Item soulSword;
@ -189,6 +191,7 @@ public class ModItems
arcaneAshes = registerItem(new ItemArcaneAshes());
monsterSoul = registerItem(new ItemMonsterSoul());
soulGem = registerItem(new ItemSoulGem());
soulSnare = registerItem(new ItemSoulSnare());
soulSword = registerItem(new ItemSoulSword());
}
@ -291,6 +294,7 @@ public class ModItems
renderHelper.itemRender(arcaneAshes);
renderHelper.itemRender(monsterSoul, 0);
renderHelper.itemRender(soulGem, 0);
renderHelper.itemRender(soulSnare);
renderHelper.itemRender(soulSword, 0);
renderHelper.itemRender(soulSword, 1);

View file

@ -38,7 +38,7 @@ public class ModPotions
, false, 0, 0, 0);
whirlwind = new PotionBloodMagic("Whirlwind", new ResourceLocation("whirlwind"), false, 0, 0, 0);
planarBinding = new PotionBloodMagic("Planar Binding", new ResourceLocation("planarBinding"), false, 0, 0, 0);
soulSnare = new PotionBloodMagic("Soul Snare", new ResourceLocation("soulSnare"), false, 0, 0, 0);
soulSnare = new PotionBloodMagic("Soul Snare", new ResourceLocation("soulSnare"), false, 0xFFFFFF, 0, 0);
// heavyHeart = new PotionBloodMagic("Heavy Heart", new
// ResourceLocation(resourceLocation +
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);

View file

@ -41,7 +41,7 @@ public class ModRecipes
public static void addCraftingRecipes()
{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.sacrificialDagger), "aaa", " ba", "c a", 'a', "blockGlass", 'b', "ingotGold", 'c', "ingotIron"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.altar), "a a", "aba", "cdc", 'a', "stone", 'b', Blocks.furnace, 'c', "ingotGold", 'd', "gemDiamond"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.altar), "a a", "aba", "cdc", 'a', "stone", 'b', Blocks.furnace, 'c', "ingotGold", 'd', new ItemStack(ModItems.monsterSoul)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.packSelfSacrifice), "aba", "cdc", "aea", 'a', "blockGlass", 'b', Items.bucket, 'c', Items.flint, 'd', Items.leather_chestplate, 'e', ModItems.slate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.packSacrifice), "aba", "cdc", "aea", 'a', "blockGlass", 'b', Items.bucket, 'c', "ingotIron", 'd', Items.leather_chestplate, 'e', ModItems.slate));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ritualDiviner), "dfd", "ase", "dwd", 'f', EnumRuneType.FIRE.getScribeStack(), 'a', EnumRuneType.AIR.getScribeStack(), 'w', EnumRuneType.WATER.getScribeStack(), 'e', EnumRuneType.EARTH.getScribeStack(), 'd', "gemDiamond", 's', "stickWood"));
@ -50,6 +50,7 @@ public class ModRecipes
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.bloodStoneBrick, 1, 1), "stone", new ItemStack(ModItems.bloodShard)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.arcaneAshes), "dyeWhite", Items.gunpowder, Items.gunpowder, "dustRedstone", new ItemStack(Items.flint), new ItemStack(Items.coal, 1, 1), ModItems.slate));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.activationCrystal, 1, 1), new ItemStack(Items.nether_star), OrbRegistry.getOrbStack(ModItems.orbArchmage));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.soulSnare, 4, 0), "sis", "iri", "sis", 's', new ItemStack(Items.string), 'i', "ingotIron", 'r', "dustRedstone"));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.telepositionFocus, 1, 2), new ItemStack(ModItems.telepositionFocus, 1, 1), new ItemStack(ModItems.bloodShard));
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.telepositionFocus, 1, 3), new ItemStack(ModItems.telepositionFocus, 1, 2), new ItemStack(ModItems.bloodShard, 1, 1));

View file

@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
@ -28,8 +28,8 @@ import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
@ -56,6 +56,7 @@ import WayofTime.bloodmagic.livingArmour.StatTrackerPhysicalProtect;
import WayofTime.bloodmagic.livingArmour.StatTrackerSelfSacrifice;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -396,6 +397,16 @@ public class EventHandler
DamageSource source = event.source;
Entity entity = source.getEntity();
if (attackedEntity.isPotionActive(ModPotions.soulSnare))
{
PotionEffect eff = attackedEntity.getActivePotionEffect(ModPotions.soulSnare);
int lvl = eff.getAmplifier();
double amountOfSouls = random.nextDouble() * (lvl + 1) * (lvl + 1) * 5;
ItemStack soulStack = ((ISoul) ModItems.monsterSoul).createSoul(0, amountOfSouls);
event.drops.add(new EntityItem(attackedEntity.worldObj, attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, soulStack));
}
if (entity != null && entity instanceof EntityLivingBase)
{
EntityLivingBase attackingEntity = (EntityLivingBase) entity;

View file

@ -111,6 +111,7 @@ item.BloodMagic.arcaneAshes.name=Arcane Ashes
item.BloodMagic.soul.sword.name=Soul Sword
item.BloodMagic.soulGem.lesser.name=Lesser Soul Gem
item.BloodMagic.soulSnare.base.name=Rudimentary Soul Snare
# Blocks
tile.BloodMagic.fluid.lifeEssence.name=Life Essence
@ -237,9 +238,11 @@ tooltip.BloodMagic.livingArmour.upgrade.meleeDamage=Fierce Strike
tooltip.BloodMagic.livingArmour.upgrade.arrowShot=Trick Shot
tooltip.BloodMagic.livingArmour.upgrade.level=(Level %d)
tooltip.BloodMagic.souls=Soul Quality: %1$,.3f
tooltip.BloodMagic.souls=Soul Quality: %1$,.2f
tooltip.BloodMagic.soul.sword.desc=Uses souls to unleash its full potential.
tooltip.BloodMagic.soulGem.lesser=A gem used to contain many souls
tooltip.BloodMagic.soulSnare.desc1=Throw at a monster and then
tooltip.BloodMagic.soulSnare.desc2=kill them to get a monster soul
# Ritual
ritual.BloodMagic.testRitual=Test Ritual

View file

@ -0,0 +1,6 @@
{
"parent":"bloodmagic:item/ItemModelBase",
"textures": {
"layer0":"bloodmagic:items/SoulSnare"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B