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

fix fluid lighting #53

Merged
merged 4 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
73 changes: 53 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1692122114
//version: 1695474595
/*
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 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.0'
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.5')
}

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 @@ -1576,6 +1590,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
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ usesShadowedDependencies = false
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
disableSpotless =

disableCheckstyle = false

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 {
mavenLocal()

maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ public static void drawFluidTexture(FluidStack content, float x0, float y0, floa
((IPatchedTextureAtlasSprite) fluidStill).markNeedsAnimationUpdate();
}

GlStateManager.disableLighting();
GlStateManager.enableBlend();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* A fluid tank with long capacity and stored amount
*
*
* @author BlueWeabo
*/
public class FluidTankLong implements IFluidTankLong {
Expand Down Expand Up @@ -102,7 +102,7 @@ public long fill(Fluid fluid, long amount, boolean doFill) {
}

/**
*
*
* @param amount Amount of fluid to try and drain
* @param doDrain Should it update the stack internally
* @return a Fluid stack with the amount drained
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ default List<ItemStack> getStacks() {
/**
* Get the inventory this slot originates from. Only supposed to be an identifier. Avoid callings methods on this
* inventory directly beyond comparing its identity.
*
*
* @return the source inventory, or null if not from any {@link IInventory}, or the source inventory information has
* been lost.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public boolean isItemValid(int slot, ItemStack stack) {

/**
* Searches all item handlers and find one matching handler that contains specified slot index
*
*
* @param slot Index to search
* @return Pair of item handler and actual index for it
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gtnewhorizons.modularui.api.math;

import java.awt.*;
import java.awt.Rectangle;
import java.util.Objects;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gtnewhorizons.modularui.api.math;

import java.awt.*;
import java.awt.Point;
import java.util.Objects;

import com.google.gson.JsonElement;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/gtnewhorizons/modularui/api/math/Size.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gtnewhorizons.modularui.api.math;

import java.awt.*;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.Objects;

import com.google.gson.JsonElement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gtnewhorizons.modularui.api.screen;

import java.awt.*;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gtnewhorizons.modularui.api.screen;

import java.awt.*;
import java.awt.Rectangle;

import org.jetbrains.annotations.Nullable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.gtnewhorizons.modularui.api.screen;

import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public Builder setSize(int width, int height) {
/**
* Set position of this Window displayed. {@link Alignment#getAlignedPos(Size, Size)} is useful for specifying
* rough location. Center is selected as default.
*
*
* @param pos BiFunction providing {@link Pos2d} out of sizes of game screen and this window
*/
public Builder setPos(PosProvider pos) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.gtnewhorizons.modularui.api.screen;

import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Supplier;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gtnewhorizons.modularui.api.widget;

import java.awt.*;
import java.awt.Rectangle;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gtnewhorizons.modularui.api.widget;

import java.awt.*;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

import net.minecraft.util.ResourceLocation;

import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.gtnewhorizons.modularui.ModularUI;
import com.gtnewhorizons.modularui.api.forge.CraftingHelper;
import com.gtnewhorizons.modularui.config.Config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static codechicken.lib.render.FontUtils.fontRenderer;

import java.awt.*;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.gtnewhorizons.modularui.common.internal.wrapper;

import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.gtnewhorizons.modularui.common.internal.wrapper;

import java.util.*;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;

public class MultiList<T> extends AbstractList<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import net.minecraft.network.PacketBuffer;
Expand Down Expand Up @@ -230,7 +232,7 @@ public CycleButtonWidget setToggle(Supplier<Boolean> getter, Consumer<Boolean> s

/**
* Sets texture that will be changed depending on the value stored and drawn on top of background.
*
*
* @param textureGetter state of button -> texture
*/
public CycleButtonWidget setTextureGetter(Function<Integer, IDrawable> textureGetter) {
Expand Down Expand Up @@ -258,7 +260,7 @@ public CycleButtonWidget setStaticTexture(IDrawable texture) {

/**
* Sets background that will be changed depending on the value stored.
*
*
* @param backgroundGetter state of button -> background
*/
public CycleButtonWidget setVariableBackgroundGetter(Function<Integer, IDrawable[]> backgroundGetter) {
Expand Down Expand Up @@ -295,7 +297,7 @@ public CycleButtonWidget addTooltip(int state, String tooltip) {

/**
* Adds tooltips with given function. Should be called after {@link #setLength}.
*
*
* @param tooltipFunc state -> tooltip
*/
public CycleButtonWidget addTooltip(Function<Integer, String> tooltipFunc) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package com.gtnewhorizons.modularui.common.widget;

import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gtnewhorizons.modularui.common.widget.textfield;

import java.awt.*;
import java.awt.Point;
import java.awt.Rectangle;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gtnewhorizons.modularui.common.widget.textfield;

import java.awt.*;
import java.awt.Point;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down
Loading