Skip to content

Commit

Permalink
Whoops! All providers!
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcat101 committed Dec 3, 2023
1 parent 595633a commit 378c21b
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 59 deletions.
6 changes: 5 additions & 1 deletion src/generated/resources/.cache/cache
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,22 @@ cd91e697fcbe7d063a7fea5517dd72aeab00cb79 assets/reignitedutilities/blockstates/5
2ca260983339b811d5da304e1f8f6598579206a5 assets/reignitedutilities/blockstates/8_compressed_cobblestone.json
b7f6d60665ee01d4a5c5fc94a5ac586c72236c2a assets/reignitedutilities/blockstates/angel_block.json
d9c3e3490f48e9d5e39854ee6a01542374eeffe3 assets/reignitedutilities/blockstates/creative_spike.json
2c429d5a9f565ea1f37e1e5b1dd63259d45761ce assets/reignitedutilities/blockstates/cursed_earth.json
c5ba78c3443348b831ea9bef9b04c184b5e2bd2d assets/reignitedutilities/blockstates/diamond_spike.json
d8b966ea846e1fe68ad166668e42ace1407a8f2b assets/reignitedutilities/blockstates/gold_spike.json
9956961ea6625c9c53fda2978bea5f76900fd26f assets/reignitedutilities/blockstates/iron_spike.json
4c43255d36c864ac6d3a442b6650b78ad98c7cc3 assets/reignitedutilities/blockstates/lunar_panel.json
5e4ea7660eebcfd6695c46283c72b269fcbee11e assets/reignitedutilities/blockstates/manual_mill.json
27d0f6550a11c068fb1756f5e4fdece70350a0c1 assets/reignitedutilities/blockstates/overworld_portal.json
7d47ec891592a69bf5e4c38a8d9192994d1a379e assets/reignitedutilities/blockstates/polished_stone.json
3bca83cdc653ce9127ee28792232ff9f03636b3d assets/reignitedutilities/blockstates/slightly_larger_chest.json
fb68a3c2fb963115f5e9be4951a36a1907d10c71 assets/reignitedutilities/blockstates/solar_panel.json
c717d198a07fcf2bb6239ff2482643f75fee2e72 assets/reignitedutilities/blockstates/stone_spike.json
9d5cdbcd82a4b1402447b5ecce594f00d9c6b1e5 assets/reignitedutilities/blockstates/stoneburnt.json
595aae3ad8cf0d22dfb3e83017e7f2db310482a9 assets/reignitedutilities/blockstates/stoneburnt_chiseled.json
42873545e1afa1fb77d982312ca1dd6153a6b691 assets/reignitedutilities/blockstates/stoneburnt_cross.json
36ef9b7a021adac5f25176686b40ead6b7dba83c assets/reignitedutilities/blockstates/truchet.json
122dbdf1ad87d06877f9cc5f2a843990678e2f44 assets/reignitedutilities/blockstates/wind_mill.json
e627fb35484c0d310a801195a46f31e23c8a9eec assets/reignitedutilities/blockstates/wood_spike.json
78f7dad805cc82188dbe85bd4d6547fbd5a5944c assets/reignitedutilities/models/block/1_compressed_cobblestone.json
fb66cdd4012f2c43bf09dfdec65d05ab9bfe0e03 assets/reignitedutilities/models/block/1_compressed_dirt.json
Expand Down Expand Up @@ -184,7 +188,7 @@ b47f8d8e79d06b7451a80cf6cffb1593d43ce170 data/reignitedutilities/loot_tables/blo
4bd8cfa60e46bcb9e8ee4fb11204a834f9324ba6 data/reignitedutilities/loot_tables/blocks/chunk_loading_ward.json
f24cf94dd028a26da04d65efbac61d5ad9f6d6f1 data/reignitedutilities/loot_tables/blocks/creative_mill.json
1161da25913e8ab2a02f82c1161eafb33192a3d2 data/reignitedutilities/loot_tables/blocks/creative_spike.json
63f208618e11b19ef7dc881080adf92ef8582685 data/reignitedutilities/loot_tables/blocks/cursed_earth.json
426e6a7e0dfcc5585f058423d1ffd39b129e4386 data/reignitedutilities/loot_tables/blocks/cursed_earth.json
cf56ac538add7d7437dd9968c4cebeae51936607 data/reignitedutilities/loot_tables/blocks/diamond_spike.json
70a7331e3fe59d5b2341e1de76232fc5914413c3 data/reignitedutilities/loot_tables/blocks/dragon_egg_mill.json
2c15ab866f6ebe043ef82739ff64753089846c1c data/reignitedutilities/loot_tables/blocks/fire_mill.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"variants": {
"spread=0": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=1": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=2": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=3": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=4": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=5": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=6": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=7": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=8": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=9": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=10": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=11": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=12": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=13": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=14": {
"model": "reignitedutilities:block/cursed_earth"
},
"spread=15": {
"model": "reignitedutilities:block/cursed_earth"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "reignitedutilities:block/manual_mill"
},
"facing=south": {
"model": "reignitedutilities:block/manual_mill",
"y": 180
},
"facing=west": {
"model": "reignitedutilities:block/manual_mill",
"y": 270
},
"facing=east": {
"model": "reignitedutilities:block/manual_mill",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"variants": {
"facing=east": {
"model": "reignitedutilities:block/slightly_larger_chest",
"y": 90
},
"facing=north": {
"model": "reignitedutilities:block/slightly_larger_chest"
},
Expand All @@ -14,6 +10,10 @@
"facing=west": {
"model": "reignitedutilities:block/slightly_larger_chest",
"y": 270
},
"facing=east": {
"model": "reignitedutilities:block/slightly_larger_chest",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=north": {
"model": "reignitedutilities:block/wind_mill"
},
"facing=south": {
"model": "reignitedutilities:block/wind_mill",
"y": 180
},
"facing=west": {
"model": "reignitedutilities:block/wind_mill",
"y": 270
},
"facing=east": {
"model": "reignitedutilities:block/wind_mill",
"y": 90
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,37 @@
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "reignitedutilities:cursed_earth"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "reignitedutilities:cursed_earth"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"name": "minecraft:dirt"
}
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
import site.hellishmods.reignitedutilities.reignitedutilities;
import site.hellishmods.reignitedutilities.providers.blocks.AllSideBlockModelProvider;
import site.hellishmods.reignitedutilities.providers.blocks.BlockLootTableProvider;
import site.hellishmods.reignitedutilities.providers.blocks.OtherBlockStateProvider;
import site.hellishmods.reignitedutilities.providers.blocks.PanelModelProvider;
import site.hellishmods.reignitedutilities.providers.blocks.compressed.CompressedBlockModelProvider;
import site.hellishmods.reignitedutilities.providers.blocks.compressed.CompressedBlockRecipeProvider;
Expand All @@ -25,7 +25,7 @@ public static void onDataGather(GatherDataEvent e) {
gen.addProvider(new ReignitedItemModelProvider(gen, exFileHelper));

gen.addProvider(new BlockLootTableProvider(gen));
gen.addProvider(new AllSideBlockModelProvider(gen, exFileHelper));
gen.addProvider(new OtherBlockStateProvider(gen, exFileHelper));
gen.addProvider(new PanelModelProvider(gen, exFileHelper));
gen.addProvider(new SpikeModelProvider(gen, exFileHelper));
gen.addProvider(new SpikeRecipeProvider(gen));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
package site.hellishmods.reignitedutilities.lib.loottables;

import java.util.HashMap;
import java.util.stream.Collectors;

import net.minecraft.block.Block;
import net.minecraft.block.CropsBlock;
import net.minecraft.data.loot.BlockLootTables;
import net.minecraft.loot.ItemLootEntry;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import site.hellishmods.reignitedutilities.reignitedutilities;
import site.hellishmods.reignitedutilities.init.Blocks;

public class ReignitedUtilitiesBlockLootTable extends BlockLootTables {
private static HashMap<RegistryObject<Block>, Block> exceptions = new HashMap<>();
static {
exceptions.put(Blocks.CURSED_EARTH, net.minecraft.block.Blocks.DIRT); // TODO: fix
}

@Override
protected void addTables() {
for (RegistryObject<Block> block : reignitedutilities.BLOCKS.getEntries()) {
if (!(block.get() instanceof CropsBlock)) dropSelf(block.get());
for (RegistryObject<Block> b : reignitedutilities.BLOCKS.getEntries()) {
Block block = b.get();
if (block instanceof CropsBlock) continue;

if (exceptions.containsKey(b)) {
add(block, createSelfDropDispatchTable(block, HAS_SILK_TOUCH, applyExplosionCondition(block, ItemLootEntry.lootTableItem(exceptions.get(b)))));
continue;
}

dropSelf(block);
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package site.hellishmods.reignitedutilities.providers.blocks;

import java.util.ArrayList;

import com.google.common.collect.Lists;

import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourcePackType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.client.model.generators.ModelProvider;
import net.minecraftforge.client.model.generators.ModelFile.ExistingModelFile;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.common.data.ExistingFileHelper.ResourceType;
import net.minecraftforge.registries.ForgeRegistries;
import site.hellishmods.reignitedutilities.reignitedutilities;
import site.hellishmods.reignitedutilities.lib.blocks.OrientableBlock;

public class OtherBlockStateProvider extends BlockStateProvider {
private static final ArrayList<String> ALL_SIDED_MODELS = Lists.newArrayList(
"polished_stone",
"stoneburnt",
"stoneburnt_chiseled",
"stoneburnt_cross",
"truchet",
"angel_block",
"overworld_portal"
);

ExistingFileHelper exFileHelper;
public OtherBlockStateProvider(DataGenerator gen, ExistingFileHelper exFileHelper) {
super(gen, reignitedutilities.MOD_ID, exFileHelper);
this.exFileHelper = exFileHelper;
}

@Override
protected void registerStatesAndModels() {
ForgeRegistries.BLOCKS.getValues().stream().filter(b -> b.getRegistryName().getNamespace().equals(reignitedutilities.MOD_ID)).forEach(b -> {
if (ALL_SIDED_MODELS.contains(b.getRegistryName().getPath())) {
simpleBlock(b);
return;
}

ExistingModelFile model = new ModelFile.ExistingModelFile(new ResourceLocation(b.getRegistryName().getNamespace(), ModelProvider.BLOCK_FOLDER+"/"+b.getRegistryName().getPath()), exFileHelper);
if (!exFileHelper.exists(model.getUncheckedLocation(), new ResourceType(ResourcePackType.CLIENT_RESOURCES, ".json", "models"))) return;

if (b instanceof OrientableBlock) {
horizontalBlock(b, model);
return;
}

getVariantBuilder(b).forAllStates(state -> ConfiguredModel.builder().modelFile(model).build());
});
}

}
5 changes: 3 additions & 2 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
protected net.minecraft.data.loot.BlockLootTables field_218573_a # HAS_SILK_TOUCH

public net.minecraft.client.gui.NewChatGui func_146234_a(Lnet/minecraft/util/text/ITextComponent;I)V # addMessage
public net.minecraft.client.gui.NewChatGui func_146242_c(I)V # removeById
public net.minecraft.block.RedstoneOreBlock func_196500_d(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V # interact
public net.minecraft.state.StateHolder field_235893_d_ # propertiesCodec
public net.minecraft.block.RedstoneOreBlock func_196500_d(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V # interact

This file was deleted.

0 comments on commit 378c21b

Please sign in to comment.