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

View file

@ -63,11 +63,6 @@ public class GuiRangedCollector extends GuiContainer{
this.buttonList.add(this.whitelistButton); 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 @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void drawScreen(int x, int y, float f){ public void drawScreen(int x, int y, float f){
@ -96,4 +91,9 @@ public class GuiRangedCollector extends GuiContainer{
this.mc.getTextureManager().bindTexture(resLoc); this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 86); 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! * Needs to be called in slotClick() in the Container!
* *
* @param player The player * @param player The player
* @param button The button pressed (1 is right mouse button!)
* @return Nothing, as the Item didn't really get "transferred" * @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(); ItemStack heldStack = player.inventory.getItemStack();
//Delete the stack in the inventory //Delete the stack in the inventory
@ -49,14 +48,14 @@ public class SlotFilter extends Slot{
} }
@Override @Override
public void putStack(ItemStack stack){ public boolean isItemValid(ItemStack stack){
ItemStack theStack = (stack != null ? stack.copy() : null); return false;
super.putStack(theStack);
} }
@Override @Override
public boolean isItemValid(ItemStack stack){ public void putStack(ItemStack stack){
return false; ItemStack theStack = (stack != null ? stack.copy() : null);
super.putStack(theStack);
} }
@Override @Override

View file

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