feat: basic soul brazier impl

This commit is contained in:
LordMZTE 2023-05-16 19:20:32 +02:00
parent 6a9a0633f6
commit ecd1db1e41
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
12 changed files with 869 additions and 7 deletions

View File

@ -24,6 +24,7 @@ import net.anvilcraft.thaummach.tiles.TileCrystallizer;
import net.anvilcraft.thaummach.tiles.TileFilter;
import net.anvilcraft.thaummach.tiles.TilePurifier;
import net.anvilcraft.thaummach.tiles.TileSeal;
import net.anvilcraft.thaummach.tiles.TileSoulBrazier;
import net.anvilcraft.thaummach.tiles.TileVoidChest;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
@ -56,6 +57,7 @@ public class ClientProxy extends CommonProxy {
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
GameRegistry.registerTileEntity(TileFilter.class, "filter");
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
GameRegistry.registerTileEntity(TileSoulBrazier.class, "soulBrazier");
ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer());
ClientRegistry.registerTileEntity(

View File

@ -12,6 +12,7 @@ import net.anvilcraft.thaummach.tiles.TileCrystallizer;
import net.anvilcraft.thaummach.tiles.TileFilter;
import net.anvilcraft.thaummach.tiles.TilePurifier;
import net.anvilcraft.thaummach.tiles.TileSeal;
import net.anvilcraft.thaummach.tiles.TileSoulBrazier;
import net.anvilcraft.thaummach.tiles.TileVoidChest;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
@ -36,5 +37,6 @@ public class CommonProxy {
GameRegistry.registerTileEntity(TileSeal.class, "seal");
GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest");
GameRegistry.registerTileEntity(TileVoidInterface.class, "voidInterface");
GameRegistry.registerTileEntity(TileSoulBrazier.class, "soulBrazier");
}
}

View File

@ -4,8 +4,17 @@ 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.network.NetworkRegistry;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.relauncher.Side;
import dev.tilera.auracore.api.HelperLocation;
import net.anvilcraft.thaummach.entities.EntitySingularity;
import net.anvilcraft.thaummach.packets.IPacketFX;
import net.anvilcraft.thaummach.packets.PacketFXSparkle;
import net.anvilcraft.thaummach.packets.PacketFXWisp;
import net.minecraft.world.World;
@Mod(modid = "thaummach")
public class ThaumicMachinery {
@ -16,8 +25,19 @@ public class ThaumicMachinery {
)
public static CommonProxy proxy;
public static SimpleNetworkWrapper channel;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent ev) {
channel = NetworkRegistry.INSTANCE.newSimpleChannel("thaummach");
int pktid = 0;
channel.registerMessage(
new PacketFXWisp.Handler(), PacketFXWisp.class, pktid++, Side.CLIENT
);
channel.registerMessage(
new PacketFXSparkle.Handler(), PacketFXSparkle.class, pktid++, Side.CLIENT
);
proxy.registerTileEntities();
TMBlocks.init();
TMItems.init();
@ -32,4 +52,11 @@ public class ThaumicMachinery {
);
proxy.init();
}
public static void sendFXPacket(World worldObj, IPacketFX pkt) {
HelperLocation loc = pkt.getLocation();
channel.sendToAllAround(
pkt, new TargetPoint(worldObj.provider.dimensionId, loc.x, loc.y, loc.z, 32)
);
}
}

View File

@ -12,6 +12,7 @@ import net.anvilcraft.thaummach.render.apparatus.apparati.metal.ArcaneFurnaceApp
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.render.apparatus.apparati.metal.SoulBrazierApparatusRenderer;
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.VoidChestApparatusRenderer;
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.VoidInterfaceApparatusRenderer;
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
@ -19,6 +20,7 @@ import net.anvilcraft.thaummach.tiles.TileBore;
import net.anvilcraft.thaummach.tiles.TileConduitTank;
import net.anvilcraft.thaummach.tiles.TileCrucible;
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
import net.anvilcraft.thaummach.tiles.TileSoulBrazier;
import net.anvilcraft.thaummach.tiles.TileVoidChest;
import net.anvilcraft.thaummach.tiles.TileVoidInterface;
import net.minecraft.block.Block;
@ -166,6 +168,10 @@ public class BlockApparatusMetal extends BlockApparatus {
case VOID_INTERFACE:
return VoidInterfaceApparatusRenderer.INSTANCE;
case SOUL_BRAZIER:
return SoulBrazierApparatusRenderer.INSTANCE;
default:
return null;
}
@ -193,7 +199,7 @@ public class BlockApparatusMetal extends BlockApparatus {
} else if (md == MetaVals.TANK) {
return new TileConduitTank();
} else if (md == MetaVals.SOUL_BRAZIER) {
//return new TileSoulBrazier();
return new TileSoulBrazier();
}
return null;
@ -310,6 +316,9 @@ public class BlockApparatusMetal extends BlockApparatus {
} else {
return this.iconArcaneFurnaceSide;
}
} else if (meta == MetaVals.SOUL_BRAZIER) {
return side == 0 || side == 1 ? this.iconSoulBrazierBottom
: this.iconSoulBrazierSide;
}
//else if (meta == 5) {
// return 144;
@ -865,12 +874,11 @@ public class BlockApparatusMetal extends BlockApparatus {
// ? 13
// : 0;
} else if (md == MetaVals.SOUL_BRAZIER) {
// TODO: soul brazier
//tsb = iba.getTileEntity(i, j, k);
//return tsb != null && tsb instanceof TileSoulBrazier
// && ((TileSoulBrazier) tsb).isWorking()
// ? 15
// : 0;
tsb = iba.getTileEntity(i, j, k);
return tsb != null && tsb instanceof TileSoulBrazier
&& ((TileSoulBrazier) tsb).isWorking()
? 15
: 0;
} else {
return super.getLightValue(iba, i, j, k);
}

View File

@ -0,0 +1,21 @@
package net.anvilcraft.thaummach.packets;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
abstract class AbstractFXPacketHandler<Req extends IPacketFX>
implements IMessageHandler<Req, IMessage> {
public abstract EntityFX readFX(Req message);
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(Req message, MessageContext ctx) {
Minecraft.getMinecraft().effectRenderer.addEffect(this.readFX(message));
return null;
}
}

View File

@ -0,0 +1,8 @@
package net.anvilcraft.thaummach.packets;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import dev.tilera.auracore.api.HelperLocation;
public interface IPacketFX extends IMessage {
public HelperLocation getLocation();
}

View File

@ -0,0 +1,79 @@
package net.anvilcraft.thaummach.packets;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.api.HelperLocation;
import dev.tilera.auracore.client.FXSparkle;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
public class PacketFXSparkle implements IPacketFX {
double x;
double y;
double z;
float f;
int type;
int m;
float gravity;
public PacketFXSparkle() {}
public PacketFXSparkle(
double x, double y, double z, float f, int type, int m, float gravity
) {
this.x = x;
this.y = y;
this.z = z;
this.f = f;
this.type = type;
this.m = m;
this.gravity = gravity;
}
@Override
public void fromBytes(ByteBuf buf) {
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.f = buf.readFloat();
this.type = buf.readInt();
this.m = buf.readInt();
this.gravity = buf.readFloat();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeDouble(this.x);
buf.writeDouble(this.y);
buf.writeDouble(this.z);
buf.writeFloat(this.f);
buf.writeInt(this.type);
buf.writeInt(this.m);
buf.writeFloat(this.gravity);
}
@Override
public HelperLocation getLocation() {
return new HelperLocation(this.x, this.y, this.z);
}
public static class Handler extends AbstractFXPacketHandler<PacketFXSparkle> {
@Override
@SideOnly(Side.CLIENT)
public EntityFX readFX(PacketFXSparkle msg) {
FXSparkle fx = new FXSparkle(
Minecraft.getMinecraft().theWorld,
msg.x,
msg.y,
msg.z,
msg.f,
msg.type,
msg.m
);
fx.setGravity(msg.gravity);
return fx;
}
}
}

View File

@ -0,0 +1,75 @@
package net.anvilcraft.thaummach.packets;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dev.tilera.auracore.api.HelperLocation;
import io.netty.buffer.ByteBuf;
import net.anvilcraft.thaummach.particles.FXWisp;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
public class PacketFXWisp implements IPacketFX {
double x;
double y;
double z;
float f;
int type;
boolean shrink;
float gravity;
public PacketFXWisp() {}
public PacketFXWisp(
double x, double y, double z, float f, int type, boolean shrink, float gravity
) {
this.x = x;
this.y = y;
this.z = z;
this.f = f;
this.type = type;
this.shrink = shrink;
this.gravity = gravity;
}
@Override
public void fromBytes(ByteBuf buf) {
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.f = buf.readFloat();
this.type = buf.readInt();
this.shrink = buf.readBoolean();
this.gravity = buf.readFloat();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeDouble(this.x);
buf.writeDouble(this.y);
buf.writeDouble(this.z);
buf.writeFloat(this.f);
buf.writeInt(this.type);
buf.writeBoolean(this.shrink);
buf.writeFloat(this.gravity);
}
public static class Handler extends AbstractFXPacketHandler<PacketFXWisp> {
@Override
@SideOnly(Side.CLIENT)
public EntityFX readFX(PacketFXWisp msg) {
FXWisp fx = new FXWisp(
Minecraft.getMinecraft().theWorld, msg.x, msg.y, msg.z, msg.f, msg.type
);
fx.shrink = msg.shrink;
fx.setGravity(msg.gravity);
return fx;
}
}
@Override
public HelperLocation getLocation() {
return new HelperLocation(this.x, this.y, this.z);
}
}

View File

@ -0,0 +1,234 @@
package net.anvilcraft.thaummach.particles;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
public class FXWisp extends EntityFX {
public boolean shrink;
float moteParticleScale;
int moteHalfLife;
public boolean tinkle;
public int blendmode;
public FXWisp(
World world, double d, double d1, double d2, float f, float f1, float f2
) {
this(world, d, d1, d2, 1.0F, f, f1, f2);
}
public FXWisp(
World world, double d, double d1, double d2, float f, float f1, float f2, float f3
) {
super(world, d, d1, d2, 0.0, 0.0, 0.0);
this.shrink = false;
this.tinkle = false;
this.blendmode = 1;
if (f1 == 0.0F) {
f1 = 1.0F;
}
super.particleRed = f1;
super.particleGreen = f2;
super.particleBlue = f3;
super.particleGravity = 0.0F;
super.motionX = super.motionY = super.motionZ = 0.0;
super.particleScale *= f;
this.moteParticleScale = super.particleScale;
super.particleMaxAge = (int) (36.0 / (Math.random() * 0.3 + 0.7));
this.moteHalfLife = super.particleMaxAge / 2;
super.noClip = false;
}
public FXWisp(World world, double d, double d1, double d2, float f, int type) {
this(world, d, d1, d2, f, 0.0F, 0.0F, 0.0F);
switch (type) {
case 0:
super.particleRed = 0.75F + world.rand.nextFloat() * 0.25F;
super.particleGreen = 0.25F + world.rand.nextFloat() * 0.25F;
super.particleBlue = 0.75F + world.rand.nextFloat() * 0.25F;
break;
case 1:
super.particleRed = 0.5F + world.rand.nextFloat() * 0.3F;
super.particleGreen = 0.5F + world.rand.nextFloat() * 0.3F;
super.particleBlue = 0.2F;
break;
case 2:
super.particleRed = 0.2F;
super.particleGreen = 0.2F;
super.particleBlue = 0.7F + world.rand.nextFloat() * 0.3F;
break;
case 3:
super.particleRed = 0.2F;
super.particleGreen = 0.7F + world.rand.nextFloat() * 0.3F;
super.particleBlue = 0.2F;
break;
case 4:
super.particleRed = 0.7F + world.rand.nextFloat() * 0.3F;
super.particleGreen = 0.2F;
super.particleBlue = 0.2F;
break;
case 5:
this.blendmode = 771;
super.particleRed = world.rand.nextFloat() * 0.1F;
super.particleGreen = world.rand.nextFloat() * 0.1F;
super.particleBlue = world.rand.nextFloat() * 0.1F;
break;
case 6:
super.particleRed = 0.8F + world.rand.nextFloat() * 0.2F;
super.particleGreen = 0.8F + world.rand.nextFloat() * 0.2F;
super.particleBlue = 0.8F + world.rand.nextFloat() * 0.2F;
break;
case 7:
float rr = world.rand.nextFloat();
super.particleRed = 0.2F + rr * 0.3F;
super.particleGreen = 0.2F + rr * 0.3F;
super.particleBlue = 0.7F + world.rand.nextFloat() * 0.3F;
}
}
public FXWisp(
World world,
double d,
double d1,
double d2,
double x,
double y,
double z,
float f,
int type
) {
this(world, d, d1, d2, f, type);
double dx = x - super.posX;
double dy = y - super.posY;
double dz = z - super.posZ;
super.motionX = dx / (double) super.particleMaxAge;
super.motionY = dy / (double) super.particleMaxAge;
super.motionZ = dz / (double) super.particleMaxAge;
}
public void renderParticle(
Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5
) {
float agescale = 0.0F;
if (this.shrink) {
agescale = ((float) super.particleMaxAge - (float) super.particleAge)
/ (float) super.particleMaxAge;
} else {
agescale = (float) super.particleAge / (float) this.moteHalfLife;
if (agescale > 1.0F) {
agescale = 2.0F - agescale;
}
}
super.particleScale = this.moteParticleScale * agescale;
tessellator.draw();
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, this.blendmode);
Minecraft.getMinecraft().renderEngine.bindTexture(
new ResourceLocation("thaummach", "textures/misc/p_large.png")
);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float f10 = 0.5F * super.particleScale;
float f11 = (float
) (super.prevPosX + (super.posX - super.prevPosX) * (double) f
- EntityFX.interpPosX);
float f12 = (float
) (super.prevPosY + (super.posY - super.prevPosY) * (double) f
- EntityFX.interpPosY);
float f13 = (float
) (super.prevPosZ + (super.posZ - super.prevPosZ) * (double) f
- EntityFX.interpPosZ);
tessellator.startDrawingQuads();
tessellator.setBrightness(240);
tessellator.setColorRGBA_F(
super.particleRed, super.particleGreen, super.particleBlue, 0.5F
);
tessellator.addVertexWithUV(
(double) (f11 - f1 * f10 - f4 * f10),
(double) (f12 - f2 * f10),
(double) (f13 - f3 * f10 - f5 * f10),
0.0,
1.0
);
tessellator.addVertexWithUV(
(double) (f11 - f1 * f10 + f4 * f10),
(double) (f12 + f2 * f10),
(double) (f13 - f3 * f10 + f5 * f10),
1.0,
1.0
);
tessellator.addVertexWithUV(
(double) (f11 + f1 * f10 + f4 * f10),
(double) (f12 + f2 * f10),
(double) (f13 + f3 * f10 + f5 * f10),
1.0,
0.0
);
tessellator.addVertexWithUV(
(double) (f11 + f1 * f10 - f4 * f10),
(double) (f12 - f2 * f10),
(double) (f13 + f3 * f10 - f5 * f10),
0.0,
0.0
);
tessellator.draw();
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(
new ResourceLocation("textures/particles/particles.png")
);
tessellator.startDrawingQuads();
}
public void onUpdate() {
EntityPlayer renderentity = Minecraft.getMinecraft().thePlayer;
int visibleDistance = 50;
if (renderentity.getDistance(super.posX, super.posY, super.posZ)
> (double) visibleDistance) {
this.setDead();
}
super.prevPosX = super.posX;
super.prevPosY = super.posY;
super.prevPosZ = super.posZ;
if (super.particleAge == 0 && this.tinkle
&& super.worldObj.rand.nextInt(3) == 0) {
super.worldObj.playSoundAtEntity(
this,
"random.orb",
0.02F,
0.5F
* ((super.worldObj.rand.nextFloat() - super.worldObj.rand.nextFloat())
* 0.6F
+ 2.0F)
);
}
if (super.particleAge++ >= super.particleMaxAge) {
this.setDead();
}
super.motionY -= 0.04 * (double) super.particleGravity;
this.moveEntity(super.motionX, super.motionY, super.motionZ);
super.motionX *= 0.9800000190734863;
super.motionY *= 0.9800000190734863;
super.motionZ *= 0.9800000190734863;
if (super.onGround) {
super.motionX *= 0.699999988079071;
super.motionZ *= 0.699999988079071;
}
}
public void setGravity(float value) {
super.particleGravity = value;
}
}

