Compare commits

...

5 commits

Author SHA1 Message Date
Ell 6050e5ad94 add transitive jgrapht dependencies 2023-07-08 14:24:54 +02:00
Ell ea7c6d7c7f attempts to get jarJar working 2023-07-08 11:33:12 +02:00
Ell 0e7c9cb3f7 added build number to version 2023-07-08 11:02:20 +02:00
Ell edb7e9b8b7 i still haven't learned groovy 2023-07-08 10:58:43 +02:00
Ell 6cb3e6e57e resolved some TODOs 2023-07-08 10:38:52 +02:00
5 changed files with 26 additions and 23 deletions

View file

@ -5,7 +5,14 @@ plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
// Enable the Jar-in-Jar system for your mod
jarJar.enable()
version = mod_version
if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}
group = mod_group_id
base {
@ -105,23 +112,12 @@ minecraft {
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
all {
lazyToken('minecraft_classpath') {
configurations.embed.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
configurations {
embed
implementation.extendsFrom(embed)
}
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
@ -150,7 +146,12 @@ dependencies {
// 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}"
embed "org.jgrapht:jgrapht-core:${jgt_version}"
minecraftLibrary "org.jgrapht:jgrapht-core:${jgt_version}"
jarJar(group: "org.jgrapht", name: "jgrapht-core", version: "[${jgt_version}]")
// for some reason jgrapht dependencies aren't auto-included in the metadata and i can't figure out how to make that happen
jarJar(group: "org.jheaps", name: "jheaps", version: "[${jheaps_version}]")
jarJar(group: "org.apfloat", name: "apfloat", version: "[${apfloat_version}]")
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
@ -177,7 +178,7 @@ tasks.named('processResources', ProcessResources).configure {
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version : forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: version,
mod_authors : mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
@ -200,14 +201,14 @@ tasks.named('jar', Jar).configure {
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
// TODO figure out if leaving this out causes jgrapht to be left out of the jar
// from configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }
// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}
tasks.named('jarJar', Jar).configure {
finalizedBy 'reobfJarJar'
}
// 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:
// tasks.named('publish').configure {
// dependsOn 'reobfJar'
@ -217,6 +218,8 @@ tasks.named('jar', Jar).configure {
publishing {
publications {
register('mavenJava', MavenPublication) {
groupId mod_group_id
artifactId mod_name
artifact jar
pom.withXml {
def node = asNode()

View file

@ -38,6 +38,8 @@ mapping_channel=official
mapping_version=1.20.1
jei_version=15.2.0.22
jgt_version=1.5.2
jheaps_version=0.14
apfloat_version=1.10.1
## Mod Properties

View file

@ -10,7 +10,6 @@ import java.util.function.Supplier;
public class ItemEquality {
public static final ItemEquality DAMAGE = new ItemEquality((stack, filter) -> stack.getDamageValue() == filter.getDamageValue(), false, Type.DAMAGE);
// TODO see if this tagMatches replacement is good enough?
public static final ItemEquality NBT = new ItemEquality(ItemStack::areShareTagsEqual, false, Type.NBT);
public static final ItemEquality MOD = new ItemEquality((stack, filter) -> stack.getItem().getCreatorModId(stack).equals(filter.getItem().getCreatorModId(filter)), true, Type.MOD);

View file

@ -39,8 +39,6 @@ public class ItemTerminalWidget extends AbstractWidget {
@Override
protected void renderWidget(GuiGraphics graphics, int p_268034_, int p_268009_, float p_268085_) {
var mc = this.screen.getMinecraft();
var renderer = mc.getItemRenderer();
// TODO test this new blit offset replacement?
graphics.pose().translate(0, 0, 100);
if (this.selected)
graphics.fill(this.getX(), this.getY(), this.getX() + 16, this.getY() + 16, -2130706433);

View file

@ -28,6 +28,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
@ -224,9 +225,9 @@ public class PipeBlock extends BaseEntityBlock {
protected static boolean hasLegsTo(Level world, BlockState state, BlockPos pos, Direction direction) {
if (state.getBlock() instanceof WallBlock || state.getBlock() instanceof FenceBlock)
return direction == Direction.DOWN;
// TODO figure out new condition for legs now that materials are gone
/* if (state.getMaterial() == Material.STONE || state.getMaterial() == Material.METAL)
return Block.canSupportCenter(world, pos, direction.getOpposite());*/
var mapColor = state.getMapColor(world,pos);
if (mapColor == MapColor.STONE || mapColor == MapColor.METAL)
return Block.canSupportCenter(world, pos, direction.getOpposite());
return false;
}