4 Commits

Author SHA1 Message Date
QuImUfu f83d2c220f fix config and extend example 2023-07-07 22:48:25 +02:00
QuImUfu 74801ef10b fix example generation 2023-07-06 00:03:50 +02:00
QuImUfu 7f2f3692c3 bump version 2023-07-02 19:00:02 +02:00
QuImUfu 0039e70591 add transparent blocks 2023-07-02 18:59:13 +02:00
11 changed files with 176 additions and 28 deletions
+21
View File
@@ -137,3 +137,24 @@
teal (0x167E86), dark_aqua (0x3A8E8C), dark_dull_pink (0x562C3E),
bright_teal (0x14B485), deepslate_gray (0x646464),
raw_iron_pink (0xD8AF93), lichen_green (0x7FA796)
"renderLayer" ~ string
one of:
solid, cutout_mipped, cutout, translucent,
translucent_moving_block, translucent_no_crumbling,
leash, water_mask, armor_glint, armor_entity_glint, glint_translucent,
glint, direct_glint, entity_glint, direct_entity_glint, text_background,
text_background_see_through, lightning, tripwire, end_portal,
end_gateway, lines, line_strip, debug_filled_box, debug_quads,
debug_section_quads, gui, gui_overlay, gui_text_highlight,
gui_ghost_recipe_overlay
different renderLayers allow different graphical effects.
Only the first 4 are interesting
solid = solid block no transparency
stone ...
cutout_mipped = 100% or no transparency, ?gets softened far away when mipmapping is enabled?
glass, leaves and similar
cutout = 100% or no transparency
flowers, saplings...
translucent = full alpha support
ice, stained glass, portal...
+2 -15
View File
@@ -35,17 +35,6 @@ repositories {
}
}
loom {
splitEnvironmentSourceSets()
mods {
"modid" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}
dependencies {
// To change the versions see the gradle.properties file
@@ -70,15 +59,13 @@ dependencies {
include(modApi("de.siphalor.tweed4:tweed4-tailor-screen-$project.minecraft_major_version"))
modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version")
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}
configurations.include.transitive = true
configurations.include.dependencies.each {
if (!it.name.contains("bom")) {
if (!it.name.contains("bom") && !it.name.contains("fabric")) {
it.transitive = false
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ loader_version=0.14.21
fabric_version=0.84.0+1.20.1
#Mod properties
mod_version = 0.10.0
mod_version = 0.10.1
maven_group = quimufu.simple_creator
archives_base_name = simple_creator
+1 -1
View File
@@ -1,10 +1,10 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
@@ -78,6 +78,8 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
if (burnChance != -1 && spreadChance != -1) {
FlammableBlockRegistry.getDefaultInstance().add(resB, spreadChance, burnChance);
}
SimpleCreatorMod.BLOCKS_RENDER_LAYER.add(new Pair<>(resB, bspj.renderLayer));
return new Pair<>(resB, resI);
}
@@ -29,5 +29,6 @@ public class BlockSettingsPojo {
public boolean noBlockBreakParticles = false;
public boolean requiresTool = false;
public boolean breaksInstantly = false;
String mapColor = "stone";
public String renderLayer = "solid";
public String mapColor = "stone";
}
@@ -2,15 +2,19 @@ package quimufu.simple_creator;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.util.Identifier;
import net.minecraft.util.Pair;
import org.apache.logging.log4j.Level;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Optional;
import static quimufu.simple_creator.SimpleCreatorMod.MOD_ID;
import static quimufu.simple_creator.SimpleCreatorMod.log;
public abstract class GenericManualResourceLoader<T> {
@@ -43,7 +47,7 @@ public abstract class GenericManualResourceLoader<T> {
public void load() {
if (true) {
if (SimpleCreatorConfig.enableTestThings) {
createFromResource("simple_creator/blocks/test_block.json");
createFromResource("simple_creator/items/test_item.json");
}
@@ -103,10 +107,21 @@ public abstract class GenericManualResourceLoader<T> {
}
private static void createFromResource(String path) {
try (InputStream blocks = ClassLoader.getSystemClassLoader().getResourceAsStream("data/" + path)) {
Optional<ModContainer> modContainerOp = FabricLoader.getInstance().getModContainer(MOD_ID);
if(modContainerOp.isEmpty()){
log(Level.ERROR,"ModContainer " + MOD_ID + " not Found" );
return;
}
Optional<Path> nioPath = modContainerOp
.flatMap(modContainer -> modContainer.findPath("data/" + path));
if(nioPath.isEmpty()){
log(Level.ERROR,"data/" + path + " Not Found" );
return;
}
try (InputStream blocks = Files.newInputStream(nioPath.get())) {
File file = new File("./simplyCreated/" + path);
if (!file.exists() && blocks != null) {
if (!file.exists()) {
File parent = file.getParentFile();
if (parent != null && !parent.exists() && !parent.mkdirs()) {
@@ -1,12 +1,24 @@
package quimufu.simple_creator;
import de.siphalor.tweed4.Tweed;
import de.siphalor.tweed4.config.ConfigEnvironment;
import de.siphalor.tweed4.config.ConfigLoader;
import de.siphalor.tweed4.config.TweedRegistry;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.Block;
import net.minecraft.util.Pair;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
public class SimpleCreatorMod implements ModInitializer {
public static List<Pair<Block, String>> BLOCKS_RENDER_LAYER = new ArrayList<>();
public static Logger LOGGER = LogManager.getLogger();
public static ItemResourceLoader irl = new ItemResourceLoader();
public static BlockResourceLoader brl = new BlockResourceLoader();
@@ -17,6 +29,12 @@ public class SimpleCreatorMod implements ModInitializer {
@Override
public void onInitialize() {
log(Level.INFO, "Initializing");
Tweed.runEntryPoints();
ConfigLoader.initialReload(
TweedRegistry.getConfigFile(MOD_ID),
FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER ? ConfigEnvironment.SERVER : ConfigEnvironment.UNIVERSAL
);
irl.load();
brl.load();
}
@@ -0,0 +1,89 @@
package quimufu.simple_creator;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.block.Block;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.util.Pair;
import org.apache.logging.log4j.Level;
@Environment(EnvType.CLIENT)
public class SimpleCreatorModClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
SimpleCreatorMod.log(Level.INFO, "Client init");
for (Pair<Block, String> blockRenderLayerPair : SimpleCreatorMod.BLOCKS_RENDER_LAYER) {
BlockRenderLayerMap.INSTANCE.putBlock(blockRenderLayerPair.getLeft(), getRenderLayer(blockRenderLayerPair.getRight()));
}
}
private net.minecraft.client.render.RenderLayer getRenderLayer(String renderLayer) {
switch (renderLayer.toUpperCase()){
case "SOLID":
return RenderLayer.getSolid();
case "CUTOUT_MIPPED":
return RenderLayer.getCutoutMipped();
case "CUTOUT":
return RenderLayer.getCutout();
case "TRANSLUCENT":
return RenderLayer.getTranslucent();
case "TRANSLUCENT_MOVING_BLOCK":
return RenderLayer.getTranslucentMovingBlock();
case "TRANSLUCENT_NO_CRUMBLING":
return RenderLayer.getTranslucentNoCrumbling();
case "LEASH":
return RenderLayer.getLeash();
case "WATER_MASK":
return RenderLayer.getWaterMask();
case "ARMOR_GLINT":
return RenderLayer.getArmorGlint();
case "ARMOR_ENTITY_GLINT":
return RenderLayer.getArmorEntityGlint();
case "GLINT_TRANSLUCENT":
return RenderLayer.getGlintTranslucent();
case "GLINT":
return RenderLayer.getGlint();
case "DIRECT_GLINT":
return RenderLayer.getDirectGlint();
case "ENTITY_GLINT":
return RenderLayer.getEntityGlint();
case "DIRECT_ENTITY_GLINT":
return RenderLayer.getDirectEntityGlint();
case "TEXT_BACKGROUND":
return RenderLayer.getTextBackground();
case "TEXT_BACKGROUND_SEE_THROUGH":
return RenderLayer.getTextBackgroundSeeThrough();
case "LIGHTNING":
return RenderLayer.getLightning();
case "TRIPWIRE":
return RenderLayer.getTripwire();
case "END_PORTAL":
return RenderLayer.getEndPortal();
case "END_GATEWAY":
return RenderLayer.getEndGateway();
case "LINES":
return RenderLayer.getLines();
case "LINE_STRIP":
return RenderLayer.getLineStrip();
case "DEBUG_FILLED_BOX":
return RenderLayer.getDebugFilledBox();
case "DEBUG_QUADS":
return RenderLayer.getDebugQuads();
case "DEBUG_SECTION_QUADS":
return RenderLayer.getDebugSectionQuads();
case "GUI":
return RenderLayer.getGui();
case "GUI_OVERLAY":
return RenderLayer.getGuiOverlay();
case "GUI_TEXT_HIGHLIGHT":
return RenderLayer.getGuiTextHighlight();
case "GUI_GHOST_RECIPE_OVERLAY":
return RenderLayer.getGuiGhostRecipeOverlay();
default:
SimpleCreatorMod.log(Level.INFO, "Could not find renderLayer " + renderLayer + " using solid");
return RenderLayer.getSolid();
}
}
}
@@ -1,5 +1,4 @@
{
"material": "ice",
"mapColor": "yellow",
"collidable": true,
"soundGroup": "wool",
@@ -13,5 +12,20 @@
"slowDownMultiplier": 2.0,
"jumpVelocityMultiplier": 2.0,
"opaque": true,
"itemGroup": "food"
"itemGroup": "minecraft:building_blocks",
"allowsSpawning": true,
"solidBlock": true,
"suffocates": true,
"blockVision": true,
"postProcess": false,
"emissiveLighting": false,
"modelOffset": "none",
"pistonBehavior": "normal",
"instrument": "harp",
"burnable": false,
"replaceable": false,
"noBlockBreakParticles": false,
"requiresTool": false,
"breaksInstantly": false,
"renderLayer": "solid"
}
+4 -3
View File
@@ -16,15 +16,16 @@
"main": [
"quimufu.simple_creator.SimpleCreatorMod"
],
"client": [],
"server": [],
"client": [
"quimufu.simple_creator.SimpleCreatorModClient"
],
"tweed4:config": [
"quimufu.simple_creator.SimpleCreatorConfig"
]
},
"mixins": [],
"depends": {
"fabricloader": ">=0.4.0",
"fabricloader": ">=0.14.21",
"fabric": "*"
}
}