-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from railcraft-reborn/patchouli-test
POC multiblock visualization
- Loading branch information
Showing
22 changed files
with
430 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ mod_version=1.0.8 | |
# Deps | ||
mixin_version=0.8.5 | ||
jei_version=15.2.0.22 | ||
patchouli_version=1.20.1-81-FORGE |
3 changes: 2 additions & 1 deletion
3
src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/generated/resources/.cache/e5c5eb35b4ba40351ecb7d9f04c3527f2f5779b0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/generated/resources/data/railcraft/advancements/grant_book_on_first_join.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"criteria": { | ||
"tick": { | ||
"conditions": {}, | ||
"trigger": "minecraft:tick" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"tick" | ||
] | ||
], | ||
"rewards": { | ||
"loot": [ | ||
"railcraft:advancements/patchouli_book" | ||
] | ||
}, | ||
"sends_telemetry_event": true | ||
} |
22 changes: 22 additions & 0 deletions
22
src/generated/resources/data/railcraft/loot_tables/advancements/patchouli_book.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"type": "minecraft:advancement_reward", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"functions": [ | ||
{ | ||
"function": "minecraft:set_nbt", | ||
"tag": "{\"patchouli:book\":\"railcraft:guide_book\"}" | ||
} | ||
], | ||
"name": "patchouli:guide_book" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "railcraft:advancements/patchouli_book" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/mods/railcraft/data/advancements/RailcraftAdvancements.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package mods.railcraft.data.advancements; | ||
|
||
import java.util.function.Consumer; | ||
import mods.railcraft.Railcraft; | ||
import mods.railcraft.data.loot.packs.RailcraftAdvancementRewardLoot; | ||
import net.minecraft.advancements.Advancement; | ||
import net.minecraft.advancements.AdvancementRewards; | ||
import net.minecraft.advancements.critereon.PlayerTrigger; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraftforge.common.data.ExistingFileHelper; | ||
import net.minecraftforge.common.data.ForgeAdvancementProvider; | ||
|
||
class RailcraftAdvancements implements ForgeAdvancementProvider.AdvancementGenerator { | ||
|
||
@Override | ||
public void generate(HolderLookup.Provider registries, Consumer<Advancement> consumer, | ||
ExistingFileHelper fileHelper) { | ||
Advancement.Builder.advancement() | ||
.addCriterion("tick", PlayerTrigger.TriggerInstance.tick()) | ||
.rewards(AdvancementRewards.Builder.loot(RailcraftAdvancementRewardLoot.PATCHOULI_BOOK)) | ||
.save(consumer, new ResourceLocation(Railcraft.ID, "grant_book_on_first_join"), fileHelper); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/mods/railcraft/data/loot/packs/RailcraftAdvancementRewardLoot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package mods.railcraft.data.loot.packs; | ||
|
||
import java.util.function.BiConsumer; | ||
import mods.railcraft.Railcraft; | ||
import net.minecraft.data.loot.LootTableSubProvider; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.storage.loot.LootPool; | ||
import net.minecraft.world.level.storage.loot.LootTable; | ||
import net.minecraft.world.level.storage.loot.entries.LootItem; | ||
import net.minecraft.world.level.storage.loot.functions.SetNbtFunction; | ||
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; | ||
import vazkii.patchouli.api.PatchouliAPI; | ||
|
||
public class RailcraftAdvancementRewardLoot implements LootTableSubProvider { | ||
|
||
public static final ResourceLocation PATCHOULI_BOOK = | ||
new ResourceLocation(Railcraft.ID, "advancements/patchouli_book"); | ||
|
||
@Override | ||
public void generate(BiConsumer<ResourceLocation, LootTable.Builder> consumer) { | ||
var bookId = new ResourceLocation(Railcraft.ID, "guide_book"); | ||
var book = PatchouliAPI.get().getBookStack(bookId).getItem(); | ||
var tag = new CompoundTag(); | ||
tag.putString("patchouli:book", bookId.toString()); | ||
consumer.accept(PATCHOULI_BOOK, LootTable.lootTable() | ||
.withPool(LootPool.lootPool() | ||
.setRolls(ConstantValue.exactly(1)) | ||
.add(LootItem.lootTableItem(book).apply(SetNbtFunction.setTag(tag))) | ||
) | ||
); | ||
} | ||
} |
149 changes: 149 additions & 0 deletions
149
src/main/java/mods/railcraft/integrations/patchouli/Patchouli.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
package mods.railcraft.integrations.patchouli; | ||
|
||
import mods.railcraft.Railcraft; | ||
import mods.railcraft.tags.RailcraftTags; | ||
import mods.railcraft.world.level.block.RailcraftBlocks; | ||
import mods.railcraft.world.level.block.steamboiler.FireboxBlock; | ||
import mods.railcraft.world.level.block.steamboiler.SteamBoilerTankBlock; | ||
import mods.railcraft.world.level.block.tank.IronTankGaugeBlock; | ||
import mods.railcraft.world.level.block.tank.IronTankValveBlock; | ||
import mods.railcraft.world.level.block.tank.IronTankWallBlock; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.DyeColor; | ||
import net.minecraft.world.level.block.Block; | ||
import vazkii.patchouli.api.IStateMatcher; | ||
import vazkii.patchouli.api.PatchouliAPI; | ||
|
||
public class Patchouli { | ||
|
||
public static void setup() { | ||
var patchouliApi = PatchouliAPI.get(); | ||
|
||
var crusherBlock = validBlock(patchouliApi, RailcraftBlocks.CRUSHER.get()); | ||
var crusher = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BB", "BB", "BB"}, //Y:1 | ||
{"BB", "0B", "BB"} //Y:0 | ||
}, 'B', crusherBlock, '0', crusherBlock | ||
).setSymmetrical(false); | ||
patchouliApi.registerMultiblock(new ResourceLocation(Railcraft.ID, "crusher"), crusher); | ||
|
||
var cokeOvenBlock = validBlock(patchouliApi, RailcraftBlocks.COKE_OVEN_BRICKS.get()); | ||
var cokeOven = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BBB", "BBB", "BBB"}, //Y:2 | ||
{"BBB", "BAB", "BBB"}, //Y:1 | ||
{"BBB", "B0B", "BBB"} //Y:0 | ||
}, 'B', cokeOvenBlock, '0', cokeOvenBlock, 'A', patchouliApi.airMatcher() | ||
).setSymmetrical(true); | ||
patchouliApi.registerMultiblock(new ResourceLocation(Railcraft.ID, "coke_oven"), cokeOven); | ||
|
||
var blastFurnaceBlock = validBlock(patchouliApi, RailcraftBlocks.BLAST_FURNACE_BRICKS.get()); | ||
var blastFurnace = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BBB", "BBB", "BBB"}, //Y:3 | ||
{"BBB", "BAB", "BBB"}, //Y:2 | ||
{"BBB", "BAB", "BBB"}, //Y:1 | ||
{"BBB", "B0B", "BBB"} //Y:0 | ||
}, 'B', blastFurnaceBlock, '0', blastFurnaceBlock, 'A', patchouliApi.airMatcher() | ||
).setSymmetrical(true); | ||
patchouliApi | ||
.registerMultiblock(new ResourceLocation(Railcraft.ID, "blast_furnace"), blastFurnace); | ||
|
||
var steamTurbineBlock = validBlock(patchouliApi, RailcraftBlocks.STEAM_TURBINE.get()); | ||
var steamTurbine = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BB", "BB", "BB"}, //Y:1 | ||
{"BB", "0B", "BB"} //Y:0 | ||
}, 'B', steamTurbineBlock, '0', steamTurbineBlock | ||
).setSymmetrical(false); | ||
patchouliApi | ||
.registerMultiblock(new ResourceLocation(Railcraft.ID, "steam_turbine"), steamTurbine); | ||
|
||
var waterTankBlock = validBlock(patchouliApi, RailcraftBlocks.WATER_TANK_SIDING.get()); | ||
var waterTank = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BB", "BB"}, //Y:1 | ||
{"BB", "0B"} //Y:0 | ||
}, 'B', waterTankBlock, '0', waterTankBlock | ||
).setSymmetrical(true); | ||
patchouliApi | ||
.registerMultiblock(new ResourceLocation(Railcraft.ID, "water_tank"), waterTank); | ||
|
||
var steamOvenBlock = validBlock(patchouliApi, RailcraftBlocks.STEAM_OVEN.get()); | ||
var steamOven = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BB", "BB"}, //Y:1 | ||
{"BB", "0B"} //Y:0 | ||
}, 'B', steamOvenBlock, '0', steamOvenBlock | ||
).setSymmetrical(true); | ||
patchouliApi | ||
.registerMultiblock(new ResourceLocation(Railcraft.ID, "steam_oven"), steamOven); | ||
|
||
var ironTankWallBlock = validTankWallBlock(patchouliApi, | ||
RailcraftBlocks.IRON_TANK_WALL.variantFor(DyeColor.WHITE).get()); | ||
var ironTankGaugeBlock = validTankGaugeBlock(patchouliApi, | ||
RailcraftBlocks.IRON_TANK_GAUGE.variantFor(DyeColor.WHITE).get()); | ||
var ironTankValveBlock = validTankValveBlock(patchouliApi, | ||
RailcraftBlocks.IRON_TANK_VALVE.variantFor(DyeColor.WHITE).get()); | ||
var tank = patchouliApi.makeMultiblock(new String[][]{ | ||
{"BBBBB", "BBBBB", "BBVBB", "BBBBB", "BBBBB"}, //Y:4 | ||
{"BGGGB", "GAAAG", "GAAAG", "GAAAG", "BGGGB"}, //Y:3 | ||
{"BGGGB", "GAAAG", "GAAAG", "GAAAG", "BGGGB"}, //Y:2 | ||
{"BGGGB", "GAAAG", "GAAAG", "GAAAG", "BGGGB"}, //Y:1 | ||
{"BBBBB", "BBBBB", "BBVBB", "BBBBB", "BB0BB"} //Y:0 | ||
}, | ||
'A', patchouliApi.airMatcher(), | ||
'B', ironTankWallBlock, | ||
'G', ironTankGaugeBlock, | ||
'V', ironTankValveBlock, | ||
'0', ironTankWallBlock | ||
).setSymmetrical(true); | ||
patchouliApi | ||
.registerMultiblock(new ResourceLocation(Railcraft.ID, "iron_tank"), tank); | ||
|
||
var solidFueledFireboxBlock = validFireboxBlock(patchouliApi, | ||
RailcraftBlocks.SOLID_FUELED_FIREBOX.get()); | ||
var boilerTankBlock = validSteamBoilerTankBlock(patchouliApi, | ||
RailcraftBlocks.LOW_PRESSURE_STEAM_BOILER_TANK.get()); | ||
var boiler = patchouliApi.makeMultiblock(new String[][]{ | ||
{"TT", "TT"}, //Y:3 | ||
{"TT", "TT"}, //Y:2 | ||
{"TT", "TT"}, //Y:1 | ||
{"B0", "BB"} //Y:0 | ||
}, | ||
'B', solidFueledFireboxBlock, | ||
'T', boilerTankBlock, | ||
'0', solidFueledFireboxBlock | ||
).setSymmetrical(true); | ||
patchouliApi | ||
.registerMultiblock(new ResourceLocation(Railcraft.ID, "boiler"), boiler); | ||
} | ||
|
||
private static IStateMatcher validBlock(PatchouliAPI.IPatchouliAPI api, Block block) { | ||
return api.predicateMatcher(block, state -> state.is(block)); | ||
} | ||
|
||
private static IStateMatcher validTankWallBlock(PatchouliAPI.IPatchouliAPI api, | ||
IronTankWallBlock block) { | ||
return api.predicateMatcher(block, state -> state.is(RailcraftTags.Blocks.IRON_TANK_WALL)); | ||
} | ||
|
||
private static IStateMatcher validTankGaugeBlock(PatchouliAPI.IPatchouliAPI api, | ||
IronTankGaugeBlock block) { | ||
return api.predicateMatcher(block, state -> state.is(RailcraftTags.Blocks.IRON_TANK_GAUGE)); | ||
} | ||
|
||
private static IStateMatcher validTankValveBlock(PatchouliAPI.IPatchouliAPI api, | ||
IronTankValveBlock block) { | ||
return api.predicateMatcher(block, state -> state.is(RailcraftTags.Blocks.IRON_TANK_VALVE)); | ||
} | ||
|
||
private static IStateMatcher validFireboxBlock(PatchouliAPI.IPatchouliAPI api, | ||
FireboxBlock block) { | ||
return api.predicateMatcher(block, | ||
state -> state.is(RailcraftBlocks.FLUID_FUELED_FIREBOX.get()) || | ||
state.is(RailcraftBlocks.SOLID_FUELED_FIREBOX.get())); | ||
} | ||
|
||
private static IStateMatcher validSteamBoilerTankBlock(PatchouliAPI.IPatchouliAPI api, | ||
SteamBoilerTankBlock block) { | ||
return api.predicateMatcher(block, | ||
state -> state.is(RailcraftBlocks.LOW_PRESSURE_STEAM_BOILER_TANK.get()) || | ||
state.is(RailcraftBlocks.HIGH_PRESSURE_STEAM_BOILER_TANK.get())); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...in/resources/assets/railcraft/patchouli_books/guide_book/en_us/categories/multiblock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Multi-block structures", | ||
"description": "Everything you need to build multi-block structures", | ||
"icon": "railcraft:coke_oven_bricks" | ||
} |
16 changes: 16 additions & 0 deletions
16
...s/assets/railcraft/patchouli_books/guide_book/en_us/entries/multiblock/blast_furnace.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Blast Furnace", | ||
"icon": "railcraft:blast_furnace_bricks", | ||
"category": "railcraft:multiblock", | ||
"pages": [ | ||
{ | ||
"type": "patchouli:text", | ||
"text": "The Blast Furnace is a 3x3x4 brick structure, hollow in the middle, for converting Iron Ingots into Steel Ingots.$(br2)The Oven is built out of 34 special bricks made from Nether Brick, Soul Sand, and Magma Cream. If broken down, it takes 36 Nether Bricks, 36 Soul Sand, and 9 Magma Creams to build one Blast Furnace. Blast Furnaces cannot be built adjacent to each other – there must be at least one tile in between Furnaces." | ||
}, | ||
{ | ||
"type": "patchouli:multiblock", | ||
"name": "Blast Furnace", | ||
"multiblock_id": "railcraft:blast_furnace" | ||
} | ||
] | ||
} |
20 changes: 20 additions & 0 deletions
20
...urces/assets/railcraft/patchouli_books/guide_book/en_us/entries/multiblock/coke_oven.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "Coke Oven", | ||
"icon": "railcraft:coke_oven_bricks", | ||
"category": "railcraft:multiblock", | ||
"pages": [ | ||
{ | ||
"type": "patchouli:text", | ||
"text": "The Coke Oven is a 3x3x3 brick structure, hollow in the middle, for converting Coal into Coal Coke or Wood into Charcoal and producing Creosote Oil as a byproduct.$(br2)The Oven is built out of 26 special bricks made from Brick and Sand. If broken down, it takes 104 Clay and 130 Sand to build one Coke Oven. They cannot be built adjacent to each other, there must be at least one tile in between ovens." | ||
}, | ||
{ | ||
"type": "patchouli:multiblock", | ||
"name": "Coke Oven", | ||
"multiblock_id": "railcraft:coke_oven" | ||
}, | ||
{ | ||
"type": "patchouli:text", | ||
"text": "The Coal Oven can hold 64,000 units of Creosote Oil. which can be extracted and kept in either Buckets or Glass Bottles. Each Bucket or Bottle can hold 1,000 units of Creosote Oil. The filled Buckets will not stack. The filled Bottles will.$(br2)Converting Coal into Coke is a slow process. You will probably want to build several Ovens if you plan to make a lot rails." | ||
} | ||
] | ||
} |
Oops, something went wrong.