Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void update()
- {
- if(isCasting)
- {
- if(!isValidStructure()) stopCasting(true);
- //TODO Filling chunk
- if(isFillingChunk)
- {
- Chunk chunk = world.getChunk(pos);
- for(int i = 0; i < 20; i++)
- {
- double posX = getPos().getX() + 0.5D;
- double posY = getPos().getY() + 1D;
- double posZ = getPos().getZ() + 0.5D;
- double motionX = ((world.rand.nextInt(8) - 4)) * 0.01D;
- double motionY = (world.rand.nextInt(3) + 3) * 0.1D;
- double motionZ = ((world.rand.nextInt(8) - 4)) * 0.01D;
- if(world.isRemote)
- {
- VoidEssenceParticle essence = new VoidEssenceParticle(world, posX, posY, posZ, motionX, motionY, motionZ);
- spawnParticle.addEffect(essence);
- }
- }
- if(chunk.hasCapability(EssenceProvider.essenceCapability, null))
- {
- IEssence cap = chunk.getCapability(EssenceProvider.essenceCapability, null);
- if(cap.getEssence() < 1500 && voidEssence > 0)
- {
- voidEssence--;
- cap.setEssence(cap.getEssence() + 1);
- }
- else
- {
- isCasting = false;
- isFillingChunk = false;
- }
- }
- }
- //TODO Crafting item/spell
- if(isCraftingItem || isCraftingSpell)
- {
- if(ticks <= voidEssence && ticks > 0)
- {
- ticks--;
- voidEssence--;
- Iterable<MutableBlockPos> blocksWithin = BlockPos.getAllInBoxMutable(pos.getX() - 3, pos.getY(), pos.getZ() - 3, pos.getX() + 3, pos.getY(), pos.getZ() + 3);
- for(MutableBlockPos allBlockPos : blocksWithin)
- {
- if(world.getTileEntity(allBlockPos) instanceof TileWhitewoodPedestal)
- {
- TileWhitewoodPedestal pedestal = (TileWhitewoodPedestal) world.getTileEntity(allBlockPos);
- double posX = (pedestal.getPos().getX() + 0.5D);
- double posY = pedestal.getPos().getY() + 1D;
- double posZ = (pedestal.getPos().getZ() + 0.5D);
- double motionX = ((pos.getX() + 0.5D) - posX) * 0.06D;
- double motionY = ((pos.getY() + 4D) - posY) * 0.06D;
- double motionZ = ((pos.getZ() + 0.5D) - posZ) * 0.06D;
- if(world.isRemote)
- {
- VoidEssenceParticle essence = new VoidEssenceParticle(world, posX, posY, posZ, motionX, motionY, motionZ);
- spawnParticle.addEffect(essence);
- }
- }
- }
- }
- else if(ticks == 0)
- {
- stopCasting(false);
- }
- }
- //TODO Filling altar
- if(isInputEssence)
- {
- if(ticks < 200)
- {
- ticks++;
- Iterable<MutableBlockPos> blocksWithin = BlockPos.getAllInBoxMutable(pos.getX() - 3, pos.getY(), pos.getZ() - 3, pos.getX() + 3, pos.getY(), pos.getZ() + 3);
- for(MutableBlockPos allBlockPos : blocksWithin)
- {
- if(world.getTileEntity(allBlockPos) instanceof TileWhitewoodPedestal)
- {
- TileWhitewoodPedestal pedestal = (TileWhitewoodPedestal) world.getTileEntity(allBlockPos);
- if(!pedestal.handler.getStackInSlot(0).isEmpty())
- {
- double posX = (pedestal.getPos().getX() + 0.5D);
- double posY = pedestal.getPos().getY() + 1D;
- double posZ = (pedestal.getPos().getZ() + 0.5D);
- double motionX = ((pos.getX() + 0.5D) - posX) * 0.06D;
- double motionZ = ((pos.getZ() + 0.5D) - posZ) * 0.06D;
- if(world.isRemote)
- {
- VoidEssenceParticle essence = new VoidEssenceParticle(world, posX, posY, posZ, motionX, 0D, motionZ);
- spawnParticle.addEffect(essence);
- }
- }
- }
- }
- }
- else if(ticks >= 200)
- {
- ticks = 0;
- stopCasting(false);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement