Bugfixes
Fixes: + Critical laser targeting bug + Miner collects bedrock + TileEntity instances duplication after jump + Air does not spread in hyperspace + Lift radius was too big + Jump ships ignores air blocks + Moved space respawn to Overworld + Fixed energyNet issue with AirGen + Added layer offset to mining laser + Changed recipes
This commit is contained in:
parent
192ff788a6
commit
1113dd9196
10 changed files with 211 additions and 123 deletions
|
@ -252,7 +252,7 @@ public class BlockAir extends Block
|
|||
@Override
|
||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
if (par1World.provider.dimensionId == WarpDrive.instance.spaceDimID)
|
||||
if (par1World.provider.dimensionId == WarpDrive.instance.spaceDimID || par1World.provider.dimensionId == WarpDrive.instance.hyperSpaceDimID)
|
||||
{
|
||||
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World));
|
||||
} else
|
||||
|
|
|
@ -89,7 +89,7 @@ public class BlockLift extends BlockContainer {
|
|||
TileEntityLift booster = (TileEntityLift)par1World.getBlockTileEntity(par2, par3, par4);
|
||||
|
||||
if (booster != null){
|
||||
par5EntityPlayer.addChatMessage("[Particle Booster] Energy level: " + booster.getCurrentEnergyValue());
|
||||
par5EntityPlayer.addChatMessage("[Laser Lift] Energy level: " + booster.getCurrentEnergyValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -454,7 +454,7 @@ public class EntityJump extends Entity {
|
|||
for(int z = z1; z <= z2; z++) {
|
||||
int blockID = worldObj.getBlockId(x, y, z);
|
||||
// Skip air blocks
|
||||
if (blockID == 0 || blockID == WarpDrive.AIR_BLOCKID || blockID == WarpDrive.GAS_BLOCKID) {
|
||||
if (blockID == 0 || blockID == WarpDrive.GAS_BLOCKID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -534,8 +534,8 @@ public class EntityJump extends Entity {
|
|||
for (int y = minY; y <= maxY; y++) {
|
||||
int blockID = worldObj.getBlockId(x, y, z);
|
||||
|
||||
// Пропускаем пустые блоки воздуха
|
||||
if (blockID == 0 || blockID == WarpDrive.AIR_BLOCKID || blockID == WarpDrive.GAS_BLOCKID) {
|
||||
// Skipping air blocks
|
||||
if (blockID == 0 || blockID == WarpDrive.GAS_BLOCKID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -845,7 +845,13 @@ public class EntityJump extends Entity {
|
|||
int blockMeta = shipBlock.blockMeta;
|
||||
|
||||
mySetBlock(targetWorld, newX, newY, newZ, blockID, blockMeta, 2);
|
||||
|
||||
// Re-schedule air blocks update
|
||||
if (blockID == WarpDrive.AIR_BLOCKID) {
|
||||
targetWorld.markBlockForUpdate(newX, newY, newZ);
|
||||
targetWorld.scheduleBlockUpdate(newX, newY, newZ, blockID, 40 + targetWorld.rand.nextInt(20));
|
||||
}
|
||||
|
||||
|
||||
NBTTagCompound oldnbt = new NBTTagCompound();
|
||||
|
||||
|
||||
|
@ -870,16 +876,13 @@ public class EntityJump extends Entity {
|
|||
newTileEntity.invalidate();
|
||||
|
||||
newTileEntity.readFromNBT(oldnbt);
|
||||
|
||||
//newTileEntity.worldObj = targetWorld;
|
||||
targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity);
|
||||
}
|
||||
|
||||
newTileEntity.worldObj = targetWorld;
|
||||
newTileEntity.validate();
|
||||
|
||||
targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity);
|
||||
|
||||
worldObj.removeBlockTileEntity(oldX, oldY, oldZ);
|
||||
targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
|
|
|
@ -39,6 +39,61 @@ public class FXBeam extends EntityFX
|
|||
private float prevSize = 0.0F;
|
||||
private int energy = 0;
|
||||
|
||||
boolean a = false;
|
||||
|
||||
public FXBeam(World par1World, Vector3 position, float yaw, float pitch, float red, float green, float blue, int age, int energy) {
|
||||
super(par1World, position.x, position.y, position.z, 0.0D, 0.0D, 0.0D);
|
||||
|
||||
a = true;
|
||||
|
||||
this.setRGB(red, green, blue);
|
||||
|
||||
this.setSize(0.02F, 0.02F);
|
||||
this.noClip = true;
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
|
||||
this.length = 200;
|
||||
this.rotYaw = yaw;
|
||||
this.rotPitch = pitch;
|
||||
this.prevYaw = this.rotYaw;
|
||||
this.prevPitch = this.rotPitch;
|
||||
|
||||
this.particleMaxAge = age;
|
||||
this.energy = energy;
|
||||
|
||||
if (red == 1 && green == 0 && blue == 0) {
|
||||
TEXTURE = new ResourceLocation("warpdrive", "textures/blocks/energy_red.png");
|
||||
} else if (red == 0 && green == 1 && blue == 0) {
|
||||
TEXTURE = new ResourceLocation("warpdrive", "textures/blocks/energy_green.png");
|
||||
} else if (red == 0 && green == 0 && blue == 1) {
|
||||
TEXTURE = new ResourceLocation("warpdrive", "textures/blocks/energy.png");
|
||||
} else if (red == 1 && green == 1 && blue == 0) {
|
||||
TEXTURE = new ResourceLocation("warpdrive", "textures/blocks/energy_yellow.png");
|
||||
} else if (red == 1 && green == 0.5 && blue == 0) {
|
||||
TEXTURE = new ResourceLocation("warpdrive", "textures/blocks/energy_orange.png");
|
||||
} else if (red == 0.5 && green == 0 && blue == 0.5) {
|
||||
TEXTURE = new ResourceLocation("warpdrive", "textures/blocks/energy_violet.png");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the particle age based on distance.
|
||||
*/
|
||||
EntityLivingBase renderentity = Minecraft.getMinecraft().renderViewEntity;
|
||||
|
||||
int visibleDistance = 300;
|
||||
|
||||
if (!Minecraft.getMinecraft().gameSettings.fancyGraphics)
|
||||
{
|
||||
visibleDistance = 100;
|
||||
}
|
||||
if (renderentity.getDistance(this.posX, this.posY, this.posZ) > visibleDistance)
|
||||
{
|
||||
this.particleMaxAge = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public FXBeam(World par1World, Vector3 position, Vector3 target, float red, float green, float blue, int age, int energy)
|
||||
{
|
||||
super(par1World, position.x, position.y, position.z, 0.0D, 0.0D, 0.0D);
|
||||
|
@ -111,6 +166,7 @@ public class FXBeam extends EntityFX
|
|||
this.prevYaw = this.rotYaw;
|
||||
this.prevPitch = this.rotPitch;
|
||||
|
||||
if (!a) {
|
||||
float xd = (float) (this.posX - this.target.x);
|
||||
float yd = (float) (this.posY - this.target.y);
|
||||
float zd = (float) (this.posZ - this.target.z);
|
||||
|
@ -121,7 +177,8 @@ public class FXBeam extends EntityFX
|
|||
|
||||
this.rotYaw = ((float) (Math.atan2(xd, zd) * 180.0D / 3.141592653589793D));
|
||||
this.rotPitch = ((float) (Math.atan2(yd, var7) * 180.0D / 3.141592653589793D));
|
||||
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
setDead();
|
||||
|
|
|
@ -34,7 +34,7 @@ public class SpaceProvider extends WorldProvider {
|
|||
|
||||
@Override
|
||||
public boolean canRespawnHere() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -119,11 +119,11 @@ public class SpaceProvider extends WorldProvider {
|
|||
return (dimensionId == 0 ? null : "WarpDrive/Space" + dimensionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public boolean canCoordinateBeSpawn(int par1, int par2) {
|
||||
int var3 = this.worldObj.getFirstUncoveredBlock(par1, par2);
|
||||
return var3 != 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) {
|
||||
|
@ -151,15 +151,9 @@ public class SpaceProvider extends WorldProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWelcomeMessage()
|
||||
{
|
||||
return "Gagarin: POEHALI!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRespawnDimension(EntityPlayerMP player) {
|
||||
return WarpDrive.instance.spaceDimID;
|
||||
return 0; // respawn on Earth
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -171,7 +165,7 @@ public class SpaceProvider extends WorldProvider {
|
|||
public boolean canBlockFreeze(int x, int y, int z, boolean byWater) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public ChunkCoordinates getRandomizedSpawnPoint() {
|
||||
ChunkCoordinates var5 = new ChunkCoordinates(this.worldObj.getSpawnPoint());
|
||||
|
@ -205,7 +199,7 @@ public class SpaceProvider extends WorldProvider {
|
|||
}
|
||||
return var5;
|
||||
}
|
||||
|
||||
*/
|
||||
@Override
|
||||
public boolean getWorldHasVoidParticles() {
|
||||
return false;
|
||||
|
|
|
@ -150,12 +150,4 @@ public class TileEntityAirGenerator extends TileEntity implements IEnergySink {
|
|||
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
||||
addedToEnergyNet = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
private int dx, dz, dy;
|
||||
private float yaw, pitch; // laser direction
|
||||
|
||||
private int frequency; // beam frequency
|
||||
private int frequency = -1; // beam frequency
|
||||
private float r, g, b; // beam color (corresponds to frequency)
|
||||
|
||||
private boolean isEmitting = false;
|
||||
|
@ -64,6 +64,11 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
// Frequency is not set
|
||||
if (frequency == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEmitting && ++delayTicks > 20 * 3) {
|
||||
delayTicks = 0;
|
||||
isEmitting = false;
|
||||
|
@ -116,12 +121,20 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
|
||||
Vector3 beamVector = new Vector3(this).add(0.5);
|
||||
System.out.println("beamVector: " + beamVector);
|
||||
Vector3 lookVector = beamVector.clone().getDeltaPositionFromRotation(yaw, pitch);
|
||||
|
||||
float yawz = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
|
||||
float yawx = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
|
||||
float pitchhorizontal = -MathHelper.cos(-pitch * 0.017453292F);
|
||||
float pitchvertical = MathHelper.sin(-pitch * 0.017453292F);
|
||||
float directionx = yawx * pitchhorizontal;
|
||||
float directionz = yawz * pitchhorizontal;
|
||||
Vector3 lookVector = new Vector3((double) directionx, (double) pitchvertical, (double) directionz);
|
||||
Vector3.translate(beamVector, lookVector);
|
||||
|
||||
Vector3 reachPoint = beamVector.clone().translate(beamVector.clone(), beamVector.clone().scale(lookVector.clone(), beamLengthBlocks));
|
||||
|
||||
System.out.println("Look vector: " + lookVector);
|
||||
System.out.println("reachPoint: " + reachPoint);
|
||||
|
||||
Vector3.translate(beamVector, lookVector);
|
||||
System.out.println("translatedBeamVector: " + beamVector);
|
||||
Vector3 endPoint = reachPoint.clone();
|
||||
|
||||
|
@ -141,35 +154,47 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
MovingObjectPosition hit = worldObj.rayTraceBlocks_do_do(beamVector.toVec3(), reachPoint.toVec3(), true, false);
|
||||
|
||||
// FIXME entity ray-tracing
|
||||
MovingObjectPosition entityHit = rayTraceEntities(beamVector.clone(), reachPoint.clone().toVec3(), true, beamLengthBlocks);
|
||||
MovingObjectPosition entityHit = raytraceEntities(beamVector.clone(), lookVector.clone(), true, beamLengthBlocks);
|
||||
if (entityHit == null) {
|
||||
System.out.println("Entity hit is null.");
|
||||
} else {
|
||||
System.out.println("Entity hit: " + entityHit);
|
||||
}
|
||||
|
||||
if (entityHit != null && entityHit.entityHit instanceof EntityLivingBase) {
|
||||
if (hit != null && hit.hitVec.distanceTo(beamVector.clone().toVec3()) > entityHit.hitVec.distanceTo(beamVector.clone().toVec3())) {
|
||||
((EntityLivingBase)entityHit.entityHit).setFire(100);
|
||||
((EntityLivingBase)entityHit.entityHit).attackEntityFrom(DamageSource.inFire, 10);
|
||||
endPoint = new Vector3(entityHit);
|
||||
break;
|
||||
} else if (hit == null) {
|
||||
if (entityHit.hitVec.distanceTo(beamVector.clone().toVec3()) <= beamLengthBlocks) {
|
||||
((EntityLivingBase)entityHit.entityHit).setFire(100);
|
||||
((EntityLivingBase)entityHit.entityHit).attackEntityFrom(DamageSource.inFire, 10);
|
||||
endPoint = new Vector3(entityHit);
|
||||
EntityLivingBase e = (EntityLivingBase)entityHit.entityHit;
|
||||
double distanceToEntity = entityHit.hitVec.distanceTo(beamVector.clone().toVec3());
|
||||
if (hit == null || (hit != null && hit.hitVec.distanceTo(beamVector.clone().toVec3()) > distanceToEntity)) {
|
||||
if (distanceToEntity <= beamLengthBlocks) {
|
||||
((EntityLivingBase)e).setFire(100);
|
||||
((EntityLivingBase)e).attackEntityFrom(DamageSource.inFire, energy / 10000);
|
||||
if (energy > 1000000) {
|
||||
worldObj.newExplosion(null, e.posX, e.posY, e.posZ, 4F, true, true);
|
||||
}
|
||||
|
||||
// consume energy
|
||||
energy -= 10000 + (100 * distanceToEntity);
|
||||
|
||||
endPoint = new Vector3(entityHit.hitVec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hit == null) {
|
||||
// Laser is missed
|
||||
// Laser is missed
|
||||
if (hit == null && entityHit == null) {
|
||||
endPoint = reachPoint;
|
||||
break;
|
||||
} else {
|
||||
// We got a hit
|
||||
// We got a hit block
|
||||
int distance = (int) new Vector3(hit.hitVec).distanceTo(beamVector);
|
||||
|
||||
// Laser gone too far
|
||||
if (distance >= beamLengthBlocks) {
|
||||
endPoint = reachPoint;
|
||||
break;
|
||||
}
|
||||
|
||||
int blockID = worldObj.getBlockId(hit.blockX, hit.blockY, hit.blockZ);
|
||||
int blockMeta = worldObj.getBlockMetadata(hit.blockX, hit.blockY, hit.blockZ);
|
||||
float resistance = Block.blocksList[blockID].blockResistance;
|
||||
|
@ -191,7 +216,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
}
|
||||
|
||||
if (Block.blocksList[blockID].blockMaterial == Material.glass) {
|
||||
worldObj.setBlockToAir(hit.blockX, hit.blockY, hit.blockZ);
|
||||
worldObj.destroyBlock(hit.blockX, hit.blockY, hit.blockZ, (worldObj.rand.nextInt(20) == 0));
|
||||
endPoint = new Vector3(hit.hitVec);
|
||||
}
|
||||
|
||||
|
@ -207,7 +232,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
worldObj.newExplosion(null, hit.blockX, hit.blockY, hit.blockZ, 4F * (2 + (energy / 500000)), true, true);
|
||||
worldObj.setBlock(hit.blockX, hit.blockY, hit.blockZ, (worldObj.rand.nextBoolean()) ? Block.fire.blockID : 0);
|
||||
} else{
|
||||
worldObj.setBlockToAir(hit.blockX, hit.blockY, hit.blockZ);
|
||||
worldObj.destroyBlock(hit.blockX, hit.blockY, hit.blockZ, (worldObj.rand.nextInt(20) == 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -215,61 +240,53 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
sendLaserPacket(beamVector, endPoint, r, g, b, 50, energy, beamLengthBlocks);
|
||||
}
|
||||
|
||||
public MovingObjectPosition rayTraceEntities(Vector3 beamVector, Vec3 reachPoint, boolean collisionFlag, double reachDistance)
|
||||
{
|
||||
MovingObjectPosition pickedEntity = null;
|
||||
Vec3 startingPosition = beamVector.toVec3();
|
||||
double playerBorder = 1.1 * reachDistance;
|
||||
AxisAlignedBB boxToScan = AxisAlignedBB.getAABBPool().getAABB(-playerBorder, -playerBorder, -playerBorder, playerBorder, playerBorder, playerBorder);
|
||||
public MovingObjectPosition raytraceEntities(Vector3 beamVec, Vector3 lookVec, boolean collisionFlag, double reachDistance) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Entity> entitiesHit = worldObj.getEntitiesWithinAABBExcludingEntity(null, boxToScan);
|
||||
double closestEntity = reachDistance;
|
||||
MovingObjectPosition pickedEntity = null;
|
||||
Vec3 playerPosition = beamVec.toVec3();
|
||||
Vec3 playerLook = lookVec.toVec3();
|
||||
|
||||
if (entitiesHit == null || entitiesHit.isEmpty())
|
||||
{
|
||||
System.out.println("There is no Entitys hits.");
|
||||
return null;
|
||||
}
|
||||
for (Entity entityHit : entitiesHit)
|
||||
{
|
||||
if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null)
|
||||
{
|
||||
float border = entityHit.getCollisionBorderSize();
|
||||
AxisAlignedBB aabb = entityHit.boundingBox.expand(border, border, border);
|
||||
MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, reachPoint);
|
||||
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * reachDistance, playerPosition.yCoord
|
||||
+ playerLook.yCoord * reachDistance, playerPosition.zCoord + playerLook.zCoord * reachDistance);
|
||||
|
||||
if (hitMOP != null)
|
||||
{
|
||||
if (aabb.isVecInside(startingPosition))
|
||||
{
|
||||
if (0.0D < closestEntity || closestEntity == 0.0D)
|
||||
{
|
||||
pickedEntity = new MovingObjectPosition(entityHit);
|
||||
if (pickedEntity != null)
|
||||
{
|
||||
pickedEntity.hitVec = hitMOP.hitVec;
|
||||
closestEntity = 0.0D;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double distance = startingPosition.distanceTo(hitMOP.hitVec);
|
||||
double playerBorder = 1.1 * reachDistance;
|
||||
AxisAlignedBB boxToScan = WarpDrive.laserBlock.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord, zCoord).expand(playerBorder, playerBorder, playerBorder);
|
||||
|
||||
if (distance < closestEntity || closestEntity == 0.0D)
|
||||
{
|
||||
pickedEntity = new MovingObjectPosition(entityHit);
|
||||
pickedEntity.hitVec = hitMOP.hitVec;
|
||||
closestEntity = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pickedEntity;
|
||||
}
|
||||
List entitiesHit = worldObj.getEntitiesWithinAABBExcludingEntity(null, boxToScan);
|
||||
double closestEntity = reachDistance;
|
||||
|
||||
if (entitiesHit == null || entitiesHit.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (Entity entityHit : (Iterable<Entity>) entitiesHit) {
|
||||
if (entityHit != null && entityHit.canBeCollidedWith() && entityHit.boundingBox != null) {
|
||||
float border = entityHit.getCollisionBorderSize();
|
||||
AxisAlignedBB aabb = entityHit.boundingBox.expand((double) border, (double) border, (double) border);
|
||||
MovingObjectPosition hitMOP = aabb.calculateIntercept(playerPosition, playerViewOffset);
|
||||
|
||||
if (hitMOP != null) {
|
||||
if (aabb.isVecInside(playerPosition)) {
|
||||
if (0.0D < closestEntity || closestEntity == 0.0D) {
|
||||
pickedEntity = new MovingObjectPosition(entityHit);
|
||||
if (pickedEntity != null) {
|
||||
pickedEntity.hitVec = hitMOP.hitVec;
|
||||
closestEntity = 0.0D;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
double distance = playerPosition.distanceTo(hitMOP.hitVec);
|
||||
|
||||
if (distance < closestEntity || closestEntity == 0.0D) {
|
||||
pickedEntity = new MovingObjectPosition(entityHit);
|
||||
pickedEntity.hitVec = hitMOP.hitVec;
|
||||
closestEntity = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pickedEntity;
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return frequency;
|
||||
|
@ -534,7 +551,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
|||
|
||||
return info;
|
||||
} else {
|
||||
return new Object[] { -1 };
|
||||
return new Object[] { -1, 0, 0, 0, 0, 0, -1 };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,14 +52,14 @@ public class TileEntityLift extends TileEntity implements IEnergySink {
|
|||
addedToEnergyNet = true;
|
||||
}
|
||||
|
||||
if (++ticks > 20) {
|
||||
if (++ticks > 40) {
|
||||
ticks = 0;
|
||||
|
||||
// Switching mode
|
||||
if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
|
||||
mode = 1;
|
||||
mode = 2; // down
|
||||
} else {
|
||||
mode = 2;
|
||||
mode = 1; // up
|
||||
}
|
||||
|
||||
isEnabled = (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) && worldObj.isAirBlock(xCoord, yCoord + 2, zCoord));
|
||||
|
@ -126,7 +126,7 @@ public class TileEntityLift extends TileEntity implements IEnergySink {
|
|||
|
||||
// Lift up
|
||||
if (mode == 1) {
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin, firstUncoveredY, zmin, xmax, yCoord, zmax);
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin + 0.3, firstUncoveredY, zmin + 0.3, xmax - 0.3, yCoord, zmax - 0.3);
|
||||
|
||||
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb);
|
||||
if (list != null) { // up
|
||||
|
@ -143,7 +143,7 @@ public class TileEntityLift extends TileEntity implements IEnergySink {
|
|||
}
|
||||
}
|
||||
} else if (mode == 2) { // down
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin, yCoord, zmin, xmax, yCoord + 2, zmax);
|
||||
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(xmin + 0.3, yCoord, zmin + 0.3, xmax - 0.3, yCoord + 2, zmax - 0.3);
|
||||
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, aabb);
|
||||
if (list != null) {
|
||||
for (Object o : list) {
|
||||
|
|
|
@ -48,7 +48,8 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
"startMining", "stop", // 0, 1
|
||||
"isMining", // 2
|
||||
"startQuarry", // 3
|
||||
"getMinerState" // 4
|
||||
"getMinerState", // 4
|
||||
"setStartLayerOffset" // 5
|
||||
};
|
||||
|
||||
public static final ArrayList<Integer> valuableOres = new ArrayList<Integer>(Arrays.asList(
|
||||
|
@ -81,10 +82,10 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
private final int SCAN_DELAY = 20 * 5;
|
||||
private int delayTicksScan = 0;
|
||||
|
||||
private final int MINE_DELAY = 25;
|
||||
private final int MINE_DELAY = 10;
|
||||
private int delayTicksMine = 0;
|
||||
|
||||
private final int EU_PER_LAYER = 250;
|
||||
private final int EU_PER_LAYER = 500;
|
||||
|
||||
private int currentMode = 0; // 0 - scan next layer, 1 - collect valuables
|
||||
|
||||
|
@ -94,12 +95,22 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
private ArrayList<Vector3> valuablesInLayer = new ArrayList<Vector3>();
|
||||
private int valuableIndex = 0;
|
||||
|
||||
Vector3 minerVector;
|
||||
private int layerOffset = 1;
|
||||
|
||||
private Vector3 minerVector;
|
||||
private long uid = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (isMining) {
|
||||
if (minerVector != null) {
|
||||
minerVector.x = xCoord;
|
||||
minerVector.y = yCoord - 1;
|
||||
minerVector.z = zCoord;
|
||||
|
||||
minerVector = minerVector.add(0.5);
|
||||
}
|
||||
|
||||
if (currentMode == 0) {
|
||||
if (++delayTicksScan > SCAN_DELAY) {
|
||||
delayTicksScan = 0;
|
||||
|
@ -114,7 +125,11 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
int blockMeta = worldObj.getBlockMetadata(xCoord, currentLayer, zCoord);
|
||||
|
||||
// That block is too hard
|
||||
if (blockID != 0 && worldObj.getBlockMaterial(xCoord, currentLayer, zCoord) != Material.water && Block.blocksList[blockID].blockHardness > Block.obsidian.blockHardness) {
|
||||
if (blockID == Block.bedrock.blockID) {
|
||||
isMining = false;
|
||||
return;
|
||||
}
|
||||
if (blockID != 0 && worldObj.getBlockMaterial(xCoord, currentLayer, zCoord) != Material.water && Block.blocksList[blockID].blockResistance > Block.obsidian.blockResistance) {
|
||||
isMining = false;
|
||||
return;
|
||||
}
|
||||
|
@ -146,7 +161,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
int blockID = worldObj.getBlockId(valuable.intX(), valuable.intY(), valuable.intZ());
|
||||
|
||||
// Skip if block is too hard or its empty block
|
||||
if (worldObj.getBlockMaterial(xCoord, currentLayer, zCoord) != Material.water && (worldObj.isAirBlock(valuable.intX(), valuable.intY(), valuable.intZ()) || Block.blocksList[blockID].blockHardness > Block.obsidian.blockHardness)) {
|
||||
if (worldObj.getBlockMaterial(xCoord, currentLayer, zCoord) != Material.water && (worldObj.isAirBlock(valuable.intX(), valuable.intY(), valuable.intZ()) || Block.blocksList[blockID].blockResistance > Block.obsidian.blockResistance)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -311,7 +326,10 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
for (int z = zmin; z <= zmax; z++) {
|
||||
if (isQuarry) { // Quarry collects all blocks
|
||||
int blockID = worldObj.getBlockId(x, currentLayer, z);
|
||||
if (!worldObj.isAirBlock(x, currentLayer, z) && blockID != Block.lavaMoving.blockID && blockID != Block.lavaStill.blockID && (Block.blocksList[blockID].blockHardness <= Block.obsidian.blockHardness))
|
||||
if (blockID == Block.bedrock.blockID) {
|
||||
continue;
|
||||
}
|
||||
if (!worldObj.isAirBlock(x, currentLayer, z) && blockID != Block.lavaMoving.blockID && blockID != Block.lavaStill.blockID && (Block.blocksList[blockID].blockResistance <= Block.obsidian.blockResistance))
|
||||
valuablesInLayer.add(new Vector3(x, currentLayer, z));
|
||||
} else // Not-quarry collect only valuables blocks
|
||||
if (valuableOres.contains((worldObj.getBlockId(x, currentLayer, z))) || otherValuables.contains((worldObj.getBlockId(x, currentLayer, z)))) {
|
||||
|
@ -480,7 +498,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
currentMode = 0;
|
||||
|
||||
minerVector = new Vector3(xCoord, yCoord - 1, zCoord).add(0.5);
|
||||
currentLayer = yCoord - 1;
|
||||
currentLayer = yCoord - layerOffset;
|
||||
|
||||
return new Object[] { 0 };
|
||||
|
||||
|
@ -502,11 +520,11 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
currentMode = 0;
|
||||
|
||||
minerVector = new Vector3(xCoord, yCoord - 1, zCoord).add(0.5);
|
||||
currentLayer = yCoord - 1;
|
||||
currentLayer = yCoord - layerOffset;
|
||||
|
||||
return new Object[] { 0 };
|
||||
|
||||
// State is: state, energy, currentLayer, valuablesInLayer, valuablesMined = getMinerState()
|
||||
// State is: state, energy, currentLayer, valuablesMined, valuablesInLayer = getMinerState()
|
||||
case 4: // getMinerState()
|
||||
String state = "not mining";
|
||||
Integer valuablesInLayer, valuablesMined;
|
||||
|
@ -520,6 +538,13 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
|||
}
|
||||
|
||||
return new Object[] {state, energy, currentLayer, 0, 0};
|
||||
case 5: // setStartLayerOffset
|
||||
if (arguments.length == 1) {
|
||||
int a = ((Double)arguments[0]).intValue();
|
||||
if (a < 1) { a = 1; }
|
||||
|
||||
layerOffset = a;
|
||||
}
|
||||
}
|
||||
|
||||
return new Object[] { 0 };
|
||||
|
|
|
@ -198,11 +198,11 @@ public class WarpDrive implements LoadingCallback {
|
|||
GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll",
|
||||
'l', Block.leaves, 'm', Items.getItem("advancedMachine"), 'c', Items.getItem("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(laserBlock), "ccc", "asa", "cac",
|
||||
'c', Items.getItem("energyCrystal"), 'a', Items.getItem("advancedAlloy"), 's', Items.getItem("advancedCircuit"));
|
||||
GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa",
|
||||
'm', Items.getItem("advancedMachine"), 'a', Items.getItem("advancedAlloy"), 's', Items.getItem("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "aka", "scs",
|
||||
'c', Items.getItem("advancedCircuit"), 'a', Items.getItem("advancedAlloy"), 's', Items.getItem("ovScanner"), 'k', Items.getItem("energyCrystal"));
|
||||
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc",
|
||||
'c', Items.getItem("advancedCircuit"), 'a', Items.getItem("advancedAlloy"), 'm', Items.getItem("miner"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(boosterBlock), "afc", "ama", "cfa",
|
||||
'c', Items.getItem("advancedCircuit"), 'a', Items.getItem("advancedAlloy"), 'f', Items.getItem("glassFiberCableItem"), 'm', Items.getItem("mfeUnit"));
|
||||
|
|
Loading…
Reference in a new issue