Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ usesMixins = true
separateMixinSourceSet =

# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
usesMixinDebug = true

# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
package org.embeddedt.archaicfix.mixins.client.core;

import net.minecraft.client.settings.GameSettings;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.server.integrated.IntegratedServer;
import org.embeddedt.archaicfix.config.ArchaicConfig;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(IntegratedServer.class)
public class MixinIntegratedServer {
/**
* Force the integrated server to have a minimum view distance of 8, so mob spawning works correctly.
*/
@Redirect(method = "tick", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/settings/GameSettings;renderDistanceChunks:I"))
private int getRealRenderDistance(GameSettings settings) {
if(ArchaicConfig.fixMobSpawnsAtLowRenderDist)
return Math.max(settings.renderDistanceChunks, 8);
else
return settings.renderDistanceChunks;
@ModifyExpressionValue(method = "tick", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/settings/GameSettings;renderDistanceChunks:I"))
private int getRealRenderDistance(int original) {
return ArchaicConfig.fixMobSpawnsAtLowRenderDist ? Math.max(original, 8) : original;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.embeddedt.archaicfix.mixins.common.core;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.entity.Entity;
import net.minecraft.world.SpawnerAnimals;
import net.minecraft.world.World;
Expand All @@ -10,14 +11,14 @@
@Mixin(SpawnerAnimals.class)
public class MixinSpawnerAnimals {

@ModifyConstant(method = "findChunksForSpawning", constant = @Constant(doubleValue = 24.0D))
@ModifyExpressionValue(method = "findChunksForSpawning", at = @At(value = "CONSTANT", args = "doubleValue=24.0"))
private double lowerSpawnRange(double old) {
return ArchaicConfig.fixMobSpawnsAtLowRenderDist ? 16 : old;
}

@Redirect(method = "performWorldGenSpawning", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntityInWorld(Lnet/minecraft/entity/Entity;)Z"))
private static boolean checkForCollision(World world, Entity instance) {
if(!ArchaicConfig.preventEntitySuffocationWorldgen || world.getCollidingBoundingBoxes(instance, instance.boundingBox).isEmpty()) {
if (!ArchaicConfig.preventEntitySuffocationWorldgen || world.getCollidingBoundingBoxes(instance, instance.boundingBox).isEmpty()) {
return world.spawnEntityInWorld(instance);
}
return false;
Expand Down