lead fix and unloaded entity fix

This commit is contained in:
gnembon committed 2019-07-07 20:46:59 -03:00
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();
}
}
@@ -104,7 +104,7 @@ public class CarpetSettings
@Rule( desc = "Shulkers will respawn in end cities", category = FEATURE ) @Rule( desc = "Shulkers will respawn in end cities", category = FEATURE )
public static boolean shulkerSpawningInEndCities = false; public static boolean shulkerSpawningInEndCities = false;
@Rule(desc = "Entities pushed or moved into unloaded chunks no longer disappear", category = {EXPERIMENTAL, BUGFIX}, validate = Validator.WIP.class) @Rule(desc = "Entities pushed or moved into unloaded chunks no longer disappear", category = {EXPERIMENTAL, BUGFIX})
public static boolean unloadedEntityFix = false; public static boolean unloadedEntityFix = false;
@Rule( desc = "TNT doesn't update when placed against a power source", category = CREATIVE ) @Rule( desc = "TNT doesn't update when placed against a power source", category = CREATIVE )
@@ -164,7 +164,11 @@ public class CarpetSettings
@Rule(desc = "Enables /tick command to control game clocks", category = COMMAND) @Rule(desc = "Enables /tick command to control game clocks", category = COMMAND)
public static boolean commandTick = true; public static boolean commandTick = true;
@Rule(desc = "Enables /log command to monitor events in the game via chat and overlays", category = COMMAND) @Rule(
desc = "Enables /log command to monitor events in the game via chat and overlays",
category = COMMAND,
validate = Validator.WIP.class
)
public static boolean commandLog = true; public static boolean commandLog = true;
@Rule( @Rule(
@@ -388,8 +392,7 @@ public class CarpetSettings
@Rule( @Rule(
desc = "Fixes leads breaking/becoming invisible in unloaded chunks", desc = "Fixes leads breaking/becoming invisible in unloaded chunks",
extra = "You may still get visibly broken leash links on the client side, but server side the link is still there.", extra = "You may still get visibly broken leash links on the client side, but server side the link is still there.",
category = BUGFIX, category = BUGFIX
validate = Validator.WIP.class
) )
public static boolean leadFix = false; public static boolean leadFix = false;
+2 -2
View File
@@ -47,13 +47,13 @@ public abstract class Validator<T>
if (source != null) if (source != null)
try try
{ {
Messenger.m(source, "r "+currentRule.name+" is not yet fully implemented - we are still working on it."); Messenger.m(source, "r "+currentRule.name+" is missing a few bits - we are still working on it.");
} }
catch (NullPointerException ignored) { } catch (NullPointerException ignored) { }
return newValue; return newValue;
} }
@Override @Override
public String description() { return "Its not yet fully implemented - we are working on it";} public String description() { return "A few bits still needs implementing - we are working on it";}
} }
public static class _STRICT<T> extends Validator<T> public static class _STRICT<T> extends Validator<T>
{ {
+2
View File
@@ -24,6 +24,8 @@
"ThreadedAnvilChunkStorage_tickMixin", "ThreadedAnvilChunkStorage_tickMixin",
"MobEntityMixin", "MobEntityMixin",
"ServerWorld_unloadedEntityMixin",
"MobEntity_leashMixin",
"ServerPlayNetworkHandlerMixin", "ServerPlayNetworkHandlerMixin",
"MinecraftServer_scarpetMixin", "MinecraftServer_scarpetMixin",