use of net.silentchaos512.gems.item.ItemBlockPlacer in project SilentGems by SilentChaos512.
the class GemsCommonEvents method onItemPickup.
@SubscribeEvent
public void onItemPickup(EntityItemPickupEvent event) {
ItemStack entityStack = event.getItem().getEntityItem();
if (entityStack.getItem() instanceof ItemBlock) {
for (ItemStack stack : PlayerHelper.getNonEmptyStacks(event.getEntityPlayer())) {
if (stack.getItem() instanceof ItemBlockPlacer) {
ItemBlockPlacer itemPlacer = (ItemBlockPlacer) stack.getItem();
IBlockState state = ((ItemBlock) entityStack.getItem()).block.getStateFromMeta(entityStack.getItemDamage());
if (state.equals(itemPlacer.getBlockPlaced(stack))) {
// event.getItem().setDead();
break;
}
}
}
}
}
use of net.silentchaos512.gems.item.ItemBlockPlacer in project SilentGems by SilentChaos512.
the class RecipeHoldingGemSetBlock method matches.
@Override
public boolean matches(InventoryCrafting inv, World world) {
int countGem = 0;
int countBlock = 0;
for (ItemStack stack : getNonEmptyStacks(inv)) {
// Empty holding gem
Item item = stack.getItem();
if (item instanceof ItemHoldingGem && ((ItemBlockPlacer) item).getRemainingBlocks(stack) == 0)
++countGem;
else // Block item
if (item instanceof ItemBlock)
++countBlock;
else
return false;
}
return countGem == 1 && countBlock == 1;
}
Aggregations