mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
humongous spotless apply to make CI happy
This commit is contained in:
1 parent
a0f11f404a
commit
834beb5ac8
114 files changed
+2121
-1858
No files matched your search
@@ -103,12 +103,12 @@ public class ContainerAutoChisel extends Container {
|
||||
ItemStack ret = super.slotClick(slotId, p_75144_2_, p_75144_3_, player);
|
||||
|
||||
if (!player.worldObj.isRemote && slot.slotNumber == TileEntityAutoChisel.BASE
|
||||
&& !ItemStack.areItemStacksEqual(stack, slot.getStack())) {
|
||||
&& !ItemStack.areItemStacksEqual(stack, slot.getStack())) {
|
||||
int chiseled = stack == null ? 0
|
||||
: slot.getStack() == null ? stack.stackSize : stack.stackSize - slot.getStack().stackSize;
|
||||
: slot.getStack() == null ? stack.stackSize : stack.stackSize - slot.getStack().stackSize;
|
||||
PacketHandler.INSTANCE.sendToDimension(
|
||||
new MessageAutoChisel(autoChisel, chiseled, false, false),
|
||||
player.worldObj.provider.dimensionId);
|
||||
new MessageAutoChisel(autoChisel, chiseled, false, false),
|
||||
player.worldObj.provider.dimensionId);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -137,15 +137,14 @@ public class ContainerAutoChisel extends Container {
|
||||
if (par1ItemStack.isStackable()) {
|
||||
|
||||
while (par1ItemStack.stackSize > 0
|
||||
&& (!reversOrder && checkIndex < toIndex || reversOrder && checkIndex >= fromIndex)) {
|
||||
&& (!reversOrder && checkIndex < toIndex || reversOrder && checkIndex >= fromIndex)) {
|
||||
slot = (Slot) this.inventorySlots.get(checkIndex);
|
||||
itemstack1 = slot.getStack();
|
||||
|
||||
if (itemstack1 != null && itemstack1.getItem() == par1ItemStack.getItem()
|
||||
&& (!par1ItemStack.getHasSubtypes()
|
||||
|| par1ItemStack.getItemDamage() == itemstack1.getItemDamage())
|
||||
&& ItemStack.areItemStackTagsEqual(par1ItemStack, itemstack1)
|
||||
&& slot.isItemValid(par1ItemStack)) {
|
||||
&& (!par1ItemStack.getHasSubtypes() || par1ItemStack.getItemDamage() == itemstack1.getItemDamage())
|
||||
&& ItemStack.areItemStackTagsEqual(par1ItemStack, itemstack1)
|
||||
&& slot.isItemValid(par1ItemStack)) {
|
||||
|
||||
int mergedSize = itemstack1.stackSize + par1ItemStack.stackSize;
|
||||
int maxStackSize = Math.min(par1ItemStack.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
|
||||
@@ -7,12 +7,12 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingRegistry;
|
||||
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.item.chisel.ItemChisel;
|
||||
import team.chisel.utils.General;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingRegistry;
|
||||
|
||||
public class ContainerChisel extends Container {
|
||||
|
||||
public final InventoryChiselSelection inventory;
|
||||
@@ -33,13 +33,7 @@ public class ContainerChisel extends Container {
|
||||
// selection slots
|
||||
for (int i = 0; i < InventoryChiselSelection.normalSlots; i++) {
|
||||
addSlotToContainer(
|
||||
new SlotChiselSelection(
|
||||
this,
|
||||
inventory,
|
||||
inventory,
|
||||
i,
|
||||
left + ((i % 10) * 18),
|
||||
top + ((i / 10) * 18)));
|
||||
new SlotChiselSelection(this, inventory, inventory, i, left + ((i % 10) * 18), top + ((i / 10) * 18)));
|
||||
}
|
||||
|
||||
// main slot
|
||||
@@ -103,10 +97,10 @@ public class ContainerChisel extends Container {
|
||||
|
||||
if (slotIdx > InventoryChiselSelection.normalSlots) {
|
||||
if (!this.mergeItemStack(
|
||||
itemstack1,
|
||||
InventoryChiselSelection.normalSlots,
|
||||
InventoryChiselSelection.normalSlots + 1,
|
||||
false)) {
|
||||
itemstack1,
|
||||
InventoryChiselSelection.normalSlots,
|
||||
InventoryChiselSelection.normalSlots + 1,
|
||||
false)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
@@ -116,10 +110,10 @@ public class ContainerChisel extends Container {
|
||||
entity.inventory.setItemStack(null);
|
||||
|
||||
if (!this.mergeItemStack(
|
||||
itemstack1,
|
||||
InventoryChiselSelection.normalSlots + 1,
|
||||
InventoryChiselSelection.normalSlots + 1 + 36,
|
||||
false)) {
|
||||
itemstack1,
|
||||
InventoryChiselSelection.normalSlots + 1,
|
||||
InventoryChiselSelection.normalSlots + 1 + 36,
|
||||
false)) {
|
||||
entity.inventory.setItemStack(itemstack1);
|
||||
return null;
|
||||
}
|
||||
@@ -154,7 +148,7 @@ public class ContainerChisel extends Container {
|
||||
@Override
|
||||
protected boolean mergeItemStack(ItemStack par1ItemStack, int fromIndex, int toIndex, boolean reversOrder) {
|
||||
return ((Slot) this.inventorySlots.get(reversOrder ? toIndex - 1 : fromIndex)).isItemValid(par1ItemStack)
|
||||
&& super.mergeItemStack(par1ItemStack, fromIndex, toIndex, reversOrder);
|
||||
&& super.mergeItemStack(par1ItemStack, fromIndex, toIndex, reversOrder);
|
||||
}
|
||||
|
||||
public void onChiselSlotChanged() {
|
||||
|
||||
@@ -78,7 +78,8 @@ public class ContainerPresent extends Container {
|
||||
public void detectAndSendChanges() {
|
||||
TileEntityPresent te = (TileEntityPresent) lower;
|
||||
if (te != null && te.hasWorldObj() && !te.getWorldObj().isRemote) {
|
||||
if (te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) != te) isContainerValid = false;
|
||||
if (te.getWorldObj()
|
||||
.getTileEntity(te.xCoord, te.yCoord, te.zCoord) != te) isContainerValid = false;
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
|
||||
import team.chisel.item.chisel.ItemChisel;
|
||||
import team.chisel.utils.General;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
|
||||
public class InventoryChiselSelection implements IInventory {
|
||||
|
||||
ItemStack chisel;
|
||||
@@ -135,15 +135,17 @@ public class InventoryChiselSelection implements IInventory {
|
||||
if (Block.getBlockFromItem(item) == null) return;
|
||||
|
||||
if (!((IChiselItem) chisel.getItem())
|
||||
.canChisel(container.playerInventory.player.worldObj, chisel, General.getVariation(chiseledItem)))
|
||||
return;
|
||||
.canChisel(container.playerInventory.player.worldObj, chisel, General.getVariation(chiseledItem))) return;
|
||||
|
||||
List<ItemStack> list = container.carving.getItemsForChiseling(chiseledItem);
|
||||
maxScroll = list.size();
|
||||
int activeVariations = 0;
|
||||
while (activeVariations < normalSlots && activeVariations + currentScroll < list.size()) {
|
||||
if (Block.blockRegistry.getNameForObject(
|
||||
Block.getBlockFromItem(list.get(activeVariations + currentScroll).getItem())) != null) {
|
||||
Block.getBlockFromItem(
|
||||
list.get(activeVariations + currentScroll)
|
||||
.getItem()))
|
||||
!= null) {
|
||||
inventory[activeVariations] = list.get(activeVariations + currentScroll);
|
||||
activeVariations++;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class SlotChiselInput extends Slot {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemstack) {
|
||||
return !container.finished && !container.carving.getItemsForChiseling(itemstack).isEmpty()
|
||||
&& super.isItemValid(itemstack);
|
||||
return !container.finished && !container.carving.getItemsForChiseling(itemstack)
|
||||
.isEmpty() && super.isItemValid(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,20 +6,20 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.Statistics;
|
||||
|
||||
import team.chisel.carving.Carving;
|
||||
import team.chisel.utils.General;
|
||||
import team.chisel.utils.GeneralClient;
|
||||
|
||||
import com.cricketcraft.chisel.api.IChiselItem;
|
||||
import com.cricketcraft.chisel.api.Statistics;
|
||||
|
||||
public class SlotChiselSelection extends Slot {
|
||||
|
||||
private final ContainerChisel container;
|
||||
private final InventoryChiselSelection selInventory;
|
||||
|
||||
public SlotChiselSelection(ContainerChisel container, InventoryChiselSelection inv, IInventory iinventory, int i,
|
||||
int j, int k) {
|
||||
int j, int k) {
|
||||
super(iinventory, i, j, k);
|
||||
|
||||
this.container = container;
|
||||
@@ -53,17 +53,17 @@ public class SlotChiselSelection extends Slot {
|
||||
if (selInventory.inventory[InventoryChiselSelection.normalSlots] == null) return;
|
||||
|
||||
player.inventory.setItemStack(
|
||||
new ItemStack(
|
||||
itemstack.getItem(),
|
||||
selInventory.inventory[InventoryChiselSelection.normalSlots].stackSize,
|
||||
itemstack.getItemDamage()));
|
||||
new ItemStack(
|
||||
itemstack.getItem(),
|
||||
selInventory.inventory[InventoryChiselSelection.normalSlots].stackSize,
|
||||
itemstack.getItemDamage()));
|
||||
selInventory.setInventorySlotContents(InventoryChiselSelection.normalSlots, null);
|
||||
}
|
||||
|
||||
selInventory.updateItems();
|
||||
|
||||
if (((IChiselItem) container.chisel.getItem())
|
||||
.onChisel(player.worldObj, container.chisel, General.getVariation(crafted))) {
|
||||
.onChisel(player.worldObj, container.chisel, General.getVariation(crafted))) {
|
||||
container.chisel.damageItem(1, player);
|
||||
if (container.chisel.stackSize <= 0) {
|
||||
player.inventory.mainInventory[player.inventory.currentItem] = null;
|
||||
@@ -73,11 +73,11 @@ public class SlotChiselSelection extends Slot {
|
||||
if (player.worldObj.isRemote) {
|
||||
String sound = Carving.chisel.getVariationSound(crafted.getItem(), crafted.getItemDamage());
|
||||
GeneralClient.playChiselSound(
|
||||
player.worldObj,
|
||||
MathHelper.floor_double(player.posX),
|
||||
MathHelper.floor_double(player.posY),
|
||||
MathHelper.floor_double(player.posZ),
|
||||
sound);
|
||||
player.worldObj,
|
||||
MathHelper.floor_double(player.posX),
|
||||
MathHelper.floor_double(player.posY),
|
||||
MathHelper.floor_double(player.posZ),
|
||||
sound);
|
||||
} else {
|
||||
container.playerInventory.player.addStat(Statistics.blocksChiseled, crafted.stackSize);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user