Skip to content

Commit

Permalink
Group/rename "Entity Lists" bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jchung01 committed May 10, 2024
1 parent b71e0a3 commit 122d7c9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ All changes are toggleable via config files.
* **Entity Bounding Boxes:** Saves entity bounding boxes to tags to prevent breakouts and suffocation
* **Entity Desync:** Fixes entity motion desyncs most notable with arrows and thrown items
* **Entity ID:** Fixes non-functional elytra firework boosting and guardian targeting if the entity ID is 0
* **Entity Lists:** Fixes entity lists often not getting updated correctly
* **Entity Lists**
* **Chunk Updates:** Fixes chunk entity lists often not getting updated correctly
* **World Additions:** Fixes client-side memory leak where some entity ids are not set before being added to the world's entity list
* **Entity NaN:** Prevents corruption of entities caused by invalid health or damage values
* **Entity Suffocation:** Pushes entities out of blocks when growing up to prevent suffocation
* **Entity Tracker:** Fixes entity tracker to prevent client-sided desyncs when teleporting or changing dimensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public abstract class UTEntityTilePistonMixin extends TileEntity
@Inject(method = "moveCollidedEntities", at = @At(value = "INVOKE", target = "Ljava/lang/ThreadLocal;set(Ljava/lang/Object;)V", ordinal = 1, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
public void utUpdateEntity(float p_184322_1_, CallbackInfo ci, EnumFacing enumfacing, double d0, List list, AxisAlignedBB axisalignedbb, List list1, boolean flag, int i, Entity entity, double d1)
{
if (UTConfigBugfixes.ENTITIES.utEntityListsToggle) world.updateEntityWithOptionalForce(entity, false);
if (UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utChunkUpdatesToggle) world.updateEntityWithOptionalForce(entity, false);
}

@Surrogate
public void utUpdateEntity(float p_184322_1_, CallbackInfo ci, EnumFacing enumfacing, double d0, List list, AxisAlignedBB axisalignedbb, List list1, boolean flag, int i, Entity entity, double d1, int quark0)
{
if (UTConfigBugfixes.ENTITIES.utEntityListsToggle) world.updateEntityWithOptionalForce(entity, false);
if (UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utChunkUpdatesToggle) world.updateEntityWithOptionalForce(entity, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class UTWorldClientMixin
@Inject(method = "addEntityToWorld",
slice = @Slice(from = @At(value = "HEAD"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;spawnEntity(Lnet/minecraft/entity/Entity;)Z")),
at = @At(value = "INVOKE", target = "Ljava/util/Set;add(Ljava/lang/Object;)Z"))
at = @At(value = "INVOKE", target = "Ljava/util/Set;add(Ljava/lang/Object;)Z", ordinal = 0, remap = false))
private void utSetIdBeforeAdd(int entityID, Entity entityToSpawn, CallbackInfo ci)
{
if (UTConfigBugfixes.ENTITIES.utEntityListAdditionToggle)
if (UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utWorldAdditionsToggle)
{
entityToSpawn.setEntityId(entityID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public abstract class UTWorldMixin
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPositionNonDirty()Z", ordinal = 0))
public boolean utAlwaysLoadChunk(Entity entityIn)
{
if (UTConfigBugfixes.ENTITIES.utEntityListsToggle)
if (UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utChunkUpdatesToggle)
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ public static class EntitiesCategory
@Config.Name("Entity Desync")
public final EntityDesyncCategory ENTITY_DESYNC = new EntityDesyncCategory();

@Config.LangKey("cfg.universaltweaks.bugfixes.entities.entitylists")
@Config.Name("Entity Lists")
public final EntityListsCategory ENTITY_LISTS = new EntityListsCategory();

@Config.RequiresMcRestart
@Config.Name("Attack Radius")
@Config.Comment("Improves the attack radius of hostile mobs by checking the line of sight with raytracing")
Expand Down Expand Up @@ -212,16 +216,6 @@ public static class EntitiesCategory
@Config.Comment("Fixes non-functional elytra firework boosting and guardian targeting if the entity ID is 0")
public boolean utEntityIDToggle = true;

@Config.RequiresMcRestart
@Config.Name("Entity List Addition")
@Config.Comment("Fixes client-side memory leak where some entity ids are not set before being added to the entity list")
public boolean utEntityListAdditionToggle = true;

@Config.RequiresMcRestart
@Config.Name("Entity Lists")
@Config.Comment("Fixes entity lists often not getting updated correctly")
public boolean utEntityListsToggle = true;

@Config.Name("Entity NaN Values")
@Config.Comment("Prevents corruption of entities caused by invalid health or damage values")
public boolean utEntityNaNToggle = true;
Expand Down Expand Up @@ -307,6 +301,19 @@ public static class EntityDesyncCategory
"pixelmon:occupied_pokeball"
};
}

public static class EntityListsCategory
{
@Config.RequiresMcRestart
@Config.Name("Chunk Updates")
@Config.Comment("Fixes chunk entity lists often not getting updated correctly")
public boolean utChunkUpdatesToggle = true;

@Config.RequiresMcRestart
@Config.Name("World Additions")
@Config.Comment("Fixes client-side memory leak where some entity ids are not set before being added to the world's entity list")
public boolean utWorldAdditionsToggle = true;
}
}

public static class MiscCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
put("mixins.bugfixes.entities.desync.json", () -> UTConfigBugfixes.ENTITIES.ENTITY_DESYNC.utEntityDesyncToggle);
put("mixins.bugfixes.entities.dimensionchange.json", () -> UTConfigBugfixes.ENTITIES.utDimensionChangeToggle);
put("mixins.bugfixes.entities.entityid.json", () -> UTConfigBugfixes.ENTITIES.utEntityIDToggle);
put("mixins.bugfixes.entities.entitylists.json", () -> UTConfigBugfixes.ENTITIES.utEntityListsToggle);
put("mixins.bugfixes.entities.entitylists.json", () -> UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utChunkUpdatesToggle);
put("mixins.bugfixes.entities.horsefalling.json", () -> UTConfigBugfixes.ENTITIES.utHorseFallingToggle);
put("mixins.bugfixes.entities.maxhealth.json", () -> UTConfigBugfixes.ENTITIES.utMaxHealthToggle);
put("mixins.bugfixes.entities.minecart.json", () -> UTConfigBugfixes.ENTITIES.utMinecartAIToggle);
Expand Down Expand Up @@ -153,7 +153,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
put("mixins.bugfixes.blocks.blockoverlay.json", () -> UTConfigBugfixes.BLOCKS.BLOCK_OVERLAY.utBlockOverlayToggle);
put("mixins.bugfixes.blocks.miningglitch.client.json", () -> UTConfigBugfixes.BLOCKS.MINING_GLITCH.utMiningGlitchToggle);
put("mixins.bugfixes.entities.elytra.json", () -> UTConfigBugfixes.ENTITIES.utElytraDeploymentLandingToggle);
put("mixins.bugfixes.entities.entitylists.client.json", () -> UTConfigBugfixes.ENTITIES.utEntityListAdditionToggle);
put("mixins.bugfixes.entities.entitylists.client.json", () -> UTConfigBugfixes.ENTITIES.ENTITY_LISTS.utWorldAdditionsToggle);
put("mixins.bugfixes.entities.villagermantle.json", () -> UTConfigBugfixes.ENTITIES.utVillagerMantleToggle);
put("mixins.bugfixes.misc.depthmask.json", () -> UTConfigBugfixes.MISC.utDepthMaskToggle);
put("mixins.bugfixes.misc.modelgap.json", () -> UTConfigBugfixes.MISC.MODEL_GAP.utModelGapToggle);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/universaltweaks/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ cfg.universaltweaks.config.world=World

cfg.universaltweaks.bugfixes.blocks.blockoverlay=Block Overlay
cfg.universaltweaks.bugfixes.entities.desync=Entity Desync
cfg.universaltweaks.bugfixes.entities.entitylists=Entity Lists
cfg.universaltweaks.bugfixes.misc.modelgap=Model Gap

cfg.universaltweaks.modintegration.abyssalcraft=AbyssalCraft
Expand Down

0 comments on commit 122d7c9

Please sign in to comment.