mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
crater biome test
This commit is contained in:
parent
8dde233a5b
commit
7e665932d1
@ -6,6 +6,8 @@ import com.hbm.config.FalloutConfigJSON;
|
||||
import com.hbm.config.FalloutConfigJSON.FalloutEntry;
|
||||
import com.hbm.entity.item.EntityFallingBlockNT;
|
||||
import com.hbm.saveddata.AuxSavedData;
|
||||
import com.hbm.world.WorldUtil;
|
||||
import com.hbm.world.biome.BiomeGenCrater;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -58,8 +60,10 @@ public class EntityFalloutRain extends Entity {
|
||||
for(int x = chunkPosX << 4; x <= (chunkPosX << 4) + 16; x++) {
|
||||
for(int z = chunkPosZ << 4; z <= (chunkPosZ << 4) + 16; z++) {
|
||||
stomp(x, z, Math.hypot(x - posX, z - posZ) * 100 / getScale());
|
||||
//WorldUtil.setBiome(worldObj, x, z, BiomeGenCrater.craterBiome);
|
||||
}
|
||||
}
|
||||
//WorldUtil.syncBiomeChange(worldObj, chunkPosX, chunkPosZ);
|
||||
|
||||
} else if (!outerChunksToProcess.isEmpty()) {
|
||||
long chunkPos = outerChunksToProcess.remove(outerChunksToProcess.size() - 1);
|
||||
@ -70,9 +74,11 @@ public class EntityFalloutRain extends Entity {
|
||||
double distance = Math.hypot(x - posX, z - posZ);
|
||||
if(distance <= getScale()) {
|
||||
stomp(x, z, distance * 100 / getScale());
|
||||
//WorldUtil.setBiome(worldObj, x, z, BiomeGenCrater.craterBiome);
|
||||
}
|
||||
}
|
||||
}
|
||||
//WorldUtil.syncBiomeChange(worldObj, chunkPosX, chunkPosZ);
|
||||
|
||||
} else {
|
||||
setDead();
|
||||
@ -161,6 +167,10 @@ public class EntityFalloutRain extends Entity {
|
||||
|
||||
for(FalloutEntry entry : FalloutConfigJSON.entries) {
|
||||
|
||||
if(b == Blocks.grass) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(entry.eval(worldObj, x, y, z, b, meta, dist)) {
|
||||
if(entry.isSolid()) {
|
||||
depth++;
|
||||
|
||||
@ -4,8 +4,11 @@ import java.util.List;
|
||||
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.saveddata.TomSaveData;
|
||||
import com.hbm.world.WorldUtil;
|
||||
import com.hbm.world.biome.BiomeGenCrater;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@ -40,11 +43,18 @@ public class ItemWandD extends Item {
|
||||
TimeAnalyzer.endCount();
|
||||
TimeAnalyzer.dump();*/
|
||||
|
||||
TomSaveData data = TomSaveData.forWorld(world);
|
||||
/*TomSaveData data = TomSaveData.forWorld(world);
|
||||
data.impact = true;
|
||||
data.fire = 0F;
|
||||
data.dust = 0F;
|
||||
data.markDirty();
|
||||
data.markDirty();*/
|
||||
|
||||
/*for(int i = -5; i <= 5; i++) {
|
||||
for(int j = -5; j <= 5; j++) {
|
||||
WorldUtil.setBiome(world, pos.blockX + i, pos.blockZ + j, BiomeGenCrater.craterBiome);
|
||||
WorldUtil.syncBiomeChangeBlock(world, pos.blockX + i, pos.blockZ + j);
|
||||
}
|
||||
}*/
|
||||
|
||||
/*EntityTomBlast tom = new EntityTomBlast(world);
|
||||
tom.posX = pos.blockX;
|
||||
|
||||
@ -28,8 +28,8 @@ public class BiomeSyncPacket implements IMessage {
|
||||
}
|
||||
|
||||
public BiomeSyncPacket(int blockX, int blockZ, byte biome) {
|
||||
this.chunkX = blockX << 4;
|
||||
this.chunkZ = blockZ << 4;
|
||||
this.chunkX = blockX >> 4;
|
||||
this.chunkZ = blockZ >> 4;
|
||||
this.blockX = (byte) (blockX & 15);
|
||||
this.blockZ = (byte) (blockZ & 15);
|
||||
this.biome = biome;
|
||||
@ -63,7 +63,6 @@ public class BiomeSyncPacket implements IMessage {
|
||||
this.blockX = buf.readByte();
|
||||
this.blockZ = buf.readByte();
|
||||
} else {
|
||||
buf.writeBoolean(true);
|
||||
this.biomeArray = new byte[256];
|
||||
for(int i = 0; i < 256; i++) {
|
||||
this.biomeArray[i] = buf.readByte();
|
||||
@ -80,12 +79,15 @@ public class BiomeSyncPacket implements IMessage {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(!world.getChunkProvider().chunkExists(m.chunkX, m.chunkZ)) return null;
|
||||
Chunk chunk = world.getChunkFromChunkCoords(m.chunkX, m.chunkZ);
|
||||
chunk.isModified = true;
|
||||
|
||||
if(m.biomeArray == null) {
|
||||
chunk.getBiomeArray()[(m.blockZ & 15) << 4 | (m.blockX & 15)] = m.biome;
|
||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, m.chunkX << 4, 255, m.chunkZ << 4);
|
||||
} else {
|
||||
for(int i = 0; i < 256; i++) {
|
||||
chunk.getBiomeArray()[i] = m.biomeArray[i];
|
||||
world.markBlockRangeForRenderUpdate(m.chunkX << 4, 0, m.chunkZ << 4, (m.chunkX << 4) + 15, 255, (m.chunkZ << 4) + 15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,18 @@ public class WorldUtil {
|
||||
public static void setBiome(World world, int x, int z, BiomeGenBase biome) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)] = (byte)(biome.biomeID & 255);
|
||||
chunk.isModified = true;
|
||||
}
|
||||
|
||||
public static void syncBiomeChange(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
||||
}
|
||||
|
||||
public static void syncBiomeChangeBlock(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
byte biome = chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)];
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, biome), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
||||
}
|
||||
|
||||
public static void syncBiomeChange(World world, Chunk chunk) {
|
||||
@ -69,12 +81,6 @@ public class WorldUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void syncBiomeChange(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
//byte biome = chunk.getBiomeArray()[(z & 15) << 4 | (x & 15)];
|
||||
PacketDispatcher.wrapper.sendToAllAround(new BiomeSyncPacket(x, z, chunk.getBiomeArray()), new TargetPoint(world.provider.dimensionId, x, 128, z, 1024D));
|
||||
}
|
||||
|
||||
public static Chunk provideChunk(WorldServer world, int chunkX, int chunkZ) {
|
||||
ChunkProviderServer provider = world.theChunkProviderServer;
|
||||
|
||||
36
src/main/java/com/hbm/world/biome/BiomeGenCrater.java
Normal file
36
src/main/java/com/hbm/world/biome/BiomeGenCrater.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.hbm.world.biome;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class BiomeGenCrater extends BiomeGenBase {
|
||||
|
||||
//public static final BiomeGenBase craterBiome = new BiomeGenCrater(50 /* TEMP */).setDisableRain();
|
||||
|
||||
public BiomeGenCrater(int id) {
|
||||
super(id);
|
||||
this.waterColorMultiplier = 0xE0FFAE; //swamp color
|
||||
this.setBiomeName("Crater");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBiomeGrassColor(int x, int y, int z) {
|
||||
double noise = plantNoise.func_151601_a((double) x * 0.225D, (double) z * 0.225D);
|
||||
return noise < -0.1D ? 0x606060 : 0x505050;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBiomeFoliageColor(int x, int y, int z) {
|
||||
return 0x6A7039;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSkyColorByTemp(float temp) {
|
||||
//return 0x66BBA9;
|
||||
return 0x6B9189;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user