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:
Raven Szewczyk authored and GitHub committed 2022-09-22 20:51:23 +02:00
1 parent 18bfeaff32
commit 39be06c23b
571 files changed
+25959 -28223

No files matched your search

@@ -3,7 +3,6 @@ package tconstruct.library.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.modifier.ItemModifier;
@@ -3,47 +3,40 @@ package tconstruct.library.event;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.item.ItemStack;
/* This event fires after all of the other construction. The resulting nbttag is added to the tool
/* This event fires after all of the other construction. The resulting nbttag is added to the tool
* Note: The tag is the base tag. toolTag.getCompoundTag("InfiTool") will have all of the tool's data.
*/
public class PartBuilderEvent extends Event
{
public class PartBuilderEvent extends Event {
public final ItemStack material;
public final ItemStack pattern;
public final ItemStack otherPattern;
protected ItemStack[] resultStacks;
public PartBuilderEvent(ItemStack material, ItemStack pattern, ItemStack otherPattern)
{
public PartBuilderEvent(ItemStack material, ItemStack pattern, ItemStack otherPattern) {
this.material = material;
this.pattern = pattern;
this.otherPattern = otherPattern;
}
@HasResult
public static class NormalPart extends PartBuilderEvent
{
public NormalPart(ItemStack material, ItemStack pattern, ItemStack otherPattern)
{
public static class NormalPart extends PartBuilderEvent {
public NormalPart(ItemStack material, ItemStack pattern, ItemStack otherPattern) {
super(material, pattern, otherPattern);
}
/**
* Fires before other processing is done
*
*
* Result is significant: DEFAULT: Allows part to be crafted normally
* ALLOW: Uses resultStack instead DENY: Stops part crafting altogether
*/
public void overrideResult (ItemStack[] result)
{
public void overrideResult(ItemStack[] result) {
resultStacks = result;
this.setResult(Result.ALLOW);
}
public ItemStack[] getResultStacks ()
{
public ItemStack[] getResultStacks() {
return resultStacks;
}
}
@@ -9,29 +9,23 @@ import tconstruct.library.crafting.CastingRecipe;
*
* Set result to DENY to prevent casting.
*/
public abstract class SmelteryCastEvent extends Event
{
public abstract class SmelteryCastEvent extends Event {
public final CastingRecipe recipe;
public final FluidStack fluid;
public SmelteryCastEvent(CastingRecipe recipe, FluidStack fluid)
{
public SmelteryCastEvent(CastingRecipe recipe, FluidStack fluid) {
this.recipe = recipe;
this.fluid = fluid;
}
public static class CastingTable extends SmelteryCastEvent
{
public CastingTable(CastingRecipe recipe, FluidStack fluid)
{
public static class CastingTable extends SmelteryCastEvent {
public CastingTable(CastingRecipe recipe, FluidStack fluid) {
super(recipe, fluid);
}
}
public static class CastingBasin extends SmelteryCastEvent
{
public CastingBasin(CastingRecipe recipe, FluidStack fluid)
{
public static class CastingBasin extends SmelteryCastEvent {
public CastingBasin(CastingRecipe recipe, FluidStack fluid) {
super(recipe, fluid);
}
}
@@ -8,31 +8,25 @@ import tconstruct.library.crafting.CastingRecipe;
* Fired when an item is cast in the casting table.
* If consumeCast is set to true, the cast will be destroyed.
*/
public abstract class SmelteryCastedEvent extends Event
{
public abstract class SmelteryCastedEvent extends Event {
public final CastingRecipe recipe;
public ItemStack output;
public boolean consumeCast;
public SmelteryCastedEvent(CastingRecipe recipe, ItemStack output)
{
public SmelteryCastedEvent(CastingRecipe recipe, ItemStack output) {
this.recipe = recipe;
this.consumeCast = recipe.consumeCast;
this.output = output;
}
public static class CastingTable extends SmelteryCastedEvent
{
public CastingTable(CastingRecipe recipe, ItemStack output)
{
public static class CastingTable extends SmelteryCastedEvent {
public CastingTable(CastingRecipe recipe, ItemStack output) {
super(recipe, output);
}
}
public static class CastingBasin extends SmelteryCastedEvent
{
public CastingBasin(CastingRecipe recipe, ItemStack output)
{
public static class CastingBasin extends SmelteryCastedEvent {
public CastingBasin(CastingRecipe recipe, ItemStack output) {
super(recipe, output);
}
}
@@ -6,14 +6,12 @@ import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class SmelteryEvent extends Event
{
public class SmelteryEvent extends Event {
public InventoryLogic component;
public int x, y, z;
public SmelteryEvent(InventoryLogic component, int x, int y, int z)
{
public SmelteryEvent(InventoryLogic component, int x, int y, int z) {
this.component = component;
this.x = x;
this.y = y;
@@ -21,32 +19,31 @@ public class SmelteryEvent extends Event
}
@Cancelable
public static class ItemInsertedIntoCasting extends SmelteryEvent
{
public static class ItemInsertedIntoCasting extends SmelteryEvent {
/** Item that will be inserted into the casting block */
public ItemStack item;
public EntityPlayer player;
public ItemInsertedIntoCasting(InventoryLogic component, int x, int y, int z, ItemStack item, EntityPlayer player)
{
public ItemInsertedIntoCasting(
InventoryLogic component, int x, int y, int z, ItemStack item, EntityPlayer player) {
super(component, x, y, z);
this.item = item;
this.player = player;
}
}
public static class ItemRemovedFromCasting extends SmelteryEvent
{
public static class ItemRemovedFromCasting extends SmelteryEvent {
/** Item that will be returned to the player */
public ItemStack item;
public EntityPlayer player;
public ItemRemovedFromCasting(InventoryLogic component, int x, int y, int z, ItemStack item, EntityPlayer player)
{
public ItemRemovedFromCasting(
InventoryLogic component, int x, int y, int z, ItemStack item, EntityPlayer player) {
super(component, x, y, z);
this.item = item;
this.player = player;
}
}
}
@@ -7,16 +7,15 @@ import net.minecraft.item.ItemStack;
* Called when the ToolBuilder tries to piece together the Parts of a tool.
*
*/
public class ToolBuildEvent extends Event
{
public class ToolBuildEvent extends Event {
public ItemStack headStack;
public ItemStack handleStack;
public ItemStack accessoryStack;
public ItemStack extraStack;
public String name; // to allow shenanigans
public ToolBuildEvent(ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, ItemStack extraStack, String name)
{
public ToolBuildEvent(
ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, ItemStack extraStack, String name) {
this.headStack = headStack;
this.handleStack = handleStack;
this.accessoryStack = accessoryStack;
@@ -5,47 +5,40 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.*;
/* This event fires after all of the other construction. The resulting nbttag is added to the tool
/* This event fires after all of the other construction. The resulting nbttag is added to the tool
* Note: The tag is the base tag. toolTag.getCompoundTag("InfiTool") will have all of the tool's data.
*/
public class ToolCraftEvent extends Event
{
public class ToolCraftEvent extends Event {
public final ToolCore tool;
public final NBTTagCompound toolTag;
public final ToolMaterial[] materials;
protected ItemStack resultStack;
public ToolCraftEvent(ToolCore tool, NBTTagCompound toolTag, ToolMaterial[] materials)
{
public ToolCraftEvent(ToolCore tool, NBTTagCompound toolTag, ToolMaterial[] materials) {
this.tool = tool;
this.toolTag = toolTag;
this.materials = materials;
}
@HasResult
public static class NormalTool extends ToolCraftEvent
{
public NormalTool(ToolCore tool, NBTTagCompound toolTag, ToolMaterial[] materials)
{
public static class NormalTool extends ToolCraftEvent {
public NormalTool(ToolCore tool, NBTTagCompound toolTag, ToolMaterial[] materials) {
super(tool, toolTag, materials);
}
/**
* Fires just before the tool is put together
*
*
* Result is significant: DEFAULT: Allows tool to be crafted normally
* ALLOW: Uses resultStack instead DENY: Stops tool crafting altogether
*/
public void overrideResult (ItemStack result)
{
public void overrideResult(ItemStack result) {
resultStack = result;
this.setResult(Result.ALLOW);
}
public ItemStack getResultStack ()
{
public ItemStack getResultStack() {
return resultStack;
}
}
@@ -5,18 +5,15 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class ToolCraftedEvent extends Event
{
public class ToolCraftedEvent extends Event {
public IInventory inventory;
public EntityPlayer player;
public ItemStack tool;
public ToolCraftedEvent(IInventory inventory, EntityPlayer player, ItemStack tool)
{
public ToolCraftedEvent(IInventory inventory, EntityPlayer player, ItemStack tool) {
this.inventory = inventory;
this.player = player;
this.tool = tool;
}
}