Sentient Bow now properly renders when pulling.
This commit is contained in:
parent
2652dea81d
commit
fc70319fa2
|
@ -1,6 +1,5 @@
|
|||
package WayofTime.bloodmagic.item.soul;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -8,17 +7,20 @@ import net.minecraft.entity.projectile.EntityArrow;
|
|||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemArrow;
|
||||
import net.minecraft.item.ItemBow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
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.registry.ModItems;
|
||||
|
||||
public class ItemSentientBow extends ItemBow
|
||||
{
|
||||
|
@ -28,6 +30,29 @@ public class ItemSentientBow extends ItemBow
|
|||
setUnlocalizedName(Constants.Mod.MODID + ".sentientBow");
|
||||
setRegistryName(Constants.BloodMagicItem.SENTIENT_BOW.getRegName());
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn)
|
||||
{
|
||||
if (entityIn == null)
|
||||
{
|
||||
return 0.0F;
|
||||
} else
|
||||
{
|
||||
ItemStack itemstack = entityIn.getActiveItemStack();
|
||||
return itemstack != null && itemstack.getItem() == ModItems.sentientBow ? (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F : 0.0F;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn)
|
||||
{
|
||||
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,25 +141,6 @@ public class ItemSentientBow extends ItemBow
|
|||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
int i = stack.getMaxItemUseDuration() - player.getItemInUseCount();
|
||||
|
||||
if (i >= 18)
|
||||
{
|
||||
return new ModelResourceLocation("bloodmagic:ItemSentientBow_pulling_2", "inventory");
|
||||
} else if (i > 13)
|
||||
{
|
||||
return new ModelResourceLocation("bloodmagic:ItemSentientBow_pulling_1", "inventory");
|
||||
} else if (i > 0)
|
||||
{
|
||||
return new ModelResourceLocation("bloodmagic:ItemSentientBow_pulling_0", "inventory");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ItemStack getFiredArrow(EntityPlayer player)
|
||||
{
|
||||
if (this.func_185058_h_(player.getHeldItem(EnumHand.OFF_HAND)))
|
||||
|
|
|
@ -1,18 +1,50 @@
|
|||
{
|
||||
"parent": "builtin/generated",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "bloodmagic:items/SentientBow"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 5, 80, -45 ],
|
||||
"translation": [ 0.75, 0, 0.25 ],
|
||||
"scale": [ 1, 1, 1 ]
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ -80, 260, -40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ -80, -280, 40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, -90, 25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 90, -25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"predicate": {
|
||||
"pulling": 1
|
||||
},
|
||||
"model": "bloodmagic:item/ItemSentientBow_pulling_0"
|
||||
},
|
||||
{
|
||||
"predicate": {
|
||||
"pulling": 1,
|
||||
"pull": 0.65
|
||||
},
|
||||
"model": "bloodmagic:item/ItemSentientBow_pulling_1"
|
||||
},
|
||||
{
|
||||
"predicate": {
|
||||
"pulling": 1,
|
||||
"pull": 0.9
|
||||
},
|
||||
"model": "bloodmagic:item/ItemSentientBow_pulling_2"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -4,15 +4,25 @@
|
|||
"layer0": "bloodmagic:items/SentientBow_pulling_0"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 5, 80, -45 ],
|
||||
"translation": [ 0.75, 0, 0.25 ],
|
||||
"scale": [ 1, 1, 1 ]
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ -80, 260, -40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ -80, -280, 40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, -90, 25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 90, -25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,15 +4,25 @@
|
|||
"layer0": "bloodmagic:items/SentientBow_pulling_1"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 5, 80, -45 ],
|
||||
"translation": [ 0.75, 0, 0.25 ],
|
||||
"scale": [ 1, 1, 1 ]
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ -80, 260, -40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ -80, -280, 40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, -90, 25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 90, -25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,25 @@
|
|||
"layer0": "bloodmagic:items/SentientBow_pulling_2"
|
||||
},
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 5, 80, -45 ],
|
||||
"translation": [ 0.75, 0, 0.25 ],
|
||||
"scale": [ 1, 1, 1 ]
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ -80, 260, -40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson": {
|
||||
"rotation": [ 0, -135, 25 ],
|
||||
"translation": [ 0, 4, 2 ],
|
||||
"scale": [ 1.7, 1.7, 1.7 ]
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ -80, -280, 40 ],
|
||||
"translation": [ -1, -2, 2.5 ],
|
||||
"scale": [ 0.9, 0.9, 0.9 ]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, -90, 25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 90, -25 ],
|
||||
"translation": [ 1.13, 3.2, 1.13],
|
||||
"scale": [ 0.68, 0.68, 0.68 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue