From 717dd3e5ad3a443997bdd136e210a34a9049728d Mon Sep 17 00:00:00 2001 From: Talia-12 Date: Wed, 12 Jul 2023 18:26:19 +1000 Subject: [PATCH] fixed stuff from the merge from petra, and fixed raycasts to work without a player. --- .../mishaps/MishapAlreadyBrainswept.kt | 5 ---- .../api/casting/mishaps/MishapBadBlock.kt | 5 ---- .../casting/mishaps/MishapBadBrainsweep.kt | 5 ---- .../command/ListPerWorldPatternsCommand.java | 17 ++++--------- .../datagen/recipe/HexplatRecipes.java | 20 +--------------- .../datagen/tag/HexActionTagProvider.java | 4 ---- .../fabric/mixin/FabricClipContextMixin.java | 24 +++++++++++++++++++ .../main/resources/fabricasting.mixins.json | 1 + 8 files changed, 31 insertions(+), 50 deletions(-) create mode 100644 Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricClipContextMixin.java diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt index 67633d9f..9e5918d9 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapAlreadyBrainswept.kt @@ -12,13 +12,8 @@ class MishapAlreadyBrainswept(val mob: Mob) : Mishap() { override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment = dyeColor(DyeColor.GREEN) -<<<<<<< HEAD - override fun execute(env: CastingEnvironment, errorCtx: Context, stack: MutableList) { - mob.hurt(HexDamageSources.overcastDamageFrom(env.caster), mob.health) -======= override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { mob.hurt(mob.damageSources().source(HexDamageTypes.OVERCAST, ctx.caster), mob.health) ->>>>>>> talia-1.20/1.20.1 } override fun particleSpray(ctx: CastingEnvironment) = diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt index 44a6963c..b97a1b72 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBlock.kt @@ -16,13 +16,8 @@ class MishapBadBlock(val pos: BlockPos, val expected: Component) : Mishap() { override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment = dyeColor(DyeColor.LIME) -<<<<<<< HEAD - override fun execute(env: CastingEnvironment, errorCtx: Context, stack: MutableList) { - env.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0.25f, Explosion.BlockInteraction.NONE) -======= override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { ctx.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0.25f, Level.ExplosionInteraction.NONE) ->>>>>>> talia-1.20/1.20.1 } override fun particleSpray(ctx: CastingEnvironment) = diff --git a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt index 3f014ea3..4e235350 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/casting/mishaps/MishapBadBrainsweep.kt @@ -14,13 +14,8 @@ class MishapBadBrainsweep(val mob: Mob, val pos: BlockPos) : Mishap() { override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment = dyeColor(DyeColor.GREEN) -<<<<<<< HEAD - override fun execute(env: CastingEnvironment, errorCtx: Context, stack: MutableList) { - trulyHurt(mob, HexDamageSources.overcastDamageFrom(env.caster), 1f) -======= override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList) { trulyHurt(mob, mob.damageSources().source(HexDamageTypes.OVERCAST, ctx.caster), 1f) ->>>>>>> talia-1.20/1.20.1 } override fun particleSpray(ctx: CastingEnvironment): ParticleSpray { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPerWorldPatternsCommand.java b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPerWorldPatternsCommand.java index dd5d7c22..f39e14d4 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/command/ListPerWorldPatternsCommand.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/command/ListPerWorldPatternsCommand.java @@ -105,29 +105,22 @@ public class ListPerWorldPatternsCommand { var stack = new ItemStack(HexItems.SCROLL_LARGE); stack.setTag(tag); -<<<<<<< HEAD:Common/src/main/java/at/petrak/hexcasting/common/command/ListPerWorldPatternsCommand.java for (var player : targets) { var stackEntity = player.drop(stack, false); if (stackEntity != null) { stackEntity.setNoPickUpDelay(); - stackEntity.setOwner(player.getUUID()); + stackEntity.setThrower(player.getUUID()); } -======= - for (var player : targets) { - var stackEntity = player.drop(stack, false); - if (stackEntity != null) { - stackEntity.setNoPickUpDelay(); - stackEntity.setThrower(player.getUUID()); ->>>>>>> talia-1.20/1.20.1:Common/src/main/java/at/petrak/hexcasting/common/command/ListPatternsCommand.java - } - count++; + count++; + } } } + int finalCount = count; source.sendSuccess(() -> Component.translatable("command.hexcasting.pats.all", - count, + finalCount, targets.size() == 1 ? targets.iterator().next().getDisplayName() : targets.size()), true); return count; diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java index e39a2437..1a326ef0 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/recipe/HexplatRecipes.java @@ -304,19 +304,11 @@ public class HexplatRecipes extends PaucalRecipeProvider { .unlockedBy("has_item", hasItem(HexTags.Items.EDIFIED_LOGS)).save(recipes); for (var log : EDIFIED_LOGS) { -<<<<<<< HEAD - ShapedRecipeBuilder.shaped(log, 3) - .define('W', log) - .pattern("WW") - .pattern("WW") - .unlockedBy("has_item", hasItem(log)).save(recipes); -======= ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, log, 3) .define('W', log) .pattern("WW") .pattern("WW") .unlockedBy("has_item", hasItem(log)).save(recipes); ->>>>>>> talia-1.20/1.20.1 } ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, HexBlocks.STRIPPED_EDIFIED_WOOD, 3) @@ -483,23 +475,13 @@ public class HexplatRecipes extends PaucalRecipeProvider { // FD compat for (var log : EDIFIED_LOGS) { this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() -<<<<<<< HEAD .withInput(log) .withTool(ingredients.axeStrip()) .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) .withOutput("farmersdelight:tree_bark") .withSound(SoundEvents.AXE_STRIP)) .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/" + Registry.BLOCK.getKey(log).getPath())); -======= - .withInput(log) - .withTool(ingredients.axeStrip()) - .withOutput(HexBlocks.STRIPPED_EDIFIED_LOG) - .withOutput("farmersdelight:tree_bark") - .withSound(SoundEvents.AXE_STRIP)) - .whenModLoaded("farmersdelight") - .save(recipes, modLoc("compat/farmersdelight/cutting/" + BuiltInRegistries.BLOCK.getKey(log).getPath())); ->>>>>>> talia-1.20/1.20.1 + .save(recipes, modLoc("compat/farmersdelight/cutting/" + BuiltInRegistries.BLOCK.getKey(log).getPath())); } this.conditions.apply(new FarmersDelightCuttingRecipeBuilder() diff --git a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java index 75940bb6..4b083c57 100644 --- a/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java +++ b/Common/src/main/java/at/petrak/hexcasting/datagen/tag/HexActionTagProvider.java @@ -3,13 +3,9 @@ package at.petrak.hexcasting.datagen.tag; import at.petrak.hexcasting.api.casting.ActionRegistryEntry; import at.petrak.hexcasting.api.mod.HexTags; import at.petrak.hexcasting.xplat.IXplatAbstractions; -<<<<<<< HEAD import at.petrak.hexcasting.xplat.Platform; -import net.minecraft.data.DataGenerator; -======= import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; ->>>>>>> talia-1.20/1.20.1 import net.minecraft.data.tags.TagsProvider; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricClipContextMixin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricClipContextMixin.java new file mode 100644 index 00000000..264ecb89 --- /dev/null +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricClipContextMixin.java @@ -0,0 +1,24 @@ +package at.petrak.hexcasting.fabric.mixin; + + +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.phys.shapes.CollisionContext; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(ClipContext.class) +public abstract class FabricClipContextMixin { + + @Redirect(method = "", + at = @At( + value = "INVOKE_ASSIGN", + target = "Lnet/minecraft/world/phys/shapes/CollisionContext;of" + + "(Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/world/phys/shapes/CollisionContext;")) + public CollisionContext hex$getCollisionContext(Entity entity) { + if (entity == null) + return CollisionContext.empty(); + return CollisionContext.of(entity); + } +} diff --git a/Fabric/src/main/resources/fabricasting.mixins.json b/Fabric/src/main/resources/fabricasting.mixins.json index bd72dc74..5a816cf1 100644 --- a/Fabric/src/main/resources/fabricasting.mixins.json +++ b/Fabric/src/main/resources/fabricasting.mixins.json @@ -7,6 +7,7 @@ "mixins": [ "FabricAxeItemMixin", "FabricBlockBehaviorMixin", + "FabricClipContextMixin", "FabricEnchantmentTableBlockMixin", "FabricItemEntityMixin", "FabricLivingEntityMixin",