spear_finished

This commit is contained in:
KitsuShadow
2015-08-11 16:25:34 -04:00
parent 4783806ed0
commit aaebf5feb5
12 changed files with 134 additions and 138 deletions

View File

@@ -55,7 +55,7 @@ public class Main {
public static final String MODID = "kitsumedievalcraft";
public static final String MODNAME = "ForgeCraft";
public static final String VERSION = "2.2.5";
public static final String VERSION = "2.2.6";
public static SimpleNetworkWrapper sNet;

View File

@@ -260,6 +260,7 @@ public final class ModCrafting {
gladius0.stackTagCompound = new NBTTagCompound();
gladius0.stackTagCompound.setInteger("GLADIUSTEXTURE", 0);
GameRegistry.addRecipe(new ShapedOreRecipe(gladius0, new Object[]{"x", "y", Character.valueOf('y'), "strapLeather", 'x', ModItems.ironshortswordBlade}));
GameRegistry.addRecipe(new ShapedOreRecipe((ModItems.itemITSpear), new Object[]{"a", "c", "b", 'a', ModItems.ironspearTip, 'b', ModItems.woodentoolHandle, Character.valueOf('c'), "strapLeather"}));
//-----------------------PICKAXE COMBOS-----------------------//
//BASE PICK

View File

@@ -21,105 +21,107 @@ import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class ItemITSpear extends ItemSword {
private String name = "itemITSpear";
public ItemITSpear(String name, ToolMaterial mat) {
super(mat);
setUnlocalizedName(name);
setMaxStackSize(1);
setCreativeTab(CustomTab.MedievalCraftTab);
setTextureName(Main.MODID + ":" + name);
setMaxDamage(100);
GameRegistry.registerItem(this, name);
}
@Override
public EnumAction getItemUseAction(ItemStack stack) {
return EnumAction.bow;
}
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 72000;
}
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
{
ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return event.result;
}
if (p_77659_3_.capabilities.isCreativeMode || p_77659_3_.inventory.hasItem(ModItems.itemITSpear))
{
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
}
return p_77659_1_;
}
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_)
{
int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_;
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return;
}
j = event.charge;
boolean flag = p_77615_3_.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
if (flag || p_77615_3_.inventory.hasItem(ModItems.itemITSpear))
{
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if ((double)f < 0.1D)
{
return;
}
if (f > 1.0F)
{
f = 1.0F;
}
EntityITSpear entityspear = new EntityITSpear(p_77615_2_, p_77615_3_, f * 2.0F);
if (f == 1.0F)
{
entityspear.setIsCritical(true);
}
int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, p_77615_1_);
if (k > 0)
{
entityspear.setDamage(entityspear.getDamage() + (double)k * 0.5D + 0.5D);
}
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, p_77615_1_);
if (l > 0)
{
entityspear.setKnockbackStrength(l);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, p_77615_1_) > 0)
{
entityspear.setFire(100);
}
p_77615_1_.damageItem(1, p_77615_3_);
p_77615_2_.playSoundAtEntity(p_77615_3_, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag)
{
entityspear.canBePickedUp = 2;
}
else
{
p_77615_3_.inventory.consumeInventoryItem(ModItems.itemITSpear);
}
if (!p_77615_2_.isRemote)
{
p_77615_2_.spawnEntityInWorld(entityspear);
}
}
}
public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_)
{
return p_77654_1_;
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
ArrowNockEvent event = new ArrowNockEvent(player, stack);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return event.result;
}
if (player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.itemITSpear))
{
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
}
if(!world.isRemote){
this.setMaxDamage(500);
}
return stack;
}
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_)
{
if (!p_77615_2_.isRemote)
{
int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_;
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled())
{
return;
}
j = event.charge;
//boolean flag = p_77615_3_.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
if (p_77615_3_.inventory.hasItem(ModItems.itemITSpear))
{
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if ((double)f < 0.1D)
{
return;
}
if (f > 1.0F)
{
f = 1.0F;
}
EntityITSpear entityspear = new EntityITSpear(p_77615_2_, p_77615_3_, f * 2.0F);
if (f == 1.0F)
{
entityspear.setIsCritical(true);
}
/*int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, p_77615_1_);
if (k > 0)
{
entityspear.setDamage(entityspear.getDamage() + (double)k * 0.5D + 0.5D);
}
int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, p_77615_1_);
if (l > 0)
{
entityspear.setKnockbackStrength(l);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, p_77615_1_) > 0)
{
entityspear.setFire(100);
}*/
//p_77615_1_.damageItem(1, p_77615_3_);
p_77615_2_.playSoundAtEntity(p_77615_3_, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
p_77615_3_.inventory.consumeInventoryItem(ModItems.itemITSpear);
this.setMaxDamage(100);
p_77615_2_.spawnEntityInWorld(entityspear);
}
}
}
public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_)
{
return p_77654_1_;
}
}

