Skip to content

Commit

Permalink
add PneumaticCraft: Repressurized compat (#162)
Browse files Browse the repository at this point in the history
* add pneumaticcraft

* disable info printing spam in default examples

* add pneu mixins

* rename pneu

* add parameter types to the loottables example closures

* main PneumaticCraft compat

* amadron periodic

* uncomment xp example

* add explosion compat

* fix periodicStorage issue

* PNEUMATIC_CRAFT

* sort gradle

* use bitwise or and simplify

* fix error, register all itemstack inputs

* remove now-unneeded registration

* GroovyPropertyContainer

---------

Co-authored-by: brachy84 <[email protected]>
  • Loading branch information
WaitingIdly and brachy84 authored Jul 6, 2024
1 parent 2288d65 commit 9fb2042
Show file tree
Hide file tree
Showing 22 changed files with 1,697 additions and 3 deletions.
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ final def mod_dependencies = [
'mekanism-268560:2835175' : [project.debug_mekanism],
'natures-aura-306626:2882138' : [project.debug_natures_aura],
'packmode-278398:2567799' : [project.debug_packmode],
'pneumaticcraft-repressurized-281849:2978408' : [project.debug_pneumaticcraft],
'projecte-226410:2702991' : [project.debug_projecte],
'athenaeum-284350:4633750' : [project.debug_pyrotech],
'pyrotech-306676:4956838' : [project.debug_pyrotech],
Expand Down
7 changes: 4 additions & 3 deletions examples/postInit/loottables.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import com.cleanroommc.groovyscript.event.LootTablesLoadedEvent
import net.minecraft.world.storage.loot.LootContext

event_manager.listen { LootTablesLoadedEvent event ->
patchStrongholdLibraryLT(event)
Expand All @@ -19,7 +20,7 @@ def patchStrongholdLibraryLT(event) {
.quality(1)
.build()
)
event.loot.printEntries('minecraft:chests/stronghold_library', 'main')
// event.loot.printEntries('minecraft:chests/stronghold_library', 'main')
}

def patchChickenLT(event) {
Expand All @@ -30,15 +31,15 @@ def patchChickenLT(event) {
.entry(
event.loot.entryBuilder()
.item(item('minecraft:diamond'))
.function{ stack, random, context ->
.function{ ItemStack stack, Random random, LootContext context ->
stack.setCount(10)
return stack
}
.weight(1)
.quality(1)
.build()
)
.condition{ random, context -> random.nextFloat() < 0.05f }
.condition{ Random random, LootContext context -> random.nextFloat() < 0.05f }
.rollsRange(1.0f, 3.0f)
.bonusRollsRange(0.0f, 0.0f)
.build()
Expand Down
215 changes: 215 additions & 0 deletions examples/postInit/pneumaticcraft.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@

// Auto generated groovyscript example file
// MODS_LOADED: pneumaticcraft

println 'mod \'pneumaticcraft\' detected, running script'

// Amadron:
// Uses an Amadron Tablet and linked inventories in world to trade via drones.

mods.pneumaticcraft.amadron.removeByInput(item('minecraft:rotten_flesh'))
mods.pneumaticcraft.amadron.removeByOutput(item('minecraft:emerald'))
// mods.pneumaticcraft.amadron.removeAll()
// mods.pneumaticcraft.amadron.removeAllPeriodic()
// mods.pneumaticcraft.amadron.removeAllStatic()

mods.pneumaticcraft.amadron.recipeBuilder()
.input(item('minecraft:clay') * 3)
.output(item('minecraft:gold_ingot'))
.register()

mods.pneumaticcraft.amadron.recipeBuilder()
.fluidInput(fluid('water') * 50)
.output(item('minecraft:clay') * 3)
.register()

mods.pneumaticcraft.amadron.recipeBuilder()
.fluidInput(fluid('water') * 50)
.fluidOutput(fluid('lava') * 10)
.periodic()
.register()


// Assembly Controller:
// Uses a given Program to convert an input itemstack into an output itemstack. Drill recipes that output an itemstack used
// for the input itemstack of a Laser recipe can be chained via the Drill & Laser Program.

mods.pneumaticcraft.assembly_controller.removeByInput(item('minecraft:redstone'))
mods.pneumaticcraft.assembly_controller.removeByOutput(item('pneumaticcraft:pressure_chamber_valve'))
// mods.pneumaticcraft.assembly_controller.removeAll()
// mods.pneumaticcraft.assembly_controller.removeAllDrill()
// mods.pneumaticcraft.assembly_controller.removeAllLaser()

mods.pneumaticcraft.assembly_controller.recipeBuilder()
.input(item('minecraft:clay') * 3)
.output(item('minecraft:gold_ingot') * 6)
.drill()
.register()

mods.pneumaticcraft.assembly_controller.recipeBuilder()
.input(item('minecraft:gold_ingot') * 6)
.output(item('minecraft:diamond'))
.laser()
.register()

mods.pneumaticcraft.assembly_controller.recipeBuilder()
.input(item('minecraft:stone'))
.output(item('minecraft:clay') * 5)
.laser()
.register()


// Explosion:
// Converts an input item into an output item, with a chance to fail and destroy the item.

// mods.pneumaticcraft.explosion.removeByInput(item('minecraft:iron_block'))
mods.pneumaticcraft.explosion.removeByOutput(item('pneumaticcraft:compressed_iron_block'))
// mods.pneumaticcraft.explosion.removeAll()

mods.pneumaticcraft.explosion.recipeBuilder()
.input(item('minecraft:clay'))
.output(item('minecraft:gold_ingot'))
.lossRate(40)
.register()

mods.pneumaticcraft.explosion.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:obsidian'))
.register()


// Heat Frame Cooling:
// Converts an input itemstack into an output itemstack when inside an inventory placed within a Heat Frame which is
// cooled.

mods.pneumaticcraft.heat_frame_cooling.removeByInput(item('minecraft:water_bucket'))
mods.pneumaticcraft.heat_frame_cooling.removeByOutput(item('minecraft:obsidian'))
// mods.pneumaticcraft.heat_frame_cooling.removeAll()

mods.pneumaticcraft.heat_frame_cooling.recipeBuilder()
.input(item('minecraft:clay'))
.output(item('minecraft:gold_ingot'))
.register()

mods.pneumaticcraft.heat_frame_cooling.recipeBuilder()
.input(item('minecraft:diamond'))
.output(item('minecraft:obsidian'))
.register()


// Liquid Fuel:
// Converts fluid into Pressure in a Liquid Compressor.

mods.pneumaticcraft.liquid_fuel.remove(fluid('lava'))
// mods.pneumaticcraft.liquid_fuel.removeAll()

mods.pneumaticcraft.liquid_fuel.recipeBuilder()
.fluidInput(fluid('water'))
.pressure(100_000_000)
.register()



// Plastic Mixer:
// Converts a fluidstack and an item with a variable damage value into each other, requiring temperature to operate the
// process, optionally consuming dye, and allowing either only melting or only solidifying.

// mods.pneumaticcraft.plastic_mixer.removeByFluid(fluid('plastic'))
// mods.pneumaticcraft.plastic_mixer.removeByItem(item('pneumaticcraft:plastic'))
// mods.pneumaticcraft.plastic_mixer.removeAll()

mods.pneumaticcraft.plastic_mixer.recipeBuilder()
.fluidInput(fluid('lava') * 100)
.output(item('minecraft:clay'))
.allowMelting()
.allowSolidifying()
.requiredTemperature(323)
.register()

mods.pneumaticcraft.plastic_mixer.recipeBuilder()
.fluidInput(fluid('water') * 50)
.output(item('minecraft:sapling'))
.allowSolidifying()
.requiredTemperature(298)
.meta(-1)
.register()


// Pressure Chamber:
// Converts any number of input itemstacks into any number of output itemstacks, either generating Pressure or consuming
// Pressure from the Pressure Chamber.

mods.pneumaticcraft.pressure_chamber.removeByInput(item('minecraft:iron_block'))
mods.pneumaticcraft.pressure_chamber.removeByOutput(item('minecraft:diamond'))
// mods.pneumaticcraft.pressure_chamber.removeAll()

mods.pneumaticcraft.pressure_chamber.recipeBuilder()
.input(item('minecraft:clay') * 3)
.output(item('minecraft:gold_ingot'))
.pressure(4)
.register()

mods.pneumaticcraft.pressure_chamber.recipeBuilder()
.input(item('minecraft:clay'), item('minecraft:gold_ingot'), item('minecraft:gold_block'), item('minecraft:gold_nugget'), item('minecraft:diamond'), item('minecraft:diamond_block'), item('minecraft:obsidian'), item('minecraft:stone'), item('minecraft:stone:1'), item('minecraft:stone:2'), item('minecraft:stone:3'), item('minecraft:stone:4'), item('minecraft:stone:5'), item('minecraft:stone:6'))
.output(item('minecraft:cobblestone'))
.pressure(4)
.register()


// Refinery:
// Converts an input fluidstack into between 2 and 4 fluidstacks, consuming Temperature, with the number of fluidstacks
// output depending on the recipe and the number of Refineries vertically stacked.

// mods.pneumaticcraft.refinery.removeByInput(fluid('oil'))
mods.pneumaticcraft.refinery.removeByOutput(fluid('kerosene'))
// mods.pneumaticcraft.refinery.removeAll()

mods.pneumaticcraft.refinery.recipeBuilder()
.fluidInput(fluid('water') * 1000)
.fluidOutput(fluid('lava') * 750, fluid('lava') * 250, fluid('lava') * 100, fluid('lava') * 50)
.register()

mods.pneumaticcraft.refinery.recipeBuilder()
.fluidInput(fluid('lava') * 100)
.fluidOutput(fluid('water') * 50, fluid('kerosene') * 25)
.register()


// Thermopneumatic Processing Plant:
// Converts an input fluidstack into an output fluidstack, consuming Pressure and Temperature, with an optional itemstack
// being consumed.

mods.pneumaticcraft.thermopneumatic_processing_plant.removeByInput(fluid('diesel'))
mods.pneumaticcraft.thermopneumatic_processing_plant.removeByInput(item('minecraft:coal'))
mods.pneumaticcraft.thermopneumatic_processing_plant.removeByOutput(fluid('lpg'))
// mods.pneumaticcraft.thermopneumatic_processing_plant.removeAll()

mods.pneumaticcraft.thermopneumatic_processing_plant.recipeBuilder()
.input(item('minecraft:clay') * 3)
.fluidInput(fluid('water') * 100)
.fluidOutput(fluid('kerosene') * 100)
.pressure(4)
.requiredTemperature(323)
.register()

mods.pneumaticcraft.thermopneumatic_processing_plant.recipeBuilder()
.fluidInput(fluid('water') * 100)
.fluidOutput(fluid('lava') * 100)
.pressure(4)
.requiredTemperature(323)
.register()


// XP Fluid:
// Controls what fluids are considered XP Fluids and how much experience they provide.

// mods.pneumaticcraft.xp_fluid.remove(fluid('xpjuice'))
// mods.pneumaticcraft.xp_fluid.removeAll()

mods.pneumaticcraft.xp_fluid.recipeBuilder()
.fluidInput(fluid('lava'))
.ratio(5)
.register()



2 changes: 2 additions & 0 deletions examples/postInit/vanilla.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import net.minecraftforge.event.entity.living.EnderTeleportEvent
import net.minecraftforge.event.world.BlockEvent
import net.minecraft.util.text.TextComponentString

/*
def ore_iron = ore('ingotIron')
def item_iron = item('minecraft:iron_ingot')
log.info(item_iron in ore_iron) // true
Expand All @@ -14,6 +15,7 @@ log.info(item_iron << ore_iron) // true
log.info((item_iron * 3) << ore_iron) // false
log.info(ore_iron >> item_iron) // true
log.info(ore_iron >> (item_iron * 3)) // false
*/

/*file('config/').eachFile { file ->
println file.path
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ debug_lazy_ae2 = false
debug_mekanism = false
debug_natures_aura = false
debug_packmode = false
debug_pneumaticcraft = false
debug_prodigytech = false
debug_projecte = false
debug_pyrotech = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.cleanroommc.groovyscript.compat.mods.lazyae2.LazyAE2;
import com.cleanroommc.groovyscript.compat.mods.mekanism.Mekanism;
import com.cleanroommc.groovyscript.compat.mods.naturesaura.NaturesAura;
import com.cleanroommc.groovyscript.compat.mods.pneumaticcraft.PneumaticCraft;
import com.cleanroommc.groovyscript.compat.mods.prodigytech.ProdigyTech;
import com.cleanroommc.groovyscript.compat.mods.projecte.ProjectE;
import com.cleanroommc.groovyscript.compat.mods.pyrotech.PyroTech;
Expand Down Expand Up @@ -95,6 +96,7 @@ public class ModSupport {
public static final GroovyContainer<Mekanism> MEKANISM = new InternalModContainer<>("mekanism", "Mekanism", Mekanism::new);
public static final GroovyContainer<LazyAE2> LAZYAE2 = new InternalModContainer<>("threng", "LazyAE2", LazyAE2::new, "lazyae2");
public static final GroovyContainer<NaturesAura> NATURES_AURA = new InternalModContainer<>("naturesaura", "Nature's Aura", NaturesAura::new);
public static final GroovyContainer<PneumaticCraft> PNEUMATIC_CRAFT = new InternalModContainer<>("pneumaticcraft", "PneumaticCraft: Repressurized", PneumaticCraft::new);
public static final GroovyContainer<ProdigyTech> PRODIGY_TECH = new InternalModContainer<>("prodigytech", "Prodigy Tech", ProdigyTech::new);
public static final GroovyContainer<ProjectE> PROJECT_E = new InternalModContainer<>("projecte", "ProjectE", ProjectE::new);
public static final GroovyContainer<PyroTech> PYROTECH = new InternalModContainer<>("pyrotech", "Pyrotech", PyroTech::new);
Expand Down
Loading

0 comments on commit 9fb2042

Please sign in to comment.