mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +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
@@ -1,7 +1,5 @@
|
||||
package tconstruct.weaponry.entity;
|
||||
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.library.util.PiercingArrowDamage;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -10,7 +8,9 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.util.PiercingArrowDamage;
|
||||
|
||||
public class ArrowEntity extends ProjectileBase {
|
||||
public ArrowEntity(World world) {
|
||||
@@ -33,17 +33,18 @@ public class ArrowEntity extends ProjectileBase {
|
||||
@Override
|
||||
protected double getSlowdown() {
|
||||
// we could use the fletchling material for the slowdown, hm
|
||||
// note: not done because fletchlings also balance amount you get now. Rather use slowdown for different projectile types
|
||||
// note: not done because fletchlings also balance amount you get now. Rather use slowdown for different
|
||||
// projectile types
|
||||
return super.getSlowdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getGravity() {
|
||||
if(returnStack == null || !returnStack.hasTagCompound())
|
||||
return super.getGravity();
|
||||
if (returnStack == null || !returnStack.hasTagCompound()) return super.getGravity();
|
||||
|
||||
float mass = returnStack.getTagCompound().getCompoundTag("InfiTool").getFloat("Mass");
|
||||
mass /= 36f; // why 36? simple because it's roughly 0.05 with flint head and wooden arrow shaft! Yes, that's the only reason.
|
||||
mass /= 36f; // why 36? simple because it's roughly 0.05 with flint head and wooden arrow shaft! Yes, that's the
|
||||
// only reason.
|
||||
return mass;
|
||||
}
|
||||
|
||||
@@ -51,15 +52,13 @@ public class ArrowEntity extends ProjectileBase {
|
||||
public void onHitBlock(MovingObjectPosition movingobjectposition) {
|
||||
super.onHitBlock(movingobjectposition);
|
||||
|
||||
if(defused)
|
||||
return;
|
||||
if (defused) return;
|
||||
|
||||
if(returnStack == null || !returnStack.hasTagCompound())
|
||||
return;
|
||||
if (returnStack == null || !returnStack.hasTagCompound()) return;
|
||||
|
||||
// we might break! oh noez!
|
||||
float chance = returnStack.getTagCompound().getCompoundTag("InfiTool").getFloat("BreakChance");
|
||||
if(chance > TConstruct.random.nextFloat()) {
|
||||
if (chance > TConstruct.random.nextFloat()) {
|
||||
this.setDead();
|
||||
this.playSound("random.break", 1.0F, 1.5F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
}
|
||||
@@ -77,42 +76,40 @@ public class ArrowEntity extends ProjectileBase {
|
||||
|
||||
// returns true if it was successful
|
||||
@Override
|
||||
public boolean dealDamage(float damage, ToolCore ammo, NBTTagCompound tags, Entity entityHit)
|
||||
{
|
||||
public boolean dealDamage(float damage, ToolCore ammo, NBTTagCompound tags, Entity entityHit) {
|
||||
boolean dealtDamage = false;
|
||||
|
||||
//Minecraft.getMinecraft().thePlayer.sendChatMessage("Damage/Weight: " + damage + " - " + tags.getFloat("Mass"));
|
||||
// Minecraft.getMinecraft().thePlayer.sendChatMessage("Damage/Weight: " + damage + " - " +
|
||||
// tags.getFloat("Mass"));
|
||||
|
||||
// we take the weight, and shift the damage done towards armor piercing, the more weight the arrow/bolt has!
|
||||
float shift = (tags.getFloat("Mass") - 0.7f)*armorPenetrationModifier();
|
||||
float shift = (tags.getFloat("Mass") - 0.7f) * armorPenetrationModifier();
|
||||
|
||||
if(shift < 0)
|
||||
shift = 0;
|
||||
if(shift > damage)
|
||||
shift = damage;
|
||||
if (shift < 0) shift = 0;
|
||||
if (shift > damage) shift = damage;
|
||||
|
||||
damage -= shift;
|
||||
|
||||
// deal regular damage
|
||||
if(damage > 0)
|
||||
dealtDamage = super.dealDamage(damage, ammo, tags, entityHit);
|
||||
if (damage > 0) dealtDamage = super.dealDamage(damage, ammo, tags, entityHit);
|
||||
|
||||
// deal armor piercing damage
|
||||
if(shift > 0) {
|
||||
if (shift > 0) {
|
||||
DamageSource damagesource;
|
||||
if (this.shootingEntity == null)
|
||||
damagesource = new PiercingArrowDamage("arrow", this, this);
|
||||
else
|
||||
damagesource = new PiercingArrowDamage("arrow", this, this.shootingEntity);
|
||||
if (this.shootingEntity == null) damagesource = new PiercingArrowDamage("arrow", this, this);
|
||||
else damagesource = new PiercingArrowDamage("arrow", this, this.shootingEntity);
|
||||
|
||||
//Minecraft.getMinecraft().thePlayer.sendChatMessage("Piercing Damage: " + shift);
|
||||
// Minecraft.getMinecraft().thePlayer.sendChatMessage("Piercing Damage: " + shift);
|
||||
|
||||
// piercing damage does not affect wether the entity was hit (return value), since it should go through always
|
||||
// piercing damage does not affect wether the entity was hit (return value), since it should go through
|
||||
// always
|
||||
entityHit.attackEntityFrom(damagesource, shift);
|
||||
}
|
||||
|
||||
return dealtDamage;
|
||||
}
|
||||
|
||||
protected float armorPenetrationModifier() { return 1.0f; }
|
||||
protected float armorPenetrationModifier() {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,7 @@ public class BoltEntity extends ArrowEntity {
|
||||
|
||||
@Override
|
||||
protected void updateInAir() {
|
||||
if(this.ticksInAir > 1)
|
||||
this.setIsCritical(true);
|
||||
if (this.ticksInAir > 1) this.setIsCritical(true);
|
||||
|
||||
super.updateInAir();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package tconstruct.weaponry.entity;
|
||||
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
public class JavelinEntity extends ProjectileBase {
|
||||
public int roll = 0;
|
||||
@@ -25,8 +25,7 @@ public class JavelinEntity extends ProjectileBase {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
// you turn me right round baby
|
||||
if(this.ticksInGround == 0)
|
||||
roll = (roll + 13) % 360;
|
||||
if (this.ticksInGround == 0) roll = (roll + 13) % 360;
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
@@ -39,7 +38,9 @@ public class JavelinEntity extends ProjectileBase {
|
||||
roll = TinkerWeaponry.random.nextInt(360);
|
||||
}
|
||||
|
||||
protected double getGravity() { return 0.07; }
|
||||
protected double getGravity() {
|
||||
return 0.07;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getStuckDepth() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package tconstruct.weaponry.entity;
|
||||
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
public class ShurikenEntity extends ProjectileBase {
|
||||
public int spin = 0;
|
||||
@@ -32,8 +32,7 @@ public class ShurikenEntity extends ProjectileBase {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
// you turn me right round baby
|
||||
if(this.ticksInGround == 0)
|
||||
spin = (spin + 33) % 360;
|
||||
if (this.ticksInGround == 0) spin = (spin + 33) % 360;
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
@@ -43,13 +42,14 @@ public class ShurikenEntity extends ProjectileBase {
|
||||
super.readSpawnData(data);
|
||||
|
||||
// this is only relevant clientside only, so we don't actually have it on the server
|
||||
//rollAngle = (TinkerWeaponry.random.nextInt(3)-1)*45 + TinkerWeaponry.random.nextInt(30)-15;
|
||||
// rollAngle = (TinkerWeaponry.random.nextInt(3)-1)*45 + TinkerWeaponry.random.nextInt(30)-15;
|
||||
spin = TinkerWeaponry.random.nextInt(360);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getGravity() {
|
||||
return (this.ticksExisted/8) * 0.018d; // integer division. so the first 20 ticks it will have no gravity at all.
|
||||
return (this.ticksExisted / 8)
|
||||
* 0.018d; // integer division. so the first 20 ticks it will have no gravity at all.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package tconstruct.weaponry.entity;
|
||||
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.entity.ProjectileBase;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
public class ThrowingKnifeEntity extends ProjectileBase {
|
||||
public ThrowingKnifeEntity(World world) {
|
||||
|
||||
Reference in new issue
Block a user