Ejemplo n.º 1
0
 @SuppressWarnings("rawtypes")
 @Inject(
     method =
         "getCollidingBoundingBoxes(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/AxisAlignedBB;)Ljava/util/List;",
     at = @At("HEAD"),
     cancellable = true)
 public void onGetCollidingBoundingBoxes(
     net.minecraft.entity.Entity entity, AxisAlignedBB axis, CallbackInfoReturnable<List> cir) {
   if (!entity.worldObj.isRemote && SpongeHooks.checkBoundingBoxSize(entity, axis)) {
     // Removing misbehaved living entities
     cir.setReturnValue(new ArrayList());
   }
 }
Ejemplo n.º 2
0
  public void preInitialize() {
    try {
      Sponge.getLogger().info("Loading Sponge...");

      File gameDir = Sponge.getGameDirectory();
      File pluginsDir = Sponge.getPluginsDirectory();

      if (!gameDir.isDirectory() || !pluginsDir.isDirectory()) {
        if (!pluginsDir.mkdirs()) {
          throw new IOException("Failed to create plugins folder");
        }
      }

      SpongeBootstrap.initializeServices();
      SpongeBootstrap.preInitializeRegistry();

      this.game.getEventManager().register(this, this);
      this.game.getEventManager().register(this, this.game.getRegistry());

      Sponge.getLogger().info("Loading plugins...");
      ((VanillaPluginManager) this.game.getPluginManager()).loadPlugins();
      postState(ConstructionEvent.class);
      Sponge.getLogger().info("Initializing plugins...");
      postState(PreInitializationEvent.class);

      this.game
          .getServiceManager()
          .potentiallyProvide(PermissionService.class)
          .executeWhenPresent(
              new Predicate<PermissionService>() {

                @Override
                public boolean apply(PermissionService input) {
                  input.registerContextCalculator(new SpongeContextCalculator());
                  return true;
                }
              });

      SpongeHooks.enableThreadContentionMonitoring();
    } catch (IOException e) {
      throw Throwables.propagate(e);
    }
  }
Ejemplo n.º 3
0
 // @formatter:on
 @Inject(method = "<init>", at = @At("RETURN"))
 public void onConstructed(
     ISaveHandler saveHandlerIn,
     WorldInfo info,
     WorldProvider providerIn,
     Profiler profilerIn,
     boolean client,
     CallbackInfo ci) {
   if (info == null) {
     SpongeImpl.getLogger()
         .warn(
             "World constructed without a WorldInfo! This will likely cause problems. Subsituting dummy info.",
             new RuntimeException("Stack trace:"));
     this.worldInfo =
         new WorldInfo(
             new WorldSettings(0, WorldSettings.GameType.NOT_SET, false, false, WorldType.DEFAULT),
             "sponge$dummy_world");
   }
   this.worldContext = new Context(Context.WORLD_KEY, this.worldInfo.getWorldName());
   if (SpongeImpl.getGame().getPlatform().getType() == Platform.Type.SERVER) {
     this.worldBorder.addListener(new PlayerBorderListener(providerIn.getDimensionId()));
   }
   this.activeConfig = SpongeHooks.getActiveConfig((net.minecraft.world.World) (Object) this);
 }