Esempio n. 1
0
 @Override
 public SpongeBlockSnapshot createSpongeBlockSnapshot(
     IBlockState state, IBlockState extended, BlockPos pos, int updateFlag) {
   this.builder.reset();
   Location<World> location = new Location<>((World) this, VecHelper.toVector(pos));
   this.builder
       .blockState((BlockState) state)
       .extendedState((BlockState) extended)
       .worldId(location.getExtent().getUniqueId())
       .position(location.getBlockPosition());
   Optional<UUID> creator = getCreator(pos.getX(), pos.getY(), pos.getZ());
   Optional<UUID> notifier = getNotifier(pos.getX(), pos.getY(), pos.getZ());
   if (creator.isPresent()) {
     this.builder.creator(creator.get());
   }
   if (notifier.isPresent()) {
     this.builder.notifier(notifier.get());
   }
   if (state.getBlock() instanceof ITileEntityProvider) {
     net.minecraft.tileentity.TileEntity te = getTileEntity(pos);
     if (te != null) {
       TileEntity tile = (TileEntity) te;
       for (DataManipulator<?, ?> manipulator : tile.getContainers()) {
         this.builder.add(manipulator);
       }
       NBTTagCompound nbt = new NBTTagCompound();
       te.writeToNBT(nbt);
       this.builder.unsafeNbt(nbt);
     }
   }
   return new SpongeBlockSnapshot(this.builder, updateFlag);
 }
Esempio n. 2
0
 public List<Entity> getEntities() {
   List<Entity> entities = new ArrayList<Entity>();
   for (Location<World> loc : POS2) {
     Location<World> pos2 = loc.getRelative(Direction.UP);
     for (Entity entity : loc.getExtent().getEntities()) {
       if (entity.getLocation().getBlockPosition().equals(pos2.getBlockPosition())) {
         entities.add(entity);
       }
     }
   }
   return entities;
 }
Esempio n. 3
0
 @SuppressWarnings("unchecked")
 private void animation3() {
   for (Location<World> loc : POS2) {
     World world = loc.getExtent();
     Location<World>[] pos = mix(loc, POS1);
     for (Location<World> pos5 : pos) {
       Lightning light =
           (Lightning) world.createEntity(EntityTypes.LIGHTNING, pos5.getBlockPosition()).get();
       light.setEffect(true);
       world.spawnEntity(light, Causes.TELEPORT_LIGHTNING.build());
     }
   }
 }
 @SuppressWarnings("unchecked")
 public void createSpongeData() {
   List<BlockPos> affectedPositions = this.explosion.func_180343_e();
   ImmutableList.Builder<BlockTransaction> builder =
       new ImmutableList.Builder<BlockTransaction>();
   for (BlockPos pos : affectedPositions) {
     Location<World> location = new Location<World>((World) this.world, VecHelper.toVector(pos));
     BlockSnapshot originalSnapshot =
         ((IMixinBlockSnapshot)
                 net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(this.world, pos))
             .createSpongeBlockSnapshot();
     final SpongeBlockSnapshotBuilder replacementBuilder =
         new SpongeBlockSnapshotBuilder()
             .blockState(BlockTypes.AIR.getDefaultState())
             .position(location.getBlockPosition())
             .worldId(location.getExtent().getUniqueId());
     BlockSnapshot replacementSnapshot = replacementBuilder.build();
     builder.add(new BlockTransaction(originalSnapshot, replacementSnapshot)).build();
   }
   this.blockTransactions = builder.build();
 }
Esempio n. 5
0
 @SuppressWarnings("unchecked")
 private void animation2() {
   for (Location<World> loc : POS2) {
     World world = loc.getExtent();
     Location<World> pos1 =
         world.getLocation(loc.getBlockX() - 3, loc.getBlockY(), loc.getBlockZ() + 3);
     Location<World> pos2 =
         world.getLocation(loc.getBlockX() + 3, loc.getBlockY(), loc.getBlockZ() + 3);
     Location<World> pos3 =
         world.getLocation(loc.getBlockX() - 3, loc.getBlockY(), loc.getBlockZ() - 3);
     Location<World> pos4 =
         world.getLocation(loc.getBlockX() + 3, loc.getBlockY(), loc.getBlockZ() + 3);
     Location<World>[] pos = mix(pos1, pos2, pos3, pos4);
     for (Location<World> pos5 : pos) {
       Lightning light =
           (Lightning) world.createEntity(EntityTypes.LIGHTNING, pos5.getBlockPosition()).get();
       light.setEffect(true);
       world.spawnEntity(light, Causes.TELEPORT_LIGHTNING.build());
     }
   }
 }
Esempio n. 6
0
 public BoundingBox2(Location parA, Location parB) {
   this(parA.getBlockPosition(), parB.getBlockPosition());
 }