use of ivorius.reccomplex.capability.RCEntityInfo in project RecurrentComplex by Ivorforce.
the class CommandPreview method execute.
@Override
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
RCParameters parameters = RCParameters.of(args);
EntityPlayer player = getCommandSenderAsPlayer(commandSender);
RCEntityInfo RCEntityInfo = RCCommands.getStructureEntityInfo(player, null);
Operation.PreviewType previewType = parameters.get().first().map(Operation.PreviewType::find, s -> ServerTranslations.commandException("commands.rcpreview.invalid")).require();
RCEntityInfo.setPreviewType(previewType);
RCEntityInfo.sendPreviewTypeToClients(player);
commandSender.sendMessage(ServerTranslations.format("commands.rcpreview.success", previewType.key));
}
use of ivorius.reccomplex.capability.RCEntityInfo in project RecurrentComplex by Ivorforce.
the class CommandCancel method execute.
@Override
public void execute(MinecraftServer server, ICommandSender commandSender, String[] args) throws CommandException {
EntityPlayer player = getCommandSenderAsPlayer(commandSender);
RCEntityInfo RCEntityInfo = RCCommands.getStructureEntityInfo(player, null);
if (!RCEntityInfo.cancelOperation(commandSender.getEntityWorld(), player))
throw ServerTranslations.commandException("commands.rc.noOperation");
}
use of ivorius.reccomplex.capability.RCEntityInfo in project RecurrentComplex by Ivorforce.
the class RCRegistryHandler method preInit.
public static void preInit(FMLPreInitializationEvent event, RecurrentComplex mod) {
if (!RecurrentComplex.isLite()) {
tabStructureTools = new CreativeTabs("structureTools") {
@Override
public ItemStack getTabIconItem() {
return new ItemStack(RCItems.blockSelector);
}
};
tabInventoryGenerators = new CreativeTabs("inventoryGenerators") {
@Override
public ItemStack getTabIconItem() {
return new ItemStack(RCItems.inventoryGenerationTag);
}
};
}
RCMaterials.materialNegativeSpace = new MaterialNegativeSpace();
RCMaterials.materialGenericSolid = (new Material(MapColor.STONE));
CapabilityManager.INSTANCE.register(RCEntityInfo.class, new NBTCompoundObjectCapabilityStorage<>(RCEntityInfo.class), RCEntityInfo::new);
CapabilityManager.INSTANCE.register(CapabilitySelection.class, new NBTCompoundObjectCapabilityStorage<>(CapabilitySelection.class), CapabilitySelection::new);
blockSelector = new ItemBlockSelectorBlock().setUnlocalizedName("blockSelector");
blockSelector.setCreativeTab(tabStructureTools);
register(blockSelector, "block_selector");
RecurrentComplex.cremapper.registerLegacyIDs(blockSelector, "blockSelector");
blockSelectorFloating = new ItemBlockSelectorFloating().setUnlocalizedName("blockSelectorFloating");
blockSelectorFloating.setCreativeTab(tabStructureTools);
register(blockSelectorFloating, "block_selector_floating");
RecurrentComplex.cremapper.registerLegacyIDs(blockSelectorFloating, "blockSelectorFloating");
inventoryGenerationTag = (ItemInventoryGenMultiTag) new ItemInventoryGenMultiTag().setUnlocalizedName("inventoryGenerationTag");
inventoryGenerationTag.setCreativeTab(tabInventoryGenerators);
register(inventoryGenerationTag, "inventory_generation_tag");
RecurrentComplex.cremapper.registerLegacyIDs(inventoryGenerationTag, "inventoryGenerationTag");
inventoryGenerationSingleTag = (ItemInventoryGenSingleTag) new ItemInventoryGenSingleTag().setUnlocalizedName("inventoryGenerationSingleTag");
inventoryGenerationSingleTag.setCreativeTab(tabInventoryGenerators);
register(inventoryGenerationSingleTag, "inventory_generation_single_tag");
RecurrentComplex.cremapper.registerLegacyIDs(inventoryGenerationSingleTag, "inventoryGenerationSingleTag");
inventoryGenerationComponentTag = (ItemInventoryGenComponentTag) new ItemInventoryGenComponentTag().setUnlocalizedName("inventoryGenerationComponentTag");
inventoryGenerationComponentTag.setCreativeTab(tabInventoryGenerators);
register(inventoryGenerationComponentTag, "inventory_generation_component_tag");
artifactGenerationTag = new ItemArtifactGenerator().setUnlocalizedName("artifactGenerationTag");
artifactGenerationTag.setCreativeTab(tabInventoryGenerators);
register(artifactGenerationTag, "artifact_generation_tag");
RecurrentComplex.cremapper.registerLegacyIDs(artifactGenerationTag, "artifactGenerationTag");
bookGenerationTag = new ItemBookGenerator().setUnlocalizedName("bookGenerationTag");
bookGenerationTag.setCreativeTab(tabInventoryGenerators);
register(bookGenerationTag, "book_generation_tag");
RecurrentComplex.cremapper.registerLegacyIDs(bookGenerationTag, "bookGenerationTag");
genericSpace = (BlockGenericSpace) new BlockGenericSpace().setUnlocalizedName("negativeSpace");
genericSpace.setCreativeTab(tabStructureTools);
register(genericSpace, "generic_space", new ItemBlockGenericSpace(genericSpace));
RecurrentComplex.cremapper.registerLegacyIDs(genericSpace, true, "negativeSpace");
genericSolid = new BlockGenericSolid().setUnlocalizedName("naturalFloor");
genericSolid.setCreativeTab(tabStructureTools);
register(genericSolid, "generic_solid", new ItemBlockGenericSolid(genericSolid));
RecurrentComplex.cremapper.registerLegacyIDs(genericSolid, true, "naturalFloor");
structureGenerator = new BlockStructureGenerator().setUnlocalizedName("structureGenerator");
register(structureGenerator, "structure_generator");
register(BlockStructureGenerator.TileEntityStructureGenerator.class, "RCStructureGenerator", "SGStructureGenerator");
RecurrentComplex.cremapper.registerLegacyIDs(structureGenerator, true, "structureGenerator");
mazeGenerator = new BlockMazeGenerator().setUnlocalizedName("mazeGenerator");
register(mazeGenerator, "maze_generator");
register(BlockMazeGenerator.TileEntityMazeGenerator.class, "RCMazeGenerator", "SGMazeGenerator");
RecurrentComplex.cremapper.registerLegacyIDs(mazeGenerator, true, "mazeGenerator");
spawnCommands = new BlockSpawnCommand().setUnlocalizedName("spawn_command");
register(spawnCommands, "weighted_command_block");
register(BlockSpawnCommand.TileEntitySpawnCommand.class, "RCSpawnCommand");
RecurrentComplex.cremapper.registerLegacyIDs(spawnCommands, true, "spawnCommand");
spawnScript = new BlockScript().setUnlocalizedName("spawn_script");
spawnScript.setCreativeTab(tabStructureTools);
register(spawnScript, "spawn_script");
register(TileEntityBlockScript.class, "RCSpawnScript");
inspector = new ItemInspector().setUnlocalizedName("recinspector");
inspector.setCreativeTab(tabStructureTools);
register(inspector, "inspector");
// Set preset defaults
GenericPlacerPresets.instance().getRegistry().register("clear", MOD_ID, PresetRegistry.fullPreset("clear", new GenericPlacer(), new PresetRegistry.Metadata("Clear", "Do not place anywhere")), true, LeveledRegistry.Level.INTERNAL);
GenericPlacerPresets.instance().setDefault("clear");
DimensionMatcherPresets.instance().getRegistry().register("clear", MOD_ID, PresetRegistry.fullPreset("clear", new ArrayList<>(), new PresetRegistry.Metadata("None", "No dimensions")), true, LeveledRegistry.Level.INTERNAL);
DimensionMatcherPresets.instance().setDefault("clear");
BiomeMatcherPresets.instance().getRegistry().register("clear", MOD_ID, PresetRegistry.fullPreset("clear", new ArrayList<>(), new PresetRegistry.Metadata("None", "No biomes")), true, LeveledRegistry.Level.INTERNAL);
BiomeMatcherPresets.instance().setDefault("clear");
WeightedBlockStatePresets.instance().getRegistry().register("clear", MOD_ID, PresetRegistry.fullPreset("clear", new ArrayList<>(), new PresetRegistry.Metadata("None", "No blocks")), true, LeveledRegistry.Level.INTERNAL);
WeightedBlockStatePresets.instance().setDefault("clear");
TransfomerPresets.instance().getRegistry().register("clear", MOD_ID, PresetRegistry.fullPreset("clear", new TransformerMulti.Data(), new PresetRegistry.Metadata("None", "No transformers")), true, LeveledRegistry.Level.INTERNAL);
TransfomerPresets.instance().setDefault("clear");
GenerationSanityChecker.init();
}
use of ivorius.reccomplex.capability.RCEntityInfo in project RecurrentComplex by Ivorforce.
the class PacketEditStructureHandler method openEditStructure.
public static void openEditStructure(GenericStructure structureInfo, String structureID, EntityPlayerMP player) {
if (structureID == null)
structureID = "NewStructure";
RCEntityInfo entityInfo = RCEntityInfo.get(player, null);
if (entityInfo != null)
entityInfo.setCachedExportStructureBlockDataNBT(structureInfo.worldDataCompound);
SimpleLeveledRegistry<Structure<?>>.Status<Structure<?>> status = StructureRegistry.INSTANCE.status(structureID);
RecurrentComplex.network.sendTo(new PacketEditStructure(structureInfo, structureID, SaveDirectoryData.defaultData(structureID, status != null && status.isActive(), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.ACTIVE.toPath(), RCFileSuffix.STRUCTURE), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.INACTIVE.toPath(), RCFileSuffix.STRUCTURE))), player);
}
use of ivorius.reccomplex.capability.RCEntityInfo in project RecurrentComplex by Ivorforce.
the class RCForgeEventHandler method onDrawWorld.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawWorld(RenderWorldLastEvent event) {
Minecraft mc = Minecraft.getMinecraft();
int ticks = mc.player.ticksExisted;
Entity renderEntity = mc.getRenderViewEntity();
RCEntityInfo info = RCEntityInfo.get(mc.player, null);
double entityX = renderEntity.lastTickPosX + (renderEntity.posX - renderEntity.lastTickPosX) * (double) event.getPartialTicks();
double entityY = renderEntity.lastTickPosY + (renderEntity.posY - renderEntity.lastTickPosY) * (double) event.getPartialTicks();
double entityZ = renderEntity.lastTickPosZ + (renderEntity.posZ - renderEntity.lastTickPosZ) * (double) event.getPartialTicks();
GlStateManager.pushMatrix();
GlStateManager.translate(-entityX, -entityY, -entityZ);
if (info != null && info.showGrid) {
int spacing = 10;
GlStateManager.disableTexture2D();
GlStateManager.color(0.5f, 0.5f, 0.5f);
GlStateManager.pushMatrix();
GlStateManager.translate(MathHelper.floor(entityX / spacing) * spacing, MathHelper.floor(entityY / spacing) * spacing, MathHelper.floor(entityZ / spacing) * spacing);
GridRenderer.renderGrid(8, spacing, 100, 0.05f);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
}
SelectionRenderer.renderSelection(mc.player, ticks, event.getPartialTicks());
if (info != null && info.danglingOperation != null)
info.danglingOperation.renderPreview(info.getPreviewType(), mc.world, ticks, event.getPartialTicks());
GlStateManager.popMatrix();
}
Aggregations