mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Integrate stack size logic directly into SlotPattern
This commit is contained in:
parent
d890443150
commit
8d7664f728
@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotPattern extends Slot {
|
||||
|
||||
@ -24,6 +25,15 @@ public class SlotPattern extends Slot {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
stack = stack.copy();
|
||||
stack.stackSize = 1;
|
||||
}
|
||||
super.putStack(stack);
|
||||
}
|
||||
|
||||
public SlotPattern disableHover() {
|
||||
this.canHover = false;
|
||||
return this;
|
||||
|
||||
@ -74,13 +74,7 @@ public class ContainerAutocrafter extends ContainerBase {
|
||||
|
||||
} else {
|
||||
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
autocrafter.matcher.initPatternSmart(autocrafter.getWorldObj(), slot.getStack(), index);
|
||||
autocrafter.updateTemplateGrid();
|
||||
|
||||
|
||||
@ -66,13 +66,7 @@ public class ContainerCartDestroyer extends Container {
|
||||
if(slot.getHasStack())
|
||||
ret = slot.getStack().copy();
|
||||
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -48,13 +48,7 @@ public class ContainerCounterTorch extends ContainerBase {
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
radio.matcher.initPatternStandard(radio.getWorldObj(), slot.getStack(), index);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -105,13 +105,7 @@ public class ContainerCraneExtractor extends ContainerBase {
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
extractor.matcher.initPatternStandard(extractor.getWorldObj(), slot.getStack(), index);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -100,13 +100,7 @@ public class ContainerCraneGrabber extends ContainerBase {
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
grabber.matcher.initPatternStandard(grabber.getWorldObj(), slot.getStack(), index);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -52,13 +52,7 @@ public class ContainerCraneRouter extends ContainerBase {
|
||||
|
||||
} else {
|
||||
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
router.initPattern(slot.getStack(), index);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -85,13 +85,7 @@ public class ContainerDroneRequester extends ContainerCrateBase {
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
requester.matcher.initPatternStandard(requester.getWorldObj(), slot.getStack(), index);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -94,13 +94,7 @@ public class ContainerMachineCustom extends Container {
|
||||
|
||||
} else {
|
||||
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
custom.matcher.initPatternSmart(player.worldObj, slot.getStack(), index - 10);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -79,13 +79,7 @@ public class ContainerMassStorage extends ContainerBase {
|
||||
if(storage.getStockpile() > 0)
|
||||
return ret;
|
||||
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
|
||||
if(slot.getHasStack()) {
|
||||
slot.getStack().stackSize = 1;
|
||||
}
|
||||
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -39,9 +39,7 @@ public class ContainerPneumoTube extends ContainerBase {
|
||||
tube.nextMode(index);
|
||||
return ret;
|
||||
} else {
|
||||
slot.putStack(held != null ? held.copy() : null);
|
||||
if(slot.getHasStack()) slot.getStack().stackSize = 1;
|
||||
slot.onSlotChanged();
|
||||
slot.putStack(held);
|
||||
tube.initPattern(slot.getStack(), index);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user