Random stuff

- Multiply by 31 in some hash functions
 - Remove unused render utility classes
This commit is contained in:
JozsefA 2021-04-29 11:44:45 -07:00
parent e33ab160ac
commit 446b24f1cf
4 changed files with 6 additions and 49 deletions

View file

@ -52,7 +52,7 @@ public class RedstoneLinkNetworkHandler {
@Override
public int hashCode() {
return item.hashCode() ^ color;
return (item.hashCode() * 31) ^ color;
}
@Override

View file

@ -1,24 +0,0 @@
package com.simibubi.create.foundation;
import java.util.Optional;
import java.util.function.Supplier;
public class OptionalUtil {
public static <T> Optional<T> thenTry(Optional<T> first, Optional<T> thenTry) {
if (first.isPresent()) {
return first;
} else {
return thenTry;
}
}
public static <T> Optional<T> thenTryLazy(Supplier<Optional<T>> first, Supplier<Optional<T>> thenTry) {
Optional<T> one = first.get();
if (one.isPresent()) {
return one;
} else {
return thenTry.get();
}
}
}

View file

@ -1,23 +0,0 @@
package com.simibubi.create.foundation.render.backend;
public class ShaderLoadingException extends RuntimeException {
public ShaderLoadingException() {
}
public ShaderLoadingException(String message) {
super(message);
}
public ShaderLoadingException(String message, Throwable cause) {
super(message, cause);
}
public ShaderLoadingException(Throwable cause) {
super(cause);
}
public ShaderLoadingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View file

@ -49,7 +49,11 @@ public class Pair<F, S> {
@Override
public int hashCode() {
return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
return (nullHash(first) * 31) ^ nullHash(second);
}
int nullHash(Object o) {
return o == null ? 0 : o.hashCode();
}
@Override