View File

@ -0,0 +1,120 @@
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.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
public class SoulBrazierApparatusRenderer implements IApparatusRenderer {
public static SoulBrazierApparatusRenderer INSTANCE
= new SoulBrazierApparatusRenderer();
@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) {
float t4 = 0.25F;
float t2 = 0.125F;
float t6 = 0.375F;
rb.setRenderBounds(t2, 0.5F, t6, t4, 1.0F, 1.0F - t6);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
true
);
} else {
rb.renderStandardBlock(block, i, j, k);
}
rb.setRenderBounds(t6, 0.5F, t2, 1.0F - t6, 1.0F, t4);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
true
);
} else {
rb.renderStandardBlock(block, i, j, k);
}
rb.setRenderBounds(1.0F - t4, 0.5F, t6, 1.0F - t2, 1.0F, 1.0F - t6);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
true
);
} else {
rb.renderStandardBlock(block, i, j, k);
}
rb.setRenderBounds(t6, 0.5F, 1.0F - t4, 1.0F - t6, 1.0F, 1.0F - t2);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
true
);
} else {
rb.renderStandardBlock(block, i, j, k);
}
rb.setRenderBounds(t4, 0.0F, t4, 1.0F - t4, 0.5F + t4, 1.0F - t4);
if (inv) {
ApparatusRenderingHelper.drawFaces(
rb,
block,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
block.iconSoulBrazierBottom,
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);
}
}

View File

@ -0,0 +1,286 @@
package net.anvilcraft.thaummach.tiles;
import dev.tilera.auracore.api.AuraNode;
import dev.tilera.auracore.aura.AuraManager;
import net.anvilcraft.thaummach.ThaumicMachinery;
import net.anvilcraft.thaummach.packets.PacketFXSparkle;
import net.anvilcraft.thaummach.packets.PacketFXWisp;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.EnumSkyBlock;
public class TileSoulBrazier extends TileEntity implements ISidedInventory {
private ItemStack stack = null;
private int delay;
public int burnTime;
private boolean previousLight;
private int lightingDelay;
// TODO: implement soul fragment
public static ItemStack VALID_ITEM = new ItemStack(Blocks.soul_sand);
// TODO: GUIs
//public GuiScreen getGui(EntityPlayer player) {
// return new GuiSoulBrazier(player.inventory, this);
//}
public boolean isWorking() {
return this.burnTime > 0
&& !super.worldObj.isBlockIndirectlyGettingPowered(
super.xCoord, super.yCoord, super.zCoord
);
}
@Override
public void updateEntity() {
if (this.lightingDelay <= 0 && this.isWorking() != this.previousLight) {
super.worldObj.markBlockForUpdate(super.xCoord, super.yCoord, super.zCoord);
super.worldObj.updateLightByType(
EnumSkyBlock.Block, super.xCoord, super.yCoord, super.zCoord
);
this.lightingDelay = 10;
this.previousLight = this.isWorking();
}
--this.lightingDelay;
if (!super.worldObj.isBlockIndirectlyGettingPowered(
super.xCoord, super.yCoord, super.zCoord
)) {
if (this.burnTime <= 0 && this.stack != null
&& this.stack.isItemEqual(VALID_ITEM)) {
this.burnTime = 6000;
this.lightingDelay = 0;
super.worldObj.markBlockForUpdate(
super.xCoord, super.yCoord, super.zCoord
);
super.worldObj.updateLightByType(
EnumSkyBlock.Block, super.xCoord, super.yCoord, super.zCoord
);
--this.stack.stackSize;
if (this.stack.stackSize == 0) {
this.stack = null;
}
}
if (this.burnTime > 0) {
--this.burnTime;
int q = 5;
if (this.burnTime % q == 0) {
ThaumicMachinery.sendFXPacket(
this.worldObj,
new PacketFXWisp(
(double) ((float) super.xCoord + 0.5F),
(double) (super.yCoord + 1),
(double) ((float) super.zCoord + 0.5F),
0.6F,
5,
true,
-0.03f
)
);
ThaumicMachinery.sendFXPacket(
this.worldObj,
new PacketFXWisp(
(double) ((float) super.xCoord + 0.5F),
(double) ((float) super.yCoord + 0.8F),
(double) ((float) super.zCoord + 0.5F),
0.2F,
6,
false,
-0.015f
)
);
ThaumicMachinery.sendFXPacket(
this.worldObj,
new PacketFXSparkle(
(double
) ((float) super.xCoord + 0.5F
+ (super.worldObj.rand.nextFloat()
- super.worldObj.rand.nextFloat())
/ 5.0F),
(double
) ((float) (super.yCoord + 1)
+ (super.worldObj.rand.nextFloat()
- super.worldObj.rand.nextFloat())
/ 5.0F),
(double
) ((float) super.zCoord + 0.5F
+ (super.worldObj.rand.nextFloat()
- super.worldObj.rand.nextFloat())
/ 5.0F),
0.65F,
6,
3,
-0.03F
)
);
}
if (this.delay > 0) {
--this.delay;
return;
}
this.delay = 90 - (3 + Math.abs(super.worldObj.getMoonPhase() - 4)) * 10;
int closestId = AuraManager.getClosestAuraWithinRange(
this.worldObj, this.xCoord, this.yCoord, this.zCoord, 16
);
if (closestId < 0)
return;
AuraNode closest = AuraManager.getNode(closestId);
int secondClosestId = -1;
synchronized (AuraManager.saveLock) {
AuraManager.auraNodes.remove(closestId);
secondClosestId = AuraManager.getClosestAuraWithinRange(
this.worldObj, this.xCoord, this.yCoord, this.zCoord, 1024
);
AuraManager.auraNodes.put(closestId, closest);
}
if (secondClosestId < 0)
return;
AuraNode secondClosest = AuraManager.getNode(secondClosestId);
if (this.worldObj.rand.nextBoolean() && secondClosest.level > 0) {
AuraManager.queueNodeChanges(
secondClosestId, -1, 0, false, null, 0, 0, 0
);
AuraManager.queueNodeChanges(closestId, 1, 0, false, null, 0, 0, 0);
} else if (secondClosest.taint > 0) {
AuraManager.queueNodeChanges(
secondClosestId, 0, 0, -1, false, null, 0, 0, 0
);
AuraManager.queueNodeChanges(
closestId, 0, 0, 1, false, null, 0, 0, 0
);
}
}
}
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
this.burnTime = nbttagcompound.getInteger("burnTime");
if (nbttagcompound.hasKey("stack"))
this.stack
= ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("stack"));
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("burnTime", this.burnTime);
if (this.stack != null) {
NBTTagCompound stackTag = new NBTTagCompound();
this.stack.writeToNBT(stackTag);
nbttagcompound.setTag("stack", stackTag);
}
}
@Override
public ItemStack decrStackSize(int i, int j) {
if (this.stack != null) {
ItemStack itemstack1;
if (this.stack.stackSize <= j) {
itemstack1 = this.stack;
this.stack = null;
return itemstack1;
} else {
itemstack1 = this.stack.splitStack(j);
if (this.stack.stackSize == 0) {
this.stack = null;
}
return itemstack1;
}
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
this.stack = itemstack;
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) {
itemstack.stackSize = this.getInventoryStackLimit();
}
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public ItemStack getStackInSlot(int i) {
return this.stack;
}
@Override
public ItemStack getStackInSlotOnClosing(int var1) {
ItemStack stack = this.stack;
this.stack = null;
return stack;
}
@Override
public String getInventoryName() {
return "Brazier of Souls";
}
@Override
public boolean hasCustomInventoryName() {
return true;
}
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int slot, ItemStack otherStack) {
return this.canInsertItem(slot, otherStack, 0);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return new int[] { 0 };
}
@Override
public boolean canInsertItem(int slot, ItemStack otherStack, int side) {
return this.stack == null ? otherStack.getItem() == VALID_ITEM.getItem()
: (this.stack.isItemEqual(otherStack))
&& otherStack.stackSize + this.stack.stackSize
<= this.stack.getMaxStackSize();
}
@Override
public boolean canExtractItem(int slot, ItemStack otherStack, int side) {
return this.stack != null && otherStack.isItemEqual(this.stack)
&& otherStack.stackSize <= this.stack.stackSize;
}
@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
return true;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B