-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #544 from jchung01/memory-leaks
Fix more client-side memory leaks
- Loading branch information
Showing
16 changed files
with
931 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/mod/acgaming/universaltweaks/mods/bibliocraft/mixin/UTBiblioCraftMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package mod.acgaming.universaltweaks.mods.bibliocraft.mixin; | ||
|
||
import jds.bibliocraft.BiblioCraft; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
// Courtesy of jchung01 | ||
@Mixin(value = BiblioCraft.class, remap = false) | ||
public class UTBiblioCraftMixin | ||
{ | ||
/** | ||
* @reason Skip version checking because it retains the first WorldClient | ||
*/ | ||
@Inject(method = "postInitClient", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;register(Ljava/lang/Object;)V", ordinal = 0, shift = At.Shift.AFTER), cancellable = true) | ||
private void utDisableVersionCheck(CallbackInfo ci) | ||
{ | ||
ci.cancel(); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/mod/acgaming/universaltweaks/mods/compactmachines/render/DummyWorld.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package mod.acgaming.universaltweaks.mods.compactmachines.render; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.util.math.ChunkPos; | ||
import net.minecraft.world.GameType; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldSettings; | ||
import net.minecraft.world.WorldType; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.IChunkProvider; | ||
import net.minecraftforge.fml.common.Loader; | ||
|
||
import io.netty.util.collection.LongObjectHashMap; | ||
import io.netty.util.collection.LongObjectMap; | ||
|
||
public class DummyWorld | ||
{ | ||
public static final WorldSettings DEFAULT_SETTINGS = new WorldSettings(1L, GameType.SURVIVAL, true, false, WorldType.DEFAULT); | ||
public static final boolean isAlfheimLoaded = Loader.isModLoaded("alfheim"); | ||
|
||
public static class DummyChunkProvider implements IChunkProvider | ||
{ | ||
private final World world; | ||
private final LongObjectMap<Chunk> loadedChunks = new LongObjectHashMap<>(); | ||
|
||
public DummyChunkProvider(World world) { | ||
this.world = world; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Chunk getLoadedChunk(int x, int z) { | ||
return loadedChunks.get(ChunkPos.asLong(x, z)); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Chunk provideChunk(int x, int z) { | ||
long chunkKey = ChunkPos.asLong(x, z); | ||
if (loadedChunks.containsKey(chunkKey)) | ||
return loadedChunks.get(chunkKey); | ||
Chunk chunk = new Chunk(world, x, z); | ||
loadedChunks.put(chunkKey, chunk); | ||
return chunk; | ||
} | ||
|
||
@Override | ||
public boolean tick() { | ||
for (Chunk chunk : loadedChunks.values()) { | ||
chunk.onTick(false); | ||
} | ||
return !loadedChunks.isEmpty(); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String makeString() { | ||
return "Dummy"; | ||
} | ||
|
||
@Override | ||
public boolean isChunkGeneratedAt(int x, int z) { | ||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.