fix my bad datagen-fu

This commit is contained in:
Curle 2023-08-29 23:50:19 +01:00
parent 398b216e85
commit 3b3f960768
18 changed files with 86 additions and 35 deletions

View File

@ -2,7 +2,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'net.neoforged.gradle' version '[6.0,6.2)'
}
version = mod_version
@ -100,6 +100,7 @@ minecraft {
}
repositories {
maven { url "https://cubicinterpolation.net/maven/" }
}
configurations {
@ -112,8 +113,10 @@ dependencies {
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
minecraft "net.neoforged:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf(group: "commoble.exmachina_engine", name: "exmachina_engine-${exmachina_engine_mc_version}", version: "${exmachina_engine_version}")
jarJar(group: "commoble.exmachina_engine", name: "exmachina_engine-${exmachina_engine_mc_version}", version: "[${exmachina_engine_version}, ${exmachina_engine_next_version})")
dataImplementation sourceSets.main.output
}
@ -171,6 +174,14 @@ publishing {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
maven {
url = 'https://maven.neoforged.net/releases'
credentials {
username = 'curle'
password = 'zkniWrFTmXJUMEUQX/IZt4Vxt45lnmSQdplhHmhXNW4zFTZvWQg9Pe/nspx7a93a'
}
}
}
}

View File

@ -13,7 +13,7 @@ minecraft_version=1.20.1
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.1,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=47.0.34
forge_version=47.1.63
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[47,)
# The loader version range can only use the major version of Forge/FML as bounds
@ -48,7 +48,7 @@ mod_name=Engage!
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=1.20-0.1.8
mod_version=1.20-0.1.13
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@ -56,4 +56,8 @@ mod_group_id=uk.gemwire.engage
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=Curle
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Placeholder
mod_description=Create Warp Plasma, and find an advanced tech tree to play with!
exmachina_engine_version = 0.1.0.0
exmachina_engine_mc_version = 1.20.1
exmachina_engine_next_version = 0.2.0.0

View File

@ -2,8 +2,8 @@ pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases/'
}
}
}

View File

