This commit is contained in:
Ellpeck 2015-10-10 02:52:53 +02:00
parent e0e6bc8b4a
commit 4b6b5c1cf2
5 changed files with 34 additions and 35 deletions

View file

@ -107,7 +107,7 @@ public class ContainerInputter extends Container{
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function
return ((SlotFilter)getSlot(par1)).slotClick(player, par2);
return ((SlotFilter)getSlot(par1)).slotClick(player);
}
else{
return super.slotClick(par1, par2, par3, player);

View file

@ -49,17 +49,6 @@ public class ContainerRangedCollector extends Container{
}
}
@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function
return ((SlotFilter)getSlot(par1)).slotClick(player, par2);
}
else{
return super.slotClick(par1, par2, par3, player);
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 18;
@ -109,6 +98,17 @@ public class ContainerRangedCollector extends Container{
return null;
}
@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function
return ((SlotFilter)getSlot(par1)).slotClick(player);
}
else{
return super.slotClick(par1, par2, par3, player);
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.collector.isUseableByPlayer(player);

View file

@ -63,11 +63,6 @@ public class GuiRangedCollector extends GuiContainer{
this.buttonList.add(this.whitelistButton);
}
@Override
public void actionPerformed(GuiButton button){
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
}
@Override
@SuppressWarnings("unchecked")
public void drawScreen(int x, int y, float f){
@ -96,4 +91,9 @@ public class GuiRangedCollector extends GuiContainer{
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 86);
}
@Override
public void actionPerformed(GuiButton button){
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
}
}

View file

@ -26,10 +26,9 @@ public class SlotFilter extends Slot{
* Needs to be called in slotClick() in the Container!
*
* @param player The player
* @param button The button pressed (1 is right mouse button!)
* @return Nothing, as the Item didn't really get "transferred"
*/
public ItemStack slotClick(EntityPlayer player, int button){
public ItemStack slotClick(EntityPlayer player){
ItemStack heldStack = player.inventory.getItemStack();
//Delete the stack in the inventory
@ -49,14 +48,14 @@ public class SlotFilter extends Slot{
}
@Override
public void putStack(ItemStack stack){
ItemStack theStack = (stack != null ? stack.copy() : null);
super.putStack(theStack);
public boolean isItemValid(ItemStack stack){
return false;
}
@Override
public boolean isItemValid(ItemStack stack){
return false;
public void putStack(ItemStack stack){
ItemStack theStack = (stack != null ? stack.copy() : null);
super.putStack(theStack);
}
@Override

View file

@ -230,9 +230,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
return this.getHandler().drain(from, resource, doDrain);
}
return null;
} @Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
}
@Override
@ -241,6 +238,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
return this.getHandler().drain(from, maxDrain, doDrain);
}
return null;
} @Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
}
@Override
@ -294,9 +294,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
}
}
return 0;
} @Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider);
}
@Override
@ -310,6 +307,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
}
}
return 0;
} @Override
public boolean isBoundThingInRange(){
return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider);
}
public IEnergyProvider getProvider(){
@ -330,7 +330,11 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
}
}
return null;
} @Override
}
@Override
public void updateEntity(){
super.updateEntity();
@ -347,7 +351,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
}
private void pushEnergy(ForgeDirection side){
TileEntity tile = WorldUtil.getTileEntityFromSide(side, worldObj, xCoord, yCoord, zCoord);
if(tile != null && tile instanceof IEnergyReceiver && this.getProvider().getEnergyStored(ForgeDirection.UNKNOWN) > 0){
@ -360,9 +363,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
}
@Override
public boolean canConnectEnergy(ForgeDirection from){
if(this.isBoundThingInRange()){