Skip to content

Commit

Permalink
24w03a
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Jan 17, 2024
1 parent c2a2fd8 commit e9bfd96
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 66 deletions.
Expand Up @@ -24,7 +24,7 @@ public class MinecraftMixin {
/**
* To mitigate the effect of leaked client worlds, clear most of the data structures that waste memory.
*/
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/Minecraft;level:Lnet/minecraft/client/multiplayer/ClientLevel;"))
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;Z)V", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/Minecraft;level:Lnet/minecraft/client/multiplayer/ClientLevel;"))
private void clearLevelDataForLeaks(CallbackInfo ci) {
if(this.level != null) {
try {
Expand Down
@@ -0,0 +1,15 @@
package org.embeddedt.modernfix.common.mixin.perf.reduce_blockstate_cache_rebuilds;

import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockBehaviour.class)
public interface BlockBehaviourInvoker {
@Invoker
FluidState invokeGetFluidState(BlockState blockState);
@Invoker
boolean invokeIsRandomlyTicking(BlockState blockState);
}
Expand Up @@ -93,7 +93,7 @@ private FluidState genCacheBeforeGettingFluid(BlockBehaviour.BlockStateBase base
if(!buildingCache) {
buildingCache = true;
try {
this.fluidState = this.owner.getFluidState(this.asState());
this.fluidState = ((BlockBehaviourInvoker)this.owner).invokeGetFluidState(this.asState());
} finally {
buildingCache = false;
}
Expand All @@ -112,7 +112,7 @@ private FluidState genCacheBeforeGettingFluid(BlockBehaviour.BlockStateBase base
))
private boolean genCacheBeforeGettingTicking(BlockBehaviour.BlockStateBase base) {
if(this.cacheInvalid)
return this.owner.isRandomlyTicking(this.asState());
return ((BlockBehaviourInvoker)this.owner).invokeIsRandomlyTicking(this.asState());
return this.isRandomlyTicking;
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -178,7 +178,6 @@ public DefaultSettingMapBuilder put(String key, Boolean value) {
.put("mixin.feature.warn_missing_perf_mods", true)
.put("mixin.feature.spark_profile_launch", false)
.put("mixin.devenv", isDevEnv)
.put("mixin.perf.remove_spawn_chunks", isDevEnv)
.putConditionally(() -> !isFabric, "mixin.bugfix.fix_config_crashes", true)
.putConditionally(() -> !isFabric, "mixin.feature.registry_event_progress", false)
.putConditionally(() -> isFabric, "mixin.perf.clear_fabric_mapping_tables", false)
Expand Down
Expand Up @@ -2,6 +2,7 @@

import com.mojang.datafixers.util.Pair;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -13,7 +14,11 @@
import java.util.*;

public class EntityIDSyncPacket implements CustomPacketPayload {
public static final StreamCodec<FriendlyByteBuf, EntityIDSyncPacket> STREAM_CODEC = CustomPacketPayload.codec(EntityIDSyncPacket::write, EntityIDSyncPacket::new);

public static final ResourceLocation ID = new ResourceLocation(ModernFix.MODID, "entity_id_sync");
public static final CustomPacketPayload.Type<EntityIDSyncPacket> TYPE = CustomPacketPayload.createType(ID.toString());

private Map<Class<? extends Entity>, List<Pair<String, Integer>>> map;

public EntityIDSyncPacket(Map<Class<? extends Entity>, List<Pair<String, Integer>>> map) {
Expand All @@ -24,7 +29,6 @@ public Map<Class<? extends Entity>, List<Pair<String, Integer>>> getFieldInfo()
return this.map;
}

@Override
public void write(FriendlyByteBuf buf) {
buf.writeVarInt(map.keySet().size());
for(Map.Entry<Class<? extends Entity>, List<Pair<String, Integer>>> entry : map.entrySet()) {
Expand Down Expand Up @@ -76,7 +80,7 @@ public EntityIDSyncPacket(FriendlyByteBuf buf) {
}

@Override
public ResourceLocation id() {
return ID;
public Type<? extends CustomPacketPayload> type() {
return TYPE;
}
}
6 changes: 3 additions & 3 deletions gradle.properties
Expand Up @@ -5,7 +5,7 @@ junit_version=5.10.0-M1
mixinextras_version=0.3.2

mod_id=modernfix
minecraft_version=23w51a
minecraft_version=24w03a
enabled_platforms=fabric
forge_version=20.4.70-beta
# parchment_version=2023.07.09
Expand All @@ -15,9 +15,9 @@ rei_version=13.0.678
ctm_version=1.20.1-1.1.8+4
kubejs_version=1902.6.0-build.142
rhino_version=1902.2.2-build.268
supported_minecraft_versions=23w51a
supported_minecraft_versions=24w03a

fabric_loader_version=0.15.1
fabric_loader_version=0.15.6
fabric_api_version=0.91.1+1.20.4

continuity_version=3.0.0-beta.4+1.20.2
Expand Down

0 comments on commit e9bfd96

Please sign in to comment.