Skip to content

Commit

Permalink
24w07a
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Feb 14, 2024
1 parent 37b8213 commit 7144fde
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 64 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

# Fabric Properties
# Get new versions at https://fabricmc.net/develop and https://lambdaurora.dev/tools/import_quilt.html
minecraft_version=24w06a
quilt_mappings=24w05b+build.1
minecraft_version=24w07a
quilt_mappings=24w07a+build.1
parchment_mappings=1.20.2:2023.12.10
loader_version=0.15.6
loader_version=0.15.7

# Mod Properties
mod_id = wilderwild
Expand All @@ -25,7 +25,7 @@
archives_base_name = WilderWild

# Dependencies
fabric_api_version=0.96.0+1.20.5
fabric_api_version=0.96.2+1.20.5
mixin_extras_version=0.3.2
fabric_asm_version=v2.3
frozenlib_version=1.6.1-mc24w06a
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/frozenblock/wilderwild/entity/Crab.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.gameevent.PositionSource;
import net.minecraft.world.level.gameevent.vibrations.VibrationSystem;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
Expand Down Expand Up @@ -160,12 +160,12 @@ public Crab(EntityType<? extends Crab> entityType, Level level) {
this.dynamicGameEventListener = new DynamicGameEventListener<>(new VibrationSystem.Listener(this));
this.jumpControl = new CrabJumpControl(this);
this.prevMovement = Vec3.ZERO;
this.setPathfindingMalus(BlockPathTypes.LAVA, -1F);
this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1F);
this.setPathfindingMalus(BlockPathTypes.WATER, 0F);
this.setPathfindingMalus(BlockPathTypes.WATER_BORDER, 0F);
this.setPathfindingMalus(PathType.LAVA, -1F);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1F);
this.setPathfindingMalus(PathType.WATER, 0F);
this.setPathfindingMalus(PathType.WATER_BORDER, 0F);
if (EntityConfig.get().unpassableRail) {
this.setPathfindingMalus(BlockPathTypes.UNPASSABLE_RAIL, 0F);
this.setPathfindingMalus(PathType.UNPASSABLE_RAIL, 0F);
}
this.moveControl = new CrabMoveControl(this);
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/frozenblock/wilderwild/entity/Firefly.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -108,11 +108,11 @@ public class Firefly extends PathfinderMob implements FlyingAnimal {

public Firefly(@NotNull EntityType<? extends Firefly> entityType, @NotNull Level level) {
super(entityType, level);
this.setPathfindingMalus(BlockPathTypes.LAVA, -1F);
this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, -1F);
this.setPathfindingMalus(BlockPathTypes.WATER, -1F);
this.setPathfindingMalus(BlockPathTypes.WATER_BORDER, 16F);
this.setPathfindingMalus(BlockPathTypes.UNPASSABLE_RAIL, 0F);
this.setPathfindingMalus(PathType.LAVA, -1F);
this.setPathfindingMalus(PathType.DANGER_FIRE, -1F);
this.setPathfindingMalus(PathType.WATER, -1F);
this.setPathfindingMalus(PathType.WATER_BORDER, 16F);
this.setPathfindingMalus(PathType.UNPASSABLE_RAIL, 0F);
this.moveControl = new FlyingMoveControl(this, 20, true);
this.setFlickers(this.random.nextInt(FLICKERS_CHANCE) == 0);
this.setFlickerAge(this.random.nextIntBetweenInclusive(0, RANDOM_FLICKER_AGE_MAX));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import net.minecraft.world.entity.ai.navigation.GroundPathNavigation;
import net.minecraft.world.entity.monster.warden.Warden;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.level.pathfinder.Node;
import net.minecraft.world.level.pathfinder.PathFinder;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -75,8 +75,8 @@ protected boolean canMoveDirectly(@NotNull Vec3 origin, @NotNull Vec3 target) {
}

@Override
protected boolean hasValidPathType(@NotNull BlockPathTypes pathType) {
return EntityConfig.get().warden.wardenSwims ? pathType != BlockPathTypes.OPEN : super.hasValidPathType(pathType);
protected boolean hasValidPathType(@NotNull PathType pathType) {
return EntityConfig.get().warden.wardenSwims ? pathType != PathType.OPEN : super.hasValidPathType(pathType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.PathNavigationRegion;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.AmphibiousNodeEvaluator;
import net.minecraft.world.level.pathfinder.Node;
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.level.pathfinder.Target;
import net.minecraft.world.level.pathfinder.WalkNodeEvaluator;
import org.jetbrains.annotations.NotNull;
Expand All @@ -45,17 +46,17 @@ public WardenNodeEvaluator(boolean prefersShallowSwimming) {
@Override
public void prepare(@NotNull PathNavigationRegion level, @NotNull Mob mob) {
super.prepare(level, mob);
mob.setPathfindingMalus(BlockPathTypes.WATER, 0.0F);
this.oldWalkableCost = mob.getPathfindingMalus(BlockPathTypes.WALKABLE);
mob.setPathfindingMalus(BlockPathTypes.WALKABLE, 0.0F);
this.oldWaterBorderPenalty = mob.getPathfindingMalus(BlockPathTypes.WATER_BORDER);
mob.setPathfindingMalus(BlockPathTypes.WATER_BORDER, 4.0F);
mob.setPathfindingMalus(PathType.WATER, 0.0F);
this.oldWalkableCost = mob.getPathfindingMalus(PathType.WALKABLE);
mob.setPathfindingMalus(PathType.WALKABLE, 0.0F);
this.oldWaterBorderPenalty = mob.getPathfindingMalus(PathType.WATER_BORDER);
mob.setPathfindingMalus(PathType.WATER_BORDER, 4.0F);
}

@Override
public void done() {
this.mob.setPathfindingMalus(BlockPathTypes.WALKABLE, this.oldWalkableCost);
this.mob.setPathfindingMalus(BlockPathTypes.WATER_BORDER, this.oldWaterBorderPenalty);
this.mob.setPathfindingMalus(PathType.WALKABLE, this.oldWalkableCost);
this.mob.setPathfindingMalus(PathType.WATER_BORDER, this.oldWaterBorderPenalty);
super.done();
}

Expand All @@ -75,10 +76,10 @@ public Node getStart() {

@Override
@NotNull
public Target getGoal(double x, double y, double z) {
public Target getTarget(double x, double y, double z) {
return !this.isEntitySubmergedInWaterOrLava(this.mob)
? super.getGoal(x, y, z)
: this.getTargetFromNode(this.getNode(Mth.floor(x), Mth.floor(y + 0.5), Mth.floor(z)));
? super.getTarget(x, y, z)
: this.getTargetNodeAt(x, y + 0.5, z);
}

@Override
Expand All @@ -87,10 +88,10 @@ public int getNeighbors(Node @NotNull [] successors, @NotNull Node node) {
return super.getNeighbors(successors, node);
} else {
int i = super.getNeighbors(successors, node);
BlockPathTypes blockPathTypes = this.getCachedBlockType(this.mob, node.x, node.y + 1, node.z);
BlockPathTypes blockPathTypes2 = this.getCachedBlockType(this.mob, node.x, node.y, node.z);
PathType blockPathTypes = this.getCachedPathType(node.x, node.y + 1, node.z);
PathType blockPathTypes2 = this.getCachedPathType(node.x, node.y, node.z);
int j;
if (this.mob.getPathfindingMalus(blockPathTypes) >= 0.0F && blockPathTypes2 != BlockPathTypes.STICKY_HONEY) {
if (this.mob.getPathfindingMalus(blockPathTypes) >= 0.0F && blockPathTypes2 != PathType.STICKY_HONEY) {
j = Mth.floor(Math.max(1.0F, this.mob.maxUpStep()));
} else {
j = 0;
Expand All @@ -103,13 +104,13 @@ public int getNeighbors(Node @NotNull [] successors, @NotNull Node node) {
successors[i++] = node2;
}

if (this.isVerticalNeighborValid(node3, node) && blockPathTypes2 != BlockPathTypes.TRAPDOOR) {
if (this.isVerticalNeighborValid(node3, node) && blockPathTypes2 != PathType.TRAPDOOR) {
successors[i++] = node3;
}

for (int k = 0; k < i; ++k) {
Node node4 = successors[k];
if (node4.type == BlockPathTypes.WATER && this.prefersShallowSwimming && node4.y < this.mob.level().getSeaLevel() - 10) {
if (node4.type == PathType.WATER && this.prefersShallowSwimming && node4.y < this.mob.level().getSeaLevel() - 10) {
++node4.costMalus;
}
}
Expand All @@ -119,34 +120,34 @@ public int getNeighbors(Node @NotNull [] successors, @NotNull Node node) {
}

private boolean isVerticalNeighborValid(@Nullable Node node, @NotNull Node successor) {
return this.isNeighborValid(node, successor) && (node != null && node.type == BlockPathTypes.WATER);
return this.isNeighborValid(node, successor) && (node != null && node.type == PathType.WATER);
}

@Override
protected boolean isAmphibious() {
return true;
}

@Override
@NotNull
public BlockPathTypes getBlockPathType(@NotNull BlockGetter level, int x, int y, int z) {
@Override
public PathType getPathType(BlockGetter blockGetter, int x, int y, int z) {
BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();
BlockPathTypes pathNodeType = getBlockPathTypeRaw(level, mutable.set(x, y, z));
if (pathNodeType == BlockPathTypes.WATER || pathNodeType == BlockPathTypes.LAVA) {
PathType pathNodeType = getPathTypeFromState(blockGetter, mutable.set(x, y, z));
if (pathNodeType == PathType.WATER || pathNodeType == PathType.LAVA) {
for (Direction direction : Direction.values()) {
BlockPathTypes pathNodeType2 = getBlockPathTypeRaw(level, mutable.set(x, y, z).move(direction));
if (pathNodeType2 == BlockPathTypes.BLOCKED) {
return BlockPathTypes.WATER_BORDER;
PathType pathNodeType2 = getPathTypeFromState(blockGetter, mutable.set(x, y, z).move(direction));
if (pathNodeType2 == PathType.BLOCKED) {
return PathType.WATER_BORDER;
}
}

if (pathNodeType == BlockPathTypes.WATER) {
return BlockPathTypes.WATER;
if (pathNodeType == PathType.WATER) {
return PathType.WATER;
} else {
return BlockPathTypes.LAVA;
return PathType.LAVA;
}
} else {
return getBlockPathTypeStatic(level, mutable);
return getPathTypeStatic(blockGetter, mutable);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@
public class WalkNodeEvaluatorMixin {

@WrapOperation(
method = "checkNeighbourBlocks",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z", ordinal = 0),
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/world/level/block/Blocks;CACTUS:Lnet/minecraft/world/level/block/Block;", opcode = Opcodes.GETSTATIC))
)
private static boolean wilderWild$checkNeighbourBlocksWithPricklyPear(BlockState blockState, Block block, Operation<Boolean> operation) {
return operation.call(blockState, block) || operation.call(blockState, RegisterBlocks.PRICKLY_PEAR_CACTUS);
}

@WrapOperation(
method = "getBlockPathTypeRaw",
method = "getPathTypeFromState",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z", ordinal = 0),
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/world/level/block/Blocks;CACTUS:Lnet/minecraft/world/level/block/Block;", opcode = Opcodes.GETSTATIC))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import net.minecraft.world.entity.monster.Slime;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -37,14 +37,14 @@
public class MobMixin {

@Shadow
public void setPathfindingMalus(BlockPathTypes nodeType, float malus) {
public void setPathfindingMalus(PathType pathType, float malus) {
throw new AssertionError("Mixin injection failed - Wilder Wild MobMixin.");
}

@Inject(method = "<init>", at = @At("TAIL"))
private void wilderWild$addUnpassableRail(EntityType<? extends Mob> entityType, Level level, CallbackInfo info) {
if (EntityConfig.get().unpassableRail) {
this.setPathfindingMalus(BlockPathTypes.UNPASSABLE_RAIL, 0.0F);
this.setPathfindingMalus(PathType.UNPASSABLE_RAIL, 0.0F);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import net.minecraft.world.entity.monster.warden.Warden;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -144,9 +144,9 @@ public void travel(@NotNull Vec3 travelVector) {
@Inject(method = "<init>", at = @At("TAIL"))
private void wilderWild$wardenEntity(EntityType<? extends Monster> entityType, Level level, CallbackInfo ci) {
Warden wardenEntity = Warden.class.cast(this);
wardenEntity.setPathfindingMalus(BlockPathTypes.WATER, 0F);
wardenEntity.setPathfindingMalus(BlockPathTypes.POWDER_SNOW, -1F);
wardenEntity.setPathfindingMalus(BlockPathTypes.DANGER_POWDER_SNOW, -1F);
wardenEntity.setPathfindingMalus(PathType.WATER, 0F);
wardenEntity.setPathfindingMalus(PathType.POWDER_SNOW, -1F);
wardenEntity.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1F);
this.moveControl = new WardenMoveControl(wardenEntity, 0.05F, 80F, 0.13F, 1F);
this.lookControl = new WardenLookControl(wardenEntity, 10);
}
Expand Down

0 comments on commit 7144fde

Please sign in to comment.