Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Item wantedItem = Items.bone;
- Set<Item> set = new TreeSet<Item>();
- set.add(wantedItem);
- if (bookSpawnDelay > 0) bookSpawnDelay--;
- else
- {
- @SuppressWarnings("unchecked")
- List<Entity> entities = world.loadedEntityList;
- for (int i = 0; i < entities.size(); i++)
- {
- EntityItem item = (EntityItem)entities.get(i);
- if(item.getEntityItem().getItem() == Items.book) {
- int xBound = item.getPosition().getX() + 3;
- int yBound = item.getPosition().getY() + 3;
- int zBound = item.getPosition().getZ() + 3;
- List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(item, new AxisAlignedBB(item.getPosition(), new BlockPos(xBound, yBound, zBound)));
- for(int j = 0; j < list.size(); j++) {
- Entity entity = list.get(j);
- if(entity instanceof EntityItem) {
- EntityItem entityItem = (EntityItem)entity;
- if(entityItem.getEntityItem().getItem() == wantedItem) {
- set.remove(wantedItem);
- if(set.isEmpty()) {
- bookSpawnDelay += 20;
- int x = item.getPosition().getX();
- int y = item.getPosition().getY();
- int z = item.getPosition().getZ();
- WorldServer worldServer = (WorldServer) world;
- worldServer.spawnParticle(EnumParticleTypes.SMOKE_LARGE,
- false, x + 0.5D, y + 1.0D, z + 0.5D, 1, 0.0D,
- 0.0D, 0.0D, 0.0D, new int[0]);
- world.spawnEntityInWorld(new EntityItem(world, x, y, z,
- new ItemStack(ARKCraftItems.info_book)));
- entityItem.getEntityItem().stackSize--;
- item.getEntityItem().stackSize--;
- if(entityItem.getEntityItem().stackSize <= 0) entityItem.setDead();
- if(item.getEntityItem().stackSize <= 0) item.setDead();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement