use of com.lowdragmc.multiblocked.common.definition.CreatePartDefinition in project Multiblocked by Low-Drag-MC.
the class CommonProxy method commonSetup.
@SubscribeEvent
public void commonSetup(FMLCommonSetupEvent e) {
e.enqueueWork(() -> {
for (MultiblockCapability<?> capability : MbdCapabilities.CAPABILITY_REGISTRY.values()) {
capability.getAnyBlock().definition.baseRenderer = new CycleBlockStateRenderer(capability.getCandidates());
}
RecipeMap.registerRecipeFromFile(Multiblocked.GSON, new File(Multiblocked.location, "recipe_map"));
MbdComponents.commonLastWork();
if (Multiblocked.isCreateLoaded()) {
MbdComponents.DEFINITION_REGISTRY.forEach((r, d) -> {
if (d instanceof CreatePartDefinition) {
CreatePartDefinition definition = (CreatePartDefinition) d;
if (definition.isOutput) {
BlockStressDefaults.setDefaultCapacity(d.location, definition.stress);
} else {
BlockStressDefaults.setDefaultImpact(d.location, definition.stress);
}
}
});
}
});
}
use of com.lowdragmc.multiblocked.common.definition.CreatePartDefinition in project Multiblocked by Low-Drag-MC.
the class PartBuilderWidget method updateList.
protected void updateList() {
setNewRenderer(null, "");
files.forEach(containers::waitToRemoved);
files.clear();
File path = new File(Multiblocked.location, "definition/part");
walkFile("Common", new ItemStackTexture(BlueprintTableTileEntity.partDefinition.getStackForm()), path, (jsonElement, file) -> {
PartDefinition definition = Multiblocked.GSON.fromJson(jsonElement, PartDefinition.class);
new PartWidget(this, definition, jsonObject -> {
if (jsonObject != null) {
FileUtility.saveJson(file, jsonObject);
}
});
});
if (Multiblocked.isCreateLoaded()) {
path = new File(path, "create");
walkFile("Create", new ItemStackTexture(AllBlocks.FLYWHEEL.asStack()), path, ((jsonElement, file) -> {
CreatePartDefinition definition = Multiblocked.GSON.fromJson(jsonElement, CreatePartDefinition.class);
new CreatePartWidget(this, definition, jsonObject -> {
if (jsonObject != null) {
FileUtility.saveJson(file, jsonObject);
}
});
}));
}
}
Aggregations