Search in sources :

Example 1 with ItemBlockCollectorCrystal

use of hellfirepvp.astralsorcery.common.item.block.ItemBlockCollectorCrystal in project AstralSorcery by HellFirePvP.

the class BlockCollectorCrystal method onBlockPlacedBy.

@Override
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity entity, ItemStack stack) {
    TileCollectorCrystal tcc = MiscUtils.getTileAt(world, pos, TileCollectorCrystal.class, true);
    Item i = stack.getItem();
    if (tcc != null && i instanceof ItemBlockCollectorCrystal) {
        ItemBlockCollectorCrystal ibcc = (ItemBlockCollectorCrystal) i;
        UUID playerUUID = null;
        if (entity instanceof PlayerEntity) {
            playerUUID = entity.getUniqueID();
        }
        tcc.updateData(playerUUID, ibcc.getCollectorType());
    }
    super.onBlockPlacedBy(world, pos, state, entity, stack);
}
Also used : Item(net.minecraft.item.Item) ConstellationItem(hellfirepvp.astralsorcery.common.constellation.ConstellationItem) TileCollectorCrystal(hellfirepvp.astralsorcery.common.tile.TileCollectorCrystal) UUID(java.util.UUID) ItemBlockCollectorCrystal(hellfirepvp.astralsorcery.common.item.block.ItemBlockCollectorCrystal) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

ConstellationItem (hellfirepvp.astralsorcery.common.constellation.ConstellationItem)1 ItemBlockCollectorCrystal (hellfirepvp.astralsorcery.common.item.block.ItemBlockCollectorCrystal)1 TileCollectorCrystal (hellfirepvp.astralsorcery.common.tile.TileCollectorCrystal)1 UUID (java.util.UUID)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 Item (net.minecraft.item.Item)1