/** */ @ForceBlockActive(retainUnalteredOnBlockChange = true) public class RetainedOnBlockChangeComponent implements Component { public int value; public RetainedOnBlockChangeComponent() { } public RetainedOnBlockChangeComponent(int value) { this.value = value; } }
LiquidVoxelInfo(Block block, Vector3i position) { this.shape = block.getCollisionShape(); this.offset = block.getCollisionOffset(); this.colliding = block.isLiquid(); this.blocking = false; this.position = position; }
private void generateMesh() { Tessellator tessellator = new Tessellator(); for (BlockPart dir : BlockPart.values()) { BlockMeshPart part = block.getPrimaryAppearance().getPart(dir); if (part != null) { if (block.isDoubleSided()) { tessellator.addMeshPartDoubleSided(part); } else { tessellator.addMeshPart(part); } } } mesh = tessellator.generateMesh(new ResourceUrn("engine", "blockmesh", block.getURI().toString())); } }
@Override public Block getFromString(String representation) { return blockManager.getBlock(representation); }
public SymmetricFamily(BlockFamilyDefinition definition, BlockBuilderHelper blockBuilder) { super(definition, blockBuilder); block = blockBuilder.constructSimpleBlock(definition, new BlockUri(definition.getUrn()), this); }
private boolean hasRequiredSupportOnSideForBlock(Vector3i location, Side sideChanged, Block block) { final BlockMeshPart part = block.getPrimaryAppearance().getPart(BlockPart.fromSide(sideChanged)); if (part != null) { // This block has mesh on this side, therefore it requires a support on that side if (!hasSupportFromBlockOnSide(location, sideChanged, Collections.<Vector3i, Block>emptyMap())) { return false; } } return true; }
TeraVoxelInfo(Block block, boolean colliding, boolean blocking, Vector3i position) { this.shape = block.getCollisionShape(); this.offset = block.getCollisionOffset(); this.colliding = shape != null && colliding; this.blocking = shape != null && blocking; this.position = position; this.friction = block.getFriction(); this.restitution = block.getRestitution(); }
@Override public BlockFamily getFromString(String representation) { return blockManager.getBlockFamily(representation); }
/** * Light can spread out of a block if * - it has luminance (ie, glows), * - it is translucent * - or the side isn't full * <p> * {@inheritDoc} */ @Override public boolean canSpreadOutOf(Block block, Side side) { return block.getLuminance() > 0 || block.isTranslucent() || !block.isFullSide(side); }
@Override public void shutdown() { for (Block block : CoreRegistry.get(BlockManager.class).listRegisteredBlocks()) { block.setEntity(EntityRef.NULL); } }
/** * Light can spread into a block if * - it is translucent, * - or the side isn't ful * <p> * {@inheritDoc} */ @Override public boolean canSpreadInto(Block block, Side side) { return block.isTranslucent() || !block.isFullSide(side); } }
/** * Any luminance from the block is a constant * <p> * {@inheritDoc} */ @Override public byte getFixedValue(Block block, Vector3i pos) { return block.getLuminance(); }
public BlockUri(BlockUri parentUri, Name blockName) { this(parentUri.getBlockFamilyDefinitionUrn(), parentUri.getShapeUrn(), blockName); }
public boolean isDestructible() { return getHardness() > 0; }
@Override public String toString() { return uri.toString(); }
/** * This component is added by the authority to temporary block entities so that they can persist for a bit while the block is being damaged. */ @ForceBlockActive public class BlockDamagedComponent implements Component { }
/** */ @ForceBlockActive public class ForceBlockActiveComponent implements Component { }
@ForceBlockActive public class TimedExplosionComponent implements Component { public long fuseTimeMs; }