Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

Commit

Permalink
Version v1.0.1
Browse files Browse the repository at this point in the history
Do backwards compatibility with TF 3.8 properly
  • Loading branch information
sam-kirby committed Apr 1, 2019
1 parent efff5d6 commit 5fec190
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apply plugin: 'org.spongepowered.mixin'

def buildnumber = System.getenv('TRAVIS_BUILD_NUMBER')
def suffix = buildnumber != null ? ".$buildnumber" : "-SNAPSHOT"
version = "1.0.0$suffix"
version = "1.0.1$suffix"
group = "uk.bobbytables.jeidsi" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "jeidsi"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public String getRefMapperConfig() {

@Override
public boolean shouldApplyMixin(String s, String s1) {
JEIDsILoadingPlugin.LOGGER.info("Testing " + s1);
for (ModContainer mod : Loader.instance().getModList()) {
if (mod.getModId().equals("twilightforest")) {
if (s1.equals("MixinBlockTFMagicLogSpecialUpdate")) {
if (s1.equals("uk.bobbytables.jeidsi.compat.twilightforest.mixins.MixinBlockTFMagicLogSpecialUpdate")) {
if (Integer.parseInt(mod.getVersion().split("[.]")[2]) > 689) {
JEIDsILoadingPlugin.LOGGER.info("Applying TF Network Mixin");
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import twilightforest.biomes.TFBiomes;
import twilightforest.block.BlockTFMagicLogSpecial;
import uk.bobbytables.jeidsi.JEIDsILoadingPlugin;

import java.util.Random;

@Mixin(BlockTFMagicLogSpecial.class)
public class MixinBlockTFMagicLogSpecial {
@Inject(method = "doTreeOfTransformationEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"), locals = LocalCapture.CAPTURE_FAILHARD)
// For versions upto and including 3.8
@Inject(method = "doTreeOfTransformationEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void onChangeBiome(World world, BlockPos pos, Random rand, CallbackInfo ci, int i, BlockPos dPos, Biome biomeAt, Chunk chunkAt) {
((INewChunk) chunkAt).getIntBiomeArray()[(dPos.getZ() & 15) << 4 | (dPos.getX() & 15)] = Biome.getIdForBiome(TFBiomes.enchantedForest);
}

// For versions 3.9 and later
@Inject(method = "doTreeOfTransformationEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"), locals = LocalCapture.CAPTURE_FAILSOFT)
private void onChangeBiome(World world, BlockPos pos, Random rand, CallbackInfo ci, Biome targetBiome, int i, BlockPos dPos, Biome biomeAt, Chunk chunkAt) {
((INewChunk) chunkAt).getIntBiomeArray()[(dPos.getZ() & 15) << 4 | (dPos.getX() & 15)] = Biome.getIdForBiome(targetBiome);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private void sendChangedBiome(World world, BlockPos pos, Biome biome) {
IMessage message = new BiomeChangeMessage(pos.getX(), pos.getZ(), Biome.getIdForBiome(biome));
MessageManager.CHANNEL.sendToAllAround(
message,
new NetworkRegistry.TargetPoint(world.provider.getDimension(),pos.getX(), 128.0D, pos.getZ(), 128.0D)
new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), 128.0D, pos.getZ(), 128.0D)
);
}
}

0 comments on commit 5fec190

Please sign in to comment.