diff --git a/build.gradle b/build.gradle index 83f535d4..40276d84 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,8 @@ plugins { 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.minecraft_version+'-'+project.mod_version+'+v'+new Date().format('yyMMdd') @@ -52,16 +52,8 @@ tasks.withType(JavaCompile).configureEach { // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too - // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. - // We'll use that if it's available, but otherwise we'll use the older option. - def targetVersion = 8 - if (JavaVersion.current().isJava9Compatible()) { - it.options.release = targetVersion - } - // Minecraft 1.17 (21w19a) upwards uses Java 16. - //it.options.release = 16 + it.options.release = 16 } java { diff --git a/gradle.properties b/gradle.properties index 98672d10..3d192496 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,10 +4,10 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html - minecraft_version=21w18a - yarn_mappings=21w18a+build.10 + minecraft_version=21w19a + yarn_mappings=21w19a+build.2 loader_version=0.11.3 - fabric_version=0.34.3+1.17 + fabric_version=0.34.4+1.17 # Mod Properties mod_version = 1.4.36 diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index e5062707..f7e812e5 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -142,7 +142,7 @@ public class FeatureGenerator findFirst().map(Map.Entry::getValue).orElse(null); } - public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature structure, boolean computeBox) + synchronized public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature structure, boolean computeBox) { long seed = world.getSeed(); ChunkGenerator generator = world.getChunkManager().getChunkGenerator(); diff --git a/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java b/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java index 6cb12ded..ed77613f 100644 --- a/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java +++ b/src/main/java/carpet/mixins/PickaxeItem_missingToolsMixin.java @@ -1,25 +1,31 @@ package carpet.mixins; import carpet.CarpetSettings; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Material; +import net.minecraft.item.ItemStack; +import net.minecraft.item.MiningToolItem; import net.minecraft.item.PickaxeItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.tag.Tag; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; +//import org.spongepowered.asm.mixin.injection.At; +//import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(PickaxeItem.class) -public class PickaxeItem_missingToolsMixin +public class PickaxeItem_missingToolsMixin extends MiningToolItem { - @Redirect(method = "getMiningSpeedMultiplier", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/block/BlockState;getMaterial()Lnet/minecraft/block/Material;" - )) - private Material getCustomMaterial(BlockState blockState) - { - Material material = blockState.getMaterial(); + + protected PickaxeItem_missingToolsMixin(float attackDamage, float attackSpeed, ToolMaterial material, Tag tag, Settings settings) { + super(attackDamage, attackSpeed, material, tag, settings); + } + + @Override + public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { + Material material = state.getMaterial(); if (CarpetSettings.missingTools && material == Material.GLASS) - material = Material.STONE; - return material; + return miningSpeed; + return super.getMiningSpeedMultiplier(stack, state); } } diff --git a/src/main/java/carpet/script/argument/FileArgument.java b/src/main/java/carpet/script/argument/FileArgument.java index b1f100a4..d43d5d11 100644 --- a/src/main/java/carpet/script/argument/FileArgument.java +++ b/src/main/java/carpet/script/argument/FileArgument.java @@ -189,7 +189,8 @@ public class FileArgument } catch (IOException e) { - throw new ThrowStatement("Unable to open zip file: "+zipContainer, Throwables.IO_EXCEPTION); + return null; // undr java 16 no file throws IOException - will take care of it later + //throw new ThrowStatement("Unable to open zip file: "+zipContainer, Throwables.IO_EXCEPTION); } } return zfs.getPath(resource+(isFolder?"/":type.extension)); diff --git a/src/main/resources/carpet.accesswidener b/src/main/resources/carpet.accesswidener index e9dad565..625c69ec 100644 --- a/src/main/resources/carpet.accesswidener +++ b/src/main/resources/carpet.accesswidener @@ -2,4 +2,5 @@ accessWidener v1 named accessible class net/minecraft/server/world/ThreadedAnvilChunkStorage$TicketManager accessible class net/minecraft/server/world/ServerLightingProvider$Stage -accessible class net/minecraft/recipe/Ingredient$Entry \ No newline at end of file +accessible class net/minecraft/recipe/Ingredient$Entry +accessible class net/minecraft/world/chunk/light/BlockLightStorage$Data \ No newline at end of file diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index 8186b459..224f08e2 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -2,7 +2,7 @@ "required": true, "refmap": "fabric-carpet-refmap.json", "package": "carpet.mixins", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_16", "mixins": [ "SpawnHelperInnerMixin", "CommandManagerMixin", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 2eee13cc..76f27d3e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,6 +33,7 @@ "depends": { "minecraft": "1.17.x", - "fabricloader": ">=0.7.1" + "fabricloader": ">=0.11.3", + "java": ">=16" } }