From 68a9c6f24fa46599ac01159d9e11cc58012b13f7 Mon Sep 17 00:00:00 2001 From: itsmeow Date: Tue, 19 Apr 2022 08:22:38 -0500 Subject: [PATCH] Port to 1.18.2, fix wisp only targeting line of sight, some bugs still present --- .../whisperwoods/block/WispLanternBlock.java | 2 +- .../blockentity/HandOfFateBlockEntity.java | 49 +++++++++++-------- .../whisperwoods/entity/EntityHidebehind.java | 2 +- .../whisperwoods/entity/EntityMoth.java | 4 +- .../whisperwoods/entity/EntityWisp.java | 2 +- .../whisperwoods/entity/EntityZotzpyre.java | 8 +-- .../itsmeow/whisperwoods/init/ModTags.java | 20 ++++---- .../whisperwoods/mixin/EntityMixin.java | 36 -------------- .../mixin/GroundPathNavigationMixin.java | 42 ---------------- .../util/IOverrideCollisions.java | 12 +++-- .../main/resources/whisperwoods.mixins.json | 6 +-- fabric/build.gradle | 14 ++---- fabric/src/main/resources/fabric.mod.json | 4 +- .../resources/whisperwoods-fabric.mixins.json | 2 +- .../forge/ItemBlockModeledArmorMixin.java | 4 +- forge/src/main/resources/META-INF/mods.toml | 6 +-- .../resources/mixin.imdlib-whisperwoods.json | 2 +- forge/src/main/resources/pack.mcmeta | 2 +- .../resources/whisperwoods-forge.mixins.json | 2 +- gradle.properties | 18 ++++--- 20 files changed, 82 insertions(+), 155 deletions(-) delete mode 100644 common/src/main/java/dev/itsmeow/whisperwoods/mixin/EntityMixin.java delete mode 100644 common/src/main/java/dev/itsmeow/whisperwoods/mixin/GroundPathNavigationMixin.java diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/block/WispLanternBlock.java b/common/src/main/java/dev/itsmeow/whisperwoods/block/WispLanternBlock.java index 719e050..ba6fed0 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/block/WispLanternBlock.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/block/WispLanternBlock.java @@ -106,7 +106,7 @@ public PushReaction getPistonPushReaction(BlockState state) { @Override public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor worldIn, BlockPos currentPos, BlockPos facingPos) { if(stateIn.getValue(WATERLOGGED)) { - worldIn.getLiquidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(worldIn)); + worldIn.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(worldIn)); } return stateIn.getValue(FACING) == facing && !stateIn.canSurvive(worldIn, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, worldIn, currentPos, facingPos); diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/blockentity/HandOfFateBlockEntity.java b/common/src/main/java/dev/itsmeow/whisperwoods/blockentity/HandOfFateBlockEntity.java index d0f6a7b..beeca57 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/blockentity/HandOfFateBlockEntity.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/blockentity/HandOfFateBlockEntity.java @@ -3,9 +3,7 @@ import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableList; import com.mojang.math.Vector3f; -import dev.architectury.extensions.BlockEntityExtension; import dev.architectury.registry.registries.Registries; -import dev.architectury.utils.NbtType; import dev.itsmeow.whisperwoods.WhisperwoodsMod; import dev.itsmeow.whisperwoods.block.GhostLightBlock; import dev.itsmeow.whisperwoods.block.HandOfFateBlock; @@ -25,6 +23,10 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; @@ -55,9 +57,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; -public class HandOfFateBlockEntity extends BlockEntity implements BlockEntityExtension { +public class HandOfFateBlockEntity extends BlockEntity { public static final ImmutableBiMap RECIPES = ImmutableBiMap.of( "hirschgeist", new HOFRecipe(ChatFormatting.AQUA, true, Items.BONE, Items.DIAMOND, Items.SOUL_SAND), @@ -82,8 +83,13 @@ public Item getDisplayItem() { @Override public void setChanged() { super.setChanged(); - if (this.hasLevel() && !this.level.isClientSide()) - this.syncData(); + this.sync(); + } + + public void sync() { + if (level != null && !level.isClientSide()) { + level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), Block.UPDATE_CLIENTS); + } } public boolean isLit() { @@ -111,7 +117,7 @@ protected void playSound(SoundEvent sound, float vol, float pitch) { protected void sendToTrackers(HOFEffectPacket pkt) { if (this.hasLevel()) { - WWNetwork.HANDLER.sendToPlayers(((ServerChunkCache) this.getLevel().getChunkSource()).chunkMap.getPlayers(new ChunkPos(worldPosition), false).collect(Collectors.toSet()), pkt); + WWNetwork.HANDLER.sendToPlayers(((ServerChunkCache) this.getLevel().getChunkSource()).chunkMap.getPlayers(new ChunkPos(worldPosition), false), pkt); } } @@ -206,7 +212,7 @@ public void onRecipeComplete(HOFRecipe recipe, BlockState state, Level worldIn, wColor = WispColors.values()[wisp.getRandom().nextInt(WispColors.values().length)]; } wisp.setPos((double) pos.getX() + 0.5D, (double) pos.getY() + 1D, (double) pos.getZ() + 0.5D); - double d0 = 1.0D + Shapes.collide(Direction.Axis.Y, wisp.getBoundingBox(), world.getCollisions(null, new AABB(pos), e -> true), -1.0D); + double d0 = 1.0D + Shapes.collide(Direction.Axis.Y, wisp.getBoundingBox(), world.getCollisions(null, new AABB(pos)), -1.0D); wisp.moveTo((double) pos.getX() + 0.5D, (double) pos.getY() + d0, (double) pos.getZ() + 0.5D, Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F); wisp.yHeadRot = wisp.getYRot(); wisp.yBodyRot = wisp.getYRot(); @@ -233,27 +239,28 @@ public void onRecipeComplete(HOFRecipe recipe, BlockState state, Level worldIn, } @Override - public void load(CompoundTag compoundTag) { - super.load(compoundTag); - this.getRecipeContainer().read(compoundTag); - this.displayDirty = true; + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - public CompoundTag save(CompoundTag compound) { - CompoundTag c = super.save(compound); - this.getRecipeContainer().write(compound); - return c; + public CompoundTag getUpdateTag() { + CompoundTag nbt = super.getUpdateTag(); + saveAdditional(nbt); + return nbt; } @Override - public void loadClientData(BlockState pos, CompoundTag tag) { - this.load(tag); + public void load(CompoundTag compoundTag) { + super.load(compoundTag); + this.getRecipeContainer().read(compoundTag); + this.displayDirty = true; } @Override - public CompoundTag saveClientData(CompoundTag tag) { - return this.save(tag); + public void saveAdditional(CompoundTag compound) { + super.saveAdditional(compound); + this.getRecipeContainer().write(compound); } public void dropItems(Level worldIn, BlockPos pos) { @@ -392,7 +399,7 @@ public boolean hasItem(Item item) { public void read(CompoundTag nbt) { if (nbt.contains("items")) { - nbt.getList("items", NbtType.STRING).forEach(i -> data.put(i.getAsString(), true)); + nbt.getList("items", Tag.TAG_STRING).forEach(i -> data.put(i.getAsString(), true)); } else { data.keySet().forEach((i) -> data.put(i, false)); } diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java index 6f7e143..c256f2b 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityHidebehind.java @@ -525,7 +525,7 @@ public EntityTypeContainer getContainer() { @Override public String[] getTypesFor(ResourceKey biomeKey, Biome biome, Set types, MobSpawnType reason) { - if(biomeKey == Biomes.GIANT_SPRUCE_TAIGA || biomeKey == Biomes.GIANT_SPRUCE_TAIGA_HILLS || biomeKey == Biomes.GIANT_TREE_TAIGA || biomeKey == Biomes.GIANT_TREE_TAIGA_HILLS) { + if(biomeKey == Biomes.OLD_GROWTH_SPRUCE_TAIGA || biomeKey == Biomes.OLD_GROWTH_SPRUCE_TAIGA) { return new String[] { "mega_taiga", "mega_taiga", "mega_taiga", "darkforest" }; } if(types.contains(BiomeTypes.CONIFEROUS)) { diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityMoth.java b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityMoth.java index 2ceb15f..70daa8c 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityMoth.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityMoth.java @@ -127,7 +127,7 @@ protected void customServerAiStep() { this.setNotLanded(); } } - if(this.targetPosition == null || this.random.nextInt(30) == 0 || (this.targetPosition.closerThan(this.position(), 1.0D) && !isLightBlock(level.getBlockState(this.targetPosition)))) { + if(this.targetPosition == null || this.random.nextInt(30) == 0 || (this.targetPosition.closerThan(this.blockPosition(), 1.0D) && !isLightBlock(level.getBlockState(this.targetPosition)))) { int i = 12; int j = 2; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); @@ -189,7 +189,7 @@ protected void customServerAiStep() { Vec3 vec3d1 = vec3d.add((Math.signum(d0) * 0.5D - vec3d.x) * (double) 0.1F, (Math.signum(d1) * (double) 0.7F - vec3d.y) * (double) 0.1F, (Math.signum(d2) * 0.5D - vec3d.z) * (double) 0.1F); float width = this.getContainer().getEntityType().getDimensions().width * 0.8F; AABB axisalignedbb = AABB.ofSize(vec3d1.add(this.position()), width, 0.1F, width); - boolean collides = this.level.getBlockCollisions(this, axisalignedbb, (state, pos2) -> state.isSuffocating(this.level, pos2)).findAny().isPresent(); + boolean collides = this.level.getBlockCollisions(this, axisalignedbb).iterator().hasNext(); if(collides) { vec3d1 = vec3d1.multiply(0.5, 0.5, 0.5); } diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityWisp.java b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityWisp.java index 5b4c00a..819d2c9 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityWisp.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityWisp.java @@ -58,7 +58,7 @@ public class EntityWisp extends Animal implements IContainerEntity { public static final EntityDataAccessor PASSIVE_SCALE = SynchedEntityData.defineId(EntityWisp.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor COLOR_VARIANT = SynchedEntityData.defineId(EntityWisp.class, EntityDataSerializers.INT); private static final TargetingConditions PASSIVE_SCALE_PREDICATE = TargetingConditions.forNonCombat().ignoreInvisibilityTesting().ignoreLineOfSight(); - private static final TargetingConditions HOSTILE_TARGET_PREDICATE = TargetingConditions.forCombat().selector(e -> !(e.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof ItemBlockHirschgeistSkull)); + private static final TargetingConditions HOSTILE_TARGET_PREDICATE = TargetingConditions.forCombat().ignoreLineOfSight().selector(e -> !(e.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof ItemBlockHirschgeistSkull)); protected ResourceLocation targetTexture; private boolean shouldBeHostile = false; private int attackCooldown = 0; diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityZotzpyre.java b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityZotzpyre.java index 30cdf37..f120069 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityZotzpyre.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/entity/EntityZotzpyre.java @@ -5,12 +5,9 @@ import dev.itsmeow.whisperwoods.init.ModEntities; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; @@ -36,7 +33,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraft.world.phys.shapes.VoxelShape; import java.util.EnumSet; import java.util.Random; @@ -109,7 +105,7 @@ protected SoundEvent getDeathSound() { @SuppressWarnings("deprecation") public static boolean canSpawn(EntityType type, LevelAccessor world, MobSpawnType reason, BlockPos pos, Random rand) { - if (pos.getY() >= world.getSeaLevel() && !BiomeTypes.getTypes(ResourceKey.create(Registry.BIOME_REGISTRY, ((ServerLevel)world).getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getKey(world.getBiome(pos)))).contains(BiomeTypes.JUNGLE)) { + if (pos.getY() >= world.getSeaLevel() && !BiomeTypes.getTypes(world.getBiome(pos).unwrapKey().get()).contains(BiomeTypes.JUNGLE)) { return false; } else { return checkAnyLightMonsterSpawnRules(type, world, reason, pos, rand); @@ -399,7 +395,7 @@ private boolean canReach(Vec3 vec3, int i) { AABB box = this.mob.getBoundingBox(); for (int j = 1; j < i; ++j) { box = box.move(vec3); - if (!this.mob.level.getBlockCollisions(this.mob, box).allMatch(VoxelShape::isEmpty)) { + if (this.mob.level.getBlockCollisions(this.mob, box).iterator().hasNext()) { return false; } } diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/init/ModTags.java b/common/src/main/java/dev/itsmeow/whisperwoods/init/ModTags.java index 6c91faf..d2e7492 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/init/ModTags.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/init/ModTags.java @@ -1,38 +1,38 @@ package dev.itsmeow.whisperwoods.init; -import dev.architectury.hooks.tags.TagHooks; import dev.itsmeow.whisperwoods.WhisperwoodsMod; +import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.Tag; +import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; public class ModTags { public static final class Blocks { - public static final Tag.Named GHOST_LIGHT = tag("ghost_light"); - public static final Tag.Named WISP_LANTERN = tag("wisp_lantern"); + public static final TagKey GHOST_LIGHT = tag("ghost_light"); + public static final TagKey WISP_LANTERN = tag("wisp_lantern"); public static void loadTags() { // This is a classloading dummy. } - private static Tag.Named tag(String name) { - return TagHooks.optionalBlock(new ResourceLocation(WhisperwoodsMod.MODID, name)); + private static TagKey tag(String name) { + return TagKey.create(Registry.BLOCK_REGISTRY, new ResourceLocation(WhisperwoodsMod.MODID, name)); } } public static final class Items { - public static final Tag.Named GHOST_LIGHT = tag("ghost_light"); - public static final Tag.Named WISP_LANTERN = tag("wisp_lantern"); + public static final TagKey GHOST_LIGHT = tag("ghost_light"); + public static final TagKey WISP_LANTERN = tag("wisp_lantern"); public static void loadTags() { // This is a classloading dummy. } - private static Tag.Named tag(String name) { - return TagHooks.optionalItem(new ResourceLocation(WhisperwoodsMod.MODID, name)); + private static TagKey tag(String name) { + return TagKey.create(Registry.ITEM_REGISTRY, new ResourceLocation(WhisperwoodsMod.MODID, name)); } } } diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/mixin/EntityMixin.java b/common/src/main/java/dev/itsmeow/whisperwoods/mixin/EntityMixin.java deleted file mode 100644 index 35bc71c..0000000 --- a/common/src/main/java/dev/itsmeow/whisperwoods/mixin/EntityMixin.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.itsmeow.whisperwoods.mixin; - -import dev.itsmeow.whisperwoods.util.IOverrideCollisions; -import net.minecraft.core.BlockPos; -import net.minecraft.util.RewindableStream; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.VoxelShape; -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; - -import java.util.stream.Stream; - -@Mixin(Entity.class) -public class EntityMixin { - - @Inject(at = @At(value = "HEAD"), method = "collideBoundingBoxHeuristically(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/phys/AABB;Lnet/minecraft/world/level/Level;Lnet/minecraft/world/phys/shapes/CollisionContext;Lnet/minecraft/util/RewindableStream;)Lnet/minecraft/world/phys/Vec3;", cancellable = true) - private static void collideBoundingBoxHeuristically(Entity entity, Vec3 vec3, AABB aABB, Level level, CollisionContext collisionContext, RewindableStream rewindableStream, CallbackInfoReturnable cir) { - if(entity instanceof IOverrideCollisions) { - boolean bl = vec3.x == 0.0D; - boolean bl2 = vec3.y == 0.0D; - boolean bl3 = vec3.z == 0.0D; - if ((!bl || !bl2) && (!bl || !bl3) && (!bl2 || !bl3)) { - RewindableStream rewindableStream2 = new RewindableStream(Stream.concat(rewindableStream.getStream(), level.getBlockCollisions(entity, aABB.expandTowards(vec3)).filter(shape -> !((IOverrideCollisions) entity).canPassThrough(level.getBlockState(new BlockPos(shape.bounds().minX, shape.bounds().minY, shape.bounds().minZ)))))); - cir.setReturnValue(Entity.collideBoundingBoxLegacy(vec3, aABB, rewindableStream2)); - cir.cancel(); - } - } - } - -} diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/mixin/GroundPathNavigationMixin.java b/common/src/main/java/dev/itsmeow/whisperwoods/mixin/GroundPathNavigationMixin.java deleted file mode 100644 index 3d8ccf6..0000000 --- a/common/src/main/java/dev/itsmeow/whisperwoods/mixin/GroundPathNavigationMixin.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.itsmeow.whisperwoods.mixin; - -import dev.itsmeow.whisperwoods.util.IOverrideCollisions; -import net.minecraft.core.BlockPos; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; -import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.pathfinder.PathComputationType; -import net.minecraft.world.phys.Vec3; -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(GroundPathNavigation.class) -public abstract class GroundPathNavigationMixin extends PathNavigation { - - public GroundPathNavigationMixin(Mob mob, Level level) { - super(mob, level); - } - - @Inject(at = @At("HEAD"), method = "canWalkAbove(IIIIIILnet/minecraft/world/phys/Vec3;DD)Z", cancellable = true) - public void canWalkAbove(int i, int j, int k, int l, int m, int n, Vec3 vec3, double d, double e, CallbackInfoReturnable cir) { - if(this.mob instanceof IOverrideCollisions) { - for (BlockPos blockpos : BlockPos.betweenClosed(new BlockPos(i, j, k), new BlockPos(i + l - 1, j + m - 1, k + n - 1))) { - double d0 = (double) blockpos.getX() + 0.5D - vec3.x; - double d1 = (double) blockpos.getZ() + 0.5D - vec3.z; - BlockState state = this.level.getBlockState(blockpos); - if (!(d0 * d + d1 * e < 0.0D) && !(state.isPathfindable(this.level, blockpos, PathComputationType.LAND) || ((IOverrideCollisions)this.mob).canPassThrough(state))) { - cir.setReturnValue(false); - cir.cancel(); - return; - } - } - cir.setReturnValue(true); - cir.cancel(); - return; - } - } -} diff --git a/common/src/main/java/dev/itsmeow/whisperwoods/util/IOverrideCollisions.java b/common/src/main/java/dev/itsmeow/whisperwoods/util/IOverrideCollisions.java index 1e482cd..4a33695 100644 --- a/common/src/main/java/dev/itsmeow/whisperwoods/util/IOverrideCollisions.java +++ b/common/src/main/java/dev/itsmeow/whisperwoods/util/IOverrideCollisions.java @@ -1,9 +1,12 @@ package dev.itsmeow.whisperwoods.util; import dev.itsmeow.imdlib.entity.interfaces.IContainerEntity; +import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Mob; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.Shapes; public interface IOverrideCollisions extends IContainerEntity { @@ -11,9 +14,12 @@ default boolean insideOpaque() { if (this.getImplementation().noPhysics) { return false; } else { - float f1 = this.getImplementation().getType().getDimensions().width * 0.8F; - AABB axisalignedbb = AABB.ofSize(this.getImplementation().getEyePosition(), f1, 0.1F, f1); - return this.getImplementation().getCommandSenderWorld().getBlockCollisions(this.getImplementation(), axisalignedbb, (state, pos) -> state.isSuffocating(this.getImplementation().getCommandSenderWorld(), pos) && !preventSuffocation(state)).findAny().isPresent(); + float f = this.getImplementation().getType().getDimensions().width * 0.8F; + AABB aABB = AABB.ofSize(this.getImplementation().getEyePosition(), (double)f, 1.0E-6D, (double)f); + return BlockPos.betweenClosedStream(aABB).anyMatch((blockPos) -> { + BlockState blockState = this.getImplementation().getLevel().getBlockState(blockPos); + return !blockState.isAir() && blockState.isSuffocating(this.getImplementation().getLevel(), blockPos) && !preventSuffocation(blockState) && Shapes.joinIsNotEmpty(blockState.getCollisionShape(this.getImplementation().getLevel(), blockPos).move(blockPos.getX(), blockPos.getY(), blockPos.getZ()), Shapes.create(aABB), BooleanOp.AND); + }); } } diff --git a/common/src/main/resources/whisperwoods.mixins.json b/common/src/main/resources/whisperwoods.mixins.json index ca938ea..d966523 100644 --- a/common/src/main/resources/whisperwoods.mixins.json +++ b/common/src/main/resources/whisperwoods.mixins.json @@ -1,12 +1,10 @@ { "required": true, "package": "dev.itsmeow.whisperwoods.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "minVersion": "0.8", "mixins": [ - "EntityMixin", - "LivingEntityMixin", - "GroundPathNavigationMixin" + "LivingEntityMixin" ], "client": [ "LayerDefinitionsMixin" diff --git a/fabric/build.gradle b/fabric/build.gradle index a924730..40e2a81 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -26,18 +26,14 @@ dependencies { shadowModImplementation("dev.itsmeow.imdlib:imdlib-fabric:${rootProject.imdlib_version}") { transitive = false } - modRuntimeOnly("com.terraformersmc:modmenu:2.0.14") { + modRuntimeOnly("com.terraformersmc:modmenu:3.1.1") { transitive = false } - /*modRuntimeOnly("dev.itsmeow.betteranimalsplus:betteranimalsplus-fabric:${rootProject.betteranimalsplus_version}") { - transitive = false - }*/ - modRuntimeOnly ("curse.maven:cloth-config-319057:3559636") { - transitive = false - } - runtimeOnly("me.shedaniel.cloth:basic-math:0.6.0") { - transitive = false + modRuntimeOnly ("curse.maven:cloth-config-319057:3641132") { + exclude(group: "net.fabricmc") + exclude(group: "net.fabricmc.fabric-api") } + runtimeOnly("me.shedaniel.cloth:basic-math:0.6.0") } shadowJar { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 189eaac..1941d76 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -20,8 +20,8 @@ "modmenu": ["dev.itsmeow.imdlib.compat.modmenu.ModMenuCompat"] }, "depends": { - "minecraft": "1.17.1", - "architectury": ">=2.8.0", + "minecraft": "1.18.2", + "architectury": ">=4.0.0", "fabricloader": ">=0.12.0", "fabric": ">=0.32.0" }, diff --git a/fabric/src/main/resources/whisperwoods-fabric.mixins.json b/fabric/src/main/resources/whisperwoods-fabric.mixins.json index 9c69100..7779dbd 100644 --- a/fabric/src/main/resources/whisperwoods-fabric.mixins.json +++ b/fabric/src/main/resources/whisperwoods-fabric.mixins.json @@ -1,7 +1,7 @@ { "required": true, "package": "dev.itsmeow.whisperwoods.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "minVersion": "0.8", "mixins": [], "client": [ diff --git a/forge/src/main/java/dev/itsmeow/whisperwoods/mixin/forge/ItemBlockModeledArmorMixin.java b/forge/src/main/java/dev/itsmeow/whisperwoods/mixin/forge/ItemBlockModeledArmorMixin.java index 825a15a..2587959 100644 --- a/forge/src/main/java/dev/itsmeow/whisperwoods/mixin/forge/ItemBlockModeledArmorMixin.java +++ b/forge/src/main/java/dev/itsmeow/whisperwoods/mixin/forge/ItemBlockModeledArmorMixin.java @@ -25,8 +25,8 @@ public ItemBlockModeledArmorMixin(ArmorMaterial arg, EquipmentSlot arg2, Propert public void initializeClient(java.util.function.Consumer consumer) { consumer.accept(new IItemRenderProperties() { @Override - public > A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, A defaultModel) { - return (A) ItemBlockModeledArmorMixin.this.getArmorModel(entityLiving, itemStack, armorSlot, (HumanoidModel) defaultModel); + public HumanoidModel getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel defaultModel) { + return ItemBlockModeledArmorMixin.this.getArmorModel(entityLiving, itemStack, armorSlot, (HumanoidModel) defaultModel); } }); } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index d64253d..fe01ad9 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader="javafml" -loaderVersion="[37,)" +loaderVersion="[40,)" issueTrackerURL="https://github.com/itsmeow/whisperwoods/issues" displayURL="https://www.curseforge.com/minecraft/mc-mods/whisperwoods" logoFile="icon.png" @@ -15,12 +15,12 @@ Spooky forest stuff for spooky jam''' [[dependencies.whisperwoods]] modId="forge" mandatory=true - versionRange="[37.1.0,)" + versionRange="[40.0.0,)" ordering="NONE" side="BOTH" [[dependencies.whisperwoods]] modId="architectury" mandatory=true - versionRange="[2.8.0,)" + versionRange="[4.0.0,)" ordering="NONE" side="BOTH" \ No newline at end of file diff --git a/forge/src/main/resources/mixin.imdlib-whisperwoods.json b/forge/src/main/resources/mixin.imdlib-whisperwoods.json index 774e7ba..ba77da5 100644 --- a/forge/src/main/resources/mixin.imdlib-whisperwoods.json +++ b/forge/src/main/resources/mixin.imdlib-whisperwoods.json @@ -1,7 +1,7 @@ { "required": false, "package": "", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "minVersion": "0.8", "mixins": [ ], diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta index ac5072d..ccd22b1 100644 --- a/forge/src/main/resources/pack.mcmeta +++ b/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "whisperwoods resources", - "pack_format": 7 + "pack_format": 8 } } diff --git a/forge/src/main/resources/whisperwoods-forge.mixins.json b/forge/src/main/resources/whisperwoods-forge.mixins.json index f446aa0..7fcc50b 100644 --- a/forge/src/main/resources/whisperwoods-forge.mixins.json +++ b/forge/src/main/resources/whisperwoods-forge.mixins.json @@ -1,7 +1,7 @@ { "required": true, "package": "dev.itsmeow.whisperwoods.mixin.forge", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "minVersion": "0.8", "mixins": [], "client": [ diff --git a/gradle.properties b/gradle.properties index 6a7c626..8571921 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,12 +4,12 @@ maven_group = dev.itsmeow.whisperwoods # Forge - mc_version = 1.17.1 - forge_version = 37.1.1 - architectury_version = 2.10.8 - fabric_loader_version = 0.12.12 - fabric_api_version = 0.46.1+1.17 - imdlib_version = 1.17.1-020aff273239808b499b8c5592813a72d20bf653 + mc_version = 1.18.2 + forge_version = 40.0.46 + architectury_version = 4.2.50 + fabric_loader_version = 0.13.3 + fabric_api_version = 0.50.0+1.18.2 + imdlib_version = 1.18.2-0cefc723b2f1479aa04c92284c2e4b03fa164a50 # Publishing github = itsmeow/whisperwoods @@ -17,8 +17,10 @@ url = https://github.com/itsmeow/whisperwoods curse_title = Whisperwoods curse_project_id = 349597 - curse_versions_fabric = Minecraft 1.17:1.17.1,Java 16,Fabric - curse_versions_forge = Minecraft 1.17:1.17.1,Java 16,Forge + curse_versions_fabric = Minecraft 1.18:1.18.2,Java 17,Fabric + curse_versions_forge = Minecraft 1.18:1.18.2,Java 17,Forge + curse_relations_fabric = fabric-api:requiredDependency,architectury-fabric:requiredDependency,cloth-config:optionalDependency,modmenu:optionalDependency,fiber2cloth:embeddedLibrary + curse_relations_forge = architectury-forge:requiredDependency # Toolchain Versions loom_version = 0.11.0-SNAPSHOT