lead fix and unloaded entity fix
This commit is contained in:
1 parent
800b26bf18
commit
f9e90ded2a
5 files changed
+60
-6
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.settings.CarpetSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MobEntity.class)
|
||||
public abstract class MobEntity_leashMixin
|
||||
{
|
||||
@Shadow /*@Nullable*/ private Entity holdingEntity;
|
||||
|
||||
@Shadow /*@Nullable*/ private CompoundTag leashTag;
|
||||
|
||||
@Inject(method = "writeCustomDataToTag", at = @At("TAIL"))
|
||||
private void addLeashData(CompoundTag compoundTag_1, CallbackInfo ci)
|
||||
{
|
||||
if (holdingEntity == null && CarpetSettings.leadFix && leashTag != null)
|
||||
{
|
||||
compoundTag_1.put("Leash", leashTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.settings.CarpetSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ServerWorld.class)
|
||||
public class ServerWorld_unloadedEntityMixin
|
||||
{
|
||||
@Redirect(method = "checkChunk", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/Entity;teleportRequested()Z"
|
||||
))
|
||||
private boolean addFastEntityCheck(Entity entity)
|
||||
{
|
||||
return CarpetSettings.unloadedEntityFix || entity.teleportRequested();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user