mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -11,114 +11,97 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ContainerMerchantAdd extends ContainerNpcInterface
|
||||
{
|
||||
/** Instance of Merchant. */
|
||||
public class ContainerMerchantAdd extends ContainerNpcInterface {
|
||||
/**
|
||||
* Instance of Merchant.
|
||||
*/
|
||||
private IMerchant theMerchant;
|
||||
private InventoryBasic merchantInventory;
|
||||
|
||||
/** Instance of World. */
|
||||
/**
|
||||
* Instance of World.
|
||||
*/
|
||||
private final World theWorld;
|
||||
|
||||
public ContainerMerchantAdd(EntityPlayer player, IMerchant par2IMerchant, World par3World)
|
||||
{
|
||||
super(player);
|
||||
public ContainerMerchantAdd(EntityPlayer player, IMerchant par2IMerchant, World par3World) {
|
||||
super(player);
|
||||
this.theMerchant = par2IMerchant;
|
||||
this.theWorld = par3World;
|
||||
this.merchantInventory = new InventoryBasic("", false,3);
|
||||
this.merchantInventory = new InventoryBasic("", false, 3);
|
||||
this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53));
|
||||
this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53));
|
||||
this.addSlotToContainer(new Slot(this.merchantInventory, 2, 120, 53));
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public void addCraftingToCrafters(ICrafting par1ICrafting)
|
||||
{
|
||||
public void addCraftingToCrafters(ICrafting par1ICrafting) {
|
||||
super.addCraftingToCrafters(par1ICrafting);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for changes made in the container, sends them to every listener.
|
||||
*/
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when the crafting matrix is changed.
|
||||
*/
|
||||
public void onCraftMatrixChanged(IInventory par1IInventory)
|
||||
{
|
||||
public void onCraftMatrixChanged(IInventory par1IInventory) {
|
||||
//this.merchantInventory.resetRecipeAndSlots();
|
||||
super.onCraftMatrixChanged(par1IInventory);
|
||||
}
|
||||
|
||||
public void setCurrentRecipeIndex(int par1)
|
||||
{
|
||||
public void setCurrentRecipeIndex(int par1) {
|
||||
//this.merchantInventory.setCurrentRecipeIndex(par1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2) {}
|
||||
public void updateProgressBar(int par1, int par2) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
|
||||
*/
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(par2);
|
||||
Slot slot = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (par2 != 0 && par2 != 1 && par2 != 2)
|
||||
{
|
||||
if (par2 >= 3 && par2 < 30)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false))
|
||||
{
|
||||
if (par2 != 0 && par2 != 1 && par2 != 2) {
|
||||
if (par2 >= 3 && par2 < 30) {
|
||||
if (!this.mergeItemStack(itemstack1, 30, 39, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
|
||||
{
|
||||
} else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 3, 39, false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(itemstack1, 3, 39, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize)
|
||||
{
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -131,25 +114,21 @@ public class ContainerMerchantAdd extends ContainerNpcInterface
|
||||
/**
|
||||
* Called when the container is closed.
|
||||
*/
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
this.theMerchant.setCustomer((EntityPlayer)null);
|
||||
this.theMerchant.setCustomer((EntityPlayer) null);
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
|
||||
if (!this.theWorld.isRemote)
|
||||
{
|
||||
if (!this.theWorld.isRemote) {
|
||||
ItemStack itemstack = this.merchantInventory.getStackInSlotOnClosing(0);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false);
|
||||
}
|
||||
|
||||
itemstack = this.merchantInventory.getStackInSlotOnClosing(1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user