generated from tilera/1710mod
feat: start work on arcane bore & singularity
This commit is contained in:
parent
8ae7967bbc
commit
1c27066bdc
|
@ -3,9 +3,13 @@ package net.anvilcraft.thaummach;
|
|||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.anvilcraft.thaummach.entities.EntitySingularity;
|
||||
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.entity.EntitySingularityRenderer;
|
||||
import net.anvilcraft.thaummach.render.tile.TileBoreRenderer;
|
||||
import net.anvilcraft.thaummach.render.tile.TileConduitPumpRenderer;
|
||||
import net.anvilcraft.thaummach.render.tile.TileCrystallizerRenderer;
|
||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduit;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduitPump;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduitTank;
|
||||
|
@ -25,6 +29,13 @@ public class ClientProxy extends CommonProxy {
|
|||
RenderingRegistry.registerBlockHandler(new BlockApparatusRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
RenderingRegistry.registerEntityRenderingHandler(
|
||||
EntitySingularity.class, new EntitySingularityRenderer()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTileEntities() {
|
||||
GameRegistry.registerTileEntity(TileConduit.class, "conduit");
|
||||
|
@ -37,6 +48,7 @@ public class ClientProxy extends CommonProxy {
|
|||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||
|
||||
ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer());
|
||||
ClientRegistry.registerTileEntity(
|
||||
TileConduitPump.class, "conduit_pump", new TileConduitPumpRenderer()
|
||||
);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.anvilcraft.thaummach;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduit;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduitPump;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduitTank;
|
||||
|
@ -14,7 +15,10 @@ import net.anvilcraft.thaummach.tiles.TilePurifier;
|
|||
public class CommonProxy {
|
||||
public void preInit() {}
|
||||
|
||||
public void init() {}
|
||||
|
||||
public void registerTileEntities() {
|
||||
GameRegistry.registerTileEntity(TileBore.class, "bore");
|
||||
GameRegistry.registerTileEntity(TileConduit.class, "conduit");
|
||||
GameRegistry.registerTileEntity(TileConduitPump.class, "conduit_pump");
|
||||
GameRegistry.registerTileEntity(TileConduitTank.class, "conduit_tank");
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package net.anvilcraft.thaummach;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.anvilcraft.thaummach.items.ItemFocus;
|
||||
import net.anvilcraft.thaummach.items.ItemSingularity;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class TMItems {
|
||||
public static Item focus0;
|
||||
public static Item focus1;
|
||||
public static Item focus2;
|
||||
public static Item focus3;
|
||||
public static Item focus4;
|
||||
public static Item singularity;
|
||||
|
||||
public static void init() {
|
||||
focus0 = new ItemFocus(0);
|
||||
focus1 = new ItemFocus(1);
|
||||
focus2 = new ItemFocus(2);
|
||||
focus3 = new ItemFocus(3);
|
||||
focus4 = new ItemFocus(4);
|
||||
|
||||
singularity = new ItemSingularity();
|
||||
|
||||
GameRegistry.registerItem(focus0, "focus0");
|
||||
GameRegistry.registerItem(focus1, "focus1");
|
||||
GameRegistry.registerItem(focus2, "focus2");
|
||||
GameRegistry.registerItem(focus3, "focus3");
|
||||
GameRegistry.registerItem(focus4, "focus4");
|
||||
|
||||
GameRegistry.registerItem(singularity, "singularity");
|
||||
}
|
||||
}
|
|
@ -2,7 +2,10 @@ package net.anvilcraft.thaummach;
|
|||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import net.anvilcraft.thaummach.entities.EntitySingularity;
|
||||
|
||||
@Mod(modid = "thaummach")
|
||||
public class ThaumicMachinery {
|
||||
|
@ -15,8 +18,18 @@ public class ThaumicMachinery {
|
|||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent ev) {
|
||||
proxy.preInit();
|
||||
proxy.registerTileEntities();
|
||||
TMBlocks.init();
|
||||
TMItems.init();
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent ev) {
|
||||
int entId = 0;
|
||||
EntityRegistry.registerModEntity(
|
||||
EntitySingularity.class, "singularity", entId++, this, 64, 2, true
|
||||
);
|
||||
proxy.init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,11 @@ import net.anvilcraft.thaummach.AuraUtils;
|
|||
import net.anvilcraft.thaummach.render.BlockApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.ArcaneFurnaceApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.BoreApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrucibleApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrystallizerApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
|
||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduitTank;
|
||||
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
||||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||
|
@ -30,6 +32,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
@ -148,6 +151,9 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
case CRYSTALLIZER:
|
||||
return CrystallizerApparatusRenderer.INSTANCE;
|
||||
|
||||
case BORE:
|
||||
return BoreApparatusRenderer.INSTANCE;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -167,7 +173,7 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
} else if (md == MetaVals.CRYSTALLIZER) {
|
||||
return new TileCrystallizer();
|
||||
} else if (md == MetaVals.BORE) {
|
||||
//return new TileBore();
|
||||
return new TileBore();
|
||||
} else if (md == MetaVals.VOID_CHEST) {
|
||||
//return new TileVoidChest();
|
||||
} else if (md == MetaVals.VOID_INTERFACE) {
|
||||
|
@ -327,6 +333,7 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void addCollisionBoxesToList(
|
||||
World world,
|
||||
int i,
|
||||
|
@ -748,39 +755,38 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
// world.setBlock(i, j, k, 0);
|
||||
//}
|
||||
} else if (md == MetaVals.BORE) {
|
||||
// TODO: bore
|
||||
//TileBore tb = (TileBore) world.getTileEntity(i, j, k);
|
||||
//if (MathHelper.abs((float) entityliving.posX - (float) i) < 1.0F
|
||||
// && MathHelper.abs((float) entityliving.posZ - (float) k) < 1.0F) {
|
||||
// double d = entityliving.posY + 1.82 - (double) entityliving.yOffset;
|
||||
// if (d - (double) j > 2.0) {
|
||||
// tb.orientation = 1;
|
||||
// }
|
||||
TileBore tb = (TileBore) world.getTileEntity(i, j, k);
|
||||
if (MathHelper.abs((float) entityliving.posX - (float) i) < 1.0F
|
||||
&& MathHelper.abs((float) entityliving.posZ - (float) k) < 1.0F) {
|
||||
double d = entityliving.posY + 1.82 - (double) entityliving.yOffset;
|
||||
if (d - (double) j > 2.0) {
|
||||
tb.orientation = 1;
|
||||
}
|
||||
|
||||
// if ((double) j - d > 0.0) {
|
||||
// tb.orientation = 0;
|
||||
// }
|
||||
//} else {
|
||||
// int l = MathHelper.floor_double(
|
||||
// (double) (entityliving.rotationYaw * 4.0F / 360.0F) + 0.5
|
||||
// )
|
||||
// & 3;
|
||||
// if (l == 0) {
|
||||
// tb.orientation = 2;
|
||||
// }
|
||||
if ((double) j - d > 0.0) {
|
||||
tb.orientation = 0;
|
||||
}
|
||||
} else {
|
||||
int l = MathHelper.floor_double(
|
||||
(double) (entityliving.rotationYaw * 4.0F / 360.0F) + 0.5
|
||||
)
|
||||
& 3;
|
||||
if (l == 0) {
|
||||
tb.orientation = 2;
|
||||
}
|
||||
|
||||
// if (l == 1) {
|
||||
// tb.orientation = 5;
|
||||
// }
|
||||
if (l == 1) {
|
||||
tb.orientation = 5;
|
||||
}
|
||||
|
||||
// if (l == 2) {
|
||||
// tb.orientation = 3;
|
||||
// }
|
||||
if (l == 2) {
|
||||
tb.orientation = 3;
|
||||
}
|
||||
|
||||
// if (l == 3) {
|
||||
// tb.orientation = 4;
|
||||
// }
|
||||
//}
|
||||
if (l == 3) {
|
||||
tb.orientation = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(world, i, j, k, entityliving, is);
|
||||
|
|
|
@ -0,0 +1,524 @@
|
|||
package net.anvilcraft.thaummach.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import dev.tilera.auracore.aura.AuraManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
|
||||
public class EntitySingularity extends Entity {
|
||||
public float rotation;
|
||||
double bounceFactor;
|
||||
public int fuse;
|
||||
int fusemax;
|
||||
boolean exploded;
|
||||
public double explosionX;
|
||||
public double explosionY;
|
||||
public double explosionZ;
|
||||
public float explosionSize;
|
||||
public Set<ChunkPosition> destroyedBlockPositions;
|
||||
private float currentVis;
|
||||
|
||||
public EntitySingularity(World world) {
|
||||
super(world);
|
||||
this.setSize(0.5F, 0.5F);
|
||||
super.yOffset = super.height / 2.0F;
|
||||
this.bounceFactor = 0.25;
|
||||
this.exploded = false;
|
||||
this.destroyedBlockPositions = new HashSet<>();
|
||||
super.worldObj = world;
|
||||
}
|
||||
|
||||
public EntitySingularity(World world, Entity entity) {
|
||||
this(world);
|
||||
this.setRotation(entity.rotationYaw, 0.0F);
|
||||
double xHeading
|
||||
= (double) (-MathHelper.sin(entity.rotationYaw * 3.141593F / 180.0F));
|
||||
double zHeading
|
||||
= (double) MathHelper.cos(entity.rotationYaw * 3.141593F / 180.0F);
|
||||
super.motionX = 0.75 * xHeading
|
||||
* (double) MathHelper.cos(entity.rotationPitch / 180.0F * 3.141593F);
|
||||
super.motionY
|
||||
= -0.5 * (double) MathHelper.sin(entity.rotationPitch / 180.0F * 3.141593F);
|
||||
super.motionZ = 0.75 * zHeading
|
||||
* (double) MathHelper.cos(entity.rotationPitch / 180.0F * 3.141593F);
|
||||
this.setPosition(
|
||||
entity.posX + xHeading * 0.8, entity.posY, entity.posZ + zHeading * 0.8
|
||||
);
|
||||
super.prevPosX = super.posX;
|
||||
super.prevPosY = super.posY;
|
||||
super.prevPosZ = super.posZ;
|
||||
this.explosionSize = 4.0F;
|
||||
this.fuse = 60;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTriggerWalking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
System.out.println(
|
||||
"AAALEC: " + this.motionX + " " + this.motionY + " " + this.motionZ
|
||||
);
|
||||
if (this.fuse-- == 0) {
|
||||
this.explode();
|
||||
}
|
||||
|
||||
if (this.fuse > 0) {
|
||||
double prevVelX = super.motionX;
|
||||
double prevVelY = super.motionY;
|
||||
double prevVelZ = super.motionZ;
|
||||
super.prevPosX = super.posX;
|
||||
super.prevPosY = super.posY;
|
||||
super.prevPosZ = super.posZ;
|
||||
this.moveEntity(super.motionX, super.motionY, super.motionZ);
|
||||
if (super.motionX != prevVelX) {
|
||||
super.motionX = -this.bounceFactor * prevVelX;
|
||||
}
|
||||
|
||||
if (super.motionY != prevVelY) {
|
||||
super.motionY = -this.bounceFactor * prevVelY;
|
||||
} else {
|
||||
super.motionY -= 0.04;
|
||||
}
|
||||
|
||||
if (super.motionZ != prevVelZ) {
|
||||
super.motionZ = -this.bounceFactor * prevVelZ;
|
||||
}
|
||||
|
||||
super.motionX *= 0.98;
|
||||
super.motionY *= 0.98;
|
||||
super.motionZ *= 0.98;
|
||||
// TODO: FX
|
||||
//FXWisp ef = new FXWisp(
|
||||
// super.worldObj,
|
||||
// (double) ((float) super.posX),
|
||||
// (double) ((float) super.posY + 0.1F),
|
||||
// (double) ((float) super.posZ),
|
||||
// 0.4F,
|
||||
// 0
|
||||
//);
|
||||
//ef.shrink = true;
|
||||
//Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
} else {
|
||||
++this.rotation;
|
||||
if (this.rotation > 360.0F) {
|
||||
this.rotation -= 360.0F;
|
||||
}
|
||||
|
||||
this.doSuckage();
|
||||
}
|
||||
|
||||
if (this.fuse < -170) {
|
||||
this.doSpawnResult();
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void doExplosion() {
|
||||
super.worldObj.playSoundEffect(
|
||||
this.explosionX,
|
||||
this.explosionY,
|
||||
this.explosionZ,
|
||||
"random.explode",
|
||||
4.0F,
|
||||
(1.0F
|
||||
+ (super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat()) * 0.2F)
|
||||
* 0.7F
|
||||
);
|
||||
super.worldObj.spawnParticle(
|
||||
"largeexplode",
|
||||
this.explosionX,
|
||||
this.explosionY,
|
||||
this.explosionZ,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
);
|
||||
float f = this.explosionSize;
|
||||
int i = 16;
|
||||
|
||||
int j;
|
||||
int l;
|
||||
int j1;
|
||||
double d5;
|
||||
double d7;
|
||||
double d9;
|
||||
for (j = 0; j < i; ++j) {
|
||||
for (l = 0; l < i; ++l) {
|
||||
for (j1 = 0; j1 < i; ++j1) {
|
||||
if (j == 0 || j == i - 1 || l == 0 || l == i - 1 || j1 == 0
|
||||
|| j1 == i - 1) {
|
||||
double d
|
||||
= (double) ((float) j / ((float) i - 1.0F) * 2.0F - 1.0F);
|
||||
double d1
|
||||
= (double) ((float) l / ((float) i - 1.0F) * 2.0F - 1.0F);
|
||||
double d2
|
||||
= (double) ((float) j1 / ((float) i - 1.0F) * 2.0F - 1.0F);
|
||||
double d3 = Math.sqrt(d * d + d1 * d1 + d2 * d2);
|
||||
d /= d3;
|
||||
d1 /= d3;
|
||||
d2 /= d3;
|
||||
float f1 = this.explosionSize
|
||||
* (0.7F + super.worldObj.rand.nextFloat() * 0.6F);
|
||||
d5 = this.explosionX;
|
||||
d7 = this.explosionY;
|
||||
d9 = this.explosionZ;
|
||||
|
||||
for (float f2 = 0.3F; !(f1 <= 0.0F); f1 -= f2 * 0.75F) {
|
||||
int j4 = MathHelper.floor_double(d5);
|
||||
int k4 = MathHelper.floor_double(d7);
|
||||
int l4 = MathHelper.floor_double(d9);
|
||||
Block i5 = super.worldObj.getBlock(j4, k4, l4);
|
||||
if (i5 != Blocks.air) {
|
||||
f1 -= (i5.getExplosionResistance(this) + 0.3F) * f2;
|
||||
}
|
||||
|
||||
if (f1 > 0.0F) {
|
||||
this.destroyedBlockPositions.add(
|
||||
new ChunkPosition(j4, k4, l4)
|
||||
);
|
||||
}
|
||||
|
||||
d5 += d * (double) f2;
|
||||
d7 += d1 * (double) f2;
|
||||
d9 += d2 * (double) f2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.explosionSize *= 2.0F;
|
||||
j = MathHelper.floor_double(this.explosionX - (double) this.explosionSize - 1.0);
|
||||
l = MathHelper.floor_double(this.explosionX + (double) this.explosionSize + 1.0);
|
||||
j1 = MathHelper.floor_double(this.explosionY - (double) this.explosionSize - 1.0);
|
||||
int l1 = MathHelper.floor_double(
|
||||
this.explosionY + (double) this.explosionSize + 1.0
|
||||
);
|
||||
int i2 = MathHelper.floor_double(
|
||||
this.explosionZ - (double) this.explosionSize - 1.0
|
||||
);
|
||||
int j2 = MathHelper.floor_double(
|
||||
this.explosionZ + (double) this.explosionSize + 1.0
|
||||
);
|
||||
List<Entity> list = super.worldObj.getEntitiesWithinAABBExcludingEntity(
|
||||
this,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) j, (double) j1, (double) i2, (double) l, (double) l1, (double) j2
|
||||
)
|
||||
);
|
||||
Vec3 vec3d
|
||||
= Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ);
|
||||
|
||||
for (int k2 = 0; k2 < list.size(); ++k2) {
|
||||
Entity entity = (Entity) list.get(k2);
|
||||
double d4
|
||||
= entity.getDistance(this.explosionX, this.explosionY, this.explosionZ)
|
||||
/ (double) this.explosionSize;
|
||||
if (d4 <= 1.0) {
|
||||
d5 = entity.posX - this.explosionX;
|
||||
d7 = entity.posY - this.explosionY;
|
||||
d9 = entity.posZ - this.explosionZ;
|
||||
double d11 = (double) MathHelper.sqrt_double(d5 * d5 + d7 * d7 + d9 * d9);
|
||||
d5 /= d11;
|
||||
d7 /= d11;
|
||||
d9 /= d11;
|
||||
double d12
|
||||
= (double) super.worldObj.getBlockDensity(vec3d, entity.boundingBox);
|
||||
double d13 = (1.0 - d4) * d12;
|
||||
entity.attackEntityFrom(
|
||||
// TODO: WTF
|
||||
//DamageSource.explosion,
|
||||
DamageSource.magic,
|
||||
(int
|
||||
) ((d13 * d13 + d13) / 2.0 * 8.0 * (double) this.explosionSize + 1.0)
|
||||
);
|
||||
entity.motionX += d5 * d13;
|
||||
entity.motionY += d7 * d13;
|
||||
entity.motionZ += d9 * d13;
|
||||
}
|
||||
}
|
||||
|
||||
this.explosionSize = f;
|
||||
ArrayList<ChunkPosition> arraylist = new ArrayList<>();
|
||||
arraylist.addAll(this.destroyedBlockPositions);
|
||||
|
||||
for (int ii = arraylist.size() - 1; ii >= 0; --ii) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(ii);
|
||||
int jj = chunkposition.chunkPosX;
|
||||
int kk = chunkposition.chunkPosY;
|
||||
int ll = chunkposition.chunkPosZ;
|
||||
Block id = super.worldObj.getBlock(jj, kk, ll);
|
||||
double d = (double) ((float) jj + super.worldObj.rand.nextFloat());
|
||||
double d1 = (double) ((float) kk + super.worldObj.rand.nextFloat());
|
||||
double d2 = (double) ((float) ll + super.worldObj.rand.nextFloat());
|
||||
double d3 = d - this.explosionX;
|
||||
double d4 = d1 - this.explosionY;
|
||||
double d10 = d2 - this.explosionZ;
|
||||
double d6 = (double) MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d10 * d10);
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d10 /= d6;
|
||||
double d11 = 0.5 / (d6 / (double) this.explosionSize + 0.1);
|
||||
d11 *= (double
|
||||
) (super.worldObj.rand.nextFloat() * super.worldObj.rand.nextFloat() + 0.3F);
|
||||
d3 *= -d11;
|
||||
d4 *= -d11;
|
||||
d10 *= -d11;
|
||||
super.worldObj.spawnParticle("smoke", d, d1, d2, d3, d4, d10);
|
||||
if (id != Blocks.air) {
|
||||
id.dropBlockAsItemWithChance(
|
||||
super.worldObj,
|
||||
jj,
|
||||
kk,
|
||||
ll,
|
||||
super.worldObj.getBlockMetadata(jj, kk, ll),
|
||||
0.9F,
|
||||
0
|
||||
);
|
||||
super.worldObj.setBlockToAir(jj, kk, ll);
|
||||
// TODO: need `Explosion` for this
|
||||
//id.onBlockDestroyedByExplosion(
|
||||
// super.worldObj, jj, kk, ll
|
||||
//);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
if (!this.exploded) {
|
||||
this.exploded = true;
|
||||
this.explosionX = super.posX;
|
||||
this.explosionY = super.posY;
|
||||
this.explosionZ = super.posZ;
|
||||
this.doExplosion();
|
||||
super.worldObj.playSoundEffect(
|
||||
super.posX, super.posY, super.posZ, "thaumcraft.singularity", 2.0F, 1.0F
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void doSuckage() {
|
||||
int auraSize = 10;
|
||||
int lastdistance = 999;
|
||||
int lastx = 0;
|
||||
int lasty = 0;
|
||||
int lastz = 0;
|
||||
int mx = super.worldObj.rand.nextBoolean() ? 1 : -1;
|
||||
int my = super.worldObj.rand.nextBoolean() ? 1 : -1;
|
||||
int mz = super.worldObj.rand.nextBoolean() ? 1 : -1;
|
||||
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int distance;
|
||||
for (a = -auraSize; a < auraSize + 1; ++a) {
|
||||
for (b = -auraSize; b < auraSize + 1; ++b) {
|
||||
for (c = -auraSize; c < auraSize + 1; ++c) {
|
||||
if (super.worldObj.getBlock(
|
||||
(int) super.posX + a * mx,
|
||||
(int) super.posY + b * my,
|
||||
(int) super.posZ + c * mz
|
||||
)
|
||||
!= Blocks.air) {
|
||||
distance = (int) this.getDistance(
|
||||
super.posX + (double) (a * mx) + 0.5,
|
||||
super.posY + (double) (b * my) + 0.5,
|
||||
super.posZ + (double) (c * mz) + 0.5
|
||||
);
|
||||
if (distance < lastdistance && distance <= auraSize) {
|
||||
lastdistance = distance;
|
||||
lastx = (int) super.posX + a * mx;
|
||||
lasty = (int) super.posY + b * my;
|
||||
lastz = (int) super.posZ + c * mz;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int zm;
|
||||
if (lastdistance < 999) {
|
||||
Block block = super.worldObj.getBlock(lastx, lasty, lastz);
|
||||
zm = super.worldObj.getBlockMetadata(lastx, lasty, lastz);
|
||||
if (block != Blocks.bedrock && block.getExplosionResistance(this) < 100.0F
|
||||
&& block.getBlockHardness(this.worldObj, lastx, lasty, lastz) != -1.0F) {
|
||||
block.dropBlockAsItemWithChance(
|
||||
super.worldObj,
|
||||
lastx,
|
||||
lasty,
|
||||
lastz,
|
||||
super.worldObj.getBlockMetadata(lastx, lasty, lastz),
|
||||
0.9F,
|
||||
0
|
||||
);
|
||||
super.worldObj.setBlockToAir(lastx, lasty, lastz);
|
||||
}
|
||||
}
|
||||
|
||||
a = MathHelper.floor_double(super.posX - (double) auraSize - 1.0);
|
||||
b = MathHelper.floor_double(super.posX + (double) auraSize + 1.0);
|
||||
c = MathHelper.floor_double(super.posY - (double) auraSize - 1.0);
|
||||
distance = MathHelper.floor_double(super.posY + (double) auraSize + 1.0);
|
||||
zm = MathHelper.floor_double(super.posZ - (double) auraSize - 1.0);
|
||||
int zp = MathHelper.floor_double(super.posZ + (double) auraSize + 1.0);
|
||||
List<Entity> list = super.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) a,
|
||||
(double) c,
|
||||
(double) zm,
|
||||
(double) b,
|
||||
(double) distance,
|
||||
(double) zp
|
||||
)
|
||||
);
|
||||
|
||||
Entity entity;
|
||||
for (a = 0; a < list.size(); ++a) {
|
||||
entity = (Entity) list.get(a);
|
||||
double d4 = entity.getDistance(super.posX, super.posY, super.posZ)
|
||||
/ (double) auraSize;
|
||||
double dx = entity.posX - super.posX;
|
||||
double dy = entity.posY - super.posY;
|
||||
double dz = entity.posZ - super.posZ;
|
||||
double d11 = (double) MathHelper.sqrt_double(dx * dx + dy * dy + dz * dz);
|
||||
dx /= d11;
|
||||
dy /= d11;
|
||||
dz /= d11;
|
||||
double d13 = (1.0 - d4) * 0.1;
|
||||
if (d13 < 0.0) {
|
||||
d13 = 0.0;
|
||||
}
|
||||
|
||||
entity.motionX -= dx * d13;
|
||||
entity.motionY -= dy * d13;
|
||||
entity.motionZ -= dz * d13;
|
||||
if (!(entity instanceof EntityLiving)) {
|
||||
// TODO: FX
|
||||
//FXWisp ef = new FXWisp(
|
||||
// super.worldObj,
|
||||
// (double) ((float) entity.prevPosX),
|
||||
// (double) ((float) entity.prevPosY + 0.1F),
|
||||
// (double) ((float) entity.prevPosZ),
|
||||
// 0.4F,
|
||||
// 5
|
||||
//);
|
||||
//ef.shrink = true;
|
||||
//Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
}
|
||||
}
|
||||
|
||||
a = MathHelper.floor_double(super.posX - 0.75);
|
||||
b = MathHelper.floor_double(super.posX + 0.75);
|
||||
c = MathHelper.floor_double(super.posY - 0.75);
|
||||
distance = MathHelper.floor_double(super.posY + 0.75);
|
||||
zm = MathHelper.floor_double(super.posZ - 0.75);
|
||||
zp = MathHelper.floor_double(super.posZ + 0.75);
|
||||
list = super.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) a,
|
||||
(double) c,
|
||||
(double) zm,
|
||||
(double) b,
|
||||
(double) distance,
|
||||
(double) zp
|
||||
)
|
||||
);
|
||||
|
||||
for (a = 0; a < list.size(); ++a) {
|
||||
entity = (Entity) list.get(a);
|
||||
if (!(entity instanceof EntitySingularity)) {
|
||||
if (entity instanceof EntityItem) {
|
||||
// TODO: crucible recipes
|
||||
//int val = (int) RecipesCrucible.smelting().getSmeltingResult(
|
||||
// ((EntityItem) entity).item, true, true
|
||||
//);
|
||||
//this.currentVis += (float) val;
|
||||
entity.setDead();
|
||||
// TODO: FX
|
||||
//FXWisp ef = new FXWisp(
|
||||
// super.worldObj,
|
||||
// (double) ((float) super.posX),
|
||||
// (double) ((float) super.posY + 0.1F),
|
||||
// (double) ((float) super.posZ),
|
||||
// 1.0F,
|
||||
// 5
|
||||
//);
|
||||
//ef.shrink = true;
|
||||
//Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
} else {
|
||||
entity.attackEntityFrom(DamageSource.magic, 3);
|
||||
if (entity instanceof EntityLiving) {
|
||||
++this.currentVis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doSpawnResult() {
|
||||
AuraManager.addFluxToClosest(
|
||||
this.worldObj,
|
||||
(float) this.posX,
|
||||
(float) this.posY,
|
||||
(float) this.posZ,
|
||||
new AspectList().add(Aspect.DARKNESS, (int) (this.currentVis / 4.0))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource entity, float i) {
|
||||
super.attackEntityFrom(entity, i);
|
||||
this.explode();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCollideWithPlayer(EntityPlayer entityplayer) {}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return !super.isDead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getShadowSize() {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound var1) {
|
||||
var1.setByte("Fuse", (byte) this.fuse);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound var1) {
|
||||
this.fuse = var1.getByte("Fuse");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package net.anvilcraft.thaummach.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.anvilcraft.thaummach.TMTab;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.IRepairable;
|
||||
|
||||
public class ItemFocus extends Item implements IRepairable {
|
||||
public int type = 0;
|
||||
|
||||
public ItemFocus(int tp) {
|
||||
super();
|
||||
super.maxStackSize = 1;
|
||||
this.setMaxDamage(tp == 0 ? 2500 : 2000);
|
||||
this.setCreativeTab(TMTab.INSTANCE);
|
||||
this.setUnlocalizedName("thaummach:focus_" + tp);
|
||||
this.canRepair = true;
|
||||
this.type = tp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
this.itemIcon = reg.registerIcon("thaummach:focus_" + this.type);
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//public float visRepairCost() {
|
||||
// return 0.05F;
|
||||
//}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void
|
||||
addInformation(ItemStack itemstack, EntityPlayer alec1, List list, boolean alec2) {
|
||||
switch (this.type) {
|
||||
case 0:
|
||||
list.add("Range: Medium - Focus: Narrow");
|
||||
list.add("Slightly improved durability");
|
||||
break;
|
||||
case 1:
|
||||
list.add("Range: Medium - Focus: Medium");
|
||||
list.add("Improved speed");
|
||||
break;
|
||||
case 2:
|
||||
list.add("Range: Long - Focus: Medium");
|
||||
break;
|
||||
case 3:
|
||||
list.add("Range: Medium - Focus: Wide");
|
||||
break;
|
||||
case 4:
|
||||
list.add("Range: Medium - Focus: Medium");
|
||||
list.add("Low value items are consumed");
|
||||
list.add("to improve efficiency");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package net.anvilcraft.thaummach.items;
|
||||
|
||||
import net.anvilcraft.thaummach.TMTab;
|
||||
import net.anvilcraft.thaummach.entities.EntitySingularity;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSingularity extends Item {
|
||||
public ItemSingularity() {
|
||||
super.maxStackSize = 64;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
this.setUnlocalizedName("thaummach:singularity");
|
||||
this.setCreativeTab(TMTab.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister reg) {
|
||||
this.itemIcon = reg.registerIcon("thaummach:singularity");
|
||||
}
|
||||
|
||||
public EnumRarity getRarity(ItemStack itemstack) {
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
public boolean hasEffect(ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack
|
||||
onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
|
||||
if (world.isRemote)
|
||||
return itemstack;
|
||||
|
||||
world.spawnEntityInWorld(new EntitySingularity(world, entityplayer));
|
||||
--itemstack.stackSize;
|
||||
return itemstack;
|
||||
}
|
||||
}
|
|
@ -59,4 +59,185 @@ public class ApparatusRenderingHelper {
|
|||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public static void renderItemIn2D(
|
||||
Tessellator tes,
|
||||
float p_78439_1_,
|
||||
float p_78439_2_,
|
||||
float p_78439_3_,
|
||||
float p_78439_4_,
|
||||
int p_78439_5_,
|
||||
int p_78439_6_,
|
||||
float p_78439_7_,
|
||||
int brightness
|
||||
) {
|
||||
tes.startDrawingQuads();
|
||||
tes.setBrightness(brightness);
|
||||
tes.setNormal(0.0F, 0.0F, 1.0F);
|
||||
tes.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) p_78439_1_, (double) p_78439_4_);
|
||||
tes.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) p_78439_3_, (double) p_78439_4_);
|
||||
tes.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) p_78439_3_, (double) p_78439_2_);
|
||||
tes.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) p_78439_1_, (double) p_78439_2_);
|
||||
tes.draw();
|
||||
tes.startDrawingQuads();
|
||||
tes.setBrightness(brightness);
|
||||
tes.setNormal(0.0F, 0.0F, -1.0F);
|
||||
tes.addVertexWithUV(
|
||||
0.0D,
|
||||
1.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_1_,
|
||||
(double) p_78439_2_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
1.0D,
|
||||
1.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_3_,
|
||||
(double) p_78439_2_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
1.0D,
|
||||
0.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_3_,
|
||||
(double) p_78439_4_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
0.0D,
|
||||
0.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_1_,
|
||||
(double) p_78439_4_
|
||||
);
|
||||
tes.draw();
|
||||
float f5 = 0.5F * (p_78439_1_ - p_78439_3_) / (float) p_78439_5_;
|
||||
float f6 = 0.5F * (p_78439_4_ - p_78439_2_) / (float) p_78439_6_;
|
||||
tes.startDrawingQuads();
|
||||
tes.setBrightness(brightness);
|
||||
tes.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
int k;
|
||||
float f7;
|
||||
float f8;
|
||||
|
||||
for (k = 0; k < p_78439_5_; ++k) {
|
||||
f7 = (float) k / (float) p_78439_5_;
|
||||
f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5;
|
||||
tes.addVertexWithUV(
|
||||
(double) f7,
|
||||
0.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) f8,
|
||||
(double) p_78439_4_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
(double) f7, 0.0D, 0.0D, (double) f8, (double) p_78439_4_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
(double) f7, 1.0D, 0.0D, (double) f8, (double) p_78439_2_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
(double) f7,
|
||||
1.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) f8,
|
||||
(double) p_78439_2_
|
||||
);
|
||||
}
|
||||
|
||||
tes.draw();
|
||||
tes.startDrawingQuads();
|
||||
tes.setBrightness(brightness);
|
||||
tes.setNormal(1.0F, 0.0F, 0.0F);
|
||||
float f9;
|
||||
|
||||
for (k = 0; k < p_78439_5_; ++k) {
|
||||
f7 = (float) k / (float) p_78439_5_;
|
||||
f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5;
|
||||
f9 = f7 + 1.0F / (float) p_78439_5_;
|
||||
tes.addVertexWithUV(
|
||||
(double) f9,
|
||||
1.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) f8,
|
||||
(double) p_78439_2_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
(double) f9, 1.0D, 0.0D, (double) f8, (double) p_78439_2_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
(double) f9, 0.0D, 0.0D, (double) f8, (double) p_78439_4_
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
(double) f9,
|
||||
0.0D,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) f8,
|
||||
(double) p_78439_4_
|
||||
);
|
||||
}
|
||||
|
||||
tes.draw();
|
||||
tes.startDrawingQuads();
|
||||
tes.setBrightness(brightness);
|
||||
tes.setNormal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < p_78439_6_; ++k) {
|
||||
f7 = (float) k / (float) p_78439_6_;
|
||||
f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6;
|
||||
f9 = f7 + 1.0F / (float) p_78439_6_;
|
||||
tes.addVertexWithUV(
|
||||
0.0D, (double) f9, 0.0D, (double) p_78439_1_, (double) f8
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
1.0D, (double) f9, 0.0D, (double) p_78439_3_, (double) f8
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
1.0D,
|
||||
(double) f9,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_3_,
|
||||
(double) f8
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
0.0D,
|
||||
(double) f9,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_1_,
|
||||
(double) f8
|
||||
);
|
||||
}
|
||||
|
||||
tes.draw();
|
||||
tes.startDrawingQuads();
|
||||
tes.setBrightness(brightness);
|
||||
tes.setNormal(0.0F, -1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < p_78439_6_; ++k) {
|
||||
f7 = (float) k / (float) p_78439_6_;
|
||||
f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6;
|
||||
tes.addVertexWithUV(
|
||||
1.0D, (double) f7, 0.0D, (double) p_78439_3_, (double) f8
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
0.0D, (double) f7, 0.0D, (double) p_78439_1_, (double) f8
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
0.0D,
|
||||
(double) f7,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_1_,
|
||||
(double) f8
|
||||
);
|
||||
tes.addVertexWithUV(
|
||||
1.0D,
|
||||
(double) f7,
|
||||
(double) (0.0F - p_78439_7_),
|
||||
(double) p_78439_3_,
|
||||
(double) f8
|
||||
);
|
||||
}
|
||||
|
||||
tes.draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
package net.anvilcraft.thaummach.render.apparatus.apparati.metal;
|
||||
|
||||
import net.anvilcraft.thaummach.blocks.BlockApparatusMetal;
|
||||
import net.anvilcraft.thaummach.render.apparatus.ApparatusRenderingHelper;
|
||||
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class BoreApparatusRenderer implements IApparatusRenderer {
|
||||
public static final BoreApparatusRenderer INSTANCE = new BoreApparatusRenderer();
|
||||
|
||||
@Override
|
||||
public void renderApparatus(
|
||||
IBlockAccess w,
|
||||
RenderBlocks rb,
|
||||
int i,
|
||||
int j,
|
||||
int k,
|
||||
Block block_,
|
||||
int meta,
|
||||
boolean inv
|
||||
) {
|
||||
BlockApparatusMetal block = (BlockApparatusMetal) block_;
|
||||
if (block.getRenderBlockPass() == 0 || inv) {
|
||||
boolean b1 = false;
|
||||
boolean b2 = false;
|
||||
boolean b3 = false;
|
||||
if (!inv) {
|
||||
TileBore te = (TileBore) w.getTileEntity(i, j, k);
|
||||
if (te.orientation == 0 || te.orientation == 1) {
|
||||
b1 = true;
|
||||
}
|
||||
|
||||
if (te.orientation == 4 || te.orientation == 5) {
|
||||
b2 = true;
|
||||
}
|
||||
|
||||
if (te.orientation == 2 || te.orientation == 3) {
|
||||
b3 = true;
|
||||
}
|
||||
}
|
||||
|
||||
float t2x = 0.125F;
|
||||
float t4x = 0.25F;
|
||||
IIcon t1 = block.iconGenerator3;
|
||||
IIcon t2 = block.iconGenerator2;
|
||||
IIcon tx = block.iconGenerator3;
|
||||
rb.overrideBlockTexture = tx;
|
||||
rb.setRenderBounds(t2x, t2x, t2x, 1.0F - t2x, 1.0F - t2x, 1.0F - t2x);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, t1, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
if (b1) {
|
||||
tx = t2;
|
||||
} else {
|
||||
tx = t1;
|
||||
}
|
||||
|
||||
rb.overrideBlockTexture = tx;
|
||||
rb.setRenderBounds(t4x, 0.0F, t4x, 1.0F - t4x, t2x, 1.0F - t4x);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, tx, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
rb.setRenderBounds(t4x, 1.0F - t2x, t4x, 1.0F - t4x, 1.0F, 1.0F - t4x);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, tx, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
if (b2) {
|
||||
tx = t2;
|
||||
} else {
|
||||
tx = t1;
|
||||
}
|
||||
|
||||
rb.overrideBlockTexture = tx;
|
||||
rb.setRenderBounds(0.0F, t4x, t4x, t2x, 1.0F - t4x, 1.0F - t4x);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, tx, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
rb.setRenderBounds(1.0F - t2x, t4x, t4x, 1.0F, 1.0F - t4x, 1.0F - t4x);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, tx, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
if (b3) {
|
||||
tx = t2;
|
||||
} else {
|
||||
tx = t1;
|
||||
}
|
||||
|
||||
rb.overrideBlockTexture = tx;
|
||||
rb.setRenderBounds(t4x, t4x, 0.0F, 1.0F - t4x, 1.0F - t4x, t2x);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, tx, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
rb.setRenderBounds(t4x, t4x, 1.0F - t2x, 1.0F - t4x, 1.0F - t4x, 1.0F);
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(rb, block, tx, true);
|
||||
} else {
|
||||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
rb.overrideBlockTexture = null;
|
||||
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
package net.anvilcraft.thaummach.render.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.anvilcraft.thaummach.entities.EntitySingularity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntitySingularityRenderer extends Render {
|
||||
public EntitySingularityRenderer() {
|
||||
super.shadowSize = 0.1F;
|
||||
}
|
||||
|
||||
public void
|
||||
renderEntityAt(EntitySingularity tg, double x, double y, double z, float fq) {
|
||||
if (tg.fuse > 0) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 771);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(
|
||||
TextureMap.locationItemsTexture
|
||||
);
|
||||
int i = 99;
|
||||
int size = 16;
|
||||
//float f1 = 256.0F;
|
||||
float f3 = 15.99F;
|
||||
|
||||
float f1 = ActiveRenderInfo.rotationX;
|
||||
float fa = ActiveRenderInfo.rotationXZ;
|
||||
float f4 = ActiveRenderInfo.rotationZ;
|
||||
//float f4 = ActiveRenderInfo.rotationYZ;
|
||||
float f5 = ActiveRenderInfo.rotationXY;
|
||||
float x0 = ((float) (i % 16 * size) + 0.0F) / f1;
|
||||
float x1 = ((float) (i % 16 * size) + f3) / f1;
|
||||
float x2 = ((float) (i / 16 * size) + 0.0F) / f1;
|
||||
float x3 = ((float) (i / 16 * size) + f3) / f1;
|
||||
float f10 = 0.2F;
|
||||
float f11 = (float) x;
|
||||
float f12 = (float) y;
|
||||
float f13 = (float) z;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (f11 - f1 * f10 - f4 * f10),
|
||||
(double) (f12 - fa * f10),
|
||||
(double) (f13 - f4 * f10 - f5 * f10),
|
||||
(double) x1,
|
||||
(double) x3
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (f11 - f1 * f10 + f4 * f10),
|
||||
(double) (f12 + fa * f10),
|
||||
(double) (f13 - f4 * f10 + f5 * f10),
|
||||
(double) x1,
|
||||
(double) x2
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (f11 + f1 * f10 + f4 * f10),
|
||||
(double) (f12 + fa * f10),
|
||||
(double) (f13 + f4 * f10 + f5 * f10),
|
||||
(double) x0,
|
||||
(double) x2
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (f11 + f1 * f10 - f4 * f10),
|
||||
(double) (f12 - fa * f10),
|
||||
(double) (f13 + f4 * f10 - f5 * f10),
|
||||
(double) x0,
|
||||
(double) x3
|
||||
);
|
||||
tessellator.draw();
|
||||
GL11.glDisable(3042);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
int q = Minecraft.getMinecraft().gameSettings.fancyGraphics ? 60 : 30;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
float f1 = (float) Math.abs(tg.fuse) / 170.0F;
|
||||
float f3 = 0.9F;
|
||||
float f2 = 0.0F;
|
||||
if (f1 > 0.8F) {
|
||||
f2 = (f1 - 0.8F) / 0.2F;
|
||||
}
|
||||
|
||||
Random random = new Random(245L);
|
||||
GL11.glDisable(3553);
|
||||
GL11.glShadeModel(7425);
|
||||
GL11.glEnable(3042);
|
||||
GL11.glBlendFunc(770, 1);
|
||||
GL11.glDisable(3008);
|
||||
GL11.glEnable(2884);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
int i;
|
||||
for (i = 0; (float) i < (f1 + f1 * f1) / 2.0F * (float) q; ++i) {
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(
|
||||
random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F
|
||||
);
|
||||
tessellator.startDrawing(6);
|
||||
float fa = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
|
||||
float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
|
||||
fa /= 3.0F;
|
||||
f4 /= 3.0F;
|
||||
tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
|
||||
tessellator.addVertex(0.0, 0.0, 0.0);
|
||||
tessellator.setColorRGBA_I(16711935, 0);
|
||||
tessellator.addVertex(
|
||||
-0.866 * (double) f4, (double) fa, (double) (-0.5F * f4)
|
||||
);
|
||||
tessellator.addVertex(
|
||||
0.866 * (double) f4, (double) fa, (double) (-0.5F * f4)
|
||||
);
|
||||
tessellator.addVertex(0.0, (double) fa, (double) (1.0F * f4));
|
||||
tessellator.addVertex(
|
||||
-0.866 * (double) f4, (double) fa, (double) (-0.5F * f4)
|
||||
);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
for (i = 0; (float) i < (f3 + f3 * f3) / 2.0F * (float) q; ++i) {
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(
|
||||
random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F
|
||||
);
|
||||
tessellator.startDrawing(6);
|
||||
float fa = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
|
||||
float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
|
||||
fa /= 7.0F;
|
||||
f4 /= 7.0F;
|
||||
tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
|
||||
tessellator.addVertex(0.0, 0.0, 0.0);
|
||||
tessellator.setColorRGBA_I(255, 0);
|
||||
tessellator.addVertex(
|
||||
-0.866 * (double) f4, (double) fa, (double) (-0.5F * f4)
|
||||
);
|
||||
tessellator.addVertex(
|
||||
0.866 * (double) f4, (double) fa, (double) (-0.5F * f4)
|
||||
);
|
||||
tessellator.addVertex(0.0, (double) fa, (double) (1.0F * f4));
|
||||
tessellator.addVertex(
|
||||
-0.866 * (double) f4, (double) fa, (double) (-0.5F * f4)
|
||||
);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(2884);
|
||||
GL11.glDisable(3042);
|
||||
GL11.glShadeModel(7424);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(3553);
|
||||
GL11.glEnable(3008);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public void
|
||||
doRender(Entity entity, double d, double d1, double d2, float f, float f1) {
|
||||
this.renderEntityAt((EntitySingularity) entity, d, d1, d2, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package net.anvilcraft.thaummach.render.tile;
|
||||
|
||||
import net.anvilcraft.thaummach.TMBlocks;
|
||||
import net.anvilcraft.thaummach.blocks.BlockApparatusMetal;
|
||||
import net.anvilcraft.thaummach.render.apparatus.ApparatusRenderingHelper;
|
||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemEnderPearl;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import thaumcraft.client.renderers.models.ModelCrystal;
|
||||
|
||||
public class TileBoreRenderer extends TileEntitySpecialRenderer {
|
||||
private ModelCrystal model = new ModelCrystal();
|
||||
|
||||
public void renderEntityAt(TileBore cr, double x, double y, double z, float fq) {
|
||||
if (true || cr.focus != -1) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int count = mc.thePlayer.ticksExisted;
|
||||
float bob = 0.0F;
|
||||
float angleS = (float) cr.rotation;
|
||||
float jitter = 0.0F;
|
||||
if (cr.duration > 0 && cr.gettingPower()) {
|
||||
jitter = (cr.getWorldObj().rand.nextFloat()
|
||||
- cr.getWorldObj().rand.nextFloat())
|
||||
* 0.1F;
|
||||
}
|
||||
|
||||
this.translateFromOrientation(x, y, z, cr.orientation);
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
|
||||
GL11.glRotatef(angleS, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.25f, 0.25f, 0.0F);
|
||||
GL11.glScalef(-0.5f, -0.5f, 1f);
|
||||
// TODO: rüssel
|
||||
//ThaumCraftRenderer.renderItemFromTexture(
|
||||
// mc,
|
||||
// "/thaumcraft/resources/items.png",
|
||||
// 16,
|
||||
// 43 + cr.focus,
|
||||
// 0.4F,
|
||||
// 1.5F + jitter,
|
||||
// true,
|
||||
// 1.0F,
|
||||
// 1.0F,
|
||||
// 1.0F,
|
||||
// 220,
|
||||
// 771
|
||||
//);
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
IIcon icon = Items.ender_eye.getIconFromDamage(0);
|
||||
ApparatusRenderingHelper.renderItemIn2D(
|
||||
Tessellator.instance,
|
||||
icon.getMaxU(),
|
||||
icon.getMinV(),
|
||||
icon.getMinU(),
|
||||
icon.getMaxV(),
|
||||
icon.getIconWidth(),
|
||||
icon.getIconHeight(),
|
||||
1.0f,
|
||||
128
|
||||
);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private void translateFromOrientation(double x, double y, double z, int orientation) {
|
||||
GL11.glPushMatrix();
|
||||
if (orientation == 0) {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z + 1.0F);
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
} else if (orientation == 1) {
|
||||
GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z);
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
} else if (orientation == 2) {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
} else if (orientation == 3) {
|
||||
GL11.glTranslatef((float) x + 1.0F, (float) y, (float) z + 1.0F);
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (orientation == 4) {
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z + 1.0F);
|
||||
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
} else if (orientation == 5) {
|
||||
GL11.glTranslatef((float) x + 1.0F, (float) y, (float) z);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
}
|
||||
|
||||
public void
|
||||
renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f) {
|
||||
// TODO: WTF
|
||||
//double var10002 = (double) te.xCoord + 0.5;
|
||||
//double var10003 = (double) te.yCoord + 0.5;
|
||||
//double var10004 = (double) te.zCoord;
|
||||
//if (ThaumCraftCore.isVisibleTo(
|
||||
// 1.5F,
|
||||
// ModLoader.getMinecraftInstance().thePlayer,
|
||||
// var10002,
|
||||
// var10003,
|
||||
// var10004 + 0.5
|
||||
// )) {
|
||||
this.renderEntityAt((TileBore) te, d, d1, d2, f);
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,918 @@
|
|||
package net.anvilcraft.thaummach.tiles;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.tilera.auracore.api.HelperLocation;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import thaumcraft.client.fx.particles.FXWisp;
|
||||
|
||||
public class TileBore extends TileEntity implements ISidedInventory {
|
||||
public int orientation = 0;
|
||||
public int duration;
|
||||
public int maxDuration;
|
||||
private int minedelay;
|
||||
public int rotation;
|
||||
public int focus = -1;
|
||||
private int range = 32;
|
||||
private int area = 2;
|
||||
private int delay = 4;
|
||||
private boolean conserve = false;
|
||||
private ItemStack[] boreItemStacks;
|
||||
private Map<Integer, EntityItem> entities;
|
||||
|
||||
public TileBore() {
|
||||
this.orientation = 0;
|
||||
this.boreItemStacks = new ItemStack[2];
|
||||
this.entities = new HashMap<>();
|
||||
}
|
||||
|
||||
// TODO: GUIs
|
||||
//public GuiScreen getGui(EntityPlayer player) {
|
||||
// return new GuiBore(player.inventory, this);
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (this.duration > 0 && this.gettingPower()) {
|
||||
this.rotation += 6 - this.delay;
|
||||
}
|
||||
|
||||
if (this.rotation > 360) {
|
||||
this.rotation -= 360;
|
||||
}
|
||||
|
||||
// TODO: actually implement the bore
|
||||
//if (!super.worldObj.isRemote) {
|
||||
// int a;
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus0.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus1.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus2.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus3.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus4.shiftedIndex) {
|
||||
// if (this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemSingularity.shiftedIndex) {
|
||||
// if (this.boreItemStacks[1] == null) {
|
||||
// this.boreItemStacks[1] = this.boreItemStacks[0];
|
||||
// this.boreItemStacks[0] = null;
|
||||
// } else if (this.boreItemStacks[1].getItem().shiftedIndex ==
|
||||
// mod_ThaumCraft.itemSingularity.shiftedIndex) {
|
||||
// a = Math.min(
|
||||
// this.boreItemStacks[0].stackSize,
|
||||
// 64 - this.boreItemStacks[1].stackSize
|
||||
// );
|
||||
// ItemStack var10000 = this.boreItemStacks[1];
|
||||
// var10000.stackSize += a;
|
||||
// var10000 = this.boreItemStacks[0];
|
||||
// var10000.stackSize -= a;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (this.boreItemStacks[0] != null) {
|
||||
// float f = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
// float f1 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
// float f2 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
// EntityItem entityitem = new EntityItem(
|
||||
// super.worldObj,
|
||||
// (double) ((float) super.xCoord + f),
|
||||
// (double) ((float) super.yCoord + f1),
|
||||
// (double) ((float) super.zCoord + f2),
|
||||
// ItemStack.copyItemStack(this.boreItemStacks[0])
|
||||
// );
|
||||
// float f3 = 0.05F;
|
||||
// entityitem.motionX
|
||||
// = (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||
// entityitem.motionY = (double
|
||||
// ) ((float) super.worldObj.rand.nextGaussian() * f3 + 0.2F);
|
||||
// entityitem.motionZ
|
||||
// = (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||
// super.worldObj.spawnEntityInWorld(entityitem);
|
||||
// this.boreItemStacks[0] = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// this.focus = -1;
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus0.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 2;
|
||||
// this.delay = 4;
|
||||
// this.conserve = false;
|
||||
// this.focus = 0;
|
||||
// }
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus1.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 3;
|
||||
// this.delay = 2;
|
||||
// this.conserve = false;
|
||||
// this.focus = 1;
|
||||
// }
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus2.shiftedIndex) {
|
||||
// this.range = 80;
|
||||
// this.area = 3;
|
||||
// this.delay = 4;
|
||||
// this.conserve = false;
|
||||
// this.focus = 2;
|
||||
// }
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus3.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 5;
|
||||
// this.delay = 4;
|
||||
// this.conserve = false;
|
||||
// this.focus = 3;
|
||||
// }
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus4.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 3;
|
||||
// this.delay = 4;
|
||||
// this.conserve = true;
|
||||
// this.focus = 4;
|
||||
// }
|
||||
|
||||
// ++this.minedelay;
|
||||
// if (this.minedelay > this.delay) {
|
||||
// this.minedelay = 0;
|
||||
// }
|
||||
|
||||
// if (this.duration > 0 && this.gettingPower() && this.minedelay == 0
|
||||
// && this.boreItemStacks[0] != null) {
|
||||
// for (a = 0; a < 4; ++a) {
|
||||
// if (this.minedBlock()) {
|
||||
// this.boreItemStacks[0].setItemDamage(
|
||||
// this.boreItemStacks[0].getItemDamage() + 1
|
||||
// );
|
||||
// if (this.boreItemStacks[0].getItemDamage()
|
||||
// > this.boreItemStacks[0].getMaxDamage()) {
|
||||
// this.boreItemStacks[0] = null;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// super.worldObj.playSoundEffect(
|
||||
// (double) super.xCoord,
|
||||
// (double) super.yCoord,
|
||||
// (double) super.zCoord,
|
||||
// "mob.slimeattack",
|
||||
// 0.3F,
|
||||
// 0.1F + super.worldObj.rand.nextFloat() * 0.3F
|
||||
// );
|
||||
// --this.duration;
|
||||
// if (!Config.lowGfx) {
|
||||
// HelperLocation hl = new HelperLocation(this, this.orientation);
|
||||
// HelperLocation hl2 = new HelperLocation(this, this.orientation);
|
||||
// hl.moveForwards(1.0);
|
||||
// hl2.moveForwards(5.0);
|
||||
// FXWisp ef = new FXWisp(
|
||||
// super.worldObj,
|
||||
// hl.x + 0.5,
|
||||
// hl.y + 0.5,
|
||||
// hl.z + 0.5,
|
||||
// hl2.x + 0.5,
|
||||
// hl2.y + 0.5,
|
||||
// hl2.z + 0.5,
|
||||
// 0.6F,
|
||||
// this.focus == 0 ? 5 : this.focus
|
||||
// );
|
||||
// ef.shrink = true;
|
||||
// ef.blendmode = 1;
|
||||
// ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Collection c = this.entities.values();
|
||||
|
||||
// EntityItem ac;
|
||||
// for (Iterator i$ = c.iterator(); i$.hasNext(); ac.fireResistance = 1) {
|
||||
// ac = (EntityItem) i$.next();
|
||||
// ac.noClip = false;
|
||||
// }
|
||||
|
||||
// this.entities.clear();
|
||||
// if (this.duration > 0 && this.gettingPower() && this.focus >= 0) {
|
||||
// this.suckItems();
|
||||
// }
|
||||
|
||||
// if (this.duration == 0 && this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[1] != null && this.gettingPower()
|
||||
// && this.boreItemStacks[1].isItemEqual(
|
||||
// new ItemStack(mod_ThaumCraft.itemSingularity)
|
||||
// )) {
|
||||
// this.maxDuration = 250;
|
||||
// this.duration = this.maxDuration;
|
||||
// --this.boreItemStacks[1].stackSize;
|
||||
// if (this.boreItemStacks[1].stackSize == 0) {
|
||||
// this.boreItemStacks[1] = null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public boolean gettingPower() {
|
||||
return super.worldObj.isBlockIndirectlyGettingPowered(
|
||||
super.xCoord, super.yCoord, super.zCoord
|
||||
)
|
||||
|| super.worldObj.isBlockIndirectlyGettingPowered(
|
||||
super.xCoord, super.yCoord + 1, super.zCoord
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void suckItems() {
|
||||
int xm = 0;
|
||||
int xp = 0;
|
||||
int ym = 0;
|
||||
int yp = 0;
|
||||
int zm = 0;
|
||||
int zp = 0;
|
||||
int radius = this.area + 1;
|
||||
if (this.orientation == 0) {
|
||||
xm = zm = -radius;
|
||||
zp = radius;
|
||||
xp = radius;
|
||||
ym = -this.range - 1;
|
||||
} else if (this.orientation == 1) {
|
||||
xm = zm = -radius;
|
||||
zp = radius;
|
||||
xp = radius;
|
||||
yp = this.range + 1;
|
||||
} else if (this.orientation == 2) {
|
||||
xm = ym = -radius;
|
||||
yp = radius;
|
||||
xp = radius;
|
||||
zm = -this.range - 1;
|
||||
} else if (this.orientation == 3) {
|
||||
xm = ym = -radius;
|
||||
yp = radius;
|
||||
xp = radius;
|
||||
zp = this.range + 1;
|
||||
} else if (this.orientation == 4) {
|
||||
zm = ym = -radius;
|
||||
yp = radius;
|
||||
zp = radius;
|
||||
xm = -this.range - 1;
|
||||
} else if (this.orientation == 5) {
|
||||
zm = ym = -radius;
|
||||
yp = radius;
|
||||
zp = radius;
|
||||
xp = this.range + 1;
|
||||
}
|
||||
|
||||
HelperLocation loc = new HelperLocation(this, this.orientation);
|
||||
loc.moveForwards(1.0);
|
||||
List<EntityItem> list = super.worldObj.getEntitiesWithinAABB(
|
||||
EntityItem.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) (super.xCoord + xm),
|
||||
(double) (super.yCoord + ym),
|
||||
(double) (super.zCoord + zm),
|
||||
(double) super.xCoord + 1.0 + (double) xp,
|
||||
(double) super.yCoord + 1.0 + (double) yp,
|
||||
(double) super.zCoord + 1.0 + (double) zp
|
||||
)
|
||||
);
|
||||
|
||||
int a;
|
||||
EntityItem entity;
|
||||
for (a = 0; a < list.size(); ++a) {
|
||||
entity = (EntityItem) list.get(a);
|
||||
if (entity instanceof EntityItem && !entity.noClip) {
|
||||
double d6 = entity.posX - loc.x - 0.5;
|
||||
double d8 = entity.posY - loc.y - 0.5;
|
||||
double d10 = entity.posZ - loc.z - 0.5;
|
||||
double d11
|
||||
= (double) MathHelper.sqrt_double(d6 * d6 + d8 * d8 + d10 * d10);
|
||||
d6 /= d11;
|
||||
d8 /= d11;
|
||||
d10 /= d11;
|
||||
double d13 = 0.3;
|
||||
entity.motionX -= d6 * d13;
|
||||
entity.motionY -= d8 * d13;
|
||||
entity.motionZ -= d10 * d13;
|
||||
if (entity.motionX > 0.35) {
|
||||
entity.motionX = 0.35;
|
||||
}
|
||||
|
||||
if (entity.motionX < -0.35) {
|
||||
entity.motionX = -0.35;
|
||||
}
|
||||
|
||||
if (entity.motionY > 0.35) {
|
||||
entity.motionY = 0.35;
|
||||
}
|
||||
|
||||
if (entity.motionY < -0.35) {
|
||||
entity.motionY = -0.35;
|
||||
}
|
||||
|
||||
if (entity.motionZ > 0.35) {
|
||||
entity.motionZ = 0.35;
|
||||
}
|
||||
|
||||
if (entity.motionZ < -0.35) {
|
||||
entity.motionZ = -0.35;
|
||||
}
|
||||
|
||||
entity.delayBeforeCanPickup = 2;
|
||||
entity.fireResistance = 50;
|
||||
entity.noClip = true;
|
||||
boolean dp = true;
|
||||
|
||||
if (dp) {
|
||||
FXWisp ef = new FXWisp(
|
||||
super.worldObj,
|
||||
(double) ((float) entity.prevPosX),
|
||||
(double) ((float) entity.prevPosY + 0.1F),
|
||||
(double) ((float) entity.prevPosZ),
|
||||
0.4F,
|
||||
this.focus == 0 ? 5 : this.focus
|
||||
);
|
||||
ef.shrink = true;
|
||||
ef.blendmode = 1;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
}
|
||||
|
||||
if (this.entities.get(entity.getEntityId()) == null) {
|
||||
this.entities.put(entity.getEntityId(), entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list = super.worldObj.getEntitiesWithinAABB(
|
||||
EntityItem.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
loc.x, loc.y, loc.z, loc.x + 1.0, loc.y + 1.0, loc.z + 1.0
|
||||
)
|
||||
);
|
||||
|
||||
for (a = 0; a < list.size(); ++a) {
|
||||
entity = (EntityItem) list.get(a);
|
||||
if (entity instanceof EntityItem && !entity.isDead) {
|
||||
entity.motionX = 0.0;
|
||||
entity.motionY = 0.0;
|
||||
entity.motionZ = 0.0;
|
||||
entity.noClip = false;
|
||||
entity.fireResistance = 1;
|
||||
FXWisp ef = new FXWisp(
|
||||
super.worldObj,
|
||||
(double) ((float) entity.prevPosX),
|
||||
(double) ((float) entity.prevPosY + 0.1F),
|
||||
(double) ((float) entity.prevPosZ),
|
||||
1.0F,
|
||||
this.focus == 0 ? 5 : this.focus
|
||||
);
|
||||
ef.shrink = true;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
|
||||
switch (this.orientation) {
|
||||
case 0:
|
||||
this.ejectBoreItems(
|
||||
entity,
|
||||
super.xCoord,
|
||||
super.yCoord + 1,
|
||||
super.zCoord,
|
||||
0.0F,
|
||||
0.1F,
|
||||
0.0F
|
||||
);
|
||||
break;
|
||||
case 1:
|
||||
this.ejectBoreItems(
|
||||
entity,
|
||||
super.xCoord,
|
||||
super.yCoord - 1,
|
||||
super.zCoord,
|
||||
0.0F,
|
||||
-0.1F,
|
||||
0.0F
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
this.ejectBoreItems(
|
||||
entity,
|
||||
super.xCoord,
|
||||
super.yCoord,
|
||||
super.zCoord + 1,
|
||||
0.0F,
|
||||
0.0F,
|
||||
0.1F
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
this.ejectBoreItems(
|
||||
entity,
|
||||
super.xCoord,
|
||||
super.yCoord,
|
||||
super.zCoord - 1,
|
||||
0.0F,
|
||||
0.0F,
|
||||
-0.1F
|
||||
);
|
||||
break;
|
||||
case 4:
|
||||
this.ejectBoreItems(
|
||||
entity,
|
||||
super.xCoord + 1,
|
||||
super.yCoord,
|
||||
super.zCoord,
|
||||
0.1F,
|
||||
0.0F,
|
||||
0.0F
|
||||
);
|
||||
break;
|
||||
case 5:
|
||||
this.ejectBoreItems(
|
||||
entity,
|
||||
super.xCoord - 1,
|
||||
super.yCoord,
|
||||
super.zCoord,
|
||||
-0.1F,
|
||||
0.0F,
|
||||
0.0F
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void
|
||||
ejectBoreItems(EntityItem entity, int x, int y, int z, float mx, float my, float mz) {
|
||||
super.worldObj.getTileEntity(x, y, z);
|
||||
if (this.conserve
|
||||
&& this.maxDuration - entity.getEntityItem().stackSize >= this.duration) {
|
||||
// TODO: vis smelting stuff
|
||||
//float val
|
||||
// = RecipesCrucible.smelting().getSmeltingResult(entity.item, true, true);
|
||||
//if (val > 0.0F && val < 2.0F) {
|
||||
// this.duration += entity.item.stackSize;
|
||||
// entity.setDead();
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
|
||||
if (!placeInForgeContainer(super.worldObj, entity, x, y, z, this.orientation)) {
|
||||
entity.setLocationAndAngles(
|
||||
(double) x + 0.5 - (double) (mx * 3.0F),
|
||||
(double) y + 0.5 - (double) (my * 3.0F),
|
||||
(double) z + 0.5 - (double) (mz * 3.0F),
|
||||
0.0F,
|
||||
0.0F
|
||||
);
|
||||
entity.motionX = (double) mx;
|
||||
entity.motionY = (double) my;
|
||||
entity.motionZ = (double) mz;
|
||||
super.worldObj.spawnParticle(
|
||||
"smoke",
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
0.0,
|
||||
0.1 * (double) super.worldObj.rand.nextFloat(),
|
||||
0.0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean minedBlock() {
|
||||
int xm = 0;
|
||||
int ym = 0;
|
||||
int zm = 0;
|
||||
double xoff = 0.0;
|
||||
double yoff = 0.0;
|
||||
double zoff = 0.0;
|
||||
int radius = this.area;
|
||||
if (this.orientation != 0 && this.orientation != 1) {
|
||||
if (this.orientation != 2 && this.orientation != 3) {
|
||||
if (this.orientation == 4 || this.orientation == 5) {
|
||||
zm = super.worldObj.rand.nextInt(radius)
|
||||
- super.worldObj.rand.nextInt(radius);
|
||||
ym = super.worldObj.rand.nextInt(radius)
|
||||
- super.worldObj.rand.nextInt(radius);
|
||||
if (this.orientation == 4) {
|
||||
xm = -2;
|
||||
xoff = -1.5;
|
||||
} else {
|
||||
xm = 2;
|
||||
xoff = 1.5;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xm = super.worldObj.rand.nextInt(radius)
|
||||
- super.worldObj.rand.nextInt(radius);
|
||||
ym = super.worldObj.rand.nextInt(radius)
|
||||
- super.worldObj.rand.nextInt(radius);
|
||||
if (this.orientation == 2) {
|
||||
zm = -2;
|
||||
zoff = -1.5;
|
||||
} else {
|
||||
zm = 2;
|
||||
zoff = 1.5;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xm = super.worldObj.rand.nextInt(radius)
|
||||
- super.worldObj.rand.nextInt(radius);
|
||||
zm = super.worldObj.rand.nextInt(radius)
|
||||
- super.worldObj.rand.nextInt(radius);
|
||||
if (this.orientation == 0) {
|
||||
ym = -2;
|
||||
yoff = -1.5;
|
||||
} else {
|
||||
ym = 2;
|
||||
yoff = 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
Block id = super.worldObj.getBlock(
|
||||
super.xCoord + xm, super.yCoord + ym, super.zCoord + zm
|
||||
);
|
||||
int meta = super.worldObj.getBlockMetadata(
|
||||
super.xCoord + xm, super.yCoord + ym, super.zCoord + zm
|
||||
);
|
||||
boolean unb = false;
|
||||
if (id != Blocks.air) {
|
||||
unb = id.getBlockHardness(
|
||||
this.worldObj,
|
||||
this.xCoord + xm,
|
||||
this.yCoord + ym,
|
||||
this.zCoord + zm
|
||||
)
|
||||
== -1.0F;
|
||||
}
|
||||
|
||||
if (id != Blocks.air && !unb && id != Blocks.bedrock && id != Blocks.water
|
||||
&& id != Blocks.flowing_water) {
|
||||
id.dropBlockAsItem(
|
||||
super.worldObj,
|
||||
super.xCoord + xm,
|
||||
super.yCoord + ym,
|
||||
super.zCoord + zm,
|
||||
meta,
|
||||
0
|
||||
);
|
||||
super.worldObj.setBlockToAir(
|
||||
super.xCoord + xm, super.yCoord + ym, super.zCoord + zm
|
||||
);
|
||||
super.worldObj.spawnParticle(
|
||||
"explode",
|
||||
(double) ((float) (super.xCoord + xm) + 0.5F),
|
||||
(double) ((float) (super.yCoord + ym) + 0.5F),
|
||||
(double) ((float) (super.zCoord + zm) + 0.5F),
|
||||
-0.0,
|
||||
-0.0,
|
||||
-0.0
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) (super.xCoord + xm) + 0.5,
|
||||
(double) (super.yCoord + ym) + 0.5,
|
||||
(double) (super.zCoord + zm) + 0.5,
|
||||
"step.gravel",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.orientation == 0) {
|
||||
--ym;
|
||||
} else if (this.orientation == 1) {
|
||||
++ym;
|
||||
} else if (this.orientation == 2) {
|
||||
--zm;
|
||||
} else if (this.orientation == 3) {
|
||||
++zm;
|
||||
} else if (this.orientation == 4) {
|
||||
--xm;
|
||||
} else if (this.orientation == 5) {
|
||||
++xm;
|
||||
}
|
||||
} while (super.yCoord + ym >= 0 && super.yCoord + ym <= 255 && xm <= this.range
|
||||
&& xm >= -this.range && zm <= this.range && zm >= -this.range
|
||||
&& ym <= this.range && ym >= -this.range);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
this.orientation = nbttagcompound.getShort("orientation");
|
||||
this.duration = nbttagcompound.getShort("duration");
|
||||
this.maxDuration = nbttagcompound.getShort("maxDuration");
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", 10);
|
||||
this.boreItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound1
|
||||
= (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
|
||||
byte byte0 = nbttagcompound1.getByte("SlotBore");
|
||||
if (byte0 >= 0 && byte0 < this.boreItemStacks.length) {
|
||||
this.boreItemStacks[byte0]
|
||||
= ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setShort("orientation", (short) this.orientation);
|
||||
nbttagcompound.setShort("duration", (short) this.duration);
|
||||
nbttagcompound.setShort("maxDuration", (short) this.maxDuration);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.boreItemStacks.length; ++i) {
|
||||
if (this.boreItemStacks[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("SlotBore", (byte) i);
|
||||
this.boreItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
public boolean rotate() {
|
||||
++this.orientation;
|
||||
if (this.orientation > 5) {
|
||||
this.orientation -= 6;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.boreItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return this.boreItemStacks[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (this.boreItemStacks[i] != null) {
|
||||
ItemStack itemstack1;
|
||||
if (this.boreItemStacks[i].stackSize <= j) {
|
||||
itemstack1 = this.boreItemStacks[i];
|
||||
this.boreItemStacks[i] = null;
|
||||
return itemstack1;
|
||||
} else {
|
||||
itemstack1 = this.boreItemStacks[i].splitStack(j);
|
||||
if (this.boreItemStacks[i].stackSize == 0) {
|
||||
this.boreItemStacks[i] = null;
|
||||
}
|
||||
|
||||
return itemstack1;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
this.boreItemStacks[i] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) {
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: WTF
|
||||
//@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
if (super.worldObj.getTileEntity(super.xCoord, super.yCoord, super.zCoord)
|
||||
!= this) {
|
||||
return false;
|
||||
} else {
|
||||
return entityplayer.getDistanceSq(
|
||||
(double) super.xCoord + 0.5,
|
||||
(double) super.yCoord + 0.5,
|
||||
(double) super.zCoord + 0.5
|
||||
)
|
||||
<= 64.0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int var1) {
|
||||
if (this.boreItemStacks[var1] != null) {
|
||||
ItemStack var2 = this.boreItemStacks[var1];
|
||||
this.boreItemStacks[var1] = null;
|
||||
return var2;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean placeInForgeContainer(
|
||||
World worldObj, EntityItem entity, int x, int y, int z, int orientation
|
||||
) {
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
// TODO: buildcraft
|
||||
//if (te instanceof ISpecialInventory) {
|
||||
// boolean redo = false;
|
||||
|
||||
// do {
|
||||
// ISpecialInventory si = (ISpecialInventory) te;
|
||||
// if (si.addItem(entity.item, true, Orientations.Unknown)) {
|
||||
// if (entity.item.stackSize == 0) {
|
||||
// entity.setDead();
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// redo = true;
|
||||
// }
|
||||
// } while (redo);
|
||||
//}
|
||||
|
||||
//if (te instanceof IPipeEntry) {
|
||||
// IPipeEntry pe = (IPipeEntry) te;
|
||||
// if (pe.acceptItems()) {
|
||||
// Orientations or = Orientations.Unknown;
|
||||
// switch (orientation) {
|
||||
// case 0:
|
||||
// or = Orientations.YPos;
|
||||
// --y;
|
||||
// break;
|
||||
// case 1:
|
||||
// or = Orientations.YNeg;
|
||||
// ++y;
|
||||
// break;
|
||||
// case 2:
|
||||
// or = Orientations.ZPos;
|
||||
// --z;
|
||||
// break;
|
||||
// case 3:
|
||||
// or = Orientations.ZNeg;
|
||||
// ++z;
|
||||
// break;
|
||||
// case 4:
|
||||
// or = Orientations.XPos;
|
||||
// --x;
|
||||
// break;
|
||||
// case 5:
|
||||
// or = Orientations.XNeg;
|
||||
// ++x;
|
||||
// }
|
||||
|
||||
// EntityPassiveItem epi = new EntityPassiveItem(
|
||||
// worldObj, (double) x, (double) y, (double) z, entity.item
|
||||
// );
|
||||
// epi.posX += 0.5;
|
||||
// epi.posY += 0.5;
|
||||
// epi.posZ += 0.5;
|
||||
// pe.entityEntering(epi, or);
|
||||
// entity.setDead();
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (te instanceof IInventory) {
|
||||
IInventory ii = (IInventory) te;
|
||||
if (putIntoChest(x, y, z, ii, entity)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int xx = -1; xx < 2; ++xx) {
|
||||
for (int zz = -1; zz < 2; ++zz) {
|
||||
if ((xx != 0 || zz != 0) && (xx == 0 || zz == 0)) {
|
||||
TileEntity te2 = worldObj.getTileEntity(x + xx, y, z + zz);
|
||||
if (te2 instanceof IInventory) {
|
||||
IInventory ii2 = (IInventory) te2;
|
||||
if (putIntoChest(x + xx, y, z + zz, ii2, entity)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean
|
||||
putIntoChest(int x, int y, int z, IInventory ii, EntityItem entity) {
|
||||
for (int a = 0; a < ii.getSizeInventory(); ++a) {
|
||||
if (ii.getStackInSlot(a) == null) {
|
||||
ii.setInventorySlotContents(a, entity.getEntityItem());
|
||||
entity.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ii.getStackInSlot(a).isItemEqual(entity.getEntityItem())
|
||||
&& ii.getStackInSlot(a).getMaxStackSize()
|
||||
>= entity.getEntityItem().stackSize
|
||||
+ ii.getStackInSlot(a).stackSize) {
|
||||
ItemStack var10000 = entity.getEntityItem();
|
||||
var10000.stackSize += ii.getStackInSlot(a).stackSize;
|
||||
ii.setInventorySlotContents(a, entity.getEntityItem());
|
||||
entity.setDead();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ii.getStackInSlot(a).isItemEqual(entity.getEntityItem())
|
||||
&& ii.getStackInSlot(a).getMaxStackSize() > ii.getStackInSlot(a).stackSize
|
||||
&& ii.getStackInSlot(a).getMaxStackSize()
|
||||
< entity.getEntityItem().stackSize + ii.getStackInSlot(a).stackSize) {
|
||||
int diff = entity.getEntityItem().stackSize
|
||||
+ ii.getStackInSlot(a).stackSize
|
||||
- ii.getStackInSlot(a).getMaxStackSize();
|
||||
ii.getStackInSlot(a).stackSize = ii.getStackInSlot(a).getMaxStackSize();
|
||||
entity.getEntityItem().stackSize = diff;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "thaummach:bore";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
// TODO: filtering
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
if (side != 0 && side != 1) {
|
||||
return new int[] { 0 };
|
||||
} else {
|
||||
return new int[] { 1 };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side) {
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -22,3 +22,13 @@ tile.thaummach:apparatus_metal_void_chest.name=Void Chest
|
|||
tile.thaummach:apparatus_metal_void_interface.name=Void Interface
|
||||
tile.thaummach:apparatus_metal_tank.name=Thaumium Reinforced Tank
|
||||
tile.thaummach:apparatus_metal_soul_brazier.name=Soul Brazier
|
||||
|
||||
# ---- ITEMS ----
|
||||
|
||||
item.thaummach:focus_0.name=Arcane Focus
|
||||
item.thaummach:focus_1.name=Arcane Focus: Air
|
||||
item.thaummach:focus_2.name=Arcane Focus: Water
|
||||
item.thaummach:focus_3.name=Arcane Focus: Earth
|
||||
item.thaummach:focus_4.name=Arcane Focus: Fire
|
||||
|
||||
item.thaummach:singularity.name=Arcane Singularity
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 584 B |
Binary file not shown.
After Width: | Height: | Size: 617 B |
Binary file not shown.
After Width: | Height: | Size: 612 B |
Binary file not shown.
After Width: | Height: | Size: 607 B |
Binary file not shown.
After Width: | Height: | Size: 613 B |
Binary file not shown.
After Width: | Height: | Size: 921 B |
Loading…
Reference in New Issue