diff --git a/build.gradle b/build.gradle index 5ee59bb..299a5ff 100644 --- a/build.gradle +++ b/build.gradle @@ -126,38 +126,42 @@ dependencies { } } - compileOnly rfg.deobf( "curse.maven:BiomesOPlenty-220318:2842510" ) - compileOnly rfg.deobf( "curse.maven:twilightforest-227639:3051450" ) - compileOnly rfg.deobf( "curse.maven:Thaumcraft-223628:2629023" ) - compileOnly rfg.deobf( "curse.maven:AbyssalCraft-53686:3425234" ) - compileOnly rfg.deobf( "curse.maven:Creeping+Nether-268104:2655432" ) - compileOnly rfg.deobf( "curse.maven:GeographiCraft-76544:2497541" ) - compileOnly rfg.deobf( "curse.maven:mystcraft-224599:2958490" ) - compileOnly rfg.deobf( "curse.maven:HammerCore-247401:3366814" ) + compileOnly rfg.deobf("curse.maven:biomes-o-plenty-220318:2842510") + compileOnly rfg.deobf("curse.maven:twilightforest-227639:3051450") + compileOnly rfg.deobf("curse.maven:thaumcraft-223628:2629023") + compileOnly rfg.deobf("curse.maven:abyssalcraft-53686:3425234") + compileOnly rfg.deobf("curse.maven:creeping-nether-268104:2655432") + compileOnly rfg.deobf("curse.maven:geographicraft-76544:2497541") + compileOnly rfg.deobf("curse.maven:mystcraft-224599:2958490") + compileOnly rfg.deobf("curse.maven:hammercore-247401:3366814") // Advanced Rocketry 1.7.0 - compileOnly rfg.deobf( "curse.maven:AdvancedRocketry-236542:3015079" ) + compileOnly rfg.deobf("curse.maven:advancedrocketry-236542:3015079") // Advanced Rocketry 2.0.0 - // compileOnly rfg.deobf( "curse.maven:AdvancedRocketry-236542:4671856" ) - compileOnly rfg.deobf( "curse.maven:LibVulpes-236541:3434864" ) - compileOnly rfg.deobf( "curse.maven:worldedit-225608:2941712" ) - compileOnly rfg.deobf( "curse.maven:journeymap-32274:2916002" ) - compileOnly rfg.deobf( "curse.maven:Bookshelf-228525:2836960" ) - compileOnly rfg.deobf( "curse.maven:CyclopsCore-232758:3159497" ) - compileOnly rfg.deobf( "curse.maven:extrautils2-225561:2678374" ) - compileOnly rfg.deobf( "curse.maven:TheBetweenlands-243363:3248202" ) - compileOnly rfg.deobf( "curse.maven:TofuCraftReload-317469:3115668" ) - compileOnly rfg.deobf( "curse.maven:tropicraft-254794:2713918" ) - compileOnly rfg.deobf( "curse.maven:gaiadimension-302529:2724738" ) - compileOnly rfg.deobf( "curse.maven:BiomeTweaker-228895:3112142" ) - compileOnly rfg.deobf( "curse.maven:baubles-227083:2518667" ) - compileOnly rfg.deobf( "curse.maven:Patchouli-306770:3162874" ) - compileOnly rfg.deobf( "curse.maven:bewitchment-285439:3256343" ) - compileOnly rfg.deobf( "curse.maven:compact-machines-224218:2707509") - compileOnly rfg.deobf( "curse.maven:moreplanets-261990:5063201" ) - compileOnly rfg.deobf( "curse.maven:atum2-59621:3116599" ) - - compileOnly rfg.deobf( "curse.maven:CubicChunks-292243:5135427" ) - compileOnly rfg.deobf( "curse.maven:RTGU-648514:4396319" ) + // compileOnly rfg.deobf("curse.maven:advancedrocketry-236542:4671856") + compileOnly rfg.deobf("curse.maven:libvulpes-236541:3434864") + compileOnly rfg.deobf("curse.maven:worldedit-225608:2941712") + compileOnly rfg.deobf("curse.maven:journeymap-32274:2916002") + compileOnly rfg.deobf("curse.maven:bookshelf-228525:2836960") + compileOnly rfg.deobf("curse.maven:cyclopscore-232758:3159497") + compileOnly rfg.deobf("curse.maven:extrautils2-225561:2678374") + compileOnly rfg.deobf("curse.maven:betweenlands-243363:3248202") + compileOnly rfg.deobf("curse.maven:tofucraftreload-317469:3115668") + compileOnly rfg.deobf("curse.maven:tropicraft-254794:2713918") + compileOnly rfg.deobf("curse.maven:gaiadimension-302529:2724738") + compileOnly rfg.deobf("curse.maven:biometweaker-228895:3112142") + compileOnly rfg.deobf("curse.maven:baubles-227083:2518667") + compileOnly rfg.deobf("curse.maven:patchouli-306770:3162874") + compileOnly rfg.deobf("curse.maven:bewitchment-285439:3256343") + compileOnly rfg.deobf("curse.maven:compact-machines-224218:2707509") + compileOnly rfg.deobf("curse.maven:moreplanets-261990:5063201") + compileOnly rfg.deobf("curse.maven:atum2-59621:3116599") + compileOnly rfg.deobf("curse.maven:naturescompass-252848:2893527") + compileOnly rfg.deobf("curse.maven:biomestaff-299907:2597577") + compileOnly rfg.deobf("curse.maven:kathairis-291129:2710928") + + compileOnly rfg.deobf("curse.maven:cubicchunks-292243:5135427") + // RTG+ should also work + compileOnly rfg.deobf("curse.maven:rtg-unofficial-648514:4696300") // implementation "curse.maven:LibVulpes-236541:3801015" // implementation "curse.maven:Baubles-227083:2518667" diff --git a/src/main/java/org/dimdev/jeid/core/JEIDMixinLoader.java b/src/main/java/org/dimdev/jeid/core/JEIDMixinLoader.java index 98a92ae..dd4ae50 100644 --- a/src/main/java/org/dimdev/jeid/core/JEIDMixinLoader.java +++ b/src/main/java/org/dimdev/jeid/core/JEIDMixinLoader.java @@ -34,6 +34,9 @@ public List getMixinConfigs() { if (Loader.isModLoaded("biomesoplenty")) { configs.add("mixins.jeid.biomesoplenty.json"); } + if (Loader.isModLoaded("biomestaff")) { + configs.add("mixins.jeid.biomestaff.json"); + } if (Loader.isModLoaded("biometweaker")) { configs.add("mixins.jeid.biometweaker.json"); } @@ -67,12 +70,21 @@ public List getMixinConfigs() { if (Loader.isModLoaded("journeymap")) { configs.add("mixins.jeid.journeymap.json"); } + if (Loader.isModLoaded("kathairis")) { + configs.add("mixins.jeid.kathairis.json"); + } if (Loader.isModLoaded("moreplanets")) { configs.add("mixins.jeid.moreplanets.json"); } if (Loader.isModLoaded("mystcraft")) { configs.add("mixins.jeid.mystcraft.json"); } + if (Loader.isModLoaded("naturescompass")) { + configs.add("mixins.jeid.naturescompass.json"); + } + if (Loader.isModLoaded("rtg")) { + configs.add("mixins.jeid.rtg.json"); + } if (Loader.isModLoaded("thaumcraft")) { configs.add("mixins.jeid.thaumcraft.json"); } diff --git a/src/main/java/org/dimdev/jeid/ducks/ICustomBiomesForGeneration.java b/src/main/java/org/dimdev/jeid/ducks/ICustomBiomesForGeneration.java new file mode 100644 index 0000000..b6990b0 --- /dev/null +++ b/src/main/java/org/dimdev/jeid/ducks/ICustomBiomesForGeneration.java @@ -0,0 +1,18 @@ +package org.dimdev.jeid.ducks; + +import net.minecraft.world.biome.Biome; + +/** + * Duck interface for mixins into certain mods with custom chunk generators. + * If your mod uses a custom chunk generator and modifies the biome array returned by: + *

