Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mod.mcreator;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraft.world.World;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.EnumHand;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.ItemBow;
- import net.minecraft.item.Item;
- import net.minecraft.item.IItemPropertyGetter;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.EntityLivingBase;
- import javax.annotation.Nullable;
- public class mcreator_supremeBow extends supreme_tools.ModElement {
- public static Item block;
- public static final int ENTITYID = 1;
- static {
- block = (new SupremeBow());
- }
- public static class SupremeBow extends ItemBow {
- public SupremeBow() {
- super();
- setMaxDamage(0);
- maxStackSize = 1;
- setFull3D();
- setUnlocalizedName("supremebow");
- setRegistryName("supremebow");
- setCreativeTab(mcreator_supremeTab.tab);
- addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter() {
- @SideOnly(Side.CLIENT)
- public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
- if (entityIn == null)
- return 0.0F;
- else
- return entityIn.getActiveItemStack().getItem() != mcreator_supremeBow.block
- ? 0.0F
- : (float) (stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 20.0F;
- }
- });
- this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter() {
- @SideOnly(Side.CLIENT)
- public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
- return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
- }
- });
- }/* ItemBlazeBow constructor end */
- private ItemStack findAmmo(EntityPlayer player) {
- if (this.isArrow(player.getHeldItem(EnumHand.OFF_HAND))) {
- return player.getHeldItem(EnumHand.OFF_HAND);
- } else if (this.isArrow(player.getHeldItem(EnumHand.MAIN_HAND))) {
- return player.getHeldItem(EnumHand.MAIN_HAND);
- } else {
- for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
- ItemStack itemstack = player.inventory.getStackInSlot(i);
- if (this.isArrow(itemstack))
- return itemstack;
- }
- return ItemStack.EMPTY;
- }
- }/* findAmmo method end */
- public static float getArrowVelocity(int charge) {
- float f = (float) charge / 20.0F;
- f = (f * f + f * 2.0F) / 3.0F;
- if (f > 1.0F) {
- f = 1.0F;
- }
- return f;
- }
- }
- }
- JSON
- {
- "parent": "item/generated",
- "textures": {
- "layer0": "minecraft:/textures/items/supremebow"
- },
- "display": {
- "thirdperson_righthand": {
- "rotation": [ -80, 260, -40 ],
- "translation": [ -1, -2, 2.5 ],
- "scale": [ 0.9, 0.9, 0.9 ]
- },
- "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": "minecraft:/textures/item/supremebowpulling0"
- },
- {
- "predicate": {
- "pulling": 1,
- "pull": 0.65
- },
- "model": "minecraft:/textures/item/supremebowpulling1"
- },
- {
- "predicate": {
- "pulling": 1,
- "pull": 0.9
- },
- "model": "minecraft:/textures/item/supremebowpulling2"
- }
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement