use of com.github.lunatrius.schematica.client.world.SchematicWorld in project Spark-Client by Spark-Client-Development.
the class OverlayHandler method onText.
@SubscribeEvent
public void onText(final RenderGameOverlayEvent.Text event) {
if (this.minecraft.gameSettings.showDebugInfo && SchematicaConfig.INSTANCE.showDebugInfo.getValue()) {
final SchematicWorld schematic = ClientProxy.schematic;
if (schematic != null && schematic.isRendering) {
final ArrayList<String> left = event.getLeft();
final ArrayList<String> right = event.getRight();
left.add("");
left.add(SCHEMATICA_PREFIX + schematic.getDebugDimensions());
left.add(SCHEMATICA_PREFIX + RenderSchematic.INSTANCE.getDebugInfoTileEntities());
left.add(SCHEMATICA_PREFIX + RenderSchematic.INSTANCE.getDebugInfoRenders());
final RayTraceResult rtr = ClientProxy.objectMouseOver;
if (rtr != null && rtr.typeOfHit == RayTraceResult.Type.BLOCK) {
final BlockPos pos = rtr.getBlockPos();
final IBlockState blockState = schematic.getBlockState(pos);
right.add("");
right.add(String.valueOf(Block.REGISTRY.getNameForObject(blockState.getBlock())) + SCHEMATICA_SUFFIX);
for (final String formattedProperty : BlockStateHelper.getFormattedProperties(blockState)) {
right.add(formattedProperty + SCHEMATICA_SUFFIX);
}
final BlockPos offsetPos = pos.add(schematic.position);
String lookMessage = String.format("Looking at: %d %d %d (%d %d %d)", pos.getX(), pos.getY(), pos.getZ(), offsetPos.getX(), offsetPos.getY(), offsetPos.getZ());
if (this.minecraft.objectMouseOver != null && this.minecraft.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) {
final BlockPos origPos = this.minecraft.objectMouseOver.getBlockPos();
if (offsetPos.equals(origPos)) {
lookMessage += " (matches)";
}
}
left.add(SCHEMATICA_PREFIX + lookMessage);
}
}
}
}
use of com.github.lunatrius.schematica.client.world.SchematicWorld in project Spark-Client by Spark-Client-Development.
the class WorldHandler method onLoad.
@SubscribeEvent
public void onLoad(final WorldEvent.Load event) {
final World world = event.getWorld();
if (world.isRemote && !(world instanceof SchematicWorld)) {
RenderSchematic.INSTANCE.setWorldAndLoadRenderers(ClientProxy.schematic);
addWorldAccess(world, RenderSchematic.INSTANCE);
}
}
use of com.github.lunatrius.schematica.client.world.SchematicWorld in project Spark-Client by Spark-Client-Development.
the class ClientProxy method loadSchematic.
@Override
public boolean loadSchematic(final EntityPlayer player, final File directory, final String filename) {
final ISchematic schematic = SchematicFormat.readFromFile(directory, filename);
if (schematic == null) {
return false;
}
final SchematicWorld world = new SchematicWorld(schematic);
Reference.logger.debug("Loaded {} [w:{},h:{},l:{}]", filename, world.getWidth(), world.getHeight(), world.getLength());
ClientProxy.schematic = world;
RenderSchematic.INSTANCE.setWorldAndLoadRenderers(world);
// SchematicPrinter.INSTANCE.setSchematic(world);
world.isRendering = true;
return true;
}
use of com.github.lunatrius.schematica.client.world.SchematicWorld in project Spark-Client by Spark-Client-Development.
the class SchematicRenderChunkVbo method rebuildChunk.
@Override
public void rebuildChunk(final float x, final float y, final float z, final ChunkCompileTaskGenerator generator) {
generator.getLock().lock();
try {
if (generator.getStatus() == ChunkCompileTaskGenerator.Status.COMPILING) {
final BlockPos from = getPosition();
final SchematicWorld schematic = (SchematicWorld) this.world;
if (from.getX() < 0 || from.getZ() < 0 || from.getX() >= schematic.getWidth() || from.getZ() >= schematic.getLength()) {
final SetVisibility visibility = new SetVisibility();
visibility.setAllVisible(true);
final CompiledChunk dummy = new CompiledChunk();
dummy.setVisibility(visibility);
generator.setCompiledChunk(dummy);
return;
}
}
} finally {
generator.getLock().unlock();
}
super.rebuildChunk(x, y, z, generator);
}
Aggregations