generated from quentin452/Catzmod1.7.10
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MixinWorldChunkManagerTorment (fix compat between witchery and en…
…dlessids)
- Loading branch information
1 parent
b57f3bf
commit 01ce4d6
Showing
4 changed files
with
136 additions
and
1 deletion.
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
17 changes: 17 additions & 0 deletions
17
...a/fr/iamacat/optimizationsandtweaks/mixins/common/witchery/MixinWorldProviderTorment.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,17 @@ | ||
package fr.iamacat.optimizationsandtweaks.mixins.common.witchery; | ||
|
||
import com.emoniph.witchery.dimension.WorldChunkManagerTorment; | ||
import com.emoniph.witchery.dimension.WorldProviderTorment; | ||
import fr.iamacat.optimizationsandtweaks.utilsformods.witchery.WorldChunkManagerTorment2; | ||
import net.minecraft.world.WorldProvider; | ||
import net.minecraft.world.chunk.IChunkProvider; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
|
||
@Mixin(WorldProviderTorment.class) | ||
public abstract class MixinWorldProviderTorment extends WorldProvider { | ||
@Overwrite(remap = false) | ||
public IChunkProvider func_76555_c() { | ||
return new WorldChunkManagerTorment2(this.worldObj); | ||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
...va/fr/iamacat/optimizationsandtweaks/utilsformods/witchery/WorldChunkManagerTorment2.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,113 @@ | ||
package fr.iamacat.optimizationsandtweaks.utilsformods.witchery; | ||
|
||
import com.emoniph.witchery.Witchery; | ||
import com.emoniph.witchery.dimension.GenerateMaze; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.EnumCreatureType; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.util.IProgressUpdate; | ||
import net.minecraft.world.ChunkPosition; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.BiomeGenBase; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.chunk.IChunkProvider; | ||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage; | ||
|
||
import java.util.List; | ||
|
||
public class WorldChunkManagerTorment2 implements IChunkProvider { | ||
public static final int NUM_LEVELS = 6; | ||
public static final int BASE_LEVEL = 10; | ||
public static final int LEVEL_HEIGHT = 15; | ||
public static final int MAZE_SIZE = 31; | ||
private final World world; | ||
|
||
public WorldChunkManagerTorment2(World world) { | ||
this.world = world; | ||
} | ||
|
||
@Override | ||
public boolean chunkExists(int i, int j) { | ||
return true; | ||
} | ||
|
||
@Override // FIX ENDLESSIDS COMPAT | ||
public Chunk provideChunk(int x, int z) { | ||
Chunk chunk = new Chunk(this.world, x, z); | ||
|
||
for (int y = 0; y < 256; ++y) { | ||
int l = y >> 4; | ||
ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l]; | ||
if (extendedblockstorage == null) { | ||
extendedblockstorage = new ExtendedBlockStorage(y, !this.world.provider.hasNoSky); | ||
chunk.getBlockStorageArray()[l] = extendedblockstorage; | ||
} | ||
|
||
for (int _x = 0; _x < 16; ++_x) { | ||
for (int _z = 0; _z < 16; ++_z) { | ||
Block blockId = Blocks.air; | ||
extendedblockstorage.func_150818_a(_x, y & 15, _z, blockId); | ||
extendedblockstorage.setExtBlockMetadata(_x, y & 15, _z, 0); | ||
} | ||
} | ||
} | ||
|
||
for (int i = 0; i < 16; ++i) { | ||
for (int j = 0; j < 16; ++j) { | ||
int biomeID = world.getWorldChunkManager().getBiomeGenAt((x << 4) + i, (z << 4) + j).biomeID; | ||
BiomeGenBase[] biomesForGeneration = new BiomeGenBase[256]; | ||
biomesForGeneration[(j << 4) | i] = BiomeGenBase.getBiome(biomeID); | ||
} | ||
} | ||
|
||
return chunk; | ||
} | ||
@Override | ||
public Chunk loadChunk(int x, int z) { | ||
return this.provideChunk(x, z); | ||
} | ||
@Override | ||
public void populate(IChunkProvider ichunkprovider, int i, int j) { | ||
if (i == 0 && j == 0) { | ||
for(int slot = 0; slot < 6; ++slot) { | ||
GenerateMaze maze = new GenerateMaze(31, 31, this.world.rand); | ||
maze.display(this.world, i * 16 + 8 - 31, 10 + slot * 15, j * 16 + 8 - 2, Witchery.Blocks.FORCE, Witchery.Blocks.TORMENT_STONE); | ||
} | ||
} | ||
|
||
} | ||
@Override | ||
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { | ||
return true; | ||
} | ||
@Override | ||
public boolean unloadQueuedChunks() { | ||
return false; | ||
} | ||
@Override | ||
public boolean canSave() { | ||
return true; | ||
} | ||
@Override | ||
public String makeString() { | ||
return "TormentChunk"; | ||
} | ||
@Override | ||
public List getPossibleCreatures(EnumCreatureType enumcreaturetype, int i, int j, int k) { | ||
return null; | ||
} | ||
@Override | ||
public ChunkPosition func_147416_a(World world, String s, int i, int j, int k) { | ||
return null; | ||
} | ||
@Override | ||
public int getLoadedChunkCount() { | ||
return 0; | ||
} | ||
@Override | ||
public void recreateStructures(int i, int j) { | ||
} | ||
@Override | ||
public void saveExtraData() { | ||
} | ||
} |