Some internal Changes for EMI/Asset LICENSE
This commit is contained in:
parent
e6094754ce
commit
0e8f9f6f8c
8 changed files with 87 additions and 11 deletions
4
LICENSE
4
LICENSE
|
@ -19,3 +19,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
___________________________
|
||||||
|
Some of our Assets (see LICENSE.ASSETS for a Listing) is licensed under CC BY-NC-SA 4.0
|
||||||
|
See https://creativecommons.org/licenses/by-nc-sa/4.0/ for Details.
|
||||||
|
|
14
LICENSE.ASSETS
Normal file
14
LICENSE.ASSETS
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Some of our Assets (see List below) is licensed under CC BY-NC-SA 4.0
|
||||||
|
See https://creativecommons.org/licenses/by-nc-sa/4.0/ for Details.
|
||||||
|
|
||||||
|
Please use the Attribution "Team BetterX".
|
||||||
|
|
||||||
|
The following Files are distributed under this License:
|
||||||
|
* src/main/resources/assets/bclib/lang/de_de.json
|
||||||
|
* src/main/resources/assets/bclib/textures/*
|
||||||
|
* src/main/resources/assets/bclib/betterx.png
|
||||||
|
* src/main/resources/assets/bclib/header.jpg
|
||||||
|
* src/main/resources/assets/bclib/icon_betterend.png
|
||||||
|
* src/main/resources/assets/bclib/icon_betternether.png
|
||||||
|
* src/main/resources/assets/bclib/icon_bright.png
|
||||||
|
* src/main/resources/assets/bclib/icon_updater.png
|
|
@ -76,6 +76,7 @@ task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from "LICENSE"
|
||||||
|
from "LICENSE.ASSETS"
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.betterx.bclib.integration.emi;
|
package org.betterx.bclib.integration.emi;
|
||||||
|
|
||||||
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.recipes.AlloyingRecipe;
|
import org.betterx.bclib.recipes.AlloyingRecipe;
|
||||||
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
|
@ -23,8 +24,9 @@ public class EMIAlloyingRecipe extends EMIAbstractAlloyingRecipe<Container, Allo
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
|
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
|
||||||
for (AlloyingRecipe recipe : manager.getAllRecipesFor(AlloyingRecipe.TYPE)) {
|
EMIPlugin.addAllRecipes(
|
||||||
emiRegistry.addRecipe(new EMIAlloyingRecipe(recipe));
|
emiRegistry, manager, BCLib.LOGGER,
|
||||||
}
|
AlloyingRecipe.TYPE, EMIAlloyingRecipe::new
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package org.betterx.bclib.integration.emi;
|
package org.betterx.bclib.integration.emi;
|
||||||
|
|
||||||
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.recipes.AnvilRecipe;
|
import org.betterx.bclib.recipes.AnvilRecipe;
|
||||||
|
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
|
@ -17,6 +18,7 @@ import dev.emi.emi.api.stack.EmiStack;
|
||||||
import dev.emi.emi.api.widget.WidgetHolder;
|
import dev.emi.emi.api.widget.WidgetHolder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class EMIAnvilRecipe implements EmiRecipe {
|
public class EMIAnvilRecipe implements EmiRecipe {
|
||||||
|
@ -28,7 +30,7 @@ public class EMIAnvilRecipe implements EmiRecipe {
|
||||||
public EMIAnvilRecipe(AnvilRecipe recipe, Item hammer) {
|
public EMIAnvilRecipe(AnvilRecipe recipe, Item hammer) {
|
||||||
this.id = new ResourceLocation(
|
this.id = new ResourceLocation(
|
||||||
"emi",
|
"emi",
|
||||||
recipe.getId().getNamespace() + "/" + recipe.getId().getPath() + "/" + hammer.getDescriptionId()
|
recipe.getId().getNamespace() + "/" + recipe.getId().getPath() + "/anvil/" + hammer.getDescriptionId()
|
||||||
);
|
);
|
||||||
this.input = List.of(
|
this.input = List.of(
|
||||||
EmiIngredient.of(recipe.getMainIngredient(), recipe.getInputCount()),
|
EmiIngredient.of(recipe.getMainIngredient(), recipe.getInputCount()),
|
||||||
|
@ -40,12 +42,15 @@ public class EMIAnvilRecipe implements EmiRecipe {
|
||||||
|
|
||||||
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
|
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {
|
||||||
Iterable<Holder<Item>> hammers = AnvilRecipe.getAllHammers();
|
Iterable<Holder<Item>> hammers = AnvilRecipe.getAllHammers();
|
||||||
for (AnvilRecipe recipe : manager.getAllRecipesFor(AnvilRecipe.TYPE)) {
|
EMIPlugin.addAllRecipes(
|
||||||
for (Holder<Item> hammer : hammers) {
|
emiRegistry, manager, BCLib.LOGGER,
|
||||||
if (recipe.canUse(hammer.value()))
|
AnvilRecipe.TYPE,
|
||||||
emiRegistry.addRecipe(new EMIAnvilRecipe(recipe, hammer.value()));
|
recipe -> StreamSupport.stream(hammers.spliterator(), false)
|
||||||
}
|
.map(Holder::value)
|
||||||
}
|
.filter(recipe::canUse)
|
||||||
|
.toList(),
|
||||||
|
EMIAnvilRecipe::new
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,18 +3,26 @@ package org.betterx.bclib.integration.emi;
|
||||||
import org.betterx.bclib.BCLib;
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.blocks.LeveledAnvilBlock;
|
import org.betterx.bclib.blocks.LeveledAnvilBlock;
|
||||||
import org.betterx.bclib.interfaces.AlloyingRecipeWorkstation;
|
import org.betterx.bclib.interfaces.AlloyingRecipeWorkstation;
|
||||||
|
import org.betterx.worlds.together.util.Logger;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.Container;
|
||||||
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeManager;
|
import net.minecraft.world.item.crafting.RecipeManager;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
|
||||||
import dev.emi.emi.api.EmiPlugin;
|
import dev.emi.emi.api.EmiPlugin;
|
||||||
import dev.emi.emi.api.EmiRegistry;
|
import dev.emi.emi.api.EmiRegistry;
|
||||||
|
import dev.emi.emi.api.recipe.EmiRecipe;
|
||||||
import dev.emi.emi.api.recipe.EmiRecipeCategory;
|
import dev.emi.emi.api.recipe.EmiRecipeCategory;
|
||||||
import dev.emi.emi.api.render.EmiTexture;
|
import dev.emi.emi.api.render.EmiTexture;
|
||||||
import dev.emi.emi.api.stack.EmiStack;
|
import dev.emi.emi.api.stack.EmiStack;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class EMIPlugin implements EmiPlugin {
|
public class EMIPlugin implements EmiPlugin {
|
||||||
private static boolean didInit = false;
|
private static boolean didInit = false;
|
||||||
|
@ -113,6 +121,48 @@ public class EMIPlugin implements EmiPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <C extends Container, T extends Recipe<C>, E extends EmiRecipe> void addAllRecipes(
|
||||||
|
EmiRegistry emiRegistry,
|
||||||
|
RecipeManager manager,
|
||||||
|
Logger logger,
|
||||||
|
RecipeType<T> recipeType,
|
||||||
|
Function<T, E> createRecipe
|
||||||
|
) {
|
||||||
|
addAllRecipes(
|
||||||
|
emiRegistry,
|
||||||
|
manager,
|
||||||
|
logger,
|
||||||
|
recipeType,
|
||||||
|
(_ignored) -> null,
|
||||||
|
(recipe, _ignored) -> createRecipe.apply(recipe)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <C extends Container, T extends Recipe<C>, E extends EmiRecipe, V> void addAllRecipes(
|
||||||
|
EmiRegistry emiRegistry,
|
||||||
|
RecipeManager manager,
|
||||||
|
Logger logger,
|
||||||
|
RecipeType<T> recipeType,
|
||||||
|
Function<T, List<V>> variantSupplier,
|
||||||
|
BiFunction<T, V, E> createRecipe
|
||||||
|
) {
|
||||||
|
for (T recipe : manager.getAllRecipesFor(recipeType)) {
|
||||||
|
List<V> variants = variantSupplier.apply(recipe);
|
||||||
|
if (variants == null) {
|
||||||
|
emiRegistry.addRecipe(createRecipe.apply(recipe, null));
|
||||||
|
} else {
|
||||||
|
for (V variantData : variants) {
|
||||||
|
try {
|
||||||
|
emiRegistry.addRecipe(createRecipe.apply(recipe, variantData));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Exception when parsing vanilla recipe " + recipe.getId(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static EmiRecipeCategory getAnvilCategoryForLevel(int anvilLevel) {
|
static EmiRecipeCategory getAnvilCategoryForLevel(int anvilLevel) {
|
||||||
anvilLevel = Math.max(0, Math.min(ANVIL_CATEGORIES.length - 1, anvilLevel));
|
anvilLevel = Math.max(0, Math.min(ANVIL_CATEGORIES.length - 1, anvilLevel));
|
||||||
return ANVIL_CATEGORIES[anvilLevel];
|
return ANVIL_CATEGORIES[anvilLevel];
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 432 B |
|
@ -14,7 +14,7 @@
|
||||||
"issues": "https://github.com/quiqueck/bclib/issues",
|
"issues": "https://github.com/quiqueck/bclib/issues",
|
||||||
"sources": "https://github.com/quiqueck/bclib"
|
"sources": "https://github.com/quiqueck/bclib"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT (CC BY-NC-SA 4.0 for some Assets)",
|
||||||
"icon": "assets/bclib/icon.png",
|
"icon": "assets/bclib/icon.png",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue