WarpDrive update
+ Recipe + Multi-tick jumps: 500 blocks per tick + Space modifications: RP2 ores, IC2 ores, stars + Something else
This commit is contained in:
parent
6e78f0a4f4
commit
baf85e338e
8 changed files with 257 additions and 88 deletions
|
@ -3,11 +3,11 @@ package cr0s.WarpDrive;
|
|||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
|
||||
public class CommonProxy {
|
||||
public static final String BLOCK_TEXTURE_OFFLINE = "/cr0s/WarpDrive/CORE_OFFLINE.png";
|
||||
public static final String BLOCK_TEXTURE_ONLINE = "/cr0s/WarpDrive/CORE_ONLINE.png";
|
||||
public static final String BLOCK_TEXTURE_OFFLINE = "CORE_OFFLINE.png";
|
||||
public static final String BLOCK_TEXTURE_ONLINE = "CORE_ONLINE.png";
|
||||
|
||||
public void registerJumpEntity() {
|
||||
//EntityRegistry.registerModEntity(ThreadJump.class, "EntityJump", 1, WarpDrive.instance, 80, 3, false);
|
||||
EntityRegistry.registerModEntity(EntityJump.class, "EntityJump", 1, WarpDrive.instance, 80, 1, false);
|
||||
}
|
||||
|
||||
public void registerRenderers() {
|
||||
|
|
|
@ -12,7 +12,6 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public class EntityJump extends Entity {
|
||||
|
@ -48,6 +47,11 @@ public class EntityJump extends Entity {
|
|||
public JumpBlock ship[];
|
||||
public TileEntityReactor reactor;
|
||||
|
||||
boolean isJumping = false;
|
||||
int currentIndexInShip = 0;
|
||||
|
||||
private final int BLOCKS_PER_TICK = 500;
|
||||
|
||||
public EntityJump(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
@ -78,6 +82,8 @@ public class EntityJump extends Entity {
|
|||
System.out.println("[JE] Entity created");
|
||||
|
||||
this.reactor = parReactor;
|
||||
|
||||
this.isJumping = false;
|
||||
}
|
||||
|
||||
public void killEntity(String reason) {
|
||||
|
@ -92,18 +98,37 @@ public class EntityJump extends Entity {
|
|||
@SideOnly(Side.SERVER)
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (worldObj.editingBlocks || !on || minY < 0 || maxY > 255) {
|
||||
if (!on || minY < 0 || maxY > 255) {
|
||||
killEntity("Entity is disabled or Y-coord error! Cannot jump.");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("[JUMP] onUpdate() called");
|
||||
|
||||
// Блокируем мир
|
||||
worldObj.editingBlocks = true;
|
||||
|
||||
|
||||
if (!isJumping) {
|
||||
System.out.println("[JE] Preparing to jump...");
|
||||
prepareToJump();
|
||||
} else {
|
||||
System.out.println("[JE] Moving ship part: " + ((int)ship.length / BLOCKS_PER_TICK) + "/" + ((int)currentIndexInShip / BLOCKS_PER_TICK) + ", [" + ship.length + ", " + currentIndexInShip + "]");
|
||||
if (currentIndexInShip >= ship.length-1) {
|
||||
isJumping = false;
|
||||
finishJump();
|
||||
} else {
|
||||
moveShip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void prepareToJump() {
|
||||
// Блокируем миры
|
||||
if (dir == -1 && maxY >= 255 && worldObj.provider.dimensionId != WarpDrive.instance.spaceDimID) {
|
||||
DimensionManager.getWorld(WarpDrive.instance.spaceDimID).editingBlocks = true;
|
||||
} else if (dir == -2 && (minY - distance < 0) && worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
DimensionManager.getWorld(0).editingBlocks = true;
|
||||
} else {
|
||||
worldObj.editingBlocks = true;
|
||||
}
|
||||
|
||||
distance = getPossibleJumpDistance();
|
||||
if (distance <= 0) {
|
||||
if (distance <= 0 && (dir != -1 && worldObj.provider.dimensionId != 0)) {
|
||||
killEntity("Not enough space for jump.");
|
||||
return;
|
||||
}
|
||||
|
@ -116,24 +141,34 @@ public class EntityJump extends Entity {
|
|||
int shipSize = getRealShipSize();
|
||||
|
||||
saveShip(shipSize, false);
|
||||
|
||||
removeShip();
|
||||
|
||||
moveShip();
|
||||
|
||||
|
||||
isJumping = true;
|
||||
this.currentIndexInShip = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Закончить прыжок: переместить Entity, разблокировать мир и удалить себя
|
||||
*/
|
||||
public void finishJump() {
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(Xmin, minY, Zmin, Xmax, maxY, Zmax);
|
||||
boolean fromSpace = (worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID && minY - distance < 0 && dir == -2);
|
||||
boolean toSpace = (worldObj.provider.dimensionId != WarpDrive.instance.spaceDimID && maxY >= 255);
|
||||
moveEntity(axisalignedbb, distance, dir, toSpace, fromSpace);
|
||||
|
||||
// Разблокируем мир
|
||||
worldObj.editingBlocks = false;
|
||||
// Разблокируем миры
|
||||
if (dir == -1 && maxY >= 255 && worldObj.provider.dimensionId != WarpDrive.instance.spaceDimID) {
|
||||
DimensionManager.getWorld(WarpDrive.instance.spaceDimID).editingBlocks = false;
|
||||
} else if (dir == -2 && (minY - distance < 0) && worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
DimensionManager.getWorld(0).editingBlocks = false;
|
||||
} else {
|
||||
worldObj.editingBlocks = false;
|
||||
}
|
||||
|
||||
// Прыжок окончен
|
||||
killEntity("");
|
||||
on = false;
|
||||
on = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Удаление корабля из мира
|
||||
*/
|
||||
|
@ -202,28 +237,25 @@ public class EntityJump extends Entity {
|
|||
* Перемещение корабля
|
||||
*/
|
||||
public void moveShip() {
|
||||
// 1. Прыжок в космос
|
||||
if (dir == -1 && maxY >= 255 && worldObj.provider.dimensionId != WarpDrive.instance.spaceDimID) {
|
||||
System.out.println("[JUMP] Jumping TO SPACE");
|
||||
DimensionManager.getWorld(WarpDrive.instance.spaceDimID).editingBlocks = true;
|
||||
for (int indexInShip = 0; indexInShip <= ship.length - 1; indexInShip++) {
|
||||
moveBlockToSpace(indexInShip, distance, dir);
|
||||
// 1. Прыжок в космос
|
||||
if (dir == -1 && maxY >= 255 && worldObj.provider.dimensionId != WarpDrive.instance.spaceDimID) {
|
||||
for (int index = 0; index < Math.min(BLOCKS_PER_TICK, ship.length - currentIndexInShip - 1); index++) {
|
||||
this.currentIndexInShip++;
|
||||
moveBlockToSpace(currentIndexInShip, distance, dir);
|
||||
}
|
||||
// 2. Прыжок из космоса
|
||||
} else if (dir == -2 && (minY - distance < 0) && worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
for (int index = 0; index < Math.min(BLOCKS_PER_TICK, ship.length - currentIndexInShip - 1); index++) {
|
||||
this.currentIndexInShip++;
|
||||
moveBlockFromSpace(currentIndexInShip, distance, dir);
|
||||
}
|
||||
// 3. Обычный прыжок
|
||||
} else {
|
||||
for (int index = 0; index < Math.min(BLOCKS_PER_TICK, ship.length - currentIndexInShip - 1); index++) {
|
||||
this.currentIndexInShip++;
|
||||
moveBlock(currentIndexInShip, distance, dir);
|
||||
}
|
||||
}
|
||||
DimensionManager.getWorld(WarpDrive.instance.spaceDimID).editingBlocks = false;
|
||||
// 2. Прыжок из космоса
|
||||
} else if (dir == -2 && (minY - distance < 0) && worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
System.out.println("[JUMP] Jumping from SPACE");
|
||||
DimensionManager.getWorld(0).editingBlocks = true;
|
||||
for (int indexInShip = 0; indexInShip <= ship.length - 1; indexInShip++) {
|
||||
moveBlockFromSpace(indexInShip, distance, dir);
|
||||
}
|
||||
DimensionManager.getWorld(0).editingBlocks = false;
|
||||
// 3. Обычный прыжок
|
||||
} else {
|
||||
for (int indexInShip = 0; indexInShip <= ship.length - 1; indexInShip++) {
|
||||
moveBlock(indexInShip, distance, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,7 +286,6 @@ public class EntityJump extends Entity {
|
|||
}
|
||||
|
||||
// Взрываем точку столкновения с препятствием, если это явно не стыковка
|
||||
// Сила взрыва: TNT * длинну прыжка - (расстояние до препятствия - 5)
|
||||
if (blowPoints > 5 && this.dir != -1) {
|
||||
worldObj.createExplosion((Entity) null, blowX, blowY, blowZ, Math.min(4F * 30, 4F * (distance / 2)), true);
|
||||
}
|
||||
|
@ -322,9 +353,13 @@ public class EntityJump extends Entity {
|
|||
if (obj == null || !(obj instanceof Entity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Entity entity = (Entity) obj;
|
||||
|
||||
if (entity instanceof EntityJump) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int oldEntityX = (int) entity.posX;
|
||||
int oldEntityY = (int) entity.posY;
|
||||
int oldEntityZ = (int) entity.posZ;
|
||||
|
|
77
src/cr0s/WarpDrive/SpaceEventHandler.java
Normal file
77
src/cr0s/WarpDrive/SpaceEventHandler.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Невесомость и отключение текучести жидкостей
|
||||
*/
|
||||
package cr0s.WarpDrive;
|
||||
|
||||
import keepcalm.mods.events.events.LiquidFlowEvent;
|
||||
import keepcalm.mods.events.events.PlayerMoveEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
|
||||
/**
|
||||
* Обработчик событий в мире Space
|
||||
* @author Cr0s
|
||||
*/
|
||||
public class SpaceEventHandler {
|
||||
@ForgeSubscribe
|
||||
public void onBlockFlow(LiquidFlowEvent lfe) {
|
||||
// В космосе жидкости не текут, так что событие отменяется
|
||||
System.out.println("onLiquidFlow: liquid is flowing");
|
||||
if (lfe.world.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
System.out.println("onLiquidFlow: [blocking flow]");
|
||||
lfe.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onPlayerMove(PlayerMoveEvent pme) {
|
||||
//System.out.println("onPlayerMove(): event called.");
|
||||
|
||||
// Движение происходит в космическом пространстве
|
||||
if (pme.entity.worldObj.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
if (pme.entity instanceof EntityPlayer) {
|
||||
// Отправить назад на Землю
|
||||
if (pme.newY < -50.0D) {
|
||||
((EntityPlayerMP)pme.entityPlayer).mcServer.getConfigurationManager().transferPlayerToDimension(((EntityPlayerMP) pme.entityPlayer), 0, new SpaceTeleporter(DimensionManager.getWorld(WarpDrive.instance.spaceDimID), 0, MathHelper.floor_double(pme.newX), 255, MathHelper.floor_double(pme.newZ)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
// Если это игрок в режиме Creative, то игнорируем
|
||||
if (pme.entity instanceof EntityPlayer && ((EntityPlayer)pme.entity).capabilities.isCreativeMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
//System.out.println("onPlayerMove(): oldY: " + pme.oldY + " newY: " + pme.newY);
|
||||
// Происходит падение
|
||||
if (pme.oldY > pme.newY && pme.flying) {
|
||||
//System.out.println("onPlayerMove(): [blocking falling]");
|
||||
if (pme.entity instanceof EntityPlayer) {
|
||||
pme.entityPlayer.setPositionAndUpdate(pme.oldX, pme.oldY, pme.oldZ);
|
||||
} else {
|
||||
pme.entity.setPosition(pme.oldX, pme.oldY, pme.oldZ);
|
||||
}
|
||||
|
||||
pme.setCanceled(true); // Предотвращаем падение
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void onEntityJoinedWorld(EntityJoinWorldEvent ejwe) {
|
||||
if (!(ejwe.entity instanceof EntityPlayer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ejwe.world.provider.dimensionId == WarpDrive.instance.spaceDimID) {
|
||||
((EntityPlayer)ejwe.entity).capabilities.allowFlying = true;
|
||||
} else
|
||||
{
|
||||
((EntityPlayer)ejwe.entity).capabilities.allowFlying = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
|
@ -15,13 +14,11 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event;
|
||||
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
|
||||
|
||||
public class SpaceGenerator extends ChunkProviderGenerate implements IChunkProvider {
|
||||
|
||||
private Random rand;
|
||||
private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1];
|
||||
|
||||
/**
|
||||
* Reference to the World object.
|
||||
|
@ -42,7 +39,8 @@ public class SpaceGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||
byte[] var3 = new byte[32768];
|
||||
generateTerrain(par1, par2, var3);
|
||||
//this.caveGenerator.generate(this, this.worldObj, par1, par2, var3);
|
||||
|
||||
this.biomesForGeneration[0] = WarpDrive.spaceBiome;
|
||||
|
||||
Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
|
||||
|
||||
var4.generateSkylightMap();
|
||||
|
@ -70,6 +68,8 @@ public class SpaceGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||
|
||||
@Override
|
||||
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) {
|
||||
this.biomesForGeneration[0] = WarpDrive.spaceBiome;
|
||||
|
||||
// if (!"Space".equals(worldObj.provider.getDimensionName())) {
|
||||
// }
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class SpaceGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||
int var7 = var4 + 1;
|
||||
byte var8 = 17;
|
||||
int var9 = var4 + 1;
|
||||
// this.biomesForGeneration[0] = WarpDrive.spaceBiome;
|
||||
this.biomesForGeneration[0] = WarpDrive.spaceBiome;
|
||||
this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9);
|
||||
|
||||
for (int var10 = 0; var10 < var4; ++var10) {
|
||||
|
|
|
@ -8,25 +8,30 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.biome.WorldChunkManager;
|
||||
import net.minecraft.world.biome.WorldChunkManagerHell;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
public class SpaceProvider extends WorldProvider {
|
||||
|
||||
@Override
|
||||
public String getDimensionName() {
|
||||
return "Space";
|
||||
}
|
||||
public int exitXCoord;
|
||||
public int exitYCoord;
|
||||
public int exitZCoord;
|
||||
public int exitDimID;
|
||||
|
||||
|
||||
public SpaceProvider() {
|
||||
this.hasNoSky = true;
|
||||
this.worldChunkMgr = new WorldChunkManagerHell(WarpDrive.spaceBiome, 0.0F, 0.0F);
|
||||
this.hasNoSky = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDimensionName() {
|
||||
return "Space";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRespawnHere() {
|
||||
return true;
|
||||
|
@ -50,6 +55,12 @@ public class SpaceProvider extends WorldProvider {
|
|||
super.resetRainAndThunder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiomeGenForCoords(int x, int z)
|
||||
{
|
||||
return WarpDrive.spaceBiome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) {
|
||||
super.setAllowedSpawnTypes(false, false);
|
||||
|
@ -58,7 +69,7 @@ public class SpaceProvider extends WorldProvider {
|
|||
|
||||
@Override
|
||||
public float calculateCelestialAngle(long par1, float par3) {
|
||||
return 180;
|
||||
return 0.3F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +88,7 @@ public class SpaceProvider extends WorldProvider {
|
|||
{
|
||||
float var3 = 1.0F - (float)var2 / 15.0F;
|
||||
this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -107,14 +118,12 @@ public class SpaceProvider extends WorldProvider {
|
|||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) {
|
||||
setCloudRenderer(new CloudRenderBlank());
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool((double) 0, (double) 0, (double) 0);
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3 getFogColor(float par1, float par2) {
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool((double) .2, (double) .2, (double) .2);
|
||||
|
||||
return this.worldObj.getWorldVec3Pool().getVecFromPool((double) 0, (double) 0, (double) 0);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -130,13 +139,6 @@ public class SpaceProvider extends WorldProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IRenderHandler getSkyRenderer()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWelcomeMessage()
|
||||
{
|
||||
|
@ -174,6 +176,20 @@ public class SpaceProvider extends WorldProvider {
|
|||
|
||||
if (worldObj.isAirBlock(var5.posX, var5.posY, var5.posZ)) {
|
||||
worldObj.setBlockWithNotify(var5.posX, var5.posY, var5.posZ, Block.stone.blockID);
|
||||
|
||||
worldObj.setBlockWithNotify(var5.posX + 1, var5.posY + 1, var5.posZ, Block.glass.blockID);
|
||||
worldObj.setBlockWithNotify(var5.posX + 1, var5.posY + 2, var5.posZ, Block.glass.blockID);
|
||||
|
||||
worldObj.setBlockWithNotify(var5.posX - 1, var5.posY + 1, var5.posZ, Block.glass.blockID);
|
||||
worldObj.setBlockWithNotify(var5.posX - 1, var5.posY + 2, var5.posZ, Block.glass.blockID);
|
||||
|
||||
worldObj.setBlockWithNotify(var5.posX, var5.posY + 1, var5.posZ + 1, Block.glass.blockID);
|
||||
worldObj.setBlockWithNotify(var5.posX, var5.posY + 2, var5.posZ + 1, Block.glass.blockID);
|
||||
|
||||
worldObj.setBlockWithNotify(var5.posX, var5.posY + 1, var5.posZ - 1, Block.glass.blockID);
|
||||
worldObj.setBlockWithNotify(var5.posX, var5.posY + 2, var5.posZ - 1, Block.glass.blockID);
|
||||
|
||||
worldObj.setBlockWithNotify(var5.posX, var5.posY + 3, var5.posZ, Block.glass.blockID);
|
||||
}
|
||||
return var5;
|
||||
}
|
||||
|
@ -185,7 +201,7 @@ public class SpaceProvider extends WorldProvider {
|
|||
|
||||
@Override
|
||||
public boolean isDaytime() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ public class SpaceWorldGenerator implements IWorldGenerator {
|
|||
public final int MOON_RADIUS = 32;
|
||||
|
||||
// Радиус звезды
|
||||
public final int STAR_RADIUS = 64;
|
||||
public final int STAR_RADIUS = 80;
|
||||
|
||||
// Выше 128 по Y почти ничего не будет сгенерировано
|
||||
public final int Y_LIMIT = 128;
|
||||
|
@ -84,6 +84,12 @@ public class SpaceWorldGenerator implements IWorldGenerator {
|
|||
// Ядро астероида из алмаза
|
||||
world.setBlockWithNotify(x, y, z, Block.blockDiamond.blockID);
|
||||
}
|
||||
|
||||
// Ледяные астероиды
|
||||
if (random.nextInt(2000) == 1) {
|
||||
System.out.println("Generating ice asteroid at " + x + " " + y + " " + z);
|
||||
generateAsteroidOfBlock(world, x, y, z, 6, 11, Block.ice.blockID);
|
||||
}
|
||||
|
||||
// Алмазные астероиды
|
||||
if (random.nextInt(10000) == 1) {
|
||||
|
@ -260,34 +266,38 @@ public class SpaceWorldGenerator implements IWorldGenerator {
|
|||
|
||||
|
||||
// Ставим блоки по всем осям в текущей точке
|
||||
int blockID;
|
||||
int blockID, meta = 0;
|
||||
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
blockID = (forcedID == 0) ? getRandomSurfaceBlockID(world.rand, corrupted) : forcedID;
|
||||
world.setBlock(xCoord + x, yCoord + y, zCoord + z, blockID);
|
||||
world.setBlock(xCoord - x, yCoord + y, zCoord + z, blockID);
|
||||
if (blockID > 2000 && blockID < 2500) { meta = blockID % 10; blockID = blockID / 10; }
|
||||
world.setBlockAndMetadata(xCoord + x, yCoord + y, zCoord + z, blockID, meta);
|
||||
world.setBlockAndMetadata(xCoord - x, yCoord + y, zCoord + z, blockID, meta);
|
||||
}
|
||||
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
blockID = (forcedID == 0) ? getRandomSurfaceBlockID(world.rand, corrupted) : forcedID;
|
||||
world.setBlock(xCoord + x, yCoord - y, zCoord + z, blockID);
|
||||
world.setBlock(xCoord + x, yCoord + y, zCoord - z, blockID);
|
||||
if (blockID > 2000 && blockID < 2500) { meta = blockID % 10; blockID = blockID / 10; }
|
||||
world.setBlockAndMetadata(xCoord + x, yCoord - y, zCoord + z, blockID, meta);
|
||||
world.setBlockAndMetadata(xCoord + x, yCoord + y, zCoord - z, blockID, meta);
|
||||
}
|
||||
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
blockID = (forcedID == 0) ? getRandomSurfaceBlockID(world.rand, corrupted) : forcedID;
|
||||
world.setBlock(xCoord - x, yCoord - y, zCoord + z, blockID);
|
||||
world.setBlock(xCoord + x, yCoord - y, zCoord - z, blockID);
|
||||
if (blockID > 2000 && blockID < 2500) { meta = blockID % 10; blockID = blockID / 10; }
|
||||
world.setBlockAndMetadata(xCoord - x, yCoord - y, zCoord + z, blockID, meta);
|
||||
world.setBlockAndMetadata(xCoord + x, yCoord - y, zCoord - z, blockID, meta);
|
||||
}
|
||||
|
||||
if (!corrupted || world.rand.nextInt(10) != 1)
|
||||
{
|
||||
blockID = (forcedID == 0) ? getRandomSurfaceBlockID(world.rand, corrupted) : forcedID;
|
||||
world.setBlock(xCoord - x, yCoord + y, zCoord - z, blockID);
|
||||
world.setBlock(xCoord - x, yCoord - y, zCoord - z, blockID);
|
||||
if (blockID > 2000 && blockID < 2500) { meta = blockID % 10; blockID = blockID / 10; }
|
||||
world.setBlockAndMetadata(xCoord - x, yCoord + y, zCoord - z, blockID, meta);
|
||||
world.setBlockAndMetadata(xCoord - x, yCoord - y, zCoord - z, blockID, meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,15 +318,35 @@ public class SpaceWorldGenerator implements IWorldGenerator {
|
|||
Block.oreCoal.blockID,
|
||||
Block.oreEmerald.blockID,
|
||||
Block.oreLapis.blockID,
|
||||
Block.oreRedstoneGlowing.blockID,};
|
||||
Block.oreRedstoneGlowing.blockID,
|
||||
|
||||
// IC ores
|
||||
4093, // Uranium
|
||||
4094, // Tin
|
||||
4095, // Copper ore
|
||||
4095, // Copper ore
|
||||
};
|
||||
|
||||
int redPowerOreBlockID = 242;
|
||||
int[] redPowerOres = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7 // Рубины -- Николит
|
||||
};
|
||||
|
||||
|
||||
int blockID = Block.stone.blockID;
|
||||
if (corrupted) {
|
||||
blockID = Block.cobblestone.blockID;
|
||||
}
|
||||
|
||||
if (random.nextInt(15) == 1) {
|
||||
blockID = ores[random.nextInt(ores.length - 1)];
|
||||
if (random.nextInt(10) == 1) {
|
||||
switch (random.nextInt(2)) {
|
||||
case 0:
|
||||
blockID = ores[random.nextInt(ores.length - 1)];
|
||||
break;
|
||||
case 1: // OREM -- ORE (Руда), M - метаданные
|
||||
blockID = Integer.parseInt(new StringBuilder().append(redPowerOreBlockID).append(redPowerOres[random.nextInt(redPowerOres.length - 1)]).toString());
|
||||
}
|
||||
|
||||
} else if (random.nextInt(500) == 1) {
|
||||
blockID = Block.oreDiamond.blockID;
|
||||
}
|
||||
|
|
|
@ -247,7 +247,10 @@ public class TileEntityReactor extends TileEntity implements IEnergySink {
|
|||
jump.on = true;
|
||||
|
||||
System.out.println("[TE-WC] Calling onUpdate()...");
|
||||
jump.onUpdate();
|
||||
|
||||
worldObj.spawnEntityInWorld(jump);
|
||||
|
||||
//jump.onUpdate();
|
||||
//worldObj.updateEntities();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
@ -13,14 +12,15 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import ic2.api.Items;
|
||||
|
||||
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "0.0.1")
|
||||
@NetworkMod(clientSideRequired = false, serverSideRequired = true)
|
||||
|
@ -53,10 +53,15 @@ public class WarpDrive {
|
|||
|
||||
@Init
|
||||
public void load(FMLInitializationEvent event) {
|
||||
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
|
||||
|
||||
|
||||
LanguageRegistry.addName(warpCore, "Warp-drive Reactor Core");
|
||||
GameRegistry.registerBlock(warpCore, "warpCore");
|
||||
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
|
||||
|
||||
|
||||
proxy.registerRenderers();
|
||||
proxy.registerJumpEntity();
|
||||
|
||||
|
@ -71,11 +76,14 @@ public class WarpDrive {
|
|||
@PostInit
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
space = DimensionManager.getWorld(spaceDimID);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici",
|
||||
'i', Items.getItem("iridiumPlate"), 'm', Items.getItem("advancedMachine"), 'c', Items.getItem("advancedCircuit"));
|
||||
}
|
||||
|
||||
//@SideOnly(Side.SERVER)
|
||||
private void registerSpaceDimension() {
|
||||
spaceBiome = (new BiomeSpace(23)).setColor(9286496).setDisableRain().setBiomeName("Space");
|
||||
spaceBiome = (new BiomeSpace(23)).setColor(0).setDisableRain().setBiomeName("Space");
|
||||
this.spaceProviderID = 14;
|
||||
|
||||
DimensionManager.registerProviderType(this.spaceProviderID, SpaceProvider.class, true);
|
||||
|
|
Loading…
Reference in a new issue