-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
1,642 additions
and
42 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
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
14 changes: 14 additions & 0 deletions
14
common/src/main/java/de/cech12/bucketlib/platform/services/IBucketHelper.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,14 @@ | ||
package de.cech12.bucketlib.platform.services; | ||
|
||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.item.BucketItem; | ||
import net.minecraft.world.item.MobBucketItem; | ||
import net.minecraft.world.level.material.Fluid; | ||
|
||
public interface IBucketHelper { | ||
|
||
Fluid getFluidOfBucketItem(BucketItem bucket); | ||
|
||
EntityType<?> getEntityTypeOfMobBucketItem(MobBucketItem mobBucketItem); | ||
|
||
} |
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
34 changes: 34 additions & 0 deletions
34
forge/src/main/java/de/cech12/bucketlib/platform/ForgeBucketHelper.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,34 @@ | ||
package de.cech12.bucketlib.platform; | ||
|
||
import de.cech12.bucketlib.CommonLoader; | ||
import de.cech12.bucketlib.platform.services.IBucketHelper; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.item.BucketItem; | ||
import net.minecraft.world.item.MobBucketItem; | ||
import net.minecraft.world.level.material.Fluid; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.lang.reflect.Method; | ||
|
||
/** | ||
* The bucket helper implementation for Forge. | ||
*/ | ||
public class ForgeBucketHelper implements IBucketHelper { | ||
|
||
@Override | ||
public Fluid getFluidOfBucketItem(BucketItem bucket) { | ||
return bucket.getFluid(); | ||
} | ||
|
||
@Override | ||
public EntityType<?> getEntityTypeOfMobBucketItem(MobBucketItem mobBucketItem) { | ||
try { | ||
Method entityTypeMethod = MobBucketItem.class.getDeclaredMethod("getFishType"); | ||
entityTypeMethod.setAccessible(true); | ||
return (EntityType<?>) entityTypeMethod.invoke(mobBucketItem); | ||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { | ||
CommonLoader.LOG.error("Could not get entity type of MobBucketItem.", ex); | ||
} | ||
return null; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
.../src/main/resources/META-INF/services/de.cech12.bucketlib.platform.services.IBucketHelper
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 @@ | ||
de.cech12.bucketlib.platform.ForgeBucketHelper |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...cech12/bucketlib/BucketLibTestHelper.java → ...cech12/bucketlib/BucketLibTestHelper.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
3 changes: 1 addition & 2 deletions
3
...va/cech12/bucketlib/BucketLibTestMod.java → ...de/cech12/bucketlib/BucketLibTestMod.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
2 changes: 1 addition & 1 deletion
2
.../java/cech12/bucketlib/CauldronTests.java → ...va/de/cech12/bucketlib/CauldronTests.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
2 changes: 1 addition & 1 deletion
2
...st/java/cech12/bucketlib/EntityTests.java → ...java/de/cech12/bucketlib/EntityTests.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
2 changes: 1 addition & 1 deletion
2
...a/cech12/bucketlib/FluidHandlerTests.java → ...e/cech12/bucketlib/FluidHandlerTests.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
2 changes: 1 addition & 1 deletion
2
...12/bucketlib/PlayerInteractionResult.java → ...12/bucketlib/PlayerInteractionResult.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
2 changes: 1 addition & 1 deletion
2
...va/cech12/bucketlib/WaterloggedTests.java → ...de/cech12/bucketlib/WaterloggedTests.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
2 changes: 1 addition & 1 deletion
2
...ch12/bucketlib/WorldInteractionTests.java → ...ch12/bucketlib/WorldInteractionTests.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
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,76 @@ | ||
plugins { | ||
id 'idea' | ||
id 'maven-publish' | ||
id 'net.neoforged.gradle.userdev' version '7.0.41' | ||
id 'java-library' | ||
} | ||
base { | ||
archivesName = "${mod_id}-neoforge-${minecraft_version}" | ||
} | ||
|
||
// Automatically enable neoforge AccessTransformers if the file exists | ||
// This location is hardcoded in FML and can not be changed. | ||
// https://github.com/neoforged/FancyModLoader/blob/a952595eaaddd571fbc53f43847680b00894e0c1/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java#L118 | ||
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { | ||
minecraft.accessTransformers.file file('src/main/resources/META-INF/accesstransformer.cfg') | ||
} | ||
runs { | ||
configureEach { | ||
modSource project.sourceSets.main | ||
modSource project.sourceSets.test | ||
} | ||
client { | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
server { | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
programArgument '--nogui' | ||
} | ||
gameTestServer { | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
data { | ||
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() | ||
} | ||
} | ||
|
||
sourceSets.main.resources { srcDir 'src/generated/resources' } | ||
|
||
dependencies { | ||
implementation "net.neoforged:neoforge:${neoforge_version}" | ||
compileOnly project(":common") | ||
testCompileOnly project(":common") | ||
} | ||
|
||
// NeoGradle compiles the game, but we don't want to add our common code to the game's code | ||
Spec<Task> notNeoTask = { Task it -> !it.name.startsWith("neo") } as Spec<Task> | ||
|
||
tasks.withType(JavaCompile).matching(notNeoTask).configureEach { | ||
source(project(":common").sourceSets.main.allSource) | ||
} | ||
|
||
tasks.withType(Javadoc).matching(notNeoTask).configureEach { | ||
source(project(":common").sourceSets.main.allJava) | ||
} | ||
|
||
tasks.named("sourcesJar", Jar) { | ||
from(project(":common").sourceSets.main.allSource) | ||
} | ||
|
||
tasks.withType(ProcessResources).matching(notNeoTask).configureEach { | ||
from project(":common").sourceSets.main.resources | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifactId base.archivesName.get() | ||
from components.java | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url "file://" + System.getenv("local_maven") | ||
} | ||
} | ||
} |
Oops, something went wrong.