View File

@@ -102,7 +102,7 @@ public class RendererRegistry {
MinecraftForgeClient.registerItemRenderer(ModItems.heavyMace, new ItemRenderHeavymace());
MinecraftForgeClient.registerItemRenderer(ModItems.battleAxe, new IRBattleAxe());
MinecraftForgeClient.registerItemRenderer(ModItems.gladius, new IRGladius());
MinecraftForgeClient.registerItemRenderer(ModItems.workBlade, new IRCraftingBlade());
//MinecraftForgeClient.registerItemRenderer(ModItems.workBlade, new IRCraftingBlade());
MinecraftForgeClient.registerItemRenderer(ModItems.slottedTongs, new IRSlottedTongs());

View File

@@ -13,15 +13,15 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class IRITSpear implements IItemRenderer{
public static final ResourceLocation MODEL = new ResourceLocation("kitsumedievalcraft:models/Spear.obj");
public static final ResourceLocation TEXTURE = new ResourceLocation("kitsumedievalcraft:models/Spear.png");
public IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED: {
return true;
@@ -35,15 +35,15 @@ public class IRITSpear implements IItemRenderer{
case ENTITY: {
return true;
}
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
switch(type) {
case EQUIPPED: {
return false;
@@ -55,86 +55,77 @@ public class IRITSpear implements IItemRenderer{
return false;
}
case ENTITY: {
return false;
return false;
}
default: return false;
}
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch(type) {
case EQUIPPED: {
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glTranslatef(0.5F, 0.4F, -0.0F);
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
GL11.glRotatef(140F, 0.0F, 0.0F, 1.0F);
//GL11.glRotatef(-20F, 0.0F, 1.0F, 0.0F);
//GL11.glRotatef(40F, 1.0F, 0.0F, 0.0F);
//GL11.glRotated(90, 1.0, 0.0, 0.0);
if(item.getMaxDamage()==500){
GL11.glTranslatef(0.5F, 0.6F, -0.125F);
GL11.glRotatef(40F, 0.0F, 0.0F, 1.0F);
}
if(item.getMaxDamage()==100){
GL11.glTranslatef(0.5F, 0.4F, -0.0F);
GL11.glRotatef(140F, 0.0F, 0.0F, 1.0F);
}
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
case EQUIPPED_FIRST_PERSON: {
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.0F);
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
GL11.glTranslatef(0.0F, 2.0F, 0.0F);
//GL11.glRotatef(45F, 1.0F, 0.0F, 0.0F);
//GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
//GL11.glRotatef(45F, 0.0F, -1.0F, 0.0F);
//GL11.glRotated(-85, 1.0, 0.0, 0.0);
//GL11.glRotated(50, 0.0F, 0.0F, 1.0F);
//GL11.glRotated(3, 0.0F, 1.0F, 0.0F);
if(item.getMaxDamage()==500){
GL11.glRotatef(40F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, 0.8F, -0.2F);
}
if(item.getMaxDamage()==100){
GL11.glRotatef(110F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.5F, -0.2F);
}
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
case INVENTORY: {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
float iscale = 9F;
float iscale = 5F;
GL11.glScalef(iscale, iscale, iscale);
//GL11.glRotatef(-45, 0.0F, 0.0F, 1.0F);
//GL11.glRotatef(45, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(1.5F, 1.5F, 0.0F);
GL11.glRotatef(-45, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
//GL11.glTranslatef(0.2F, 1.2F, 0.0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
model.renderAll();
GL11.glPopMatrix();
} break;
case ENTITY: {
GL11.glPushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
GL11.glScalef(5.0F, 5.0F, 5.0F);
GL11.glScalef(2.0F, 2.0F, 2.0F);
//GL11.glTranslatef(5.0F, 5.0F, 5.0F);
//ANGLE, X ROTATE, Y ROTATE, Z ROTATE
//GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
//GL11.glRotatef(90F, 1.0F, 0.0F, 1.0F);

View File

@@ -281,6 +281,7 @@ item.fireBow.name=Fire Bow
item.longbow.name=Longbow
item.gladius.name=Gladius
item.battleAxe.name=Battle Axe
item.itemITSpear.name=Iron Tipped Spear
item.itemIronTippedModelArrow.name=Iron Tipped Longbow Arrow
item.itemModelArrow.name=Longbow Arrow
item.workBlade.name=Crafting Blade

View File

@@ -3,7 +3,7 @@
"modid": "kitsumedievalcraft",
"name": "ForgeCraft",
"description": "ForgeCraft",
"version": "{2.2.5}",
"version": "{2.2.6}",
"mcversion": "{1.7.10}",
"url": "http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/2296334-wip-kitsus-forgecraft-blacksmith-style-forging",
"updateUrl": "https://bitbucket.org/kitsushadow/kitsus-forgecraft/downloads",