diff --git a/gradle.properties b/gradle.properties index c6ea4c6..71fa5f7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ minecraft_version=1.19.2 yarn_mappings=1.19.2+build.28 loader_version=0.14.19 # Mod Properties -mod_version=1.19.2-10 +mod_version=1.19.2-11 maven_group=dev.mrsterner.besmirchment archives_base_name=besmirchment # Dependencies diff --git a/src/main/java/dev/mrsterner/besmirchment/mixin/EntityMixin.java b/src/main/java/dev/mrsterner/besmirchment/mixin/EntityMixin.java index 63d70f9..acd8bb7 100644 --- a/src/main/java/dev/mrsterner/besmirchment/mixin/EntityMixin.java +++ b/src/main/java/dev/mrsterner/besmirchment/mixin/EntityMixin.java @@ -1,13 +1,21 @@ package dev.mrsterner.besmirchment.mixin; import dev.mrsterner.besmirchment.common.entity.interfaces.TameableDemon; +import dev.mrsterner.besmirchment.common.registry.BSMTags; import dev.mrsterner.besmirchment.common.registry.BSMTransformations; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityPose; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.scoreboard.AbstractTeam; +import net.minecraft.util.function.BooleanBiFunction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.shape.VoxelShapes; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; @@ -15,6 +23,39 @@ @Mixin(Entity.class) public class EntityMixin { + + @Shadow + private EntityDimensions dimensions; + + @Inject(method = "isInsideWall", at = @At("HEAD"), cancellable = true) + private void isLichInsideWall(CallbackInfoReturnable cir){ + Entity entity = Entity.class.cast(this); + if (entity instanceof LivingEntity livingEntity) { + boolean bl = BSMTransformations.isLich(livingEntity, true); + boolean bl2 = getState(livingEntity, this.dimensions.width * 0.8F); + if (bl && bl2) { + cir.setReturnValue(false); + } + } + } + + private boolean getState(LivingEntity livingEntity, float width){ + Box box = Box.of(livingEntity.getEyePos(), width, 1.0E-6, width); + + return BlockPos.stream(box).anyMatch((pos) -> { + BlockState blockState = livingEntity.getWorld().getBlockState(pos); + if (blockState.isIn(BSMTags.GHOST_IMPASSABLE)) { + return false; + } + + return !blockState.isAir() && + blockState.shouldSuffocate(livingEntity.getWorld(), pos) && + VoxelShapes.matchesAnywhere(blockState.getCollisionShape(livingEntity.getWorld(), pos).offset(pos.getX(), pos.getY(), pos.getZ()), VoxelShapes.cuboid(box), BooleanBiFunction.AND) && + blockState.isIn(BSMTags.GHOST_WHITELIST) + ; + }); + } + @Inject(method = "getScoreboardTeam", at = @At("HEAD"), cancellable = true) public void getScoreboardTeam(CallbackInfoReturnable cir) { if (this instanceof TameableDemon && ((TameableDemon) this).isTamed()) { diff --git a/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/book.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/book.json new file mode 100644 index 0000000..e1586b9 --- /dev/null +++ b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/book.json @@ -0,0 +1,4 @@ +{ + "name": "Besmirchment", + "extend": "bewitchment:book_of_shadows" +} \ No newline at end of file diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/brewing/love.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/brewing/love.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/brewing/love.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/brewing/love.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/contracts/conquest.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/contracts/conquest.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/contracts/conquest.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/contracts/conquest.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/creatures/beelzebub.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/creatures/beelzebub.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/creatures/beelzebub.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/creatures/beelzebub.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/creatures/unconventional_familiars.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/creatures/unconventional_familiars.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/creatures/unconventional_familiars.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/creatures/unconventional_familiars.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/creatures/werepyre.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/creatures/werepyre.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/creatures/werepyre.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/creatures/werepyre.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/curses/werepyrism.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/curses/werepyrism.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/curses/werepyrism.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/curses/werepyrism.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/rituals/lichdom.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/rituals/lichdom.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/rituals/lichdom.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/rituals/lichdom.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/demonic_deed.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/demonic_deed.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/demonic_deed.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/demonic_deed.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/elite_coffin.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/elite_coffin.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/elite_coffin.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/elite_coffin.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/final_broom.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/final_broom.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/final_broom.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/final_broom.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/sunscreen.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/sunscreen.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/sunscreen.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/sunscreen.json diff --git a/src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/witchy_dye.json b/src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/witchy_dye.json similarity index 100% rename from src/main/resources/assets/besmirchment/patchouli_books/book_of_shadows/en_us/entries/tools/witchy_dye.json rename to src/main/resources/data/besmirchment/patchouli_books/book_of_shadows_extension/en_us/entries/tools/witchy_dye.json diff --git a/src/main/resources/data/besmirchment/tags/blocks/ghost_whitelist.json b/src/main/resources/data/besmirchment/tags/blocks/ghost_whitelist.json new file mode 100644 index 0000000..5e6e630 --- /dev/null +++ b/src/main/resources/data/besmirchment/tags/blocks/ghost_whitelist.json @@ -0,0 +1,20 @@ +{ + "replace": false, + "values": [ + "#dirt", + "#logs", + "#nylium", + "#planks", + "#stairs", + "#slabs", + "#terracotta", + "#walls", + "#wool", + "#snow", + "#ice", + "#base_stone_overworld", + "#base_stone_nether", + "#sand", + "gravel" + ] +} \ No newline at end of file