husks spawn regardless of light level in temples and better loaded_ep for 1.14

This commit is contained in:
gnembon committed 2019-08-07 14:56:26 +02:00
1 parent b7247368c1
commit af419dbc8a
3 files changed
+28 -2

No files matched your search

@@ -0,0 +1,21 @@
package carpet.mixins;
import carpet.settings.CarpetSettings;
import net.minecraft.entity.mob.HuskEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.feature.Feature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(HuskEntity.class)
public class HuskEntityMixin
{
@Redirect(method = "method_20677", at = @At(value = "INVOKE", target="Lnet/minecraft/world/IWorld;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z"))
private static boolean isSkylightOrTempleVisible(IWorld iWorld, BlockPos blockPos_1)
{
return iWorld.isSkyVisible(blockPos_1) ||
(CarpetSettings.huskSpawningInTemples && Feature.DESERT_PYRAMID.isApproximatelyInsideStructure(iWorld, blockPos_1));
}
}
@@ -65,6 +65,7 @@ import net.minecraft.util.Clearable;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.EulerAngle;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
@@ -754,8 +755,9 @@ public class CarpetExpression
this.expr.addLazyFunction("loaded_ep", -1, (c, t, lv) ->
{
BlockPos pos = BlockValue.fromParams((CarpetContext)c, lv, 0).block.getPos();
Value retval = ((CarpetContext)c).s.getWorld().isAreaLoaded(pos.getX() - 32, 0, pos.getZ() - 32,
pos.getX() + 32, 0, pos.getZ() + 32) ? Value.TRUE : Value.FALSE;
Value retval = ((CarpetContext)c).s.getWorld().getChunkManager().shouldTickChunk(new ChunkPos(pos))?Value.TRUE : Value.FALSE;
//Value retval = ((CarpetContext)c).s.getWorld().isAreaLoaded(pos.getX() - 32, 0, pos.getZ() - 32,
// pos.getX() + 32, 0, pos.getZ() + 32) ? Value.TRUE : Value.FALSE;
return (c_, t_) -> retval;
});
+3
View File
@@ -64,8 +64,11 @@
"PlayerEntity_parrotMixin",
"SaplingBlockMixin",
"EntityMixin",
"GuardianEntityMixin",
"DesertPyramidFeatureMixin",
"HuskEntityMixin",
"OverworldChunkGeneratorMixin",
"ServerChunkManagerMixin",