{@code this.world.getBiomeProvider().getBiomes(...)},

+ * implement this in your IChunkGenerator. + */ +public interface ICustomBiomesForGeneration { + /** + * Returns the modified biome array (usually called {@code biomesForGeneration}). + * + * @return the modified biome array + */ + Biome[] getBiomesForGeneration(); +} diff --git a/src/main/java/org/dimdev/jeid/ducks/IModSupportsJEID.java b/src/main/java/org/dimdev/jeid/ducks/IModSupportsJEID.java new file mode 100644 index 0000000..7de0e4e --- /dev/null +++ b/src/main/java/org/dimdev/jeid/ducks/IModSupportsJEID.java @@ -0,0 +1,10 @@ +package org.dimdev.jeid.ducks; + +/** + * Duck interface for any mod that already sets up the Chunk's intBiomeArray + * in {@link net.minecraft.world.gen.IChunkGenerator#generateChunk}. + * If your mod uses a custom chunk generator and has explicit compat with JEID, + * implement this in your IChunkGenerator. + */ +public interface IModSupportsJEID { +} diff --git a/src/main/java/org/dimdev/jeid/mixin/core/network/client/MixinNetHandlerPlayClient.java b/src/main/java/org/dimdev/jeid/mixin/core/network/client/MixinNetHandlerPlayClient.java new file mode 100644 index 0000000..6feb3fd --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/core/network/client/MixinNetHandlerPlayClient.java @@ -0,0 +1,25 @@ +package org.dimdev.jeid.mixin.core.network.client; + +import net.minecraft.client.network.NetHandlerPlayClient; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.spongepowered.asm.mixin.injection.Slice; + +@Mixin(value = NetHandlerPlayClient.class) +public class MixinNetHandlerPlayClient { + /** + * @reason Account for JEID blockstate format (32 bits, not 16). + */ + @ModifyConstant(method = "handleSpawnObject", + slice = @Slice( + id = "fallingBlock", + from = @At(value = "NEW", target = "(Lnet/minecraft/world/World;DDDLnet/minecraft/block/state/IBlockState;)Lnet/minecraft/entity/item/EntityFallingBlock;"), + to = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;getStateById(I)Lnet/minecraft/block/state/IBlockState;") + ), constant = @Constant(intValue = 0xFFFF, slice = "fallingBlock")) + private int reid$getJEIDBlockstate(int constant) { + return 0xFFFFFFFF; + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/core/world/MixinChunkProviderServer.java b/src/main/java/org/dimdev/jeid/mixin/core/world/MixinChunkProviderServer.java index 099d6b1..54431c0 100644 --- a/src/main/java/org/dimdev/jeid/mixin/core/world/MixinChunkProviderServer.java +++ b/src/main/java/org/dimdev/jeid/mixin/core/world/MixinChunkProviderServer.java @@ -4,9 +4,11 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.ChunkProviderServer; -import net.minecraftforge.fml.common.Loader; +import net.minecraft.world.gen.IChunkGenerator; import com.llamalad7.mixinextras.sugar.Local; +import org.dimdev.jeid.ducks.ICustomBiomesForGeneration; +import org.dimdev.jeid.ducks.IModSupportsJEID; import org.dimdev.jeid.ducks.INewChunk; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -15,7 +17,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import rtg.world.biome.BiomeProviderRTG; @Mixin(ChunkProviderServer.class) public class MixinChunkProviderServer { @@ -23,6 +24,9 @@ public class MixinChunkProviderServer { private final Biome[] reusableBiomeList = new Biome[256]; @Shadow @Final + public IChunkGenerator chunkGenerator; + @Shadow + @Final public WorldServer world; /** @@ -31,14 +35,21 @@ public class MixinChunkProviderServer { */ @Inject(method = "provideChunk", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/gen/IChunkGenerator;generateChunk(II)Lnet/minecraft/world/chunk/Chunk;")) private void reid$initializeBiomeArray(int x, int z, CallbackInfoReturnable cir, @Local Chunk chunk) { - if (!Loader.isModLoaded("rtg") || !(world.getBiomeProvider() instanceof BiomeProviderRTG)) { - Biome[] biomes = world.getBiomeProvider().getBiomes(reusableBiomeList, x * 16, z * 16, 16, 16); - - INewChunk newChunk = (INewChunk) chunk; - int[] intBiomeArray = newChunk.getIntBiomeArray(); - for (int i = 0; i < intBiomeArray.length; ++i) { - intBiomeArray[i] = Biome.getIdForBiome(biomes[i]); - } + if (this.chunkGenerator instanceof IModSupportsJEID) { + return; + } + Biome[] biomes; + if (this.chunkGenerator instanceof ICustomBiomesForGeneration) { + // Some chunk generators modify the biomes beyond those returned by the BiomeProvider. + biomes = ((ICustomBiomesForGeneration) this.chunkGenerator).getBiomesForGeneration(); + } + else { + biomes = world.getBiomeProvider().getBiomes(reusableBiomeList, x * 16, z * 16, 16, 16); + } + INewChunk newChunk = (INewChunk) chunk; + int[] intBiomeArray = newChunk.getIntBiomeArray(); + for (int i = 0; i < intBiomeArray.length; ++i) { + intBiomeArray[i] = Biome.getIdForBiome(biomes[i]); } } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/biomestaff/MixinBiomeStaffUtil.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/biomestaff/MixinBiomeStaffUtil.java new file mode 100644 index 0000000..0483816 --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/biomestaff/MixinBiomeStaffUtil.java @@ -0,0 +1,42 @@ +package org.dimdev.jeid.mixin.modsupport.biomestaff; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.biome.Biome; + +import net.minecraftforge.common.util.Constants; + +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.CallbackInfoReturnable; +import p455w0rd.biomestaff.item.ItemBiomeStaff; +import p455w0rd.biomestaff.util.BiomeStaffUtil; + +@Mixin(value = BiomeStaffUtil.class, remap = false) +public class MixinBiomeStaffUtil { + /** + * @reason Rewrite to get int biome id from NBT. + */ + @SuppressWarnings("ConstantConditions") + @Inject(method = "getBiomeFromStaff", at = @At(value = "HEAD"), cancellable = true) + private static void reid$getIntBiome(ItemStack staff, CallbackInfoReturnable cir) { + if (staff.hasTagCompound() && staff.getTagCompound().hasKey(ItemBiomeStaff.TAG_BIOME, Constants.NBT.TAG_INT)) { + Biome biome = Biome.getBiome(staff.getTagCompound().getInteger(ItemBiomeStaff.TAG_BIOME)); + cir.setReturnValue(biome); + return; + } + cir.setReturnValue(null); + } + + /** + * @reason Rewrite to construct NBT based on int biome id. + */ + @Inject(method = "createTagForBiome", at = @At(value = "HEAD"), cancellable = true) + private static void reid$createIntTag(Biome biome, CallbackInfoReturnable cir) { + NBTTagCompound tag = new NBTTagCompound(); + int biomeId = Biome.getIdForBiome(biome); + tag.setInteger(ItemBiomeStaff.TAG_BIOME, biomeId); + cir.setReturnValue(tag); + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/biomestaff/MixinItemBiomeStaff.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/biomestaff/MixinItemBiomeStaff.java new file mode 100644 index 0000000..f7f57da --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/biomestaff/MixinItemBiomeStaff.java @@ -0,0 +1,71 @@ +package org.dimdev.jeid.mixin.modsupport.biomestaff; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.util.Constants; + +import com.llamalad7.mixinextras.sugar.Local; +import org.dimdev.jeid.ducks.INewChunk; +import org.dimdev.jeid.network.MessageManager; +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.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import p455w0rd.biomestaff.init.ModNetworking; +import p455w0rd.biomestaff.item.ItemBiomeStaff; +import p455w0rd.biomestaff.network.PacketSyncBiomeStaff; + +@Mixin(value = ItemBiomeStaff.class) +public class MixinItemBiomeStaff { + @ModifyArg(method = "onItemRightClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NBTTagCompound;hasKey(Ljava/lang/String;I)Z"), index = 1) + private int reid$checkIntNBTKey(int original) { + return Constants.NBT.TAG_INT; + } + + /** + * @reason Rewrite sneak use logic to save int biome id. + */ + @Inject(method = "onItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getChunk(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/world/chunk/Chunk;", ordinal = 0), cancellable = true) + private void reid$sneakUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ, CallbackInfoReturnable cir, + @Local ItemStack heldStack, @Local NBTTagCompound tag) { + Chunk chunk = world.getChunk(pos); + int biomeId = ((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 0xF) << 4 | (pos.getX() & 0xF)]; + if (!tag.hasKey(ItemBiomeStaff.TAG_BIOME, Constants.NBT.TAG_INT) || tag.getInteger(ItemBiomeStaff.TAG_BIOME) != biomeId) { + tag.setInteger(ItemBiomeStaff.TAG_BIOME, biomeId); + heldStack.setTagCompound(tag); + ModNetworking.getInstance().sendTo(new PacketSyncBiomeStaff(heldStack.getTagCompound()), (EntityPlayerMP)player); + } + cir.setReturnValue(EnumActionResult.SUCCESS); + } + + /** + * @reason Rewrite biome application logic to use int biome id. + */ + @Inject(method = "onItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/NBTTagCompound;getByte(Ljava/lang/String;)B", ordinal = 1), cancellable = true) + private void reid$applyBiome(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ, CallbackInfoReturnable cir, + @Local ItemStack heldStack, @Local NBTTagCompound tag, @Local(ordinal = 1) int rad) { + int toBiomeId = tag.getInteger(ItemBiomeStaff.TAG_BIOME); + for(int ix = pos.getX() - rad; ix <= pos.getX() + rad; ++ix) { + for(int iz = pos.getZ() - rad; iz <= pos.getZ() + rad; ++iz) { + Chunk chunk = world.getChunk(new BlockPos(ix, pos.getY(), iz)); + int[] biomeArray = ((INewChunk) chunk).getIntBiomeArray(); + int biomeIdAtPos = biomeArray[(iz & 0xF) << 4 | (ix & 0xF)]; + if (biomeIdAtPos != toBiomeId) { + chunk.markDirty(); + biomeArray[(iz & 0xF) << 4 | (ix & 0xF)] = toBiomeId; + } + } + } + MessageManager.sendClientsBiomeAreaChange(world, pos, rad, toBiomeId); + cir.setReturnValue(EnumActionResult.SUCCESS); + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinCommandSetBiome.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinCommandSetBiome.java index 3f3f1fb..859dbb1 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinCommandSetBiome.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/biometweaker/MixinCommandSetBiome.java @@ -16,6 +16,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.Slice; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Arrays; @@ -29,7 +30,18 @@ public class MixinCommandSetBiome { JEID.LOGGER.info("setting biome at {}, {}", x, z); // Method calls markDirty() ((INewChunk) chunk).getIntBiomeArray()[(z & 0xF) << 4 | x & 0xF] = id; - MessageManager.sendClientsBiomeChange(world, new BlockPos(x, coord.getY(), z), id); + } + + @Inject(method = "execute", + slice = @Slice( + from = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/BlockPos;getX()I", ordinal = 0), + to = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/BlockPos;getX()I", ordinal = 2) + ), + at = @At(value = "INVOKE", target = "Lnet/minecraft/command/ICommandSender;sendMessage(Lnet/minecraft/util/text/ITextComponent;)V")) + private void reid$sendBiomeAreaChange(MinecraftServer server, ICommandSender sender, String[] args, CallbackInfo ci, + @Local BlockPos coord, @Local World world, @Local Integer radius, + @Local(ordinal = 0) int id) { + MessageManager.sendClientsBiomeAreaChange(world, coord, radius, id); } @Inject(method = "execute", at = @At(value = "INVOKE", target = "Ljava/util/Arrays;fill([BB)V", remap = false)) @@ -47,6 +59,6 @@ public class MixinCommandSetBiome { int posX = chunkX << 4; int posZ = chunkZ << 4; ((INewChunk) world.getChunk(chunkX, chunkZ)).setIntBiomeArray(Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length)); - MessageManager.sendClientsBiomeArray(world, new BlockPos(posX, coord.getY(), posZ), Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length)); + MessageManager.sendClientsBiomeChunkChange(world, new BlockPos(posX, coord.getY(), posZ), Arrays.copyOf(intBiomeArray.get(), intBiomeArray.get().length)); } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/bookshelf/MixinWorldUtils.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/bookshelf/MixinWorldUtils.java index f101f08..4d84a4e 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/bookshelf/MixinWorldUtils.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/bookshelf/MixinWorldUtils.java @@ -23,7 +23,7 @@ public class MixinWorldUtils { // Method calls getDirty() Arrays.fill(biomeArray, Biome.getIdForBiome(biome)); if (!world.isRemote) { - MessageManager.sendClientsBiomeArray(world, pos, Arrays.copyOf(biomeArray, biomeArray.length)); + MessageManager.sendClientsBiomeChunkChange(world, pos, Arrays.copyOf(biomeArray, biomeArray.length)); } } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/creepingnether/MixinCorruptorAbstract.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/creepingnether/MixinCorruptorAbstract.java index 1b5a4d1..cf17561 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/creepingnether/MixinCorruptorAbstract.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/creepingnether/MixinCorruptorAbstract.java @@ -29,6 +29,6 @@ public abstract class MixinCorruptorAbstract { @Redirect(method = "corruptBiome", at = @At(value = "INVOKE", target = "Lcom/cutievirus/creepingnether/entity/MessageCorruptBiome;sendMessage(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lcom/cutievirus/creepingnether/entity/CorruptorAbstract;)V")) private void reid$sendBiomeMessage(World world, BlockPos pos, CorruptorAbstract corruptor) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(getBiome())); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(getBiome())); } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/cyclopscore/MixinWorldHelpers.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/cyclopscore/MixinWorldHelpers.java index b86d7d8..418ae9b 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/cyclopscore/MixinWorldHelpers.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/cyclopscore/MixinWorldHelpers.java @@ -28,7 +28,7 @@ public class MixinWorldHelpers { @Inject(method = "setBiome", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getChunkProvider()Lnet/minecraft/world/chunk/IChunkProvider;", remap = true), cancellable = true) private static void reid$sendBiomeMessage(World world, BlockPos pos, Biome biome, CallbackInfo ci) { if (!world.isRemote) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome)); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(biome)); } ci.cancel(); } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/extrautils2/MixinBiomeManip.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/extrautils2/MixinBiomeManip.java index bb67e8c..321b45f 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/extrautils2/MixinBiomeManip.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/extrautils2/MixinBiomeManip.java @@ -24,7 +24,7 @@ public class MixinBiomeManip { ((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 0xF) << 4 | pos.getX() & 0xF] = Biome.getIdForBiome(biome); chunk.markDirty(); if (!world.isRemote) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome)); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(biome)); } ci.cancel(); } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/hammercore/MixinWorldLocation.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/hammercore/MixinWorldLocation.java index 229af9a..2e1041b 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/hammercore/MixinWorldLocation.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/hammercore/MixinWorldLocation.java @@ -30,6 +30,6 @@ public class MixinWorldLocation { @Redirect(method = "setBiome", at = @At(value = "INVOKE", target = "Lcom/zeitheron/hammercore/net/HCNet;sendToAllAround(Lcom/zeitheron/hammercore/net/IPacket;Lnet/minecraftforge/fml/common/network/NetworkRegistry$TargetPoint;)V")) private void reid$sendBiomeMessage(HCNet instance, IPacket packet, NetworkRegistry.TargetPoint point, Biome biome) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome)); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(biome)); } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/kathairis/MixinChunkGeneratorMystic.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/kathairis/MixinChunkGeneratorMystic.java new file mode 100644 index 0000000..441faef --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/kathairis/MixinChunkGeneratorMystic.java @@ -0,0 +1,19 @@ +package org.dimdev.jeid.mixin.modsupport.kathairis; + +import net.minecraft.world.biome.Biome; + +import mod.krevik.world.dimension.ChunkGeneratorMystic; +import org.dimdev.jeid.ducks.ICustomBiomesForGeneration; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(value = ChunkGeneratorMystic.class, remap = false) +public class MixinChunkGeneratorMystic implements ICustomBiomesForGeneration { + @Shadow + private Biome[] biomesForGeneration; + + @Override + public Biome[] getBiomesForGeneration() { + return biomesForGeneration; + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/naturescompass/MixinBiomeUtils.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/naturescompass/MixinBiomeUtils.java new file mode 100644 index 0000000..5d9866c --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/naturescompass/MixinBiomeUtils.java @@ -0,0 +1,16 @@ +package org.dimdev.jeid.mixin.modsupport.naturescompass; + +import com.chaosthedude.naturescompass.util.BiomeUtils; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; +import net.minecraft.world.biome.Biome; +import org.dimdev.jeid.biome.BiomeError; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(value = BiomeUtils.class, remap = false) +public class MixinBiomeUtils { + @ModifyReturnValue(method = "biomeIsBlacklisted", at = @At(value = "RETURN")) + private static boolean reid$hideErrorBiome(boolean original, Biome biome) { + return (biome instanceof BiomeError) || original; + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/realisticterraingen/MixinChunkGeneratorRTG.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/realisticterraingen/MixinChunkGeneratorRTG.java new file mode 100644 index 0000000..d056c6f --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/realisticterraingen/MixinChunkGeneratorRTG.java @@ -0,0 +1,9 @@ +package org.dimdev.jeid.mixin.modsupport.realisticterraingen; + +import org.dimdev.jeid.ducks.IModSupportsJEID; +import org.spongepowered.asm.mixin.Mixin; +import rtg.world.gen.ChunkGeneratorRTG; + +@Mixin(value = ChunkGeneratorRTG.class, remap = false) +public class MixinChunkGeneratorRTG implements IModSupportsJEID { +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/thaumcraft/MixinUtils.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/thaumcraft/MixinUtils.java index 1087bcb..e833da5 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/thaumcraft/MixinUtils.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/thaumcraft/MixinUtils.java @@ -25,6 +25,6 @@ public class MixinUtils { @Redirect(method = "setBiomeAt(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/biome/Biome;Z)V", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper;sendToAllAround(Lnet/minecraftforge/fml/common/network/simpleimpl/IMessage;Lnet/minecraftforge/fml/common/network/NetworkRegistry$TargetPoint;)V")) private static void reid$sendBiomeMessage(SimpleNetworkWrapper instance, IMessage message, NetworkRegistry.TargetPoint point, World world, BlockPos pos, Biome biome) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome)); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(biome)); } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/thebetweenlands/MixinBlockSpreadingDeath.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/thebetweenlands/MixinBlockSpreadingDeath.java index 3b49047..0a3b114 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/thebetweenlands/MixinBlockSpreadingDeath.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/thebetweenlands/MixinBlockSpreadingDeath.java @@ -19,7 +19,7 @@ public class MixinBlockSpreadingDeath { // Method calls markDirty() ((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 15) << 4 | pos.getX() & 15] = Biome.getIdForBiome(biome); if (!world.isRemote) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome)); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(biome)); } } } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/twilightforest/MixinBlockTFMagicLogSpecial.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/twilightforest/MixinBlockTFMagicLogSpecial.java index e35f986..303b2b1 100644 --- a/src/main/java/org/dimdev/jeid/mixin/modsupport/twilightforest/MixinBlockTFMagicLogSpecial.java +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/twilightforest/MixinBlockTFMagicLogSpecial.java @@ -21,7 +21,7 @@ public class MixinBlockTFMagicLogSpecial { */ @Inject(method = "sendChangedBiome", at = @At(value = "HEAD"), cancellable = true) private void reid$rewriteSendChangedBiome(World world, BlockPos pos, Biome biome, CallbackInfo ci) { - MessageManager.sendClientsBiomeChange(world, pos, Biome.getIdForBiome(biome)); + MessageManager.sendClientsBiomePosChange(world, pos, Biome.getIdForBiome(biome)); ci.cancel(); } diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/worldedit/MixinBiomeCommands.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/worldedit/MixinBiomeCommands.java new file mode 100644 index 0000000..dcf8ff9 --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/worldedit/MixinBiomeCommands.java @@ -0,0 +1,48 @@ +package org.dimdev.jeid.mixin.modsupport.worldedit; + +import java.util.Set; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.chunk.Chunk; + +import com.llamalad7.mixinextras.sugar.Local; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.LocalSession; +import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.command.BiomeCommands; +import com.sk89q.worldedit.entity.Player; +import com.sk89q.worldedit.forge.ForgeWorld; +import com.sk89q.worldedit.function.visitor.FlatRegionVisitor; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.biome.BaseBiome; +import org.dimdev.jeid.ducks.INewChunk; +import org.dimdev.jeid.network.MessageManager; +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; + +@Mixin(value = BiomeCommands.class, remap = false) +public class MixinBiomeCommands { + /** + * @reason Send per-chunk packets (instead of per-position in {@link ForgeWorld}) to client to reduce network usage. + */ + @Inject(method = "setBiome", at = @At(value = "INVOKE", target = "Lcom/sk89q/worldedit/entity/Player;print(Ljava/lang/String;)V"), cancellable = true) + private void reid$sendBiomeChunksChange(Player player, LocalSession session, EditSession editSession, BaseBiome target, boolean atPosition, CallbackInfo ci, + @Local World world, @Local Region region, @Local FlatRegionVisitor visitor) { + if (!(world instanceof ForgeWorld)) return; + net.minecraft.world.World trueWorld = ((ForgeWorld) world).getWorld(); + Set chunks = region.getChunks(); + for (Vector2D chunkPos : chunks) { + BlockPos pos = new BlockPos(chunkPos.getBlockX() << 4, 0.0D, chunkPos.getBlockZ() << 4); + Chunk chunk = trueWorld.getChunk(chunkPos.getBlockX(), chunkPos.getBlockZ()); + chunk.markDirty(); + // Using chunks instead of area because WorldEdit allows non-cuboid regions. + MessageManager.sendClientsBiomeChunkChange(trueWorld, pos, ((INewChunk) chunk).getIntBiomeArray()); + } + // Changes are immediately reflected on client. + player.print("Biomes were changed in " + visitor.getAffected() + " columns."); + ci.cancel(); + } +} diff --git a/src/main/java/org/dimdev/jeid/mixin/modsupport/worldedit/MixinForgeWorld.java b/src/main/java/org/dimdev/jeid/mixin/modsupport/worldedit/MixinForgeWorld.java new file mode 100644 index 0000000..5e89589 --- /dev/null +++ b/src/main/java/org/dimdev/jeid/mixin/modsupport/worldedit/MixinForgeWorld.java @@ -0,0 +1,22 @@ +package org.dimdev.jeid.mixin.modsupport.worldedit; + +import net.minecraft.world.chunk.Chunk; + +import com.llamalad7.mixinextras.sugar.Local; +import com.sk89q.worldedit.Vector2D; +import com.sk89q.worldedit.forge.ForgeWorld; +import com.sk89q.worldedit.world.biome.BaseBiome; +import org.dimdev.jeid.ducks.INewChunk; +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.CallbackInfoReturnable; + +@Mixin(value = ForgeWorld.class, remap = false) +public class MixinForgeWorld { + @Inject(method = "setBiome", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B", remap = true)) + private void reid$toIntBiomeArray(Vector2D position, BaseBiome biome, CallbackInfoReturnable cir, + @Local Chunk chunk) { + ((INewChunk) chunk).getIntBiomeArray()[(position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF] = biome.getId(); + } +} diff --git a/src/main/java/org/dimdev/jeid/network/BiomeAreaChangeMessage.java b/src/main/java/org/dimdev/jeid/network/BiomeAreaChangeMessage.java new file mode 100644 index 0000000..a2a7ec4 --- /dev/null +++ b/src/main/java/org/dimdev/jeid/network/BiomeAreaChangeMessage.java @@ -0,0 +1,71 @@ +package org.dimdev.jeid.network; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fml.common.network.simpleimpl.IMessage; +import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; +import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; + +import io.netty.buffer.ByteBuf; +import org.dimdev.jeid.ducks.INewChunk; + +public class BiomeAreaChangeMessage implements IMessage { + private int x; + private int z; + private int radius; + private int biomeId; + + public BiomeAreaChangeMessage() {} + + public BiomeAreaChangeMessage(int x, int z, int radius, int biomeId) { + this.x = x; + this.z = z; + this.radius = radius; + this.biomeId = biomeId; + } + + @Override + public void fromBytes(ByteBuf byteBuf) { + PacketBuffer packetBuffer = new PacketBuffer(byteBuf); + x = packetBuffer.readVarInt(); + z = packetBuffer.readVarInt(); + radius = packetBuffer.readVarInt(); + biomeId = packetBuffer.readVarInt(); + } + + @Override + public void toBytes(ByteBuf byteBuf) { + PacketBuffer packetBuffer = new PacketBuffer(byteBuf); + packetBuffer.writeVarInt(x); + packetBuffer.writeVarInt(z); + packetBuffer.writeVarInt(radius); + packetBuffer.writeVarInt(biomeId); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(BiomeAreaChangeMessage message, MessageContext ctx) { + Minecraft.getMinecraft().addScheduledTask(() -> { + WorldClient world = Minecraft.getMinecraft().world; + int x = message.x; + int z = message.z; + int rad = message.radius; + for(int ix = x - rad; ix <= x + rad; ++ix) { + for(int iz = z - rad; iz <= z + rad; ++iz) { + Chunk chunk = world.getChunk(new BlockPos(ix, 0, iz)); + int[] biomeArray = ((INewChunk) chunk).getIntBiomeArray(); + int biomeIdAtPos = biomeArray[(iz & 0xF) << 4 | (ix & 0xF)]; + if (biomeIdAtPos != message.biomeId) { + biomeArray[(iz & 0xF) << 4 | (ix & 0xF)] = message.biomeId; + } + } + } + world.markBlockRangeForRenderUpdate(new BlockPos(x - rad, 0, z - rad), new BlockPos(x + rad, world.getHeight(), z + rad)); + }); + return null; + } + } +} diff --git a/src/main/java/org/dimdev/jeid/network/BiomeArrayMessage.java b/src/main/java/org/dimdev/jeid/network/BiomeChunkChangeMessage.java similarity index 86% rename from src/main/java/org/dimdev/jeid/network/BiomeArrayMessage.java rename to src/main/java/org/dimdev/jeid/network/BiomeChunkChangeMessage.java index a6a5055..d99f8b3 100644 --- a/src/main/java/org/dimdev/jeid/network/BiomeArrayMessage.java +++ b/src/main/java/org/dimdev/jeid/network/BiomeChunkChangeMessage.java @@ -11,14 +11,14 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import org.dimdev.jeid.ducks.INewChunk; -public class BiomeArrayMessage implements IMessage { +public class BiomeChunkChangeMessage implements IMessage { private int chunkX; private int chunkZ; private int[] biomeArray; - public BiomeArrayMessage() {} + public BiomeChunkChangeMessage() {} - public BiomeArrayMessage(int chunkX, int chunkZ, int[] biomeArray) { + public BiomeChunkChangeMessage(int chunkX, int chunkZ, int[] biomeArray) { this.chunkX = chunkX; this.chunkZ = chunkZ; this.biomeArray = biomeArray; @@ -40,9 +40,9 @@ public void toBytes(ByteBuf byteBuf) { packetBuffer.writeVarIntArray(biomeArray); } - public static class Handler implements IMessageHandler { + public static class Handler implements IMessageHandler { @Override - public IMessage onMessage(BiomeArrayMessage message, MessageContext ctx) { + public IMessage onMessage(BiomeChunkChangeMessage message, MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(() -> { WorldClient world = Minecraft.getMinecraft().world; Chunk chunk = world.getChunk(message.chunkX, message.chunkZ); diff --git a/src/main/java/org/dimdev/jeid/network/BiomeChangeMessage.java b/src/main/java/org/dimdev/jeid/network/BiomePositionChangeMessage.java similarity index 85% rename from src/main/java/org/dimdev/jeid/network/BiomeChangeMessage.java rename to src/main/java/org/dimdev/jeid/network/BiomePositionChangeMessage.java index a1646a9..803458a 100644 --- a/src/main/java/org/dimdev/jeid/network/BiomeChangeMessage.java +++ b/src/main/java/org/dimdev/jeid/network/BiomePositionChangeMessage.java @@ -11,14 +11,14 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; import org.dimdev.jeid.ducks.INewChunk; -public class BiomeChangeMessage implements IMessage { +public class BiomePositionChangeMessage implements IMessage { private int x; private int z; private int biomeId; - public BiomeChangeMessage() {} + public BiomePositionChangeMessage() {} - public BiomeChangeMessage(int x, int z, int biomeId) { + public BiomePositionChangeMessage(int x, int z, int biomeId) { this.x = x; this.z = z; this.biomeId = biomeId; @@ -40,9 +40,9 @@ public void toBytes(ByteBuf byteBuf) { packetBuffer.writeVarInt(biomeId); } - public static class Handler implements IMessageHandler { + public static class Handler implements IMessageHandler { @Override - public IMessage onMessage(BiomeChangeMessage message, MessageContext ctx) { + public IMessage onMessage(BiomePositionChangeMessage message, MessageContext ctx) { Minecraft.getMinecraft().addScheduledTask(() -> { WorldClient world = Minecraft.getMinecraft().world; Chunk chunk = world.getChunk(new BlockPos(message.x, 0, message.z)); diff --git a/src/main/java/org/dimdev/jeid/network/MessageManager.java b/src/main/java/org/dimdev/jeid/network/MessageManager.java index 8981da6..cfee80f 100644 --- a/src/main/java/org/dimdev/jeid/network/MessageManager.java +++ b/src/main/java/org/dimdev/jeid/network/MessageManager.java @@ -11,21 +11,31 @@ public class MessageManager { public static final SimpleNetworkWrapper CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(JEID.MODID); public static void init() { - CHANNEL.registerMessage(BiomeArrayMessage.Handler.class, BiomeArrayMessage.class, 0, Side.CLIENT); - CHANNEL.registerMessage(BiomeChangeMessage.Handler.class, BiomeChangeMessage.class, 1, Side.CLIENT); + CHANNEL.registerMessage(BiomeChunkChangeMessage.Handler.class, BiomeChunkChangeMessage.class, 0, Side.CLIENT); + CHANNEL.registerMessage(BiomePositionChangeMessage.Handler.class, BiomePositionChangeMessage.class, 1, Side.CLIENT); + CHANNEL.registerMessage(BiomeAreaChangeMessage.Handler.class, BiomeAreaChangeMessage.class, 2, Side.CLIENT); } - public static void sendClientsBiomeChange(World world, BlockPos pos, int biomeId) { + public static void sendClientsBiomePosChange(World world, BlockPos pos, int biomeId) { MessageManager.CHANNEL.sendToAllTracking( - new BiomeChangeMessage(pos.getX(), pos.getZ(), biomeId), + new BiomePositionChangeMessage(pos.getX(), pos.getZ(), biomeId), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 0.0D) // Range ignored ); } - public static void sendClientsBiomeArray(World world, BlockPos pos, int[] biomeArr) { + public static void sendClientsBiomeAreaChange(World world, BlockPos pos, int radius, int biomeId) { MessageManager.CHANNEL.sendToAllTracking( - new BiomeArrayMessage(pos.getX() >> 4, pos.getZ() >> 4, biomeArr), // Expects chunkX/Z + new BiomeAreaChangeMessage(pos.getX(), pos.getZ(), radius, biomeId), new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 0.0D) // Range ignored ); } + + public static void sendClientsBiomeChunkChange(World world, BlockPos pos, int[] biomeArr) { + MessageManager.CHANNEL.sendToAllTracking( + new BiomeChunkChangeMessage(pos.getX() >> 4, pos.getZ() >> 4, biomeArr), // Expects chunkX/Z + new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 0.0D) // Range ignored + ); + } + + } diff --git a/src/main/resources/mixins.jeid.biomestaff.json b/src/main/resources/mixins.jeid.biomestaff.json new file mode 100644 index 0000000..af4cf1b --- /dev/null +++ b/src/main/resources/mixins.jeid.biomestaff.json @@ -0,0 +1,11 @@ +{ + "package": "org.dimdev.jeid.mixin.modsupport.biomestaff", + "required": true, + "refmap": "mixins.jeid.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinBiomeStaffUtil", + "MixinItemBiomeStaff" + ] +} diff --git a/src/main/resources/mixins.jeid.core.json b/src/main/resources/mixins.jeid.core.json index f0d150e..73220ad 100644 --- a/src/main/resources/mixins.jeid.core.json +++ b/src/main/resources/mixins.jeid.core.json @@ -26,6 +26,7 @@ "client": [ "enchant.client.MixinItemEnchantedBook", "misc.client.MixinRenderGlobal", + "network.client.MixinNetHandlerPlayClient", "potion.client.MixinNetHandlerPlayClient", "world.client.MixinChunk", "world.client.MixinWorldSummary" diff --git a/src/main/resources/mixins.jeid.gaiadimension.json b/src/main/resources/mixins.jeid.gaiadimension.json index beda94e..8e047ea 100644 --- a/src/main/resources/mixins.jeid.gaiadimension.json +++ b/src/main/resources/mixins.jeid.gaiadimension.json @@ -1,5 +1,7 @@ { "package": "org.dimdev.jeid.mixin.modsupport.gaiadimension", + "required": true, + "refmap": "mixins.jeid.refmap.json", "minVersion": "0.8", "compatibilityLevel": "JAVA_8", "mixins": [ diff --git a/src/main/resources/mixins.jeid.kathairis.json b/src/main/resources/mixins.jeid.kathairis.json new file mode 100644 index 0000000..02ca645 --- /dev/null +++ b/src/main/resources/mixins.jeid.kathairis.json @@ -0,0 +1,10 @@ +{ + "package": "org.dimdev.jeid.mixin.modsupport.kathairis", + "required": true, + "refmap": "mixins.jeid.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinChunkGeneratorMystic" + ] +} diff --git a/src/main/resources/mixins.jeid.naturescompass.json b/src/main/resources/mixins.jeid.naturescompass.json new file mode 100644 index 0000000..f1b0db0 --- /dev/null +++ b/src/main/resources/mixins.jeid.naturescompass.json @@ -0,0 +1,10 @@ +{ + "package": "org.dimdev.jeid.mixin.modsupport.naturescompass", + "required": true, + "refmap": "mixins.jeid.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinBiomeUtils" + ] +} diff --git a/src/main/resources/mixins.jeid.rtg.json b/src/main/resources/mixins.jeid.rtg.json new file mode 100644 index 0000000..cd956ee --- /dev/null +++ b/src/main/resources/mixins.jeid.rtg.json @@ -0,0 +1,10 @@ +{ + "package": "org.dimdev.jeid.mixin.modsupport.realisticterraingen", + "required": true, + "refmap": "mixins.jeid.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "MixinChunkGeneratorRTG" + ] +} diff --git a/src/main/resources/mixins.jeid.worldedit.json b/src/main/resources/mixins.jeid.worldedit.json index a26e34e..972e8cb 100644 --- a/src/main/resources/mixins.jeid.worldedit.json +++ b/src/main/resources/mixins.jeid.worldedit.json @@ -5,6 +5,8 @@ "minVersion": "0.8", "compatibilityLevel": "JAVA_8", "mixins": [ - "MixinBaseBlock" + "MixinBaseBlock", + "MixinBiomeCommands", + "MixinForgeWorld" ] }