mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
83698cb73c
commit
84c2239244
561 files changed
+8872
-9300
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package tconstruct.tools.inventory;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -8,6 +9,7 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import tconstruct.library.event.ToolCraftedEvent;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
@@ -15,6 +17,7 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
|
||||
public class ToolStationContainer extends ActiveContainer {
|
||||
|
||||
public InventoryPlayer invPlayer;
|
||||
public ToolStationLogic logic;
|
||||
public Slot[] slots;
|
||||
@@ -31,9 +34,8 @@ public class ToolStationContainer extends ActiveContainer {
|
||||
|
||||
toolSlot = new SlotTool(inventoryplayer.player, builderlogic, 0, 225, 38);
|
||||
this.addSlotToContainer(toolSlot);
|
||||
slots = new Slot[] {
|
||||
new Slot(builderlogic, 1, 167, 29), new Slot(builderlogic, 2, 149, 38), new Slot(builderlogic, 3, 167, 47)
|
||||
};
|
||||
slots = new Slot[] { new Slot(builderlogic, 1, 167, 29), new Slot(builderlogic, 2, 149, 38),
|
||||
new Slot(builderlogic, 3, 167, 47) };
|
||||
|
||||
for (int iter = 0; iter < 3; iter++) this.addSlotToContainer(slots[iter]);
|
||||
|
||||
@@ -92,13 +94,17 @@ public class ToolStationContainer extends ActiveContainer {
|
||||
if (slotID < logic.getSizeInventory()) {
|
||||
if (slotID == 0) {
|
||||
if (!this.mergeCraftedStack(
|
||||
slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true, player)) {
|
||||
slotStack,
|
||||
logic.getSizeInventory(),
|
||||
this.inventorySlots.size(),
|
||||
true,
|
||||
player)) {
|
||||
return null;
|
||||
}
|
||||
} else
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(
|
||||
slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(slotStack, 1, logic.getSizeInventory(), false)) {
|
||||
return null;
|
||||
}
|
||||
@@ -115,22 +121,21 @@ public class ToolStationContainer extends ActiveContainer {
|
||||
|
||||
protected void craftTool(ItemStack stack) {
|
||||
if (stack.getItem() instanceof IModifyable) {
|
||||
NBTTagCompound tags =
|
||||
stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
|
||||
NBTTagCompound tags = stack.getTagCompound()
|
||||
.getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
|
||||
boolean full = (logic.getStackInSlot(2) != null || logic.getStackInSlot(3) != null);
|
||||
for (int i = 2; i <= 3; i++) logic.decrStackSize(i, 1);
|
||||
ItemStack compare = logic.getStackInSlot(1);
|
||||
int amount = compare.getItem() instanceof IModifyable ? compare.stackSize : 1;
|
||||
logic.decrStackSize(1, amount);
|
||||
EntityPlayer player = invPlayer.player;
|
||||
if (!player.worldObj.isRemote && full)
|
||||
player.worldObj.playSoundEffect(
|
||||
logic.xCoord,
|
||||
logic.yCoord,
|
||||
logic.zCoord,
|
||||
"tinker:little_saw",
|
||||
1.0F,
|
||||
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
if (!player.worldObj.isRemote && full) player.worldObj.playSoundEffect(
|
||||
logic.xCoord,
|
||||
logic.yCoord,
|
||||
logic.zCoord,
|
||||
"tinker:little_saw",
|
||||
1.0F,
|
||||
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
|
||||
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.logic, player, stack));
|
||||
} else
|
||||
// Simply naming items
|
||||
@@ -141,8 +146,7 @@ public class ToolStationContainer extends ActiveContainer {
|
||||
|
||||
if (!ToolStationLogic.canRename(stack2.getTagCompound(), stack2)) {
|
||||
for (int i = 0; i < logic.getSizeInventory(); i++) {
|
||||
if (logic.getStackInSlot(i) != null
|
||||
&& logic.getStackInSlot(i).getItem() == Items.name_tag) {
|
||||
if (logic.getStackInSlot(i) != null && logic.getStackInSlot(i).getItem() == Items.name_tag) {
|
||||
logic.decrStackSize(i, 1);
|
||||
break;
|
||||
}
|
||||
@@ -151,8 +155,8 @@ public class ToolStationContainer extends ActiveContainer {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean mergeCraftedStack(
|
||||
ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory, EntityPlayer player) {
|
||||
protected boolean mergeCraftedStack(ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory,
|
||||
EntityPlayer player) {
|
||||
boolean failedToMerge = false;
|
||||
int slotIndex = slotsStart;
|
||||
|
||||
|
||||
Reference in new issue
Block a user