Skip to content

Commit

Permalink
Use Block Model Generator for all models
Browse files Browse the repository at this point in the history
  • Loading branch information
JT122406 committed Nov 9, 2024
1 parent 663b66e commit 7a48010
Show file tree
Hide file tree
Showing 18 changed files with 5 additions and 97 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.BarrelBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.LadderBlock;
Expand All @@ -21,43 +19,6 @@ public class ModelGenerators {

public static void init(DataGenerator generator, boolean run, PackOutput output, ExistingFileHelper exFileHelper) {
generator.addProvider(run, new BlockModelGenerators(output, exFileHelper));
generator.addProvider(run, new ItemModelGenerators(output, exFileHelper));
}

/**
* Used to generate models for items.
* @see ItemModelProvider
*/
private static class ItemModelGenerators extends ItemModelProvider {

private ItemModelGenerators(PackOutput output, ExistingFileHelper existingFileHelper) {
super(output, WoodWeveGot.MOD_ID, existingFileHelper);
}

@Override
protected void registerModels() {
WWGWoodSet.getWoodSets().forEach(set -> {
try {
simpleItemBlockTexture(set.name(), set.ladder());
} catch (Exception ignored) {}
});
}

private ResourceLocation woodBlockTexture(String type, String name) {
return WoodWeveGot.id(ModelProvider.BLOCK_FOLDER + "/" + type + "/" + name);
}

private void simpleItemBlockTexture(String set, ItemLike item) {
singleTexture(name(item), mcLoc("item/generated"), "layer0", WoodWeveGot.id(ModelProvider.BLOCK_FOLDER + "/" + set + "/" + name(item).replace(set + "_", "")));
}

private String name(ItemLike item) {
return key(item.asItem()).getPath();
}

private ResourceLocation key(Item item) {
return ForgeRegistries.ITEMS.getKey(item);
}
}

/**
Expand Down Expand Up @@ -87,6 +48,7 @@ else if (blockState.getValue(LadderBlock.FACING) == Direction.WEST)
return ConfiguredModel.builder().modelFile(modelFile).rotationY(270).build();
else return ConfiguredModel.builder().modelFile(modelFile).build();
}, LadderBlock.WATERLOGGED);
itemModels().singleTexture(name(set.ladder()), mcLoc("item/generated"), "layer0", woodBlockTexture(set.name(), "ladder"));
}
if (models().existingFileHelper.exists(woodBlockTextureFolder(set.name(), "barrel_top"), PackType.CLIENT_RESOURCES)) {
ModelFile modelFile = models().cubeBottomTop(name(set.barrel()), woodBlockTexture(set.name(), "barrel_side"), woodBlockTexture(set.name(), "barrel_bottom"), woodBlockTexture(set.name(), "barrel_top"));
Expand All @@ -112,15 +74,6 @@ else if (blockState.getValue(LadderBlock.FACING) == Direction.WEST)
});
}

private ConfiguredModel[] createRotatedModels(ModelFile model) {
return ConfiguredModel.builder()
.modelFile(model)
.nextModel().modelFile(model).rotationY(90)
.nextModel().modelFile(model).rotationY(180)
.nextModel().modelFile(model).rotationY(270)
.build();
}

private ResourceLocation woodBlockTexture(String type, String name) {
return WoodWeveGot.id(ModelProvider.BLOCK_FOLDER + "/" + type + "/" + name);
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.gradle.kotlin.dsl.get
plugins {
id("architectury-plugin") version "3.4-SNAPSHOT"
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
id("com.gradleup.shadow") version "8.3.3" apply false
id("com.gradleup.shadow") version "8.3.5" apply false
id("com.hypherionmc.modutils.modpublisher") version "2.+"
java
idea
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ archives_base_name=All-The-Wood-Weve-Got
mod_version=1.0.0-Indev-SNAPSHOT
maven_group=net.potionstudios

fabric_loader_version=0.16.7
fabric_loader_version=0.16.9
fabric_api_version=0.92.2

forge_version=47.3.11
forge_version=47.3.12
neoforge_version=47.1.106
use_neoforge=false

parchment=2023.09.03

devauth_version=1.2.1

bwg_version=1.3.2
bwg_version=1.4.1
terrablender_version=3.0.1.7
geckolib_version=4.4.9
corgilib_version=4.0.3.2
Expand Down

0 comments on commit 7a48010

Please sign in to comment.