upadting the longbow to work more like and render more like a vanilla bow
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
- [ ] Placement bug for crucible from tongs
|
||||
|
||||
## Current Feature
|
||||
- [x] WorkBench
|
||||
- [ ] Longbow change NBT management
|
||||
|
||||
- [ ] Untick Bloomery and Forge
|
||||
- [ ] Craft Tweaker Support
|
||||
- [ ] Recipe Handler for Block Breaker
|
||||
@@ -49,6 +48,8 @@ rename s/iron/steel/ iron*
|
||||
```
|
||||
|
||||
### Completed
|
||||
- [x] WorkBench
|
||||
- [x] Longbow change NBT management
|
||||
- [x] Check dict name for cluster
|
||||
- [x] Check block break code for NBTCrucible
|
||||
- [x] Cooldown for sledgehammer not working
|
||||
|
||||
@@ -6,7 +6,7 @@ org.gradle.jvmargs=-Xmx3G
|
||||
mod_group=nmd.primal.forgecraft
|
||||
mod_name=ForgeCraft
|
||||
|
||||
mod_version=1.6.25
|
||||
mod_version=1.6.26
|
||||
forge_version=14.23.4.2765
|
||||
mcp_mappings=snapshot_20171003
|
||||
mc_version=1.12.2
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ModInfo {
|
||||
//public static final String MOD_PREFIX = MOD_ID + ":";
|
||||
public static final String MOD_CHANNEL = MOD_ID;
|
||||
|
||||
public static final String MOD_VERSION = "1.6.25";
|
||||
public static final String MOD_VERSION = "1.6.26";
|
||||
public static final String MC_VERSIONS = "[1.12.0, 1.13.0)";
|
||||
public static final String DEPENDENCIES = "required-after:forge@[14.21.1.2400,);" + "required-after:primal@[0.6.69,);";
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package nmd.primal.forgecraft.items.weapons;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -7,105 +10,69 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemArrow;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.animation.ITimeValue;
|
||||
import net.minecraftforge.common.animation.TimeValues;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.common.model.animation.CapabilityAnimation;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
import nmd.primal.forgecraft.init.ModItems;
|
||||
import nmd.primal.forgecraft.init.ModSounds;
|
||||
import nmd.primal.forgecraft.items.BaseItem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 7/2/17.
|
||||
*/
|
||||
public class Longbow extends BaseItem {
|
||||
|
||||
int mod=10;
|
||||
int time=0;
|
||||
public class Longbow extends ItemBow {
|
||||
|
||||
public Longbow(String name) {
|
||||
super(name);
|
||||
this.setMaxDamage(9000);
|
||||
this.setMaxStackSize(1);
|
||||
this.setNoRepair();
|
||||
this.setRegistryName(name);
|
||||
this.setUnlocalizedName(name);
|
||||
this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("pull"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase playerin) {
|
||||
|
||||
if (time < 1 * mod) {
|
||||
return 0.0F;
|
||||
}
|
||||
if (time >= 1 * mod && time < 2 * mod) {
|
||||
return 0.1F;
|
||||
}
|
||||
if (time >= 2 * mod && time < 3 * mod) {
|
||||
return 0.2F;
|
||||
}
|
||||
if (time >= 3 * mod && time < 4 * mod) {
|
||||
return 0.3F;
|
||||
}
|
||||
if (time >= 4 * mod && time < 5 * mod) {
|
||||
return 0.4F;
|
||||
}
|
||||
if (time >= 5 * mod && time < 6 * mod) {
|
||||
return 0.5F;
|
||||
}
|
||||
if (time >= 6 * mod && time < 7 * mod) {
|
||||
return 0.6F;
|
||||
}
|
||||
if (time >= 7 * mod && time < 8 * mod) {
|
||||
return 0.7F;
|
||||
}
|
||||
if (time >= 8 * mod && time < 72000) {
|
||||
return 0.8F;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (entityIn == null)
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
return entityIn.getActiveItemStack().getItem() != ModItems.longbow? 0.0F : (float)(stack.getMaxItemUseDuration() - entityIn.getItemInUseCount()) / 75.0F;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack item, World world, Entity playerin, int itemSlot, boolean isSelected) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) playerin;
|
||||
if(player.inventory.getCurrentItem().getItem() == ModItems.longbow) {
|
||||
time = item.getMaxItemUseDuration() - player.getItemInUseCount();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ItemStack findAmmo(EntityPlayer player)
|
||||
{
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
|
||||
this.addPropertyOverride(new ResourceLocation("pulling"), new IItemPropertyGetter()
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (this.isArrow(itemstack))
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
return itemstack;
|
||||
return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected boolean isArrow(ItemStack stack)
|
||||
{
|
||||
return stack.getItem() instanceof ItemArrow;
|
||||
public String getName() {
|
||||
return this.getRegistryName().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player stops using an Item (stops holding the right mouse button).
|
||||
*/
|
||||
@@ -140,10 +107,11 @@ public class Longbow extends BaseItem {
|
||||
{
|
||||
ItemArrow itemarrow = (ItemArrow)((ItemArrow)(itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.ARROW));
|
||||
EntityArrow entityarrow = itemarrow.createArrow(worldIn, itemstack, entityplayer);
|
||||
System.out.println(f);
|
||||
entityarrow.setDamage(entityarrow.getDamage()+(entityarrow.getDamage()*f));
|
||||
entityarrow.shoot(entityplayer, entityplayer.rotationPitch, entityplayer.rotationYaw, 0.0F, f * 6.0F, 0.5F);
|
||||
|
||||
if (f >= 1.0F)
|
||||
if (f >= 0.5F)
|
||||
{
|
||||
entityarrow.setIsCritical(true);
|
||||
}
|
||||
@@ -174,49 +142,10 @@ public class Longbow extends BaseItem {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the velocity of the arrow entity from the bow's charge
|
||||
*/
|
||||
|
||||
public static float getArrowVelocity(int charge)
|
||||
{
|
||||
float f = (float)charge / 90;
|
||||
|
||||
if (f > 1.0F)
|
||||
{
|
||||
f = 1.0F;
|
||||
}
|
||||
if(f < 0.1){
|
||||
f =0.1f;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 72000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack)
|
||||
{
|
||||
return EnumAction.BOW;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the equipped item is right clicked.
|
||||
*/
|
||||
@Override
|
||||
/*@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
|
||||
{
|
||||
ItemStack itemstack = playerIn.getHeldItem(handIn);
|
||||
@@ -234,6 +163,42 @@ public class Longbow extends BaseItem {
|
||||
playerIn.setActiveHand(handIn);
|
||||
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
private ItemStack findAmmo(EntityPlayer player)
|
||||
{
|
||||
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (this.isArrow(itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
}
|
||||
/*
|
||||
/**
|
||||
* Gets the velocity of the arrow entity from the bow's charge
|
||||
*/
|
||||
|
||||
public static float getArrowVelocity(int charge)
|
||||
{
|
||||
float f = (float)charge / 60;
|
||||
|
||||
if (f > 1.0F)
|
||||
{
|
||||
f = 1.0F;
|
||||
}
|
||||
if(f < 0.1){
|
||||
f =0.1f;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,4 +206,39 @@ public class Longbow extends BaseItem {
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flagIn)
|
||||
{
|
||||
if(!stack.isEmpty()) {
|
||||
tooltip.add(ChatFormatting.GRAY + "The longbow will increase the damage and the velocity of the arrow it shoots relative to how far its drawn.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,18 +4,18 @@
|
||||
"particle": "primal:blocks/log_stripped_yew_side",
|
||||
"texture": "primal:blocks/log_stripped_yew_side",
|
||||
"texture1": "forgecraft:items/bowstring",
|
||||
"arrow": "blocks/e_texture"
|
||||
"arrow": "forgecraft:items/arrow"
|
||||
},
|
||||
"overrides": [
|
||||
{"predicate": {"type": 0.0},"model": "forgecraft:item/longbow/longbow_0"},
|
||||
{"predicate": {"type": 0.1},"model": "forgecraft:item/longbow/longbow_1"},
|
||||
{"predicate": {"type": 0.2},"model": "forgecraft:item/longbow/longbow_2"},
|
||||
{"predicate": {"type": 0.3},"model": "forgecraft:item/longbow/longbow_3"},
|
||||
{"predicate": {"type": 0.4},"model": "forgecraft:item/longbow/longbow_4"},
|
||||
{"predicate": {"type": 0.5},"model": "forgecraft:item/longbow/longbow_5"},
|
||||
{"predicate": {"type": 0.6},"model": "forgecraft:item/longbow/longbow_6"},
|
||||
{"predicate": {"type": 0.7},"model": "forgecraft:item/longbow/longbow_7"},
|
||||
{"predicate": {"type": 0.8},"model": "forgecraft:item/longbow/longbow_8"}
|
||||
{"predicate": {"pulling": 1}, "model": "forgecraft:item/longbow/longbow_0"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.1}, "model": "forgecraft:item/longbow/longbow_1"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.2},"model": "forgecraft:item/longbow/longbow_2"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.3},"model": "forgecraft:item/longbow/longbow_3"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.4},"model": "forgecraft:item/longbow/longbow_4"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.5},"model": "forgecraft:item/longbow/longbow_5"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.6},"model": "forgecraft:item/longbow/longbow_6"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.7},"model": "forgecraft:item/longbow/longbow_7"},
|
||||
{"predicate": {"pulling": 1, "pull": 0.8},"model": "forgecraft:item/longbow/longbow_8"}
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"modid": "forgecraft",
|
||||
"name": "Kitsu's Forgecraft",
|
||||
"description": "Forged with sweat and blood",
|
||||
"version": "1.6.25",
|
||||
"version": "1.6.26",
|
||||
"mcversion": "1.12.2",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
|
||||
Reference in New Issue
Block a user