Compare commits

...

2 Commits

Author SHA1 Message Date
Timo Ley 0349b88293 fix: set current stack to null when changing gui
continuous-integration/drone/push Build is passing Details
fixes #7
2023-05-20 21:29:13 +02:00
Timo Ley 4a4798738e feat: add canHarvest to ICrystal
closes #6
2023-05-20 21:27:16 +02:00
3 changed files with 9 additions and 0 deletions

View File

@ -27,4 +27,6 @@ public interface ICrystal {
*/
void harvestShard(EntityPlayer player);
boolean canHarvest(EntityPlayer player);
}

View File

@ -30,6 +30,7 @@ class SlotWorkbenchWand extends Slot {
!this.workbench.getWorldObj().isRemote &&
this.inventory.getStackInSlot(this.getSlotIndex()) != null &&
this.inventory.getStackInSlot(this.getSlotIndex()).getItem() instanceof ItemWandCasting) {
player.inventory.setItemStack(null);
player.openGui(Thaumcraft.instance, 13, this.workbench.getWorldObj(), this.workbench.xCoord, this.workbench.yCoord, this.workbench.zCoord);
}
}

View File

@ -119,4 +119,10 @@ public abstract class MixinTileCrystal extends TileThaumcraft implements ICrysta
worldObj.spawnEntityInWorld(entity);
}
@Override
public boolean canHarvest(EntityPlayer player) {
int md = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
return md != 6 && md != 9 && count > 1;
}
}