-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1.21: 1.0.2 updated mixins to avoid deadlock
- Loading branch information
Showing
8 changed files
with
65 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...rc/main/java/com/faboslav/villagesandpillages/init/VillagesAndPillagesStructureTypes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
...on/src/main/java/com/faboslav/villagesandpillages/mixin/LessTreesInVillageWitchMixin.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
...src/main/java/com/faboslav/villagesandpillages/mixin/NoTreesOnWitchVillageHouseMixin.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
common/src/main/java/com/faboslav/villagesandpillages/mixin/TreeFeatureMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.faboslav.villagesandpillages.mixin; | ||
|
||
import com.faboslav.villagesandpillages.init.VillagesAndPillagesStructureTypes; | ||
import com.yungnickyoung.minecraft.yungsapi.util.MixinUtils; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.world.ChunkRegion; | ||
import net.minecraft.world.gen.feature.TreeFeature; | ||
import net.minecraft.world.gen.feature.TreeFeatureConfig; | ||
import net.minecraft.world.gen.feature.util.FeatureContext; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(TreeFeature.class) | ||
public class TreeFeatureMixin | ||
{ | ||
@Inject( | ||
method = "generate(Lnet/minecraft/world/gen/feature/util/FeatureContext;)Z", | ||
at = @At(value = "HEAD"), | ||
cancellable = true | ||
) | ||
private void villagesAndPillages_noTreeOrLessTreeInStructures( | ||
FeatureContext<TreeFeatureConfig> context, | ||
CallbackInfoReturnable<Boolean> cir | ||
) { | ||
if (!(context.getWorld() instanceof ChunkRegion worldGenRegion)) return; | ||
|
||
if ((worldGenRegion.getBlockState(context.getOrigin().down()).isOf(Blocks.MOSS_BLOCK) || context.getRandom().nextFloat() > 0.5) && MixinUtils.isPositionInTaggedStructure(worldGenRegion, context.getOrigin(), VillagesAndPillagesStructureTypes.VILLAGE_WITCH)) { | ||
cir.setReturnValue(false); | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...on/src/main/resources/data/villagesandpillages/tags/worldgen/structure/village_witch.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"villagesandpillages:village_witch" | ||
] | ||
} |
25 changes: 12 additions & 13 deletions
25
common/src/main/resources/villagesandpillages-common.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
{ | ||
"required": true, | ||
"package": "com.faboslav.villagesandpillages.mixin", | ||
"compatibilityLevel": "JAVA_${modJavaVersion}", | ||
"minVersion": "0.8", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
}, | ||
"mixins": [ | ||
"LessTreesInVillageWitchMixin", | ||
"NoTreesOnWitchVillageHouseMixin", | ||
"StructureTemplateMixin", | ||
"accessor.StructureProcessorAccessor" | ||
] | ||
"required": true, | ||
"package": "com.faboslav.villagesandpillages.mixin", | ||
"compatibilityLevel": "JAVA_${modJavaVersion}", | ||
"minVersion": "0.8", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
}, | ||
"mixins": [ | ||
"StructureTemplateMixin", | ||
"TreeFeatureMixin", | ||
"accessor.StructureProcessorAccessor" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters