Lumos changes - closes #74

This commit is contained in:
John Yorke committed 2022-01-07 23:17:33 -04:00
1 parent fbe4b73a49
commit 13bfced90b
3 files changed
+35 -75

No files matched your search

@@ -26,6 +26,7 @@ public class BlockLumos extends Block implements ITileEntityProvider {
setTickRandomly(false);
setLightLevel(1.0F);
setBlockTextureName("thaumcraft:blank");
setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
}
@Override
@@ -52,17 +53,6 @@ public class BlockLumos extends Block implements ITileEntityProvider {
ParticleEngine.instance.addEffect(world, fx);
}
@Override
public void setBlockBoundsBasedOnState (final IBlockAccess world, final int x, final int y, final int z) {
final int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) {
setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 0.7F, 0.7F);
}
else {
setBlockBounds(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (final World world, final int x, final int y, final int z) {
return null;
@@ -17,9 +17,6 @@ import thaumcraft.common.items.wands.ItemWandCasting;
public class TileLumos extends TileEntity {
public TileLumos () {
}
@Override
public boolean canUpdate () {
return true;
@@ -27,57 +24,15 @@ public class TileLumos extends TileEntity {
@Override
public void updateEntity () {
final Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
final int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if (block instanceof BlockLumos) {
final EntityPlayer player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 4);
if (meta == 0 && worldObj.rand.nextInt(15) == 0 && worldObj.isRemote) {
if (this.getBlockType() instanceof BlockLumos) {
if (worldObj.rand.nextInt(15) == 0 && worldObj.isRemote) {
spawnParticles();
}
if ( (meta == 1 || meta == 2) && player == null) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
else if (meta == 1 && player != null) {
if (player.getHeldItem() == null
|| player.getHeldItem() != null && ! (player.getHeldItem().getItem() instanceof ItemWandCasting)) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
else if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting) {
final ItemStack stack = player.getHeldItem();
final ItemWandCasting wand = (ItemWandCasting) stack.getItem();
if (wand.getFocus(stack) == null
|| wand.getFocus(stack) != null && wand.getFocus(stack) != ItemRegistry.ItemFocusLumos) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
}
if (meta == 2 && player != null) {
final IInventory baub = BaublesApi.getBaubles(player);
if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) == null) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
else if (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) == null
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
else if (baub.getStackInSlot(1) == null && baub.getStackInSlot(2) != null
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
else if (baub.getStackInSlot(1) != null && baub.getStackInSlot(2) != null
&& ! (baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
&& ! (baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
}
}
@SideOnly (Side.CLIENT)
void spawnParticles () {
private void spawnParticles () {
final FXSparkle fx = new FXSparkle(worldObj, xCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D,
yCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D, zCoord + 0.5D + worldObj.rand.nextGaussian() * 0.1D, 1.75F,
6, 3 + worldObj.rand.nextInt(2));