Skip to content
This repository has been archived by the owner on Dec 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from frqnny/1.17
Browse files Browse the repository at this point in the history
1.17
  • Loading branch information
Draylar authored Dec 9, 2021
2 parents 553143f + ab6f6ec commit d2d2dbb
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 52 deletions.
21 changes: 5 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '0.6-SNAPSHOT'
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = project.archives_base_name
version = project.mod_version + "-" + project.minecraft_version
Expand All @@ -17,23 +17,12 @@ minecraft {
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.5
minecraft_version=21w20a
yarn_mappings=21w20a+build.19
loader_version=0.11.3

#Fabric api
fabric_version=0.32.0+1.16
fabric_version=0.34.7+1.17

# Mod Properties
mod_version=1.2.0
mod_version=1.3.0
maven_group=draylar
archives_base_name=structurized

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public interface StructurePoolAddCallback {
Event<StructurePoolAddCallback> EVENT = EventFactory.createArrayBacked(StructurePoolAddCallback.class,
listeners -> initialPool -> {
for (StructurePoolAddCallback listener : listeners) {
listener.add(initialPool);
listener.onAdd(initialPool);
}
}
);

void add(FabricStructurePool initialPool);
void onAdd(FabricStructurePool initialPool);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.util.registry.SimpleRegistry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.util.Map;

@Mixin(DynamicRegistryManager.class)
public abstract class DynamicRegistryManagerMixin {

@Inject(method = "load(Lnet/minecraft/util/dynamic/RegistryOps;Lnet/minecraft/util/registry/DynamicRegistryManager$Impl;Lnet/minecraft/util/registry/DynamicRegistryManager$Info;)V", at = @At(value = "TAIL"), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT)
private static <E> void load(RegistryOps<?> ops, DynamicRegistryManager.Impl manager, DynamicRegistryManager.Info<E> info, CallbackInfo ci, RegistryKey<? extends Registry<E>> registryKey, SimpleRegistry<E> simpleRegistry) {
if (registryKey.getValue().toString().contains("template_pool")) {
for (Map.Entry<RegistryKey<Object>, Object> e : ((SimpleRegistryAccessor) simpleRegistry).getKeyToEntry().entrySet()) {
if (e.getValue() instanceof StructurePool) {
StructurePoolAddCallback.EVENT.invoker().add(new FabricStructurePool((StructurePool) e.getValue()));
@Inject(method = "load(Lnet/minecraft/util/dynamic/RegistryOps;Lnet/minecraft/util/registry/DynamicRegistryManager;Lnet/minecraft/util/registry/DynamicRegistryManager$Info;)V", at = @At(value = "TAIL"), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT)
private static <E> void load(RegistryOps<?> ops, DynamicRegistryManager manager, DynamicRegistryManager.Info<E> info, CallbackInfo ci, RegistryKey<? extends Registry<E>> registryKey) {
if (registryKey.equals(Registry.STRUCTURE_POOL_KEY)) {
for (E pool : manager.get(registryKey)) {
if (pool instanceof StructurePool) {
StructurePoolAddCallback.EVENT.invoker().onAdd(new FabricStructurePool((StructurePool) pool));
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.structure.pool.StructurePool;
import net.minecraft.structure.pool.StructurePoolElement;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.List;
Expand All @@ -16,6 +17,7 @@ public interface StructurePoolAccessor {
@Accessor(value = "elementCounts")
List<Pair<StructurePoolElement, Integer>> getElementCounts();

@Mutable
@Accessor(value = "elementCounts")
void setElementCounts(List<Pair<StructurePoolElement, Integer>> list);
}
5 changes: 2 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"schemaVersion": 1,
"id": "structurized",
"version": "${version}",
"version": "1.3.0",
"name": "Structurized",
"authors": [
"Draylar",
"Frqnny"
],
"license": "MIT",
"icon": "assets/villages/icon.png",
"mixins": [
"structurized.mixins.json"
],
"accessWidener": "structurized.accesswidener",
"depends": {
"minecraft": "1.16.x"
"minecraft": "1.17.x"
}
}
3 changes: 1 addition & 2 deletions src/main/resources/structurized.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"compatibilityLevel": "JAVA_8",
"mixins": [
"DynamicRegistryManagerMixin",
"StructurePoolAccessor",
"SimpleRegistryAccessor"
"StructurePoolAccessor"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit d2d2dbb

Please sign in to comment.