Smaller TE's in the root package. several of the bigger ones left

This commit is contained in:
Vincent Lee committed 2015-11-22 23:56:18 -06:00
1 parent c2f1a9ab17
commit b72be67dd7
26 files changed
+192 -205

No files matched your search

@@ -35,7 +35,7 @@ public class BlockEnderEye extends BlockModContainer implements ILexiconable {
setResistance(10F);
setStepSound(soundTypeMetal);
setUnlocalizedName(LibBlockNames.ENDER_EYE_BLOCK);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWER, 0));
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWER, 0)); // todo 1.8 this is probably powered (bool). see the TE
}
@Override
@@ -11,22 +11,23 @@
package vazkii.botania.common.block.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import vazkii.botania.common.Botania;
public class TileBifrost extends TileMod {
public class TileBifrost extends TileMod implements IUpdatePlayerListBox {
private static final String TAG_TICKS = "ticks";
public int ticks = 0;
@Override
public void updateEntity() {
public void update() {
if(!worldObj.isRemote) {
if(ticks <= 0) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.setBlockToAir(pos);
} else ticks--;
} else if(Math.random() < 0.1)
Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random(), zCoord + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
Botania.proxy.sparkleFX(worldObj, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
}
@Override
@@ -24,15 +24,10 @@ public class TileCamo extends TileMod {
public Block camo;
public int camoMeta;
@Override
public boolean canUpdate() {
return false;
}
@Override
public void writeCustomNBT(NBTTagCompound cmp) {
if(camo != null) {
cmp.setString(TAG_CAMO, Block.blockRegistry.getNameForObject(camo));
cmp.setString(TAG_CAMO, Block.blockRegistry.getNameForObject(camo).toString());
cmp.setInteger(TAG_CAMO_META, camoMeta);
}
}
@@ -46,6 +41,6 @@ public class TileCamo extends TileMod {
@Override
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
super.onDataPacket(manager, packet);
worldObj.markBlockRangeForRenderUpdate(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord);
worldObj.markBlockRangeForRenderUpdate(pos, pos);
}
}
@@ -27,26 +27,17 @@ public class TileCell extends TileMod {
private int generation;
private boolean ticked;
private BlockPos flowerCoords = new BlockPos();
private BlockPos validCoords = new BlockPos();
@Override
public boolean canUpdate() {
return false;
}
private BlockPos flowerCoords = new BlockPos(0, -1, 0);
private BlockPos validCoords = new BlockPos(0, -1, 0);
public void setGeneration(TileEntity flower, int gen) {
generation = gen;
if(!ticked) {
flowerCoords.posX = flower.xCoord;
flowerCoords.posY = flower.yCoord;
flowerCoords.posZ = flower.zCoord;
validCoords.posX = xCoord;
validCoords.posY = yCoord;
validCoords.posZ = zCoord;
flowerCoords = flower.getPos();
validCoords = this.getPos();
ticked = true;
} else if(!matchCoords(validCoords, this) || !matchCoords(flowerCoords, flower))
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.setBlockToAir(pos);
}
public boolean isSameFlower(TileEntity flower) {
@@ -54,7 +45,7 @@ public class TileCell extends TileMod {
}
private boolean matchCoords(BlockPos coords, TileEntity tile) {
return coords.posX == tile.xCoord && coords.posY == tile.yCoord && coords.posZ == tile.zCoord;
return coords.equals(tile.getPos());
}
public int getGeneration() {
@@ -66,12 +57,12 @@ public class TileCell extends TileMod {
cmp.setInteger(TAG_GENERATION, generation);
cmp.setBoolean(TAG_TICKED, ticked);
if(ticked) {
cmp.setInteger(TAG_FLOWER_X, flowerCoords.posX);
cmp.setInteger(TAG_FLOWER_Y, flowerCoords.posY);
cmp.setInteger(TAG_FLOWER_Z, flowerCoords.posZ);
cmp.setInteger(TAG_VALID_X, validCoords.posX);
cmp.setInteger(TAG_VALID_Y, validCoords.posY);
cmp.setInteger(TAG_VALID_Z, validCoords.posZ);
cmp.setInteger(TAG_FLOWER_X, flowerCoords.getX());
cmp.setInteger(TAG_FLOWER_Y, flowerCoords.getY());
cmp.setInteger(TAG_FLOWER_Z, flowerCoords.getZ());
cmp.setInteger(TAG_VALID_X, validCoords.getX());
cmp.setInteger(TAG_VALID_Y, validCoords.getY());
cmp.setInteger(TAG_VALID_Z, validCoords.getZ());
}
}
@@ -80,12 +71,16 @@ public class TileCell extends TileMod {
generation = cmp.getInteger(TAG_GENERATION);
ticked = cmp.getBoolean(TAG_TICKED);
if(ticked) {
flowerCoords.posX = cmp.getInteger(TAG_FLOWER_X);
flowerCoords.posY = cmp.getInteger(TAG_FLOWER_Y);
flowerCoords.posZ = cmp.getInteger(TAG_FLOWER_Z);
validCoords.posX = cmp.getInteger(TAG_VALID_X);
validCoords.posY = cmp.getInteger(TAG_VALID_Y);
validCoords.posZ = cmp.getInteger(TAG_VALID_Z);
flowerCoords = new BlockPos(
cmp.getInteger(TAG_FLOWER_X),
cmp.getInteger(TAG_FLOWER_Y),
cmp.getInteger(TAG_FLOWER_Z)
);
validCoords = new BlockPos(
cmp.getInteger(TAG_VALID_X),
cmp.getInteger(TAG_VALID_Y),
cmp.getInteger(TAG_VALID_Z)
);
}
}
@@ -22,9 +22,10 @@ import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
public class TileCocoon extends TileMod {
public class TileCocoon extends TileMod implements IUpdatePlayerListBox {
private static final String TAG_TIME_PASSED = "timePassed";
private static final String TAG_EMERALDS_GIVEN = "emeraldsGiven";
@@ -36,7 +37,7 @@ public class TileCocoon extends TileMod {
public int emeraldsGiven;
@Override
public void updateEntity() {
public void update() {
timePassed++;
if(timePassed >= TOTAL_TIME)
hatch();
@@ -44,8 +45,8 @@ public class TileCocoon extends TileMod {
public void hatch() {
if(!worldObj.isRemote) {
worldObj.playAuxSFX(2001, xCoord, yCoord, zCoord, Block.getIdFromBlock(getBlockType()));
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
worldObj.playAuxSFX(2001, pos, Block.getIdFromBlock(getBlockType()));
worldObj.setBlockToAir(pos);
EntityAgeable entity = null;
@@ -53,7 +54,7 @@ public class TileCocoon extends TileMod {
if(Math.random() < villagerChance) {
EntityVillager villager = new EntityVillager(worldObj);
VillagerRegistry.applyRandomTrade(villager, worldObj.rand);
// todo 1.8 village registry incomplete. VillagerRegistry.applyRandomTrade(villager, worldObj.rand);
entity = villager;
} else {
float specialChance = 0.05F;
@@ -92,7 +93,7 @@ public class TileCocoon extends TileMod {
}
if(entity != null) {
entity.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
entity.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
entity.setGrowingAge(-24000);
worldObj.spawnEntityInWorld(entity);
entity.spawnExplosionParticle();
@@ -91,7 +91,7 @@ public class TileCraftCrate extends TileOpenCrate {
}
@Override
public void updateEntity() {
public void update() {
if(!worldObj.isRemote && (craft(true) && canEject() || isFull()))
ejectAll();
@@ -102,7 +102,7 @@ public class TileCraftCrate extends TileOpenCrate {
if(newSignal != signal) {
signal = newSignal;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
}
}
@@ -197,7 +197,7 @@ public class TileCraftCrate extends TileOpenCrate {
int lastPattern = pattern;
super.onDataPacket(manager, packet);
if(pattern != lastPattern)
worldObj.markBlockRangeForRenderUpdate(xCoord,yCoord,zCoord,xCoord,yCoord,zCoord);
worldObj.markBlockRangeForRenderUpdate(pos, pos);
}
}
@@ -16,20 +16,21 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
public class TileEnderEye extends TileMod {
public class TileEnderEye extends TileMod implements IUpdatePlayerListBox {
@Override
public void updateEntity() {
public void update() {
if(worldObj.isRemote)
return;
int meta = getBlockMetadata();
int range = 80;
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(xCoord - range, yCoord - range, zCoord - range, xCoord + range, yCoord + range, zCoord + range));
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range, range, range)));
boolean looking = false;
for(EntityPlayer player : players) {
@@ -38,7 +39,7 @@ public class TileEnderEye extends TileMod {
continue;
MovingObjectPosition pos = ToolCommons.raytraceFromEntity(worldObj, player, true, 64);
if(pos != null && pos.blockX == xCoord && pos.blockY == yCoord && pos.blockZ == zCoord) {
if(pos != null && pos.getBlockPos().equals(getPos())) {
looking = true;
break;
}
@@ -22,11 +22,6 @@ public class TileFakeAir extends TileMod {
int flowerX, flowerY, flowerZ;
@Override
public boolean canUpdate() {
return false;
}
public void setFlower(TileEntity tile) {
flowerX = tile.xCoord;
flowerY = tile.yCoord;
@@ -32,11 +32,6 @@ public class TileFloatingFlower extends TileMod implements IFloatingFlower {
return new ItemStack(ModBlocks.flower, 1, getBlockMetadata());
}
@Override
public boolean canUpdate() {
return false;
}
@Override
public IslandType getIslandType() {
return type;
@@ -11,19 +11,20 @@
package vazkii.botania.common.block.tile;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.AxisAlignedBB;
public class TileForestEye extends TileMod {
public class TileForestEye extends TileMod implements IUpdatePlayerListBox {
public int entities = 0;
@Override
public void updateEntity() {
public void update() {
int range = 6;
int entityCount = worldObj.getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(xCoord - range, yCoord - range, zCoord - range, xCoord + range + 1, yCoord + range + 1, zCoord + range + 1)).size();
int entityCount = worldObj.getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range + 1, range + 1, range + 1))).size();
if(entityCount != entities) {
entities = entityCount;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
}
}
@@ -11,16 +11,18 @@
package vazkii.botania.common.block.tile;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.common.Botania;
public class TileManaBeacon extends TileMod {
public class TileManaBeacon extends TileMod implements IUpdatePlayerListBox {
@Override
public void updateEntity() {
public void update() {
boolean redstone = false;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = worldObj.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0)
redstone = true;
}
@@ -11,10 +11,11 @@
package vazkii.botania.common.block.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.coloredlights.ColoredLightHelper;
public class TileManaFlame extends TileMod {
public class TileManaFlame extends TileMod implements IUpdatePlayerListBox {
private static final String TAG_COLOR = "color";
@@ -31,7 +32,7 @@ public class TileManaFlame extends TileMod {
}
@Override
public void updateEntity() {
public void update() {
float c = 0.3F;
if(Math.random() < c) {
@@ -43,9 +44,9 @@ public class TileManaFlame extends TileMod {
float w = 0.15F;
float h = 0.05F;
double x = xCoord + 0.5 + (Math.random() - 0.5) * w;
double y = yCoord + 0.25 + (Math.random() - 0.5) * h;
double z = zCoord + 0.5 + (Math.random() - 0.5) * w;
double x = pos.getX() + 0.5 + (Math.random() - 0.5) * w;
double y = pos.getY() + 0.25 + (Math.random() - 0.5) * h;
double z = pos.getZ() + 0.5 + (Math.random() - 0.5) * w;
float s = 0.2F + (float) Math.random() * 0.1F;
float m = 0.03F + (float) Math.random() * 0.015F;
@@ -44,13 +44,13 @@ public class TileMod extends TileEntity {
public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeCustomNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
return new S35PacketUpdateTileEntity(pos, -999, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
super.onDataPacket(net, packet);
readCustomNBT(packet.func_148857_g());
readCustomNBT(packet.getNbtCompound());
}
}
@@ -14,10 +14,11 @@ import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.EnumFacing;
import vazkii.botania.common.lib.LibBlockNames;
public class TileOpenCrate extends TileSimpleInventory {
public class TileOpenCrate extends TileSimpleInventory implements IUpdatePlayerListBox {
@Override
public int getSizeInventory() {
@@ -25,15 +26,15 @@ public class TileOpenCrate extends TileSimpleInventory {
}
@Override
public String getInventoryName() {
public String getCommandSenderName() {
return LibBlockNames.OPEN_CRATE;
}
@Override
public void updateEntity() {
public void update() {
boolean redstone = false;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
for(EnumFacing dir : EnumFacing.VALUES) {
int redstoneSide = worldObj.getRedstonePower(pos.offset(dir), dir);
if(redstoneSide > 0) {
redstone = true;
break;
@@ -48,12 +49,12 @@ public class TileOpenCrate extends TileSimpleInventory {
}
public boolean canEject() {
Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
return blockBelow.isAir(worldObj, xCoord, yCoord - 1, zCoord) || blockBelow.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord - 1, zCoord) == null;
Block blockBelow = worldObj.getBlockState(pos.down()).getBlock();
return blockBelow.isAir(worldObj, pos.down()) || blockBelow.getCollisionBoundingBox(worldObj, pos.down(), worldObj.getBlockState(pos.down())) == null;
}
public void eject(ItemStack stack, boolean redstone) {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord - 0.5, zCoord + 0.5, stack);
EntityItem item = new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() - 0.5, pos.getZ() + 0.5, stack);
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
@@ -12,7 +12,8 @@ package vazkii.botania.common.block.tile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import vazkii.botania.api.mana.IManaCollisionGhost;
public class TilePlatform extends TileCamo implements IManaCollisionGhost {
@@ -39,11 +40,9 @@ public class TilePlatform extends TileCamo implements IManaCollisionGhost {
}
void swapSurroudings(TilePlatform tile, boolean empty) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int x = tile.xCoord + dir.offsetX;
int y = tile.yCoord + dir.offsetY;
int z = tile.zCoord + dir.offsetZ;
TileEntity tileAt = worldObj.getTileEntity(x, y, z);
for(EnumFacing dir : EnumFacing.VALUES) {
BlockPos pos = tile.getPos().offset(dir);
TileEntity tileAt = worldObj.getTileEntity(pos);
if(tileAt != null && tileAt instanceof TilePlatform) {
TilePlatform platform = (TilePlatform) tileAt;
if(empty ? platform.camo != null : platform.camo == null)
@@ -55,7 +54,7 @@ public class TilePlatform extends TileCamo implements IManaCollisionGhost {
void swap(TilePlatform tile, boolean empty) {
tile.camo = empty ? null : camo;
tile.camoMeta = empty ? 0 : camoMeta;
worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
worldObj.markBlockForUpdate(tile.getPos());
}
}
@@ -14,56 +14,58 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
public class TilePylon extends TileEntity {
public class TilePylon extends TileEntity implements IUpdatePlayerListBox {
boolean activated = false;
int centerX, centerY, centerZ;
BlockPos centerPos;
int ticks = 0;
@Override
public void updateEntity() {
public void update() {
++ticks;
int meta = getBlockMetadata();
if(activated && worldObj.isRemote) {
if(worldObj.getBlock(centerX, centerY, centerZ) != getBlockForMeta() || meta != 0 && worldObj.getBlockMetadata(centerX, centerY, centerZ) == 0) {
if(worldObj.getBlockState(centerPos).getBlock() != getBlockForMeta() || meta != 0 && worldObj.getBlockMetadata(centerX, centerY, centerZ) == 0) {
activated = false;
return;
}
Vector3 centerBlock = new Vector3(centerX + 0.5, centerY + 0.75 + (Math.random() - 0.5 * 0.25), centerZ + 0.5);
Vector3 centerBlock = new Vector3(centerPos.getX() + 0.5, centerPos.getY() + 0.75 + (Math.random() - 0.5 * 0.25), centerPos.getZ() + 0.5);
if(meta == 1) {
if(ConfigHandler.elfPortalParticlesEnabled) {
double worldTime = ticks;
worldTime += new Random(xCoord ^ yCoord ^ zCoord).nextInt(1000);
worldTime += new Random(pos.hashCode()).nextInt(1000);
worldTime /= 5;
float r = 0.75F + (float) Math.random() * 0.05F;
double x = xCoord + 0.5 + Math.cos(worldTime) * r;
double z = zCoord + 0.5 + Math.sin(worldTime) * r;
double x = pos.getX() + 0.5 + Math.cos(worldTime) * r;
double z = pos.getZ() + 0.5 + Math.sin(worldTime) * r;
Vector3 ourCoords = new Vector3(x, yCoord + 0.25, z);
Vector3 ourCoords = new Vector3(x, pos.getY() + 0.25, z);
centerBlock.sub(new Vector3(0, 0.5, 0));
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
Botania.proxy.wispFX(worldObj, x, yCoord + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F);
Botania.proxy.wispFX(worldObj, x, pos.getY() + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F);
if(worldObj.rand.nextInt(3) == 0)
Botania.proxy.wispFX(worldObj, x, yCoord + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
Botania.proxy.wispFX(worldObj, x, pos.getY() + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
} else {
Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0);
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
Block block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
Block block = worldObj.getBlockState(pos.down());
if(block == ModBlocks.flower || block == ModBlocks.shinyFlower) {
int fmeta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord);
float[] color = EntitySheep.fleeceColorTable[fmeta];
@@ -71,15 +73,15 @@ public class TilePylon extends TileEntity {
if(worldObj.rand.nextInt(4) == 0)
Botania.proxy.sparkleFX(worldObj, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, color[0], color[1], color[2], (float) Math.random(), 8);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.125, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
Botania.proxy.wispFX(worldObj, pos.getX() + 0.5 + (Math.random() - 0.5) * 0.25, pos.getY() - 0.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F);
Botania.proxy.wispFX(worldObj, pos.getX() + 0.5 + (Math.random() - 0.5) * 0.125, pos.getY() + 1.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F);
Botania.proxy.wispFX(worldObj, pos.getX() + 0.5 + (Math.random() - 0.5) * 0.25, pos.getY() + 1.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
}
}
if(worldObj.rand.nextBoolean() && worldObj.isRemote)
Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random() * 1.5, zCoord + Math.random(), meta == 2 ? 1F : 0.5F, meta == 1 ? 1F : 0.5F, meta == 1 ? 0.5F : 1F, (float) Math.random(), 2);
Botania.proxy.sparkleFX(worldObj, pos.getX() + Math.random(), pos.getY() + Math.random() * 1.5, pos.getZ() + Math.random(), meta == 2 ? 1F : 0.5F, meta == 1 ? 1F : 0.5F, meta == 1 ? 0.5F : 1F, (float) Math.random(), 2);
}
private Block getBlockForMeta() {
@@ -21,7 +21,9 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaReceiver;
@@ -33,7 +35,7 @@ import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibBlockNames;
public class TileRuneAltar extends TileSimpleInventory implements ISidedInventory, IManaReceiver {
public class TileRuneAltar extends TileSimpleInventory implements ISidedInventory, IManaReceiver, IUpdatePlayerListBox {
private static final String TAG_MANA = "mana";
private static final String TAG_MANA_TO_GET = "manaToGet";
@@ -69,20 +71,19 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
if(did)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, , xCoord);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
return true;
}
@Override
public void updateEntity() {
super.updateEntity();
public void update() {
// Update every tick.
recieveMana(0);
if(!worldObj.isRemote && manaToGet == 0) {
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1));
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
for(EntityItem item : items)
if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() != Item.getItemFromBlock(ModBlocks.livingrock)) {
ItemStack stack = item.getEntityItem();
@@ -102,7 +103,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
if(cooldown > 0) {
cooldown--;
Botania.proxy.wispFX(getWorld(), xCoord + Math.random(), yCoord + 0.8, zCoord + Math.random(), 0.2F, 0.2F, 0.2F, 0.2F, -0.025F);
Botania.proxy.wispFX(getWorld(), pos.getX() + Math.random(), pos.getY() + 0.8, pos.getZ() + Math.random(), 0.2F, 0.2F, 0.2F, 0.2F, -0.025F);
}
int newSignal = 0;
@@ -114,7 +115,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
if(newSignal != signal) {
signal = newSignal;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
}
if(recipeKeepTicks > 0)
@@ -135,8 +136,8 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
if(manaToGet != this.manaToGet) {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:runeAltarStart", 1F, 1F);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, , xCoord);
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:runeAltarStart", 1F, 1F);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
}
}
@@ -154,7 +155,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
public void trySetLastRecipe(EntityPlayer player) {
TileAltar.tryToSetLastRecipe(player, this, lastRecipe);
if(!isEmpty())
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, , xCoord);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
}
public boolean hasValidRecipe() {
@@ -178,7 +179,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
if(manaToGet > 0 && mana >= manaToGet && !worldObj.isRemote) {
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1));
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
EntityItem livingrock = null;
for(EntityItem item : items)
if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) {
@@ -191,7 +192,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
recieveMana(-mana);
if(!worldObj.isRemote) {
ItemStack output = recipe.getOutput().copy();
EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
EntityItem outputItem = new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
worldObj.spawnEntityInWorld(outputItem);
cooldown = 60;
}
@@ -215,12 +216,12 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
public void craftingFanciness() {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:runeAltarCraft", 1F, 1F);
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:runeAltarCraft", 1F, 1F);
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
Botania.proxy.sparkleFX(worldObj, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
}
@@ -259,7 +260,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
@Override
public String getInventoryName() {
public String getCommandSenderName() {
return LibBlockNames.RUNE_ALTAR;
}
@@ -269,7 +270,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
@Override
public int[] getAccessibleSlotsFromSide(int var1) {
public int[] getSlotsForFace(EnumFacing var1) {
int accessibleSlot = -1;
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) != null)
@@ -279,12 +280,12 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
public boolean canInsertItem(int i, ItemStack itemstack, EnumFacing j) {
return true;
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
public boolean canExtractItem(int i, ItemStack itemstack, EnumFacing j) {
return mana == 0;
}
@@ -16,7 +16,7 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
@@ -32,8 +32,8 @@ public class TileSparkChanger extends TileSimpleInventory {
ItemStack changeStack = getStackInSlot(0);
List<ISparkAttachable> attachables = new ArrayList();
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(pos.offset(dir));
if(tile != null && tile instanceof ISparkAttachable) {
ISparkAttachable attach = (ISparkAttachable) tile;
ISparkEntity spark = attach.getAttachedSpark();
@@ -57,7 +57,7 @@ public class TileSparkChanger extends TileSimpleInventory {
if(transfers != null)
transfers.clear();
setInventorySlotContents(0, sparkStack);
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
markDirty();
}
}
@@ -84,7 +84,7 @@ public class TileSparkChanger extends TileSimpleInventory {
}
@Override
public String getInventoryName() {
public String getCommandSenderName() {
return LibBlockNames.SPARK_CHANGER;
}
@@ -16,6 +16,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
@@ -26,18 +27,18 @@ import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibObfuscation;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
public class TileSpawnerClaw extends TileMod implements IManaReceiver {
public class TileSpawnerClaw extends TileMod implements IManaReceiver, IUpdatePlayerListBox {
private static final String TAG_MANA = "mana";
int mana = 0;
@Override
public void updateEntity() {
TileEntity tileBelow = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
public void update() {
TileEntity tileBelow = worldObj.getTileEntity(pos.down());
if(mana >= 5 && tileBelow instanceof TileEntityMobSpawner) {
TileEntityMobSpawner spawner = (TileEntityMobSpawner) tileBelow;
MobSpawnerBaseLogic logic = spawner.func_145881_a();
MobSpawnerBaseLogic logic = spawner.getSpawnerBaseLogic();
if(!logic.isActivated()) {
if(!worldObj.isRemote)
@@ -21,11 +21,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -35,7 +35,7 @@ import vazkii.botania.api.wand.IWandBindable;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.string.TileRedStringRelay;
public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTileContainer {
public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTileContainer, IUpdatePlayerListBox {
private static final String TAG_SUBTILE_NAME = "subTileName";
private static final String TAG_SUBTILE_CMP = "subTileCmp";
@@ -72,22 +72,16 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
}
@Override
public void updateEntity() {
public void update() {
if(subTile != null) {
TileEntity tileBelow = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
TileEntity tileBelow = worldObj.getTileEntity(pos.down());
if(tileBelow instanceof TileRedStringRelay) {
BlockPos coords = ((TileRedStringRelay) tileBelow).getBinding();
if(coords != null) {
int currX = xCoord;
int currY = yCoord;
int currZ = zCoord;
xCoord = coords.posX;
yCoord = coords.posY;
zCoord = coords.posZ;
BlockPos currPos = pos;
setPos(coords);
subTile.onUpdate();
xCoord = currX;
yCoord = currY;
zCoord = currZ;
setPos(currPos);
return;
}
@@ -108,12 +102,7 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
}
public boolean isOnSpecialSoil() {
return worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.enchantedSoil;
}
@Override
public boolean canUpdate() {
return subTile == null || subTile.canUpdate();
return worldObj.getBlockState(pos.down()).getBlock() == ModBlocks.enchantedSoil;
}
@Override
@@ -142,10 +131,6 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
subTile.readFromPacketNBTInternal(subCmp);
}
public IIcon getIcon() {
return subTile == null ? Blocks.red_flower.getIcon(0, 0) : subTile.getIcon();
}
public LexiconEntry getEntry() {
return subTile == null ? null : subTile.getEntry();
}
@@ -218,7 +203,7 @@ public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTil
return subTile.getComparatorInputOverride();
}
public int getPowerLevel(int side) {
public int getPowerLevel(EnumFacing side) {
if(subTile == null)
return 0;
return subTile.getPowerLevel(side);
@@ -10,14 +10,15 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import vazkii.botania.common.Botania;
public class TileSpiritShrine extends TileMod {
public class TileSpiritShrine extends TileMod implements IUpdatePlayerListBox {
int ticks;
@Override
public void updateEntity() {
public void update() {
if(worldObj.isRemote) {
if(ticks >= 40) {
float[][] colors = new float[][] {
@@ -43,9 +44,9 @@ public class TileSpiritShrine extends TileMod {
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
for(int i = 0; i < totalSpiritCount; i++) {
double x = xCoord + Math.sin(wticks * Math.PI / 180) * r + 0.5;
double y = yCoord + (ticks > existTicks ? 40 - (double) (ticks - existTicks) : Math.min(80 + 40 * i, ticks) - 40 * (i + 1)) * 0.1;
double z = zCoord + Math.cos(wticks * Math.PI / 180) * r + 0.5;
double x = pos.getX() + Math.sin(wticks * Math.PI / 180) * r + 0.5;
double y = pos.getY() + (ticks > existTicks ? 40 - (double) (ticks - existTicks) : Math.min(80 + 40 * i, ticks) - 40 * (i + 1)) * 0.1;
double z = pos.getZ() + Math.cos(wticks * Math.PI / 180) * r + 0.5;
wticks += tickIncrement;
float[] colorsfx = colors[i >= colors.length ? 0 : i];
@@ -10,12 +10,13 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import vazkii.botania.common.Botania;
public class TileStarfield extends TileMod {
public class TileStarfield extends TileMod implements IUpdatePlayerListBox {
@Override
public void updateEntity() {
public void update() {
int meta = getBlockMetadata();
if(!worldObj.isRemote) {
int newMeta = worldObj.isDaytime() ? 0 : 1;
@@ -29,9 +30,9 @@ public class TileStarfield extends TileMod {
double radius = 512;
int iter = 2;
for(int i = 0; i < iter; i++) {
double x = xCoord + 0.5 + (Math.random() - 0.5) * radius;
double y = yCoord + 256;
double z = zCoord + 0.5 + (Math.random() - 0.5) * radius;
double x = pos.getX() + 0.5 + (Math.random() - 0.5) * radius;
double y = pos.getY() + 256;
double z = pos.getZ() + 0.5 + (Math.random() - 0.5) * radius;
float w = 0.6F;
float c = 1F - w;
@@ -18,7 +18,9 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
@@ -31,15 +33,19 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.item.ModItems;
public class TileTerraPlate extends TileMod implements ISparkAttachable {
public class TileTerraPlate extends TileMod implements ISparkAttachable, IUpdatePlayerListBox {
public static final int MAX_MANA = TilePool.MAX_MANA / 2;
private static final int[][] LAPIS_BLOCKS = {
{ 1, 0, }, { -1, 0 }, { 0, 1 }, { 0, -1 }
private static final BlockPos[] LAPIS_BLOCKS = {
new BlockPos(1, 0, 0), new BlockPos(-1, 0, 0),
new BlockPos(0, 0, 1), new BlockPos(0, 0, -1)
};
private static final int[][] LIVINGROCK_BLOCKS = {
{ 0, 0 }, { 1, 1 }, { 1, -1 }, { -1, 1 }, { -1, -1 }
private static final BlockPos[] LIVINGROCK_BLOCKS = {
new BlockPos(0, 0, 0), new BlockPos(1, 0, 1),
new BlockPos(1, 0, -1), new BlockPos(-1, 0, 1),
new BlockPos(-1, 0, -1)
};
private static final String TAG_MANA = "mana";
@@ -49,19 +55,19 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(int[] l : LAPIS_BLOCKS)
mb.addComponent(, l[0], Blocks.lapis_block, 0);
for(int[] l : LIVINGROCK_BLOCKS)
mb.addComponent(, l[0], ModBlocks.livingrock, 0);
for(BlockPos relativePos : LAPIS_BLOCKS)
mb.addComponent(relativePos, Blocks.lapis_block, 0);
for(BlockPos relativePos : LIVINGROCK_BLOCKS)
mb.addComponent(relativePos, ModBlocks.livingrock, 0);
mb.addComponent(, 0, ModBlocks.terraPlate, 0);
mb.addComponent(new BlockPos(0, 1, 0), ModBlocks.terraPlate, 0);
mb.setRenderOffset(0, 1, 0);
return mb.makeSet();
}
@Override
public void updateEntity() {
public void update() {
boolean removeMana = true;
if(hasValidPlatform()) {
@@ -70,7 +76,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
removeMana = false;
ISparkEntity spark = getAttachedSpark();
if(spark != null) {
List<ISparkEntity> sparkEntities = SparkHelper.getSparksAround(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
List<ISparkEntity> sparkEntities = SparkHelper.getSparksAround(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
for(ISparkEntity otherSpark : sparkEntities) {
if(spark == otherSpark)
continue;
@@ -90,8 +96,8 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
else item.setEntityItemStack(new ItemStack(ModItems.manaResource, 1, 4));
item.worldObj.playSoundAtEntity(item, "botania:terrasteelCraft", 1F, 1F);
mana = 0;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, , xCoord);
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
}
}
}
@@ -114,9 +120,9 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
for(int i = 0; i < totalSpiritCount; i++) {
double x = xCoord + Math.sin(wticks * Math.PI / 180) * r + 0.5;
double y = yCoord + 0.25 + Math.abs(r) * 0.7;
double z = zCoord + Math.cos(wticks * Math.PI / 180) * r + 0.5;
double x = pos.getX() + Math.sin(wticks * Math.PI / 180) * r + 0.5;
double y = pos.getY() + 0.25 + Math.abs(r) * 0.7;
double z = pos.getZ() + Math.cos(wticks * Math.PI / 180) * r + 0.5;
wticks += tickIncrement;
float[] colorsfx = new float[] {
@@ -127,13 +133,13 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
if(ticks == 100)
for(int j = 0; j < 15; j++)
Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
Botania.proxy.wispFX(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
}
}
}
List<EntityItem> getItems() {
return worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1));
return worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
}
boolean areItemsValid(List<EntityItem> items) {
@@ -165,10 +171,9 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
return checkAll(LAPIS_BLOCKS, Blocks.lapis_block) && checkAll(LIVINGROCK_BLOCKS, ModBlocks.livingrock);
}
boolean checkAll(int[][] positions, Block block) {
for (int[] position : positions) {
int[] positions_ = position;
if(!checkPlatform(positions_[0], positions_[1], block))
boolean checkAll(BlockPos[] relPositions, Block block) {
for (BlockPos position : relPositions) {
if(!checkPlatform(position.getX(), position.getZ(), block))
return false;
}
@@ -176,7 +181,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
}
boolean checkPlatform(int xOff, int zOff, Block block) {
return worldObj.getBlock(xCoord + xOff, yCoord - 1, zOff + zCoord) == block;
return worldObj.getBlockState(pos.add(xOff, -1, zOff)).getBlock() == block;
}
@Override
@@ -202,7 +207,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
@Override
public void recieveMana(int mana) {
this.mana = Math.max(0, Math.min(MAX_MANA, this.mana + mana));
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
}
@Override
@@ -222,7 +227,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
@Override
public ISparkEntity getAttachedSpark() {
List<ISparkEntity> sparks = worldObj.getEntitiesWithinAABB(ISparkEntity.class, new AxisAlignedBB(xCoord, yCoord + 1, zCoord, xCoord + 1, yCoord + 2, zCoord + 1));
List<ISparkEntity> sparks = worldObj.getEntitiesWithinAABB(ISparkEntity.class, new AxisAlignedBB(pos.up(), pos.up().add(1, 1, 1)));
if(sparks.size() == 1) {
Entity e = (Entity) sparks.get(0);
return (ISparkEntity) e;
@@ -10,18 +10,20 @@
*/
package vazkii.botania.common.block.tile;
public class TileTeruTeruBozu extends TileMod {
import net.minecraft.server.gui.IUpdatePlayerListBox;
public class TileTeruTeruBozu extends TileMod implements IUpdatePlayerListBox {
public boolean wasRaining = false;
@Override
public void updateEntity() {
public void update() {
boolean isRaining = worldObj.isRaining();
if(isRaining && worldObj.rand.nextInt(9600) == 0)
worldObj.getWorldInfo().setRaining(false);
if(wasRaining != isRaining)
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
wasRaining = isRaining;
}
@@ -10,14 +10,15 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import vazkii.botania.api.mana.IManaCollisionGhost;
import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet;
public class TileTinyPlanet extends TileMod implements IManaCollisionGhost {
public class TileTinyPlanet extends TileMod implements IManaCollisionGhost, IUpdatePlayerListBox {
@Override
public void updateEntity() {
ItemTinyPlanet.applyEffect(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
public void update() {
ItemTinyPlanet.applyEffect(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
}
@Override
@@ -11,9 +11,10 @@
package vazkii.botania.common.block.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
public class TileTinyPotato extends TileMod {
public class TileTinyPotato extends TileMod implements IUpdatePlayerListBox {
private static final String TAG_NAME = "name";
@@ -25,7 +26,7 @@ public class TileTinyPotato extends TileMod {
jump();
if(name.equalsIgnoreCase("shia labeouf") && !worldObj.isRemote && nextDoIt == 0) {
nextDoIt = 40;
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:doit", 1F, 1F);
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:doit", 1F, 1F);
}
}
@@ -35,7 +36,7 @@ public class TileTinyPotato extends TileMod {
}
@Override
public void updateEntity() {
public void update() {
if(worldObj.rand.nextInt(100) == 0)
jump();