Compare commits

..
Author SHA1 Message Date
Martin Robertz 82955ad34d update waila dep 2023-11-16 13:57:16 +01:00
Pelotrio d726351abc Add method to clear static textures on world unload 2023-11-16 13:52:58 +01:00
Pelotrio ea103bcc80 Remove static keyword from render block variables
The static keyword was removed from several instances of RenderBlocksCTM and RenderBlocksCTMFullbright variables in various SubmapManager classes and ChiselController class. This was done to fix a potential memory leak issue where these static objects could persist in memory even when they're no longer needed. Also, related to this change, the onWorldUnload method that used to clear static reference of RenderBlocksCTMFullbright has been removed from ChiselController.
2023-11-16 13:52:58 +01:00
Martin Robertz f4291635b2 fix dependencies 2023-11-12 11:11:48 +01:00
Martin Robertz 739e5fc9c3 fix 2023-11-12 11:09:00 +01:00
7 changed files with 14 additions and 15 deletions

No files matched your search

+2 -4
View File
@@ -4,16 +4,14 @@ dependencies {
implementation("com.github.GTNewHorizons:CodeChickenCore:1.1.11:dev")
implementation("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev")
implementation("com.github.GTNewHorizons:ForgeMultipart:1.4.0:dev")
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")
shadowImplementation("com.github.GTNewHorizons:CTMLib:1.4.4:dev")
compileOnly("com.github.GTNewHorizons:waila:1.6.2:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.4.0:dev") {
compileOnly("com.github.GTNewHorizons:waila:1.6.3:dev") {
transitive = false
}
@@ -345,7 +345,12 @@ public enum TextureType {
}
}
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
public static void clearStatics() {
theRenderBlocksCTM = null;
theRenderBlocksColumn = null;
}
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
return new SubmapManagerDefault(this, variation, texturePath);
}
@@ -75,7 +75,7 @@ public class SubmapManagerAntiblock extends SubmapManagerBase {
};
@SideOnly(Side.CLIENT)
private static RenderBlocksCTMFullbright rb;
private RenderBlocksCTMFullbright rb;
private String color;
private TextureSubmap submap, submapSmall;
@@ -14,7 +14,7 @@ import team.chisel.ctmlib.TextureSubmap;
public class SubmapManagerCarpetFloor extends SubmapManagerBase {
@SideOnly(Side.CLIENT)
private static RenderBlocksCTM rb;
private RenderBlocksCTM rb;
private TextureSubmap submap;
private TextureSubmap submapSmall;
@@ -16,7 +16,7 @@ import team.chisel.ctmlib.TextureSubmap;
public class SubmapManagerSlab implements ISubmapManager {
@SideOnly(Side.CLIENT)
private static RenderBlocksCTM rb;
private RenderBlocksCTM rb;
private TextureSubmap submap;
private TextureSubmap submapSmall;
@@ -48,7 +48,7 @@ public class SubmapManagerSpecialMaterial extends SubmapManagerBase {
}
};
private static RenderBlocksCTMFullbright renderBlocksFullbright;
private RenderBlocksCTMFullbright renderBlocksFullbright;
private String color;
private MaterialType materialType;
@@ -85,8 +85,4 @@ public class SubmapManagerSpecialMaterial extends SubmapManagerBase {
return renderBlocksFullbright;
}
public static void clearRenderBlocksInstance() {
renderBlocksFullbright = null;
}
}
@@ -18,6 +18,7 @@ import com.cricketcraft.chisel.api.IChiselItem;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
import com.cricketcraft.chisel.api.carving.IChiselMode;
import com.cricketcraft.chisel.api.rendering.TextureType;
import com.google.common.collect.Queues;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -26,7 +27,6 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import team.chisel.Chisel;
import team.chisel.carving.Carving;
import team.chisel.client.render.SubmapManagerSpecialMaterial;
import team.chisel.utils.General;
public final class ChiselController {
@@ -166,7 +166,7 @@ public final class ChiselController {
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.world.isRemote) {
SubmapManagerSpecialMaterial.clearRenderBlocksInstance();
TextureType.clearStatics();
}
}