Skip to content

Commit

Permalink
Okay, I lied.
Browse files Browse the repository at this point in the history
Now all the support from JEIDsI should be added......I missed a few alright?
- Added HammerCore support
- Updated and added to AdvancedRocketry
- Fixed some more CreepingNether
- And a style changes

........this isn't the end, I can feel it now.
  • Loading branch information
ZombieHDGaming committed Aug 22, 2019
1 parent 7ece54f commit 1a67579
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 25 deletions.
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ dependencies {
compileOnly "2655:432:Creeping+Nether-2.2.2@jar"
compileOnly "2497:541:GeographiCraft-1.12-0.8.9b@jar"
compileOnly "2699:673:mystcraft-1.12.2-0.13.7.03@jar"
compileOnly "2575:801:AdvancedRocketry-1.12.2-1.4.0-88-universal@jar"
compileOnly "2710:204:HammerCore-1.12.2-2.0.4.7@jar"
compileOnly "2733:984:AdvancedRocketry-1.12.2-1.6.0-151-universal@jar"
compileOnly "2731:147:LibVulpes-1.12.2-0.4.1-59-universal@jar"
compileOnly "2655:56:worldedit-forge-mc1.12.2-6.1.10-SNAPSHOT-dist@jar"
compileOnly "2682:920:journeymap-1.12.2-5.5.4@jar"
compileOnly "2683:823:Bookshelf-1.12.2-2.3.577@jar"
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/dimdev/jeid/mixin/core/MixinChunk.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.dimdev.jeid.mixin.core;

import net.minecraft.init.Biomes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,51 @@
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import org.dimdev.jeid.INewChunk;
import org.dimdev.jeid.network.BiomeChangeMessage;
import org.dimdev.jeid.network.MessageManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Pseudo;
import zmaster587.advancedRocketry.network.PacketBiomeIDChange;
import zmaster587.advancedRocketry.util.BiomeHandler;
import zmaster587.libVulpes.network.PacketHandler;
import zmaster587.libVulpes.util.HashedBlockPosition;

@Pseudo
@Mixin(BiomeHandler.class)
public class MixinBiomeHandler {
@Overwrite(remap = false)
/**
* @author sk2048
*/
@Overwrite
public static void changeBiome(World world, int biomeId, BlockPos pos) {
changeBiome(world, biomeId, world.getChunk(pos), pos);
}
Chunk chunk = world.getChunk(pos);

@Overwrite(remap = false)
public static void changeBiome(World world, int biomeId, Chunk chunk, BlockPos pos) {
Biome biome = world.getBiome(pos);
Biome biomeTo = Biome.getBiome(biomeId);

if (biome == biomeTo) {
if (biome == biomeTo)
return;
}

int x = pos.getX();
int z = pos.getZ();

if (biome.topBlock != biomeTo.topBlock) {
int topBlockY = chunk.getHeightValue(x & 15, z & 15) - 1;
BlockPos yy = world.getHeight(pos);

while (!world.getBlockState(new BlockPos(x, topBlockY, z)).isOpaqueCube() && topBlockY > 0) topBlockY--;
if (topBlockY == 0) return;
for (; !world.getBlockState(yy).isOpaqueCube() || yy.getY() < 0; yy = yy.down()) ;

if (chunk.getBlockState(x & 15, topBlockY, z & 15) == biome.topBlock) {
chunk.setBlockState(new BlockPos(x & 15, topBlockY, z & 15), biomeTo.topBlock);
}
if (world.getBlockState(yy) == biome.topBlock)
world.setBlockState(yy, biomeTo.topBlock);
}

((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 15) << 4 | pos.getX() & 15] = biomeId;
((INewChunk) chunk).getIntBiomeArray()[(pos.getZ() & 0xF) << 4 | pos.getX() & 0xF] = biomeId;
chunk.markDirty();

NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 300);
MessageManager.CHANNEL.sendToAllAround(new BiomeChangeMessage(pos.getX(), pos.getY(), biomeId), point);
PacketHandler.sendToNearby(new PacketBiomeIDChange(chunk, world, new HashedBlockPosition(pos)), world.provider.getDimension(), pos, 256);
}

/**
* @author sk2048
*/
@Overwrite
public static void changeBiome(World world, int biomeId, Chunk chunk, BlockPos pos) {
changeBiome(world, biomeId, pos);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package org.dimdev.jeid.mixin.modsupport.advancedrocketry;

import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.chunk.Chunk;
import org.dimdev.jeid.INewChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import zmaster587.advancedRocketry.AdvancedRocketry;
import zmaster587.advancedRocketry.network.PacketBiomeIDChange;
import zmaster587.libVulpes.util.HashedBlockPosition;

@Pseudo
@Mixin(PacketBiomeIDChange.class)
public class MixinPacketBiomeIDChange {
@Shadow
Chunk chunk;
@Shadow
int worldId, xPos, zPos;
@Shadow
HashedBlockPosition pos;

int[] intArray;

@Inject(method = "<init>()V", at = @At("RETURN"))
public void onConstructed(CallbackInfo ci) {
intArray = new int[256];
}

/**
* @author sk2048
*/
@Overwrite(remap = false)
public void write(ByteBuf out) {
out.writeInt(worldId);
out.writeInt(chunk.x);
out.writeInt(chunk.z);
out.writeInt(pos.x);
out.writeShort(pos.y);
out.writeInt(pos.z);

for (int biomeId : ((INewChunk) chunk).getIntBiomeArray()) {
out.writeInt(biomeId);
}
}

/**
* @author sk2048
*/
@Overwrite(remap = false)
public void readClient(ByteBuf in) {
worldId = in.readInt();
xPos = in.readInt();
zPos = in.readInt();

pos.x = in.readInt();
pos.y = in.readShort();
pos.z = in.readInt();

for (int i = 0; i < 256; i++) {
int biomeId = in.readInt();
intArray[i] = biomeId;
}
}


/**
* @author sk2048
*/
@Overwrite(remap = false)
public void executeClient(EntityPlayer thePlayer) {
if (thePlayer.world.provider.getDimension() == worldId) {
chunk = thePlayer.world.getChunk(xPos, zPos);
if (chunk.isLoaded()) {
((INewChunk) chunk).setIntBiomeArray(intArray);
chunk.markDirty();
thePlayer.world.markBlockRangeForRenderUpdate(pos.getBlockPos(), pos.getBlockPos());

if (Minecraft.getMinecraft().gameSettings.particleSetting < 2)
AdvancedRocketry.proxy.spawnParticle("smallLazer", thePlayer.world, pos.x, pos.y, pos.z, 0, 0, 0);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public abstract class MixinCorruptorAbstract {
@Shadow public abstract Biome getBiome();

@Overwrite(remap = false)
public void corruptBiome(World world, BlockPos pos) {
public void corruptBiome(World world, BlockPos pos) {
if (!world.isBlockLoaded(pos)) return;
Biome oldBiome = world.getBiome(pos);
if (oldBiome == this.getBiome() || oldBiome != Biomes.HELL && this.getBiome() != Ref.biomeCreepingNether) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.dimdev.jeid.mixin.modsupport.hammercore;

import com.zeitheron.hammercore.utils.WorldLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import org.dimdev.jeid.INewChunk;
import org.dimdev.jeid.network.BiomeChangeMessage;
import org.dimdev.jeid.network.MessageManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(WorldLocation.class)
public class MixinWorldLocation {
@Shadow private World world;
@Shadow private BlockPos pos;

/**
*
* @author sk2048
*/
@Overwrite(remap = false)
public void setBiome(Biome biome) {
Chunk chunk = this.world.getChunk(this.pos);
((INewChunk) chunk).getIntBiomeArray()[(this.pos.getZ() & 0xF) << 4 | this.pos.getX() & 0xF] = Biome.getIdForBiome(biome);
chunk.markDirty();
if (!this.world.isRemote) {
MessageManager.CHANNEL.sendToAllAround(
new BiomeChangeMessage(this.pos.getX(), this.pos.getZ(), Biome.getIdForBiome(biome)),
new NetworkRegistry.TargetPoint(this.world.provider.getDimension(), this.pos.getX(), 128.0D, this.pos.getZ(), 128.0D)
);
}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/mixins.jeid.modsupport.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"mixins": [
"abyssalcraft.MixinBiomeUtil",
"advancedrocketry.MixinBiomeHandler",
"advancedrocketry.MixinPacketBiomeIDChange",
"biomesoplenty.MixinBOPCommand",
"biomesoplenty.MixinModBiomes",
"bookshelf.MixinWorldUtils",
Expand All @@ -17,6 +18,7 @@
"extrautils2.MixinWorldProviderSpecialDim",
"gaiadimension.MixinGenLayerGDRiverMix",
"geographicraft.MixinDimensionManager",
"hammercore.MixinWorldLocation",
"journeymap.MixinChunkMD",
"mystcraft.MixinBiomeReplacer",
"thaumcraft.MixinUtils",
Expand Down

0 comments on commit 1a67579

Please sign in to comment.