Skip to content

Commit

Permalink
Bump Eclipse Support version
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed Dec 26, 2024
1 parent d09fabc commit b1879df
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 61 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import kotlin.io.path.isDirectory
plugins {
java
`maven-publish`
id("io.papermc.paperweight.userdev") version "1.7.4" apply true
id("com.gradleup.shadow") version "8.3.5" apply true
id("io.github.dueris.eclipse.gradle") version "1.1.0-beta82" apply true
id("io.papermc.paperweight.userdev") version "1.7.7" apply true
id("com.gradleup.shadow") version "9.0.0-beta4" apply true
id("io.github.dueris.eclipse.gradle") version "1.2.2" apply true
}

version = "v1.3.0"
Expand Down Expand Up @@ -94,7 +94,7 @@ allprojects {
}

eclipse {
minecraft = MinecraftVersion.MC1_21_1
minecraft.set(MinecraftVersion.MC1_21_1.version)
wideners = files("origins.accesswidener", "calio.accesswidener", "fabricapi.accesswidener")
}

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion origins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "A full, but unofficial, port of Calio/Apoli/Origins to PaperMC se
dependencies {
implementation("com.github.DavidNiessen:JsonConfigAPI:1.0")
compileOnly("org.mineskin:java-client-jsoup:2.0.0-SNAPSHOT")
compileOnly(files("../depends/eclipse-1.3.2-all.jar"))
compileOnly(files("../depends/eclipse-2.0.0-all.jar"))
compileOnly("org.mineskin:java-client:2.0.0-SNAPSHOT")
project("calio")
}
Expand Down
29 changes: 5 additions & 24 deletions origins/src/main/java/io/github/dueris/originspaper/Bootstrap.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
package io.github.dueris.originspaper;

import io.papermc.paper.plugin.bootstrap.BootstrapContext;
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
import me.dueris.eclipse.ignite.IgniteBootstrap;
import io.github.dueris.eclipse.api.entrypoint.BootstrapInitializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;

@SuppressWarnings("UnstableApiUsage")
public class Bootstrap implements PluginBootstrap {
public class Bootstrap implements BootstrapInitializer {

private static final Logger log = LogManager.getLogger(Bootstrap.class);

private static boolean igniteBooted() {
try {
Class.forName("me.dueris.eclipse.ignite.IgniteBootstrap");
return IgniteBootstrap.BOOTED.get();
} catch (ClassNotFoundException e) {
log.error("Eclipse was not found in classpath! Please install from modrinth : {}", "https://modrinth.com/plugin/eclipse-mixin");
return false;
}
}

@Override
public void bootstrap(@NotNull BootstrapContext bootContext) {
try {
if (!igniteBooted()) return;
OriginsPaper.initialize(bootContext);
} catch (Throwable e) {
throw new RuntimeException("An error occurred when loading OriginsPaper!", e);
}
public void onInitializeBootstrap() {
// Eclipse entrypoint.
OriginsPaper.initialize();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.google.gson.JsonPrimitive;
import io.github.dueris.calio.CraftCalio;
import io.github.dueris.calio.util.IdentifierAlias;
import io.github.dueris.eclipse.api.mod.ModContainer;
import io.github.dueris.eclipse.loader.EclipseLauncher;
import io.github.dueris.originspaper.action.type.BiEntityActionTypes;
import io.github.dueris.originspaper.action.type.BlockActionTypes;
import io.github.dueris.originspaper.action.type.EntityActionTypes;
Expand Down Expand Up @@ -58,7 +60,7 @@ public class OriginsPaper {
public static final Logger LOGGER = LogManager.getLogger("OriginsPaper");
public static MinecraftServer server;
public static Path jarFile;
public static BootstrapContext context;
public static ModContainer modContainer;
public static String version = "v1.3.0";
public static OriginsPaper.ServerConfig config;

Expand All @@ -74,16 +76,17 @@ public static OriginsPlugin getPlugin() {
return OriginsPlugin.plugin;
}

public static void initialize(@NotNull BootstrapContext context) {
jarFile = context.getPluginSource();
OriginsPaper.context = context;
public static void initialize() {
ModContainer container = EclipseLauncher.INSTANCE.modEngine().container("origins").orElseThrow();
jarFile = container.resource().path().toAbsolutePath().normalize(); // Normalize path to complete.
modContainer = container;
PluginInstances.init();

CraftCalio.initialize();

final JsonConfigAPI jsonConfigAPI = new JsonConfigAPI(true);
File serverJson = new File(context.getDataDirectory().toFile(), "origins_server.json");
String parentPath = context.getDataDirectory().toFile().getAbsolutePath() + File.separator;
File serverJson = new File(jarFile.getParent().resolve("Origins").toFile(), "origins_server.json");
String parentPath = jarFile.getParent().resolve("Origins").toFile().getAbsolutePath() + File.separator;

jsonConfigAPI.registerConfig(
new OriginsPaper.ServerConfig(),
Expand Down Expand Up @@ -128,16 +131,18 @@ public static void initialize(@NotNull BootstrapContext context) {
ModItems.register();
EnderianPearlEntity.bootstrap();

CriteriaTriggers.register(GainedPowerCriterion.ID.toString(), GainedPowerCriterion.INSTANCE);
CriteriaTriggers.register(ChoseOriginCriterion.ID.toString(), ChoseOriginCriterion.INSTANCE);
Registry.register(BuiltInRegistries.LOOT_CONDITION_TYPE, identifier("origin"), OriginLootCondition.TYPE);
LOGGER.info("OriginsPaper, version {}, is initialized and ready to power up your game!", version);
}

public static void registerCommands(@NotNull BootstrapContext context) {
context.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS.newHandler(event -> {
event.registrar().register(PluginInstances.APOLI_META, PowerCommand.node(), null, new ArrayList<>());
event.registrar().register(PluginInstances.APOLI_META, ResourceCommand.node(), null, new ArrayList<>());
}));
context.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS.newHandler(event -> event.registrar().register(context.getPluginMeta(), OriginCommand.node(), null, new ArrayList<>())));

CriteriaTriggers.register(GainedPowerCriterion.ID.toString(), GainedPowerCriterion.INSTANCE);
CriteriaTriggers.register(ChoseOriginCriterion.ID.toString(), ChoseOriginCriterion.INSTANCE);
Registry.register(BuiltInRegistries.LOOT_CONDITION_TYPE, identifier("origin"), OriginLootCondition.TYPE);
LOGGER.info("OriginsPaper, version {}, is initialized and ready to power up your game!", version);
}

public static class ServerConfig implements JsonConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public MinecraftClient(ServerPlayer player) {
this.entityRenderer = new EntityRenderer(player);
}

public static void init(BootstrapContext context) {
TexturesImpl.init(context);
public static void init() {
TexturesImpl.init();
HudRenderManager.init();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public List<Tuple<Integer, TextureLocation>> get(Object key) {
}
};

public static void init(BootstrapContext bootContext) {
try (JarFile originsPaper = new JarFile(bootContext.getPluginSource().toFile())) {
public static void init() {
try (JarFile originsPaper = new JarFile(OriginsPaper.jarFile.toFile())) {
for (GuiLocation value : GuiLocation.values()) {
JarEntry entry = originsPaper.getJarEntry("assets/origins/" + value.location);
if (entry == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void run() {
}.runTaskTimerAsynchronously(this, 0L, 1L);

PehukiCommandImpl.onLoad();
MinecraftClient.init(OriginsPaper.context);
MinecraftClient.init();
RecipePowerType.registerAll();
ModItems.registerServer();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.dueris.originspaper.plugin;

import io.github.dueris.originspaper.OriginsPaper;
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
import org.jetbrains.annotations.NotNull;

@SuppressWarnings("UnstableApiUsage")
public class PaperPluginBootstrap implements PluginBootstrap {

@Override
public void bootstrap(@NotNull BootstrapContext bootstrapContext) {
// Register commands via lifecycle event system.
OriginsPaper.registerCommands(bootstrapContext);
}
}
26 changes: 13 additions & 13 deletions origins/src/main/resources/origins.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"mixins": [
"AbilitiesMixin",
"AbstractContainerMenuAccessor",
"AdvancementCommandsAccessor",
"ArmorStandMixin",
"AttributeInstanceMixin",
"AttributeMapMixin",
Expand All @@ -11,6 +12,10 @@
"BlockCollisionsMixin",
"BlockItemMixin",
"BlockStateBaseMixin",
"ClientboundBlockUpdatePacketMixin",
"ClientboundSectionBlocksUpdatePacketMixin",
"ConduitBlockEntityMixin",
"CraftEventFactoryMixin",
"CraftingMenuMixin",
"EnchantmentHelperMixin",
"EntityCallbacksMixin",
Expand All @@ -24,6 +29,7 @@
"ItemMixin",
"ItemStackMixin",
"ItemUsageContextAccessor",
"LivingEntityAccessor",
"LivingEntityMixin",
"LootContextBuilderMixin",
"LootContextMixin",
Expand All @@ -33,38 +39,32 @@
"LootTableMixin",
"MinecraftServerMixin",
"MobEffectMixin",
"MobEntityAccessor",
"MobMixin",
"NearestAttackableTargetGoalAccessor",
"PhantomSpawnerMixin",
"PlayerAdvancementsMixin",
"PlayerChunkSenderMixin",
"PlayerListMixin",
"PlayerMixin",
"PluginCommandNodeMixin",
"ReloadableServerRegistriesHolderMixin",
"ReloadableServerRegistriesMixin",
"ServerCommonPacketListenerImplMixin",
"ServerGamePacketListenerImplMixin",
"ServerLevelMixin",
"ServerPlayerGameModeAccessor",
"ServerPlayerGameModeMixin",
"ServerPlayerMixin",
"SimpleReloadInstanceMixin",
"SingleComponentItemPredicateMixin",
"SlotRangesAccessor",
"TagEntryAccessor",
"TagLoaderMixin",
"ThrownEnderpearlMixin",
"VibrationSystemMixin",
"ConduitBlockEntityMixin",
"MobEntityAccessor",
"TargetGoalAccessor",
"NearestAttackableTargetGoalAccessor",
"TargetingConditionsAccessor",
"LivingEntityAccessor",
"AdvancementCommandsAccessor",
"ServerPlayerGameModeAccessor",
"PlayerChunkSenderMixin",
"CraftEventFactoryMixin",
"ClientboundBlockUpdatePacketMixin",
"ServerCommonPacketListenerImplMixin",
"ClientboundSectionBlocksUpdatePacketMixin"
"ThrownEnderpearlMixin",
"VibrationSystemMixin"
],
"compatibilityLevel": "JAVA_17"
}
7 changes: 5 additions & 2 deletions origins/src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ mixins: [
# mod entrypoints
datapack-entry: true
main: "io.github.dueris.originspaper.plugin.OriginsPlugin"
bootstrapper: "io.github.dueris.originspaper.Bootstrap"
loader: "io.github.dueris.originspaper.DependencyLoader"
bootstrapper: "io.github.dueris.originspaper.plugin.PaperPluginBootstrap" # We use eclipse bootstrap now. Use plugin bootstrap instance instead
loader: "io.github.dueris.originspaper.DependencyLoader"

entrypoints:
bootstrap: "io.github.dueris.originspaper.Bootstrap"
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ for (name in listOf("origins", "calio")) {

pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven("https://repo.papermc.io/repository/maven-public/")
}
Expand Down

0 comments on commit b1879df

Please sign in to comment.