@ -28,7 +28,7 @@ public class BlockStateProvider extends BaseBlockStateProvider<BlockModelProvide
@Override
protected void registerStatesAndModels() {
registerFluidBlockStates(List.of(Fluids.HEAVY_WATER_FLUID, Fluids.DEUTERIUM_FLUID, Fluids.DEUTERIUM_SLUSH_FLUID, Fluids.ANTIDEUTERIUM_FLUID, Fluids.WARP_PLASMA_FLUID, Fluids.PROPANE_FLUID));
simpleBlockWithItem(Blocks.BERYLLITE_ORE_BLOCK.block().get(), models().cubeAll(name(Blocks.BERYLLITE_ORE_BLOCK.block().get()), new ResourceLocation("minecraft:block/coal_ore")));
simpleBlockWithItem(Blocks.BERYLLITE_ORE_BLOCK.block().get(), models().cubeAll(name(Blocks.BERYLLITE_ORE_BLOCK.block().get()), new ResourceLocation("engage:block/beryllite_ore")));
simpleBlockWithItem(Blocks.COMPRESSOR_BLOCK.block().get(), models().cubeAll(name(Blocks.COMPRESSOR_BLOCK.block().get()), new ResourceLocation("minecraft:block/black_wool")));
simpleBlockWithItem(Blocks.COPPER_TUBE_BLOCK.block().get(), models().cubeAll(name(Blocks.COPPER_TUBE_BLOCK.block().get()), new ResourceLocation("minecraft:block/white_wool")));
simpleBlockWithItem(Blocks.COOLANT_METERING_BLOCK.block().get(), models().cubeAll(name(Blocks.COOLANT_METERING_BLOCK.block().get()), new ResourceLocation("minecraft:block/yellow_wool")));

View File

@ -7,6 +7,6 @@ public class BlockLootTables extends BaseBlockLootTables {
@Override
protected void generate() {
add(block -> createOreDrop(block, Blocks.BERYLLITE_ORE_BLOCK.item().get()), Blocks.BERYLLITE_ORE_BLOCK.block().get());
add(block -> createOreDrop(block, Items.RAW_BERYLLITE_ITEM.get()), Blocks.BERYLLITE_ORE_BLOCK.block().get());
}
}

View File

@ -36,7 +36,7 @@ public class ItemModelProvider extends BaseItemModelProvider {
@Override
protected void registerModels() {
registerBuckets(Fluids.FLUIDS_REGISTRY);
generated(Items.RAW_BERYLLITE_ITEM.get(), new ResourceLocation("minecraft:item/gold_ingot"));
generated(Items.RAW_BERYLLITE_ITEM.get(), new ResourceLocation("engage:item/beryllite_raw"));
}
void blockParent(RegistryObject<Item> item, RegistryObject<Block> block) {

View File

@ -1,6 +1,6 @@
// 1.20.1 2023-06-30T03:19:18.0172666 Item model provider: engage
// 1.20.1 2023-08-06T18:06:42.586222 Item model provider: engage
b3abd1796143a506e2c7f2ffdefeb61e235a8689 assets/engage/models/item/antideuterium_bucket.json
cfeee2aee8fab94a821a49be3ce0d110c857e1b1 assets/engage/models/item/beryllite_raw.json
8b05e6a927ff10a8e07dd1d0632435d42b705ab6 assets/engage/models/item/beryllite_raw.json
ca322f154c4d4ab99647bfa2ebb939b9284fad9a assets/engage/models/item/deuterium_bucket.json
725bfdd287ed277d7b78d3a295ea5a71b63b40fa assets/engage/models/item/deuterium_slush_bucket.json
50ee03ab71a0bc46941091c9c8cb8f9b516368c7 assets/engage/models/item/heavy_water_bucket.json

View File

@ -1,2 +1,2 @@
// 1.20.1 2023-06-30T04:23:53.8928559 Loot Tables
a0d5edde42a3b8244b925e55faccc1024cdc3f7f data/engage/loot_tables/blocks/beryllite_ore.json
// 1.20.1 2023-08-29T22:27:09.2602278 Loot Tables
22933ac7663f965e6fe3c560231b4bcb76c43bfa data/engage/loot_tables/blocks/beryllite_ore.json

View File

@ -1,4 +1,4 @@
// 1.20.1 2023-06-30T04:23:53.8880249 Block state provider: engage
// 1.20.1 2023-08-06T18:06:42.5913045 Block state provider: engage
4af9c861d7727e9ee266ca6e10d9c78c9e4104ba assets/engage/blockstates/antideuterium.json
163e87835e33814e2cad190c2265142f42e18ba9 assets/engage/blockstates/beryllite_ore.json
1bb5f9aee9050675d6749ef05c6308e655a6e4ff assets/engage/blockstates/compressor.json
@ -11,7 +11,7 @@ e8c835ceab42e3cc09b67e242199e682ab37b47d assets/engage/blockstates/copper_tube.j
b58e421acd852f85bc9fee8f837609c8471b90b7 assets/engage/blockstates/propane.json
9b31876df3da1b32ac5639c48cab2ce60cc876ad assets/engage/blockstates/warp_plasma.json
f077c95c66d98f808227df298031ba934827bbfc assets/engage/models/block/antideuterium.json
9356d6cfcd705b3474cec35599e7709fb9f0954a assets/engage/models/block/beryllite_ore.json
e595ddd851a695d6bcf3047a05e291ac76427f4b assets/engage/models/block/beryllite_ore.json
cd4466ca9aff6e3cd44febc0ab2d2a5c4a3a45ed assets/engage/models/block/compressor.json
6164628d5c2a9ff67da9c172ffbffb82095851c0 assets/engage/models/block/coolant_meter.json
0021ec0a6a012353fc3294979a59e61e7c5c8f27 assets/engage/models/block/copper_tube.json

View File

@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "minecraft:block/coal_ore"
"all": "engage:block/beryllite_ore"
}
}

View File

@ -1,6 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/gold_ingot"
"layer0": "engage:item/beryllite_raw"
}
}

View File

@ -38,7 +38,7 @@
"function": "minecraft:explosion_decay"
}
],
"name": "engage:beryllite_ore"
"name": "engage:beryllite_raw"
}
]
}

View File

