Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emissive microblocks #34

Merged
merged 4 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 55 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1692122114
//version: 1699290261
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -89,6 +89,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output')
def projectJavaVersion = JavaLanguageVersion.of(8)

boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false

final String CHECKSTYLE_CONFIG = """
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- Use CHECKSTYLE:OFF and CHECKSTYLE:ON comments to suppress checkstyle lints in a block -->
<module name="SuppressionCommentFilter"/>
<module name="AvoidStarImport">
<!-- Allow static wildcard imports for cases like Opcodes and LWJGL classes, these don't get created accidentally by the IDE -->
<property name="allowStaticMemberImports" value="true"/>
</module>
</module>
</module>
"""

checkPropertyExists("modName")
checkPropertyExists("modId")
Expand Down Expand Up @@ -140,6 +157,17 @@ if (!disableSpotless) {
apply from: Blowdryer.file('spotless.gradle')
}

if (!disableCheckstyle) {
apply plugin: 'checkstyle'
tasks.named("checkstylePatchedMc") { enabled = false }
tasks.named("checkstyleMcLauncher") { enabled = false }
tasks.named("checkstyleIdeVirtualMain") { enabled = false }
tasks.named("checkstyleInjectedTags") { enabled = false }
checkstyle {
config = resources.text.fromString(CHECKSTYLE_CONFIG)
}
}

String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
Expand Down Expand Up @@ -600,15 +628,10 @@ repositories {
}
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
content {
includeGroup "net.industrial-craft"
}
}
maven {
name = "ic2-mirror"
url = "https://maven2.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
Expand All @@ -623,7 +646,7 @@ repositories {

def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.7.1"
def mixinProviderVersion = "0.1.13"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
Expand Down Expand Up @@ -770,23 +793,14 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}

dependencies {
def lwjgl3ifyVersion = '1.4.0'
def asmVersion = '9.4'
def lwjgl3ifyVersion = '1.5.1'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.26')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
}

java17PatchDependencies('net.minecraft:launchwrapper:1.17.2') {transitive = false}
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
}

Expand Down Expand Up @@ -1173,9 +1187,8 @@ publishing {
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}

repositories {
if (usesMavenPublishing.toBoolean()) {
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
Expand Down Expand Up @@ -1576,6 +1589,25 @@ def getSecondaryArtifacts() {
return secondaryArtifacts
}

def getURL(String main, String fallback) {
return pingURL(main, 10000) ? main : fallback
}

// credit: https://stackoverflow.com/a/3584332
def pingURL(String url, int timeout) {
url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates.
try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection()
connection.setConnectTimeout(timeout)
connection.setReadTimeout(timeout)
connection.setRequestMethod("HEAD")
int responseCode = connection.getResponseCode()
return 200 <= responseCode && responseCode <= 399
} catch (IOException ignored) {
return false
}
}

// For easier scripting of things that require variables defined earlier in the buildscript
if (file('addon.late.gradle.kts').exists()) {
apply from: 'addon.late.gradle.kts'
Expand Down
4 changes: 1 addition & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies {
implementation("com.github.GTNewHorizons:CodeChickenCore:1.1.11:dev")
implementation("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.82-GTNH:dev")
implementation("com.github.GTNewHorizons:ForgeMultipart:1.3.4:dev")
compileOnly("org.projectlombok:lombok:1.18.24")
annotationProcessor("org.projectlombok:lombok:1.18.24")

Expand All @@ -12,9 +13,6 @@ dependencies {
compileOnly("com.github.GTNewHorizons:waila:1.6.0:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.4:dev") {
transitive = false
}

compileOnly("curse.maven:ee3-65509:2305023") { // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
transitive = false
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
10 changes: 0 additions & 10 deletions repositories.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
// Add any additional repositories for your dependencies here

repositories {
maven {
name = "GTNH"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface IAdvancedChisel {

/**
* Gets the next mode the button in the GUI should switch to given the current mode.
*
*
* @param stack The {@link ItemStack} representing the chisel
* @param current The {@link IChiselMode} that is currently active
* @return The next {@link IChiselMode} in the loop
Expand All @@ -20,7 +20,7 @@ public interface IAdvancedChisel {

/**
* Gets an {@link IChiselMode} instance from a String name
*
*
* @param chisel The {@link ItemStack} representing the chisel
* @param name The name of the {@link IChiselMode mode}
* @return An {@link IChiselMode} that has the name {@code name}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cricketcraft/chisel/api/ICarvable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface ICarvable extends ICTMBlock<IVariationInfo> {
* <p>
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for
* more complex metadata handling.
*
*
* @param metadata The metadata of the block
* @param world {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to
* this method's use in rendering.
Expand All @@ -34,7 +34,7 @@ public interface ICarvable extends ICTMBlock<IVariationInfo> {

/**
* Gets the {@link ISubmapManager} for this block when it is in item form.
*
*
* @return A {@link ISubmapManager}
*/
@Override
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/cricketcraft/chisel/api/IChiselItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface IChiselItem {

/**
* Checks whether the chisel can have its GUI opened
*
*
* @param world {@link World} object
* @param player The player holding the chisel. It can always be assumed that the player's current item will be
* this.
Expand All @@ -25,7 +25,7 @@ public interface IChiselItem {

/**
* Called when an item is chiseled using this chisel
*
*
* @param world {@link World} object
* @param chisel The {@link ItemStack} representing the chisel
* @param target The {@link ICarvingVariation} representing the target item
Expand All @@ -39,7 +39,7 @@ public interface IChiselItem {
* <p>
* It is not necessary to take into account whether this item <i>has</i> any variants, this method will only be
* called after that check.
*
*
* @param world {@link World} object
* @param chisel The {@link ItemStack} representing the chisel
* @param target The {@link ICarvingVariation} representing the target item
Expand All @@ -49,7 +49,7 @@ public interface IChiselItem {

/**
* Allows you to control if your item can chisel this block in the world.
*
*
* @param world World object
* @param player {@link EntityPlayer The player} holding the chisel.
* @param x X coord of the block being chiseled
Expand All @@ -63,7 +63,7 @@ public interface IChiselItem {

/**
* Allows you to control if your item has chiseling modes.
*
*
* @param chisel The {@link ItemStack} representing the chisel.
* @return True if the chisel supports modes. False otherwise.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
import com.cricketcraft.chisel.api.FMPIMC;
import com.cricketcraft.chisel.api.rendering.TextureType;

import codechicken.microblock.MicroMaterialRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import team.chisel.block.BlockCarvableGlowie;
import team.chisel.client.render.FullBrightMicroMaterial;
import team.chisel.ctmlib.ISubmapManager;

public class CarvableHelper {
Expand Down Expand Up @@ -187,11 +190,21 @@ public void registerVariation(String name, IVariationInfo info) {
Block block = info.getVariation()
.getBlock();

if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
FMPIMC.registerFMP(
block,
info.getVariation()
.getBlockMeta());
if (block instanceof BlockCarvableGlowie) {
int meta = info.getVariation()
.getBlockMeta();

MicroMaterialRegistry.registerMaterial(
new FullBrightMicroMaterial(block, meta),
block.getUnlocalizedName() + ((meta > 0) ? ("_" + meta) : ""));

} else {
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
FMPIMC.registerFMP(
block,
info.getVariation()
.getBlockMeta());
}
}

if (forbidChiseling) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CarvingUtils {
/**
* A simple way to compare two {@link ICarvingVariation} objects based on the {@link ICarvingVariation#getOrder()
* getOrder()} method.
*
*
* @param v1 The first {@link ICarvingVariation variation}.
* @param v2 The second {@link ICarvingVariation variation}.
* @return A positive integer if the first's order is greater, a negative integer if the second's is greater, and 0
Expand All @@ -26,7 +26,7 @@ public static int compare(ICarvingVariation v1, ICarvingVariation v2) {

/**
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
*
*
* @param variation An {@link ICarvingVariation}
* @return An {@link ItemStack}
*/
Expand All @@ -48,7 +48,7 @@ public static ICarvingRegistry getChiselRegistry() {
/**
* Creates a standard {@link ICarvingVariation} for the given data. Use this if you do not need any custom behavior
* in your own variation.
*
*
* @param block The block of the variation
* @param metadata The metadata of both the block and item
* @param order The sorting order.
Expand All @@ -61,7 +61,7 @@ public static ICarvingVariation getDefaultVariationFor(Block block, int metadata
/**
* Creates a standard {@link ICarvingGroup} for the given name. Use this if you do not need any custom behavior in
* your own group.
*
*
* @param name The name of the group.
* @return A standard {@link ICarvingGroup} instance.
*/
Expand Down
Loading