use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.
the class PulseTask method run.
@Override
public void run() {
Block block = location.getBlock();
if (block == null) {
cancel();
return;
}
if (!location.getChunk().isLoaded()) {
return;
}
if (block.getType() != originalMaterial) {
cancel();
return;
}
ItemTable table = ItemTable.instance();
BlockType type = table.getBlock(originalMaterial);
if (type != null) {
type.receivePulse((GlowBlock) block);
}
}
use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.
the class BlockRedstoneRepeater method extraUpdate.
private void extraUpdate(GlowBlock block) {
Diode diode = (Diode) block.getState().getData();
ItemTable itemTable = ItemTable.instance();
GlowBlock target = block.getRelative(diode.getFacing());
if (target.getType().isSolid()) {
for (BlockFace face2 : ADJACENT) {
GlowBlock target2 = target.getRelative(face2);
BlockType notifyType = itemTable.getBlock(target2.getType());
if (notifyType != null) {
if (target2.getFace(block) == null) {
notifyType.onNearBlockChanged(target2, BlockFace.SELF, block, block.getType(), block.getData(), block.getType(), block.getData());
}
notifyType.onRedstoneUpdate(target2);
}
}
}
}
use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.
the class BlockRedstoneTorch method extraUpdate.
private void extraUpdate(GlowBlock block) {
ItemTable itemTable = ItemTable.instance();
GlowBlock target = block.getRelative(BlockFace.UP);
if (target.getType().isSolid()) {
for (BlockFace face2 : ADJACENT) {
GlowBlock target2 = target.getRelative(face2);
BlockType notifyType = itemTable.getBlock(target2.getType());
if (notifyType != null) {
if (target2.getFace(block) == null) {
notifyType.onNearBlockChanged(target2, BlockFace.SELF, block, block.getType(), block.getData(), block.getType(), block.getData());
}
notifyType.onRedstoneUpdate(target2);
}
}
}
}
use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.
the class GlowWorld method pulseTickMap.
private void pulseTickMap() {
ItemTable itemTable = ItemTable.instance();
for (Location location : tickMap) {
GlowChunk chunk = (GlowChunk) location.getChunk();
if (!chunk.isLoaded()) {
continue;
}
int typeId = chunk.getType(location.getBlockX() & 0xF, location.getBlockZ() & 0xF, location.getBlockY());
BlockType type = itemTable.getBlock(typeId);
if (type == null) {
cancelPulse(location);
continue;
}
GlowBlock block = new GlowBlock(chunk, location.getBlockX(), location.getBlockY(), location.getBlockZ());
int speed = type.getPulseTickSpeed(block);
boolean once = type.isPulseOnce(block);
if (speed == 0) {
continue;
}
if (fullTime % speed == 0) {
type.receivePulse(block);
if (once) {
cancelPulse(location);
}
}
}
}
use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.
the class BlockLever method extraUpdate.
private void extraUpdate(GlowBlock block) {
Lever lever = (Lever) block.getState().getData();
ItemTable itemTable = ItemTable.instance();
GlowBlock target = block.getRelative(lever.getAttachedFace());
if (target.getType().isSolid()) {
for (BlockFace face2 : ADJACENT) {
GlowBlock target2 = target.getRelative(face2);
BlockType notifyType = itemTable.getBlock(target2.getType());
if (notifyType != null) {
if (target2.getFace(block) == null) {
notifyType.onNearBlockChanged(target2, BlockFace.SELF, block, block.getType(), block.getData(), block.getType(), block.getData());
}
notifyType.onRedstoneUpdate(target2);
}
}
}
}
Aggregations