@ -1,17 +1,11 @@
package uk.gemwire.engage.block.coolant;
import com.google.common.graph.Network;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import uk.gemwire.engage.registries.Blocks;
import java.util.*;
/**
* Contains a set of methods that allows all Coolant System blocks to check for a completed network on placement.
@ -27,5 +21,15 @@ public class CoolantBaseBlock extends Block {
public void onPlace(BlockState prior, Level level, BlockPos pos, BlockState newState, boolean p_60570_) {
if (level.isClientSide) return;
// TODO
// CoolantNetworksSavedData.NETWORKS
// Find networks adjacent to our block
// Add to the networks
// If more than one:
// Figure out if we placed a connection between two Nodes of the same type
// if so: merge them into one Node, copy the Positions and Transitions of one into the other
// if not: simply copy all the Nodes of one Graph into the other
}
}

View File

@ -2,9 +2,11 @@ package uk.gemwire.engage.systems.coolant;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.checkerframework.checker.units.qual.C;
import org.jetbrains.annotations.Nullable;
import uk.gemwire.engage.block.coolant.CoolantBaseBlock;
import uk.gemwire.engage.registries.Blocks;
@ -61,11 +63,17 @@ public class CoolantNetworkGraph {
*/
public static class Graph {
List<NetworkBlockNode> nodes;
List<ChunkPos> chunks;
public Graph(List<NetworkBlockNode> nodes) {
this.nodes = nodes;
}
public Graph(List<NetworkBlockNode> nodes, List<ChunkPos> chunks) {
this.nodes = nodes;
this.chunks = chunks;
}
Direction distance(BlockPos bp1, BlockPos bp2) {
for (Direction dir : Direction.values()) {
if (bp1.relative(dir).equals(bp2)) return dir;
@ -135,6 +143,9 @@ public class CoolantNetworkGraph {
}
}
ChunkPos chunk = new ChunkPos(position);
if (!chunks.contains(chunk)) chunks.add(chunk);
if (foundNode) return true;
// Couldn't add to any existing Node, so create a new one

View File

@ -6,6 +6,7 @@ import net.minecraft.core.Direction;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.*;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.saveddata.SavedData;
import net.minecraftforge.server.ServerLifecycleHooks;
@ -24,11 +25,20 @@ public class CoolantNetworksSavedData extends SavedData {
public CoolantNetworksSavedData(List<CoolantNetworkGraph.Graph> networks) { this.networks = networks; }
public CoolantNetworksSavedData() { networks = new ArrayList<>(); }
public List<CoolantNetworkGraph.Graph> getNetworksInChunk(ChunkPos c) {
List<CoolantNetworkGraph.Graph> graphs = new ArrayList<>();
for (var graph : networks) {
if (graph.chunks.contains(c)) graphs.add(graph);
}
return graphs;
}
@Override
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag) {
ListTag net = new ListTag();
ListTag nets = new ListTag();
for (var acc : networks) {
CompoundTag network = new CompoundTag();
ListTag nodes = new ListTag();
for (var node : acc.nodes) {
CompoundTag n = new CompoundTag();
@ -50,10 +60,17 @@ public class CoolantNetworksSavedData extends SavedData {
n.put("transitions", transitions);
nodes.add(n);
}
net.add(nodes);
network.put("nodes", nodes);
ListTag chunks = new ListTag();
for (var chunk : acc.chunks) {
chunks.add(NbtUtils.writeBlockPos(chunk.getWorldPosition()));
}
network.put("chunks", chunks);
nets.add(network);
}
pCompoundTag.put("networks", net);
pCompoundTag.put("networks", nets);
return pCompoundTag;
}
@ -63,7 +80,8 @@ public class CoolantNetworksSavedData extends SavedData {
List<CoolantNetworkGraph.Graph> graphs = new ArrayList<>();
nets.iterator().forEachRemaining(network -> {
List<CoolantNetworkGraph.NetworkBlockNode> nodes = new ArrayList<>();
((ListTag) network).iterator().forEachRemaining(node -> {
List<ChunkPos> chunks = new ArrayList<>();
((CompoundTag) network).getList("nodes", ListTag.TAG_COMPOUND).iterator().forEachRemaining(node -> {
Block type = CoolantNetworkGraph.ValidBlocks.getBlockFor(((CompoundTag) node).getString("type"));
Set<BlockPos> positions = new HashSet<>();
ListTag poses = ((CompoundTag) node).getList("positions", ListTag.TAG_COMPOUND);
@ -83,7 +101,10 @@ public class CoolantNetworksSavedData extends SavedData {
nodes.add(new CoolantNetworkGraph.NetworkBlockNode((CoolantBaseBlock) type, positions, transitions));
});
graphs.add(new CoolantNetworkGraph.Graph(nodes));
((CompoundTag) network).getList("chunks", ListTag.TAG_COMPOUND).iterator().forEachRemaining(chunk ->
chunks.add(new ChunkPos(NbtUtils.readBlockPos((CompoundTag) chunk)))
);
graphs.add(new CoolantNetworkGraph.Graph(nodes, chunks));
});
return new CoolantNetworksSavedData(graphs);

View File

@ -18,7 +18,7 @@
}
},
"lava_level": {
"below_top": 3
"below_top": 60
},
"probability": 0.005,
"replaceable": "#minecraft:overworld_carver_replaceables",
@ -32,7 +32,7 @@
"y": {
"type": "minecraft:uniform",
"max_inclusive": {
"absolute": 180
"absolute": 40
},
"min_inclusive": {
"above_bottom": 8

View File

@ -1,7 +1,7 @@
{
"type": "minecraft:ore",
"config": {
"discard_chance_on_air_exposure": 0.0,
"discard_chance_on_air_exposure": 1.0,
"size": 17,
"targets": [
{

View File

@ -3,7 +3,7 @@
"placement": [
{
"type": "minecraft:count",
"count": 30
"count": 3
},
{
"type": "minecraft:in_square"
@ -13,7 +13,7 @@
"height": {
"type": "minecraft:uniform",
"max_inclusive": {
"below_top": 136
"below_top": 40
},
"min_inclusive": {
"absolute": 15