-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
098254d
commit 2acbb60
Showing
5 changed files
with
53 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/thut/Vector3Mixin.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,44 @@ | ||
package com.falsepattern.endlessids.mixin.mixins.common.biome.thut; | ||
|
||
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook; | ||
import lombok.val; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import thut.api.maths.Vector3; | ||
|
||
import net.minecraft.world.World; | ||
import net.minecraft.world.biome.BiomeGenBase; | ||
import net.minecraft.world.chunk.Chunk; | ||
|
||
@Mixin(value = Vector3.class, | ||
remap = false) | ||
public abstract class Vector3Mixin { | ||
|
||
@Shadow public abstract int intX(); | ||
|
||
@Shadow public abstract int intZ(); | ||
|
||
/** | ||
* @author FalsePattern | ||
* @reason ID Extension | ||
*/ | ||
@Overwrite | ||
public void setBiome(BiomeGenBase biome, World worldObj) { | ||
int x = this.intX(); | ||
int z = this.intZ(); | ||
Chunk chunk = worldObj.getChunkFromBlockCoords(x, z); | ||
val chunkHook = (ChunkBiomeHook) chunk; | ||
short[] biomes = chunkHook.getBiomeShortArray(); | ||
short newBiome = (short)biome.biomeID; | ||
int chunkX = Math.abs(x & 15); | ||
int chunkZ = Math.abs(z & 15); | ||
int point = chunkX + 16 * chunkZ; | ||
if (biomes[point] != newBiome) { | ||
biomes[point] = newBiome; | ||
chunkHook.setBiomeShortArray(biomes); | ||
chunk.setChunkModified(); | ||
} | ||
|
||
} | ||
} |
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