mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -2,10 +2,6 @@ package tconstruct.weaponry.weapons;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import tconstruct.weaponry.client.CrosshairType;
|
||||
import tconstruct.weaponry.entity.JavelinEntity;
|
||||
import tconstruct.library.weaponry.AmmoWeapon;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -13,7 +9,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.weaponry.AmmoWeapon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import tconstruct.weaponry.client.CrosshairType;
|
||||
import tconstruct.weaponry.entity.JavelinEntity;
|
||||
|
||||
public class Javelin extends AmmoWeapon {
|
||||
public Javelin() {
|
||||
@@ -21,26 +21,21 @@ public class Javelin extends AmmoWeapon {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
// javelin is the only throwing/ammo weapon that hurts on leftclicking
|
||||
return AbilityHelper.onLeftClickEntity(stack, player, entity, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWindupProgress(ItemStack itemStack, EntityPlayer player) {
|
||||
if(!itemStack.hasTagCompound())
|
||||
return super.getWindupProgress(itemStack, player);
|
||||
if (!itemStack.hasTagCompound()) return super.getWindupProgress(itemStack, player);
|
||||
|
||||
if(!itemStack.getTagCompound().getCompoundTag("InfiTool").hasKey("Throwing"))
|
||||
return 0.5f;
|
||||
if (!itemStack.getTagCompound().getCompoundTag("InfiTool").hasKey("Throwing")) return 0.5f;
|
||||
|
||||
float timeleft = itemStack.getTagCompound().getCompoundTag("InfiTool").getInteger("Throwing");
|
||||
float threshold = getWindupTime(itemStack)/5;
|
||||
if(timeleft < threshold)
|
||||
return (threshold-timeleft)/threshold;
|
||||
else
|
||||
return 0.5f - 0.25f * ((float)getWindupTime(itemStack)-timeleft)/threshold;
|
||||
float threshold = getWindupTime(itemStack) / 5;
|
||||
if (timeleft < threshold) return (threshold - timeleft) / threshold;
|
||||
else return 0.5f - 0.25f * ((float) getWindupTime(itemStack) - timeleft) / threshold;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,12 +43,10 @@ public class Javelin extends AmmoWeapon {
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
// already throwing
|
||||
if(tags.hasKey("Throwing"))
|
||||
return stack;
|
||||
if (tags.hasKey("Throwing")) return stack;
|
||||
|
||||
// has ammo?
|
||||
if(this.getAmmoCount(stack) <= 0)
|
||||
return stack;
|
||||
if (this.getAmmoCount(stack) <= 0) return stack;
|
||||
|
||||
// start throwing
|
||||
tags.setInteger("Throwing", getWindupTime(stack));
|
||||
@@ -65,21 +58,17 @@ public class Javelin extends AmmoWeapon {
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
|
||||
if(!stack.hasTagCompound())
|
||||
return;
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if(!tags.hasKey("Throwing"))
|
||||
return;
|
||||
if (!tags.hasKey("Throwing")) return;
|
||||
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if(player.inventory.getCurrentItem() != stack)
|
||||
return;
|
||||
if (player.inventory.getCurrentItem() != stack) return;
|
||||
|
||||
int timeLeft = tags.getInteger("Throwing");
|
||||
timeLeft--;
|
||||
if(timeLeft > 0)
|
||||
tags.setInteger("Throwing", timeLeft);
|
||||
if (timeLeft > 0) tags.setInteger("Throwing", timeLeft);
|
||||
else {
|
||||
onPlayerStoppedUsing(stack, world, player, 0);
|
||||
tags.removeTag("Throwing");
|
||||
@@ -118,8 +107,7 @@ public class Javelin extends AmmoWeapon {
|
||||
|
||||
@Override
|
||||
public String getIconSuffix(int partType) {
|
||||
switch (partType)
|
||||
{
|
||||
switch (partType) {
|
||||
case 0:
|
||||
return "_javelin_head";
|
||||
case 1:
|
||||
@@ -188,5 +176,7 @@ public class Javelin extends AmmoWeapon {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public CrosshairType getCrosshairType() { return CrosshairType.WEIRD; }
|
||||
public CrosshairType getCrosshairType() {
|
||||
return CrosshairType.WEIRD;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user