mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 19:59:55 +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
@@ -16,11 +16,9 @@ import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
@Deprecated
|
||||
public class Arrow extends ToolCore
|
||||
{
|
||||
public class Arrow extends ToolCore {
|
||||
|
||||
public Arrow()
|
||||
{
|
||||
public Arrow() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Arrow");
|
||||
this.setMaxStackSize(64);
|
||||
@@ -28,95 +26,87 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_arrow_head";
|
||||
case 1:
|
||||
return ""; // Doesn't break
|
||||
case 2:
|
||||
return "_arrow_shaft";
|
||||
case 3:
|
||||
return "_arrow_fletching";
|
||||
default:
|
||||
return "";
|
||||
public String getIconSuffix(int partType) {
|
||||
switch (partType) {
|
||||
case 0:
|
||||
return "_arrow_head";
|
||||
case 1:
|
||||
return ""; // Doesn't break
|
||||
case 2:
|
||||
return "_arrow_shaft";
|
||||
case 3:
|
||||
return "_arrow_fletching";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultColor(int renderPass, int materialID) {
|
||||
// fletchling uses custom material
|
||||
if(renderPass == 2) {
|
||||
if (renderPass == 2) {
|
||||
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class);
|
||||
if(mat != null)
|
||||
return mat.color;
|
||||
if (mat != null) return mat.color;
|
||||
}
|
||||
|
||||
return super.getDefaultColor(renderPass, materialID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_arrow_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "arrow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerPartPaths(int index, String[] location) {
|
||||
headStrings.put(index, location[0]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerAlternatePartPaths(int index, String[] location) {
|
||||
accessoryStrings.put(index, location[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerWeaponry.arrowhead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerWeaponry.fletching;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "ammo" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"ammo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
public float getDamageModifier() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubItems(Item id, CreativeTabs tab, List list) {
|
||||
// Vanilla style arrow
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(extra, 1, 0) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 3), new ItemStack(getHandleItem(), 1, 0), accessoryStack, extraStack, "");
|
||||
if (tool != null)
|
||||
{
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, 3),
|
||||
new ItemStack(getHandleItem(), 1, 0),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
"");
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -127,10 +117,14 @@ public class Arrow extends ToolCore
|
||||
accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, random.nextInt(4)) : null;
|
||||
extra = getExtraItem();
|
||||
extraStack = extra != null ? new ItemStack(extra, 1, 0) : null;
|
||||
tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, random.nextInt(18)), new ItemStack(getHandleItem(), 1, random.nextInt(18)), accessoryStack, extraStack, StatCollector.translateToLocal("item.tool.randomarrow"));
|
||||
tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, random.nextInt(18)),
|
||||
new ItemStack(getHandleItem(), 1, random.nextInt(18)),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
StatCollector.translateToLocal("item.tool.randomarrow"));
|
||||
|
||||
if (tool != null)
|
||||
{
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -139,15 +133,18 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
public void buildTool(int id, String name, List list) {
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(getExtraItem(), 1, id) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name);
|
||||
if (tool != null)
|
||||
{
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, id),
|
||||
new ItemStack(getHandleItem(), 1, id),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
name);
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -155,76 +152,75 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float clickX,
|
||||
float clickY,
|
||||
float clickZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
if (tags.hasKey("Energy")) {
|
||||
String color = "";
|
||||
// double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("Energy");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
if (power != 0) {
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3) color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3) color = "\u00a72";
|
||||
else color = "\u00a76";
|
||||
}
|
||||
|
||||
String energy = new StringBuilder().append(color).append(tags.getInteger("Energy")).append("/").append(getMaxEnergyStored(stack)).append(" RF").toString();
|
||||
String energy = new StringBuilder()
|
||||
.append(color)
|
||||
.append(tags.getInteger("Energy"))
|
||||
.append("/")
|
||||
.append(getMaxEnergyStored(stack))
|
||||
.append(" RF")
|
||||
.toString();
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool"))
|
||||
{
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
if (broken) list.add("\u00A7oBroken");
|
||||
else {
|
||||
int head = tags.getCompoundTag("InfiTool").getInteger("Head");
|
||||
int handle = tags.getCompoundTag("InfiTool").getInteger("Handle");
|
||||
|
||||
String headName = getAbilityNameForType(head, 0);
|
||||
if (!headName.equals(""))
|
||||
list.add(getStyleForType(head) + headName);
|
||||
if (!headName.equals("")) list.add(getStyleForType(head) + headName);
|
||||
|
||||
String handleName = getAbilityNameForType(handle, 0);
|
||||
if (!handleName.equals("") && handle != head)
|
||||
list.add(getStyleForType(handle) + handleName);
|
||||
if (!handleName.equals("") && handle != head) list.add(getStyleForType(handle) + handleName);
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
while (displayToolTips) {
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip))
|
||||
{
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip)) {
|
||||
String tipName = tags.getCompoundTag("InfiTool").getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
if (!tipName.equals("")) list.add(tipName);
|
||||
} else displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int attack = (int) (tags.getCompoundTag("InfiTool").getInteger("Attack") * this.getDamageModifier());
|
||||
list.add("\u00A79+" + attack + " " + StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " " + StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
list.add("\u00A79+" + attack + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user