Skip to content

Commit 73e3f77

Browse files
authored
Merge pull request #10 from LolHens/forge-1.15.2
Forge 1.15.2
2 parents 722fafc + a30526e commit 73e3f77

31 files changed

+1205
-0
lines changed

forge-1.15.2/build.gradle

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
buildscript {
2+
repositories {
3+
maven { url = 'https://files.minecraftforge.net/maven' }
4+
maven { url = 'https://dist.creeper.host/Sponge/maven' }
5+
jcenter()
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
10+
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
11+
classpath 'de.lolhens:java-mixin-stubber:0.0.2'
12+
}
13+
}
14+
apply plugin: 'net.minecraftforge.gradle'
15+
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
16+
apply plugin: 'org.spongepowered.mixin'
17+
apply plugin: 'scala'
18+
apply plugin: 'eclipse'
19+
apply plugin: 'maven-publish'
20+
21+
archivesBaseName = parent.project.archives_base_name
22+
version = parent.version + "+forge-1.15.2"
23+
group = parent.group
24+
mod_id = parent.project.mod_id
25+
mod_author = parent.project.mod_author
26+
27+
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
28+
29+
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
30+
minecraft {
31+
// The mappings can be changed at any time, and must be in the following format.
32+
// snapshot_YYYYMMDD Snapshot are built nightly.
33+
// stable_# Stables are built at the discretion of the MCP team.
34+
// Use non-default mappings at your own risk. they may not always work.
35+
// Simply re-run your setup task after changing the mappings to update your workspace.
36+
mappings channel: 'snapshot', version: '20200514-1.15.1'
37+
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
38+
39+
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
40+
41+
// Default run configurations.
42+
// These can be tweaked, removed, or duplicated as needed.
43+
runs {
44+
client {
45+
workingDirectory project.file('run')
46+
47+
arg '-mixin.config=' + mod_id + '.mixins.json'
48+
49+
// Recommended logging data for a userdev environment
50+
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
51+
52+
// Recommended logging level for the console
53+
property 'forge.logging.console.level', 'debug'
54+
55+
mods {
56+
fluidphysics {
57+
source sourceSets.main
58+
}
59+
}
60+
}
61+
62+
server {
63+
workingDirectory project.file('run')
64+
65+
arg '-mixin.config=' + mod_id + '.mixins.json'
66+
67+
// Recommended logging data for a userdev environment
68+
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
69+
70+
// Recommended logging level for the console
71+
property 'forge.logging.console.level', 'debug'
72+
73+
mods {
74+
fluidphysics {
75+
source sourceSets.main
76+
}
77+
}
78+
}
79+
80+
data {
81+
workingDirectory project.file('run')
82+
83+
// Recommended logging data for a userdev environment
84+
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
85+
86+
// Recommended logging level for the console
87+
property 'forge.logging.console.level', 'debug'
88+
89+
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/')
90+
91+
mods {
92+
fluidphysics {
93+
source sourceSets.main
94+
}
95+
}
96+
}
97+
}
98+
}
99+
100+
configurations {
101+
shadow
102+
compile.extendsFrom(shadow)
103+
}
104+
105+
repositories {
106+
maven { url = 'https://minecraft.curseforge.com/api/maven/' }
107+
}
108+
109+
dependencies {
110+
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
111+
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
112+
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
113+
minecraft 'net.minecraftforge:forge:1.15.2-31.2.43'
114+
115+
annotationProcessor 'org.spongepowered:mixin:0.8:processor'
116+
117+
implementation 'org.spongepowered:mixin:0.8'
118+
implementation "scalable-cats-force:ScalableCatsForce-2.13.2-build:2:dev"
119+
implementation "org.scala-lang:scala-library:2.13.3"
120+
implementation group: 'org.typelevel', name: "cats-core_2.13", version: '2.1.0'
121+
122+
shadow "io.circe:circe-parser_2.13:0.13.0"
123+
shadow "io.circe:circe-generic_2.13:0.13.0"
124+
shadow "io.circe:circe-generic-extras_2.13:0.13.0"
125+
shadow "io.circe:circe-config_2.13:0.7.0"
126+
}
127+
128+
def mixinstubsDir = file("$compileJava.temporaryDir/mixinstubs")
129+
130+
sourceSets.main.java.srcDirs += mixinstubsDir
131+
132+
def mixinstubs = task('mixinstubs') {
133+
doLast {
134+
delete(mixinstubsDir)
135+
de.lolhens.jstubber.Stubber.MIXIN.stubDirectory(sourceSets.main.scala.srcDirs[0].toPath(), mixinstubsDir.toPath())
136+
}
137+
}
138+
139+
compileJava.dependsOn(mixinstubs)
140+
141+
compileJava.doLast {
142+
delete(compileJava.destinationDir)
143+
delete(mixinstubsDir)
144+
}
145+
146+
compileScala.doFirst {
147+
compileScala.options.compilerArgs += compileJava.options.compilerArgs
148+
}
149+
150+
mixin {
151+
add sourceSets.main, "${mod_id}.refmap.json"
152+
}
153+
154+
// Example for how to get properties into the manifest for reading by the runtime..
155+
jar {
156+
manifest {
157+
attributes([
158+
"Specification-Title" : project.name,
159+
"Specification-Vendor" : mod_author,
160+
"Specification-Version" : "1", // We are version 1 of ourselves
161+
"Implementation-Title" : project.name,
162+
"Implementation-Version" : version,
163+
"Implementation-Vendor" : mod_author,
164+
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
165+
"MixinConfigs" : "${mod_id}.mixins.json"
166+
])
167+
}
168+
from {
169+
configurations.shadow.collect { file ->
170+
[
171+
"scala-library",
172+
"cats-core",
173+
"cats-macros",
174+
"cats-kernel",
175+
].any { file.toString().contains(it) } ? null : file.isDirectory() ? file : zipTree(file)
176+
}
177+
}
178+
}
179+
180+
// Example configuration to allow publishing using the maven-publish task
181+
// This is the preferred method to reobfuscate your jar file
182+
jar.finalizedBy('reobfJar')
183+
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
184+
//publish.dependsOn('reobfJar')
185+
186+
publishing {
187+
publications {
188+
mavenJava(MavenPublication) {
189+
artifact jar
190+
}
191+
}
192+
repositories {
193+
maven {
194+
url "file:///${project.projectDir}/mcmodsrepo"
195+
}
196+
}
197+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MixinConfigs: fluidphysics.mixins.json
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This is an example mods.toml file. It contains the data relating to the loading mods.
2+
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
3+
# The overall format is standard TOML format, v0.5.0.
4+
# Note that there are a couple of TOML lists in this file.
5+
# Find more information on toml format here: https://github.com/toml-lang/toml
6+
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
7+
modLoader = "kotori_scala" #mandatory
8+
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
9+
loaderVersion = "[2.13.2-build-2,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
10+
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
11+
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
12+
license = "Apache-2.0"
13+
# A URL to refer people to when problems occur with this mod
14+
issueTrackerURL = "https://github.com/LolHens/mc-fluid-physics/issues" #optional
15+
# A list of mods - how many allowed here is determined by the individual mod loader
16+
[[mods]] #mandatory
17+
# The modid of the mod
18+
modId = "fluidphysics" #mandatory
19+
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
20+
version = "${file.jarVersion}" #mandatory
21+
# A display name for the mod
22+
displayName = "Fluid Physics" #mandatory
23+
# A URL to query for updates for this mod. See the JSON update specification <here>
24+
#updateJSONURL="http://myurl.me/" #optional
25+
# A URL for the "homepage" for this mod, displayed in the mod UI
26+
displayURL = "https://github.com/LolHens/mc-fluid-physics" #optional
27+
# A file name (in the root of the mod JAR) containing a logo for display
28+
logoFile = "icon.png" #optional
29+
# A text field displayed in the mod UI
30+
#credits="Thanks for this example mod goes to Java" #optional
31+
# A text field displayed in the mod UI
32+
authors = "LolHens" #optional
33+
# The description text for the mod (multi line!) (#mandatory)
34+
description = '''
35+
This mod blends together vanilla fluid mechanics with something a little more realistic plus some small additions.
36+
'''
37+
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
38+
[[dependencies.fluidphysics]] #optional
39+
# the modid of the dependency
40+
modId = "forge" #mandatory
41+
# Does this dependency have to exist - if not, ordering below must be specified
42+
mandatory = true #mandatory
43+
# The version range of the dependency
44+
versionRange = "[31,)" #mandatory
45+
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
46+
ordering = "NONE"
47+
# Side this dependency is applied on - BOTH, CLIENT or SERVER
48+
side = "BOTH"
49+
[[dependencies.fluidphysics]]
50+
modId = "minecraft"
51+
mandatory = true
52+
versionRange = "[1.15.2,)"
53+
ordering = "NONE"
54+
side = "BOTH"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"variants": {
3+
"": {
4+
"model": "fluidphysics:block/spring"
5+
}
6+
}
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"block.fluidphysics.spring": "Quelle",
3+
"item.fluidphysics.spring": "Quelle"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"block.fluidphysics.spring": "Spring",
3+
"item.fluidphysics.spring": "Spring"
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"parent": "block/cube_all",
3+
"textures": {
4+
"all": "fluidphysics:block/spring"
5+
}
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"parent": "fluidphysics:block/spring"
3+
}
Binary file not shown.
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"required": true,
3+
"minVersion": "0.8",
4+
"package": "de.lolhens.minecraft.fluidphysics.mixin",
5+
"compatibilityLevel": "JAVA_8",
6+
"mixins": [
7+
"AbstractBlockStateMixin",
8+
"FlowableFluidAccessor",
9+
"FlowableFluidMixin",
10+
"PistonBlockMixin",
11+
"SpringFeatureMixin",
12+
"ThreadedAnvilChunkStorageAccessor",
13+
"WaterFluidMixin"
14+
],
15+
"client": [
16+
"BiomeColorsMixin"
17+
],
18+
"injectors": {
19+
"defaultRequire": 1
20+
},
21+
"refmap": "fluidphysics.refmap.json"
22+
}
8.35 KB
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"pack": {
3+
"description": "fluidphysics resources",
4+
"pack_format": 5,
5+
"_comment": "A pack_format of 5 requires json lang files and some texture changes from 1.15. Note: we require v5 pack meta for all mods."
6+
}
7+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package de.lolhens.minecraft.fluidphysics
2+
3+
import de.lolhens.minecraft.fluidphysics.block.SpringBlock
4+
import de.lolhens.minecraft.fluidphysics.config.FluidPhysicsConfig
5+
import net.minecraft.block.Block
6+
import net.minecraft.block.material.Material
7+
import net.minecraft.item.{BlockItem, Item, ItemGroup}
8+
import net.minecraft.util.ResourceLocation
9+
import net.minecraftforge.event.RegistryEvent
10+
import net.minecraftforge.fml.common.Mod
11+
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent
12+
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
13+
import net.minecraftforge.fml.{ModContainer, ModLoadingContext}
14+
import org.apache.logging.log4j.LogManager
15+
16+
@Mod("fluidphysics")
17+
object FluidPhysicsMod {
18+
val container: ModContainer = ModLoadingContext.get().getActiveContainer
19+
private val logger = LogManager.getLogger
20+
21+
lazy val config: FluidPhysicsConfig = FluidPhysicsConfig.loadOrCreate(container.getModId)
22+
23+
val SPRING_BLOCK_ID = new ResourceLocation(container.getModId, "spring")
24+
val SPRING_BLOCK: Block = new SpringBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 6.0F)).setRegistryName(SPRING_BLOCK_ID)
25+
26+
FMLJavaModLoadingContext.get.getModEventBus.addListener { _: FMLCommonSetupEvent =>
27+
config
28+
}
29+
30+
FMLJavaModLoadingContext.get.getModEventBus.addGenericListener(classOf[Block], { blockRegistryEvent: RegistryEvent.Register[Block] =>
31+
blockRegistryEvent.getRegistry.register(SPRING_BLOCK)
32+
})
33+
34+
FMLJavaModLoadingContext.get.getModEventBus.addGenericListener(classOf[Item], { itemRegistryEvent: RegistryEvent.Register[Item] =>
35+
itemRegistryEvent.getRegistry.register(new BlockItem(SPRING_BLOCK, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(SPRING_BLOCK_ID))
36+
})
37+
38+
//MinecraftForge.EVENT_BUS.register(this)
39+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package de.lolhens.minecraft.fluidphysics.block
2+
3+
import de.lolhens.minecraft.fluidphysics.FluidPhysicsMod
4+
import net.minecraft.block.Block
5+
6+
class SpringBlock(properties: Block.Properties) extends Block(properties) {
7+
FluidPhysicsMod.config.spring.filter(_.shouldUpdateBlocksInWorld).foreach { spring =>
8+
setDefaultState(spring.getBlock.getDefaultState)
9+
}
10+
}

0 commit comments

Comments
 (0)