mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 18:29:05 +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,8 +11,7 @@ import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
|
||||
public class ContainerCarpentryBench extends Container
|
||||
{
|
||||
public class ContainerCarpentryBench extends Container {
|
||||
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 4, 4);
|
||||
public IInventory craftResult = new InventoryCraftResult();
|
||||
private EntityPlayer player;
|
||||
@@ -21,8 +20,7 @@ public class ContainerCarpentryBench extends Container
|
||||
private int posY;
|
||||
private int posZ;
|
||||
|
||||
public ContainerCarpentryBench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
|
||||
{
|
||||
public ContainerCarpentryBench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) {
|
||||
this.worldObj = par2World;
|
||||
this.posX = par3;
|
||||
this.posY = par4;
|
||||
@@ -32,134 +30,108 @@ public class ContainerCarpentryBench extends Container
|
||||
int var6;
|
||||
int var7;
|
||||
|
||||
for (var6 = 0; var6 < 4; ++var6)
|
||||
{
|
||||
for (var7 = 0; var7 < 4; ++var7)
|
||||
{
|
||||
for (var6 = 0; var6 < 4; ++var6) {
|
||||
for (var7 = 0; var7 < 4; ++var7) {
|
||||
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 4, 17 + var7 * 18, 14 + var6 * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (var6 = 0; var6 < 3; ++var6)
|
||||
{
|
||||
for (var7 = 0; var7 < 9; ++var7)
|
||||
{
|
||||
for (var6 = 0; var6 < 3; ++var6) {
|
||||
for (var7 = 0; var7 < 9; ++var7) {
|
||||
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 98 + var6 * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (var6 = 0; var6 < 9; ++var6)
|
||||
{
|
||||
for (var6 = 0; var6 < 9; ++var6) {
|
||||
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 156));
|
||||
}
|
||||
|
||||
this.onCraftMatrixChanged(this.craftMatrix);
|
||||
}
|
||||
|
||||
public int getMetadata(){
|
||||
return worldObj.getBlockMetadata(posX, posY, posZ);
|
||||
public int getMetadata() {
|
||||
return worldObj.getBlockMetadata(posX, posY, posZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when the crafting matrix is changed.
|
||||
*/
|
||||
@Override
|
||||
public void onCraftMatrixChanged(IInventory par1IInventory)
|
||||
{
|
||||
if(!this.worldObj.isRemote){
|
||||
RecipeCarpentry recipe = RecipeController.Instance.findMatchingRecipe(this.craftMatrix);
|
||||
public void onCraftMatrixChanged(IInventory par1IInventory) {
|
||||
if (!this.worldObj.isRemote) {
|
||||
RecipeCarpentry recipe = RecipeController.Instance.findMatchingRecipe(this.craftMatrix);
|
||||
|
||||
ItemStack item = null;
|
||||
if(recipe != null && recipe.availability.isAvailable(player)){
|
||||
item = recipe.getCraftingResult(this.craftMatrix);
|
||||
}
|
||||
ItemStack item = null;
|
||||
if (recipe != null && recipe.availability.isAvailable(player)) {
|
||||
item = recipe.getCraftingResult(this.craftMatrix);
|
||||
}
|
||||
|
||||
this.craftResult.setInventorySlotContents(0, item);
|
||||
EntityPlayerMP plmp = (EntityPlayerMP) player;
|
||||
plmp.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(this.windowId, 0, item));
|
||||
}
|
||||
this.craftResult.setInventorySlotContents(0, item);
|
||||
EntityPlayerMP plmp = (EntityPlayerMP) player;
|
||||
plmp.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(this.windowId, 0, item));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when the crafting gui is closed.
|
||||
*/
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer) {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
for (int var2 = 0; var2 < 16; ++var2)
|
||||
{
|
||||
if (!this.worldObj.isRemote) {
|
||||
for (int var2 = 0; var2 < 16; ++var2) {
|
||||
ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);
|
||||
|
||||
if (var3 != null)
|
||||
{
|
||||
if (var3 != null) {
|
||||
par1EntityPlayer.dropPlayerItemWithRandomChoice(var3, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return this.worldObj.getBlock(this.posX, this.posY, this.posZ) != CustomItems.carpentyBench ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
|
||||
return this.worldObj.getBlock(this.posX, this.posY, this.posZ) != CustomItems.carpentyBench ? false : par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) {
|
||||
ItemStack var2 = null;
|
||||
Slot var3 = (Slot)this.inventorySlots.get(par1);
|
||||
Slot var3 = (Slot) this.inventorySlots.get(par1);
|
||||
|
||||
if (var3 != null && var3.getHasStack())
|
||||
{
|
||||
if (var3 != null && var3.getHasStack()) {
|
||||
ItemStack var4 = var3.getStack();
|
||||
var2 = var4.copy();
|
||||
|
||||
if (par1 == 0)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 17, 53, true))
|
||||
{
|
||||
if (par1 == 0) {
|
||||
if (!this.mergeItemStack(var4, 17, 53, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var3.onSlotChange(var4, var2);
|
||||
}
|
||||
else if (par1 >= 17 && par1 < 44)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 44, 53, false))
|
||||
{
|
||||
} else if (par1 >= 17 && par1 < 44) {
|
||||
if (!this.mergeItemStack(var4, 44, 53, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (par1 >= 44 && par1 < 53)
|
||||
{
|
||||
if (!this.mergeItemStack(var4, 17, 44, false))
|
||||
{
|
||||
} else if (par1 >= 44 && par1 < 53) {
|
||||
if (!this.mergeItemStack(var4, 17, 44, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(var4, 17, 53, false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(var4, 17, 53, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var4.stackSize == 0)
|
||||
{
|
||||
var3.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (var4.stackSize == 0) {
|
||||
var3.putStack((ItemStack) null);
|
||||
} else {
|
||||
var3.onSlotChanged();
|
||||
}
|
||||
|
||||
if (var4.stackSize == var2.stackSize)
|
||||
{
|
||||
if (var4.stackSize == var2.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user