Skip to content

Commit

Permalink
Merge pull request #54 from PssbleTrngle/fix/50
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle authored Aug 19, 2022
2 parents c918b1d + 612dfa5 commit 506bdb4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Update mod version
uses: christian-draeger/[email protected]
with:
path: 'gradle.properties'
property: 'mod_version'
value: ${{ github.sha }}

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MinecraftServerMixin {
@Inject(at = @At("RETURN"), method = "reloadResources(Ljava/util/Collection;)Ljava/util/concurrent/CompletableFuture;", cancellable = true)
public void onReload(Collection<String> packs, CallbackInfoReturnable<CompletableFuture<Void>> callback) {
var self = (MinecraftServer) (Object) this;
callback.getReturnValue().thenAccept($ -> XMLResource.Companion.reload(self));
callback.setReturnValue(callback.getReturnValue().thenAccept($ -> XMLResource.Companion.reload(self)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.List;

@Mixin(WorldPreset.class)
public interface WorldPresetMixin {
public interface WorldPresetAccessor {

@Accessor("PRESETS")
static List<WorldPreset> presets() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ package possible_triangle.skygrid
import kotlinx.serialization.ExperimentalSerializationApi
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.api.ModInitializer
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents
import net.fabricmc.fabric.api.resource.ResourceManagerHelper
import net.minecraft.server.packs.PackType
import nl.adaptivity.xmlutil.ExperimentalXmlUtilApi
import possible_triangle.skygrid.command.SkygridCommand
import possible_triangle.skygrid.data.XMLResource
import possible_triangle.skygrid.mixin.WorldPresetMixin
import possible_triangle.skygrid.mixin.WorldPresetAccessor
import possible_triangle.skygrid.platform.FabricPlatformHelper
import possible_triangle.skygrid.world.SkygridGenerator

@ExperimentalSerializationApi
@ExperimentalXmlUtilApi
@Suppress("unused")
object SkygridFabric : ModInitializer {
object SkygridFabric : ModInitializer, ClientModInitializer {

override fun onInitialize() {
SkygridMod.LOGGER.info("Common Initialize")
SkygridMod.init()
SkygridMod.setup()
FabricPlatformHelper.register()


XMLResource.register {
val listener = FabricReloadListener(it, it.path)
ResourceManagerHelper.get(PackType.SERVER_DATA).registerReloadListener(listener)
Expand All @@ -34,9 +35,11 @@ object SkygridFabric : ModInitializer {
ServerLifecycleEvents.SERVER_STOPPING.register { XMLResource.clear() }

CommandRegistrationCallback.EVENT.register { it, _ -> SkygridCommand.register(it) }
}

WorldPresetMixin.presets().add(SkygridGenerator)

override fun onInitializeClient() {
SkygridMod.LOGGER.info("Client Initialize")
WorldPresetAccessor.presets().add(SkygridGenerator)
}

}
8 changes: 7 additions & 1 deletion Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@
"adapter": "kotlin",
"value": "possible_triangle.skygrid.SkygridFabric"
}
],
"client": [
{
"adapter": "kotlin",
"value": "possible_triangle.skygrid.SkygridFabric"
}
]
},
"mixins": [
"skygrid.fabric.mixins.json"
],
"accessWidener" : "skygrid.accesswidener",
"accessWidener": "skygrid.accesswidener",
"depends": {
"fabricloader": ">=0.12",
"fabric": "*",
Expand Down
2 changes: 1 addition & 1 deletion Fabric/src/main/resources/skygrid.fabric.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"WorldGenSettingsMixin"
],
"client": [
"WorldPresetMixin"
"WorldPresetAccessor"
],
"injectors": {
"defaultRequire": 1
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project
mod_version=3.0.7
mod_version=0.0.0-dev
release_type=release
group=com.possible_triangle

Expand All @@ -10,12 +10,12 @@ common_client_run_name=Common Client
common_server_run_name=Common Server

# Forge
forge_version=40.0.22
forge_version=40.1.60
#forge_ats_enabled=true

# Fabric
fabric_version=0.48.0+1.18.2
fabric_loader_version=0.13.3
fabric_version=0.58.0+1.18.2
fabric_loader_version=0.14.8

# Mod options
mod_name=Skygrid
Expand Down

0 comments on commit 506bdb4

Please sign in to comment.