Merge branch 'mc1.16' into insert_to_crafter

# Conflicts:
#	src/main/java/com/refinedmods/refinedstorage/apiimpl/autocrafting/task/v6/node/ProcessingNode.java
This commit is contained in:
Darkere
2021-06-13 15:35:59 +02:00
52 changed files with 349 additions and 277 deletions

View File

@@ -2,7 +2,23 @@
### 1.9.13
- Calculate vertex data step size in FullbrightBakedModel (ylou)
- Fixed count on Storage Monitor having Z fighting (tivec)
- Fixed items on Storage Monitor not being flat (raoulvdberge)
- Removed experimental pipeline nagging message (raoulvdberge)
- Fixed crash when using an External Storage on a fluid inventory (jeremiahwinsley)
- Added some performance improvements for autocrafting (necauqua, Darkere)
- Fixed a memory leak in the pattern cache (necauqua)
- Fixed Detector crashing when dyed (Darkere)
- Fixed autocrafting being stuck after clicking "Start" (necauqua)
- Fixed Crafting Monitor not being able to show hours (Darkere)
- Fixed capacity rendering of infinite storages (Darkere)
- Fixed wrong alignment for the JEI request autocrafting tooltip (Darkere)
- Fixed mobs getting stuck in Refined Storage cables (Darkere)
- Fixed dismantling storage blocks ignoring stack size (Darkere)
- Fixed Ice and Fire banners breaking with Refined Storage (Darkere, necauqua)
- Fixed empty keybinding causing GL errors (Darkere)
- Fixed some parts of the Japanese translation (akihironagai)
- Fixed rendering issue on blocks when using OptiFine (ylou)
### 1.9.12

5
Jenkinsfile vendored
View File

@@ -22,9 +22,4 @@ node {
stage('Publish artifacts') {
sh "./gradlew publish"
}
stage('SonarQube analysis') {
withCredentials([string(credentialsId: 'SONAR_TOKEN', variable: 'SONAR_TOKEN')]) {
sh "./gradlew sonarqube -Dsonar.login=$SONAR_TOKEN"
}
}
}

View File

@@ -1,16 +1,14 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
}
}
plugins {
id "org.sonarqube" version "3.0"
id 'info.solidsoft.pitest' version '1.5.1'
}
@@ -19,15 +17,10 @@ repositories {
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
url "https://minecraft.curseforge.com/api/maven/"
}
}
sonarqube {
properties {
property "sonar.projectKey", "refinedmods_refinedstorage"
property "sonar.organization", "refinedmods"
property "sonar.host.url", "https://sonarcloud.io"
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}
@@ -48,10 +41,10 @@ if (env.BUILD_NUMBER) {
group = 'com.refinedmods'
archivesBaseName = 'refinedstorage'
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
minecraft {
mappings channel: 'snapshot', version: '20200723-1.16.1'
mappings channel: 'snapshot', version: '20210309-1.16.5'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
@@ -116,14 +109,14 @@ processResources {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'
minecraft 'net.minecraftforge:forge:1.16.5-36.1.31'
compileOnly fg.deobf("mezz.jei:jei-1.16.3:7.3.2.36:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.3:7.3.2.36")
compileOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.0.106:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:7.7.0.106")
compileOnly 'mouse-tweaks:MouseTweaks:2.13:mc1.16.2'
compileOnly fg.deobf('curse.maven:mouse-tweaks-60089:3202662')
runtimeOnly fg.deobf('crafting-tweaks:CraftingTweaks_1.16.2:12.1.0')
compileOnly fg.deobf('curse.maven:crafting-tweaks-233071:3330406')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.6.2')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.6.2')

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip

53
gradlew vendored
View File

@@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

43
gradlew.bat vendored
View File

@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell

View File

@@ -12,6 +12,7 @@ import net.minecraft.nbt.ListNBT;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -30,6 +31,11 @@ public class NodeRequirements {
private final Map<Integer, IStackList<FluidStack>> fluidRequirements = new LinkedHashMap<>();
private final Map<Integer, Integer> fluidsNeededPerCraft = new LinkedHashMap<>();
@Nullable
private IStackList<ItemStack> cachedSimulatedItemRequirementSet = null;
@Nullable
private IStackList<FluidStack> cachedSimulatedFluidRequirementSet = null;
public void addItemRequirement(int ingredientNumber, ItemStack stack, int size, int perCraft) {
if (!itemsNeededPerCraft.containsKey(ingredientNumber)) {
itemsNeededPerCraft.put(ingredientNumber, perCraft);
@@ -37,6 +43,7 @@ public class NodeRequirements {
IStackList<ItemStack> list = itemRequirements.computeIfAbsent(ingredientNumber, key -> API.instance().createItemStackList());
list.add(stack, size);
cachedSimulatedItemRequirementSet = null;
}
public void addFluidRequirement(int ingredientNumber, FluidStack stack, int size, int perCraft) {
@@ -46,9 +53,15 @@ public class NodeRequirements {
IStackList<FluidStack> list = fluidRequirements.computeIfAbsent(ingredientNumber, key -> API.instance().createFluidStackList());
list.add(stack, size);
cachedSimulatedFluidRequirementSet = null;
}
public IStackList<ItemStack> getSingleItemRequirementSet(boolean simulate) {
IStackList<ItemStack> cached = cachedSimulatedItemRequirementSet;
if (simulate && cached != null) {
return cached;
}
IStackList<ItemStack> toReturn = API.instance().createItemStackList();
for (int i = 0; i < itemRequirements.size(); i++) {
@@ -83,10 +96,17 @@ public class NodeRequirements {
}
}
cachedSimulatedItemRequirementSet = simulate ? toReturn : null;
return toReturn;
}
public IStackList<FluidStack> getSingleFluidRequirementSet(boolean simulate) {
IStackList<FluidStack> cached = cachedSimulatedFluidRequirementSet;
if (simulate && cached != null) {
return cached;
}
IStackList<FluidStack> toReturn = API.instance().createFluidStackList();
for (int i = 0; i < fluidRequirements.size(); i++) {
@@ -121,6 +141,8 @@ public class NodeRequirements {
}
}
cachedSimulatedFluidRequirementSet = simulate ? toReturn : null;
return toReturn;
}

View File

@@ -132,9 +132,11 @@ public class ProcessingNode extends Node {
if (canInsertFullAmount) {
canInsertFullAmount = container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.SIMULATE);
}
} else {
break;
}
if (hasAllRequirements && !canInsertFullAmount) {
if (!canInsertFullAmount) {
if (allRejected) {
this.state = ProcessingState.MACHINE_DOES_NOT_ACCEPT;
}
@@ -144,21 +146,19 @@ public class ProcessingNode extends Node {
allRejected = false;
}
if (hasAllRequirements && canInsertFullAmount) {
this.state = ProcessingState.READY;
this.state = ProcessingState.READY;
extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(false), internalStorage, Action.PERFORM);
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(false), internalFluidStorage, Action.PERFORM);
extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(false), internalStorage, Action.PERFORM);
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(false), internalFluidStorage, Action.PERFORM);
container.insertItemsIntoInventory(extractedItems.getStacks(), Action.PERFORM);
container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.PERFORM);
container.insertItemsIntoInventory(extractedItems.getStacks(), Action.PERFORM);
container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.PERFORM);
next();
next();
listener.onSingleDone(this);
listener.onSingleDone(this);
container.onUsedForProcessing();
}
container.onUsedForProcessing();
}
}
}

View File

@@ -26,7 +26,7 @@ public class NetworkNodeGraphEntry implements INetworkNodeGraphEntry {
NetworkNodeGraphEntry otherItem = (NetworkNodeGraphEntry) other;
if (node.getWorld().func_234923_W_() != otherItem.node.getWorld().func_234923_W_()) {
if (node.getWorld().getDimensionKey() != otherItem.node.getWorld().getDimensionKey()) {
return false;
}
@@ -36,7 +36,7 @@ public class NetworkNodeGraphEntry implements INetworkNodeGraphEntry {
@Override
public int hashCode() {
int result = node.getPos().hashCode();
result = 31 * result + node.getWorld().func_234923_W_().hashCode();
result = 31 * result + node.getWorld().getDimensionKey().hashCode();
return result;
}
}

View File

@@ -33,7 +33,7 @@ public class NetworkItemManager implements INetworkItemManager {
if (node instanceof IWirelessTransmitter &&
network.canRun() &&
node.isActive() &&
((IWirelessTransmitter) node).getDimension() == player.getEntityWorld().func_234923_W_()) {
((IWirelessTransmitter) node).getDimension() == player.getEntityWorld().getDimensionKey()) {
IWirelessTransmitter transmitter = (IWirelessTransmitter) node;
Vector3d pos = player.getPositionVec();

View File

@@ -35,6 +35,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.stream.Collectors;
@@ -73,6 +74,16 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
public int getSlotLimit(int slot) {
return 1;
}
@Nonnull
@Override
public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) {
if (!stacks.get(slot).isEmpty()) {
return stack;
}
return super.insertItem(slot, stack, simulate);
}
}
.addValidator(new PatternItemValidator(world))
.addListener(new NetworkNodeInventoryListener(this))
@@ -189,7 +200,7 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
StackUtils.readItems(upgrades, 1, tag);
if (tag.contains(NBT_DISPLAY_NAME)) {
displayName = ITextComponent.Serializer.func_240643_a_(tag.getString(NBT_DISPLAY_NAME));
displayName = ITextComponent.Serializer.getComponentFromJson(tag.getString(NBT_DISPLAY_NAME));
}
if (tag.hasUniqueId(NBT_UUID)) {

View File

@@ -98,7 +98,7 @@ public class NetworkTransmitterNetworkNode extends NetworkNode {
}
public boolean isSameDimension() {
return world.func_234923_W_() == receiverDimension;
return world.getDimensionKey() == receiverDimension;
}
private boolean canTransmit() {

View File

@@ -62,7 +62,7 @@ public class WirelessTransmitterNetworkNode extends NetworkNode implements IWire
@Override
public RegistryKey<World> getDimension() {
return world.func_234923_W_();
return world.getDimensionKey();
}
public BaseItemHandler getUpgrades() {

View File

@@ -83,8 +83,11 @@ public class FluidExternalStorage implements IExternalStorage<FluidStack> {
return stack;
}
if (context.acceptsFluid(stack)) {
int filled = handlerSupplier.get().fill(StackUtils.copy(stack, size), action == Action.PERFORM ? IFluidHandler.FluidAction.EXECUTE : IFluidHandler.FluidAction.SIMULATE);
IFluidHandler handler = handlerSupplier.get();
if (context.acceptsFluid(stack) && handler != null) {
int filled = handler.fill(StackUtils.copy(stack, size), action == Action.PERFORM ? IFluidHandler.FluidAction.EXECUTE : IFluidHandler.FluidAction.SIMULATE);
if (filled == size) {
return FluidStack.EMPTY;

View File

@@ -2,7 +2,7 @@ package com.refinedmods.refinedstorage.apiimpl.storage.tracker;
import com.refinedmods.refinedstorage.api.storage.tracker.IStorageTracker;
import com.refinedmods.refinedstorage.api.storage.tracker.StorageTrackerEntry;
import com.refinedmods.refinedstorage.apiimpl.API;
import com.refinedmods.refinedstorage.util.ItemStackKey;
import com.refinedmods.refinedstorage.util.StackUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -17,7 +17,7 @@ public class ItemStorageTracker implements IStorageTracker<ItemStack> {
private static final String NBT_NAME = "Name";
private static final String NBT_TIME = "Time";
private final Map<Key, StorageTrackerEntry> changes = new HashMap<>();
private final Map<ItemStackKey, StorageTrackerEntry> changes = new HashMap<>();
private final Runnable listener;
public ItemStorageTracker(Runnable listener) {
@@ -26,14 +26,14 @@ public class ItemStorageTracker implements IStorageTracker<ItemStack> {
@Override
public void changed(PlayerEntity player, ItemStack stack) {
changes.put(new Key(stack), new StorageTrackerEntry(System.currentTimeMillis(), player.getName().getString()));
changes.put(new ItemStackKey(stack), new StorageTrackerEntry(System.currentTimeMillis(), player.getName().getString()));
listener.run();
}
@Override
public StorageTrackerEntry get(ItemStack stack) {
return changes.get(new Key(stack));
return changes.get(new ItemStackKey(stack));
}
public void readFromNbt(ListNBT list) {
@@ -43,7 +43,7 @@ public class ItemStorageTracker implements IStorageTracker<ItemStack> {
ItemStack stack = StackUtils.deserializeStackFromNbt(tag.getCompound(NBT_STACK));
if (!stack.isEmpty()) {
changes.put(new Key(stack), new StorageTrackerEntry(tag.getLong(NBT_TIME), tag.getString(NBT_NAME)));
changes.put(new ItemStackKey(stack), new StorageTrackerEntry(tag.getLong(NBT_TIME), tag.getString(NBT_NAME)));
}
}
}
@@ -51,34 +51,16 @@ public class ItemStorageTracker implements IStorageTracker<ItemStack> {
public ListNBT serializeNbt() {
ListNBT list = new ListNBT();
for (Map.Entry<Key, StorageTrackerEntry> entry : changes.entrySet()) {
for (Map.Entry<ItemStackKey, StorageTrackerEntry> entry : changes.entrySet()) {
CompoundNBT tag = new CompoundNBT();
tag.putLong(NBT_TIME, entry.getValue().getTime());
tag.putString(NBT_NAME, entry.getValue().getName());
tag.put(NBT_STACK, StackUtils.serializeStackToNbt(entry.getKey().stack));
tag.put(NBT_STACK, StackUtils.serializeStackToNbt(entry.getKey().getStack()));
list.add(tag);
}
return list;
}
private static class Key {
private final ItemStack stack;
public Key(ItemStack stack) {
this.stack = stack;
}
@Override
public boolean equals(Object other) {
return other instanceof Key && API.instance().getComparer().isEqualNoQuantity(stack, ((Key) other).stack);
}
@Override
public int hashCode() {
return API.instance().getItemStackHashCode(stack);
}
}
}

View File

@@ -35,7 +35,7 @@ public abstract class RSWorldSavedData extends WorldSavedData {
compoundnbt.putInt("DataVersion", SharedConstants.getVersion().getWorldVersion());
try {
CompressedStreamTools.func_244264_a(compoundnbt, tempFile);
CompressedStreamTools.writeCompressed(compoundnbt, tempFile);
if (fileIn.exists()) {
if (!fileIn.delete()) {
LOGGER.error("Failed To delete " + fileIn.getName());

View File

@@ -70,7 +70,7 @@ public class ListNetworkCommand implements Command<CommandSource> {
listItem.network.getPosition().getZ()
)
.appendString(" [")
.append(new TranslationTextComponent(
.appendSibling(new TranslationTextComponent(
"commands.refinedstorage.network.list.tick_times",
new StringTextComponent(TIME_FORMATTER.format(listItem.tickTime)).setStyle(Styles.YELLOW),
new StringTextComponent(TIME_FORMATTER.format(listItem.tps)).setStyle(Styles.YELLOW)

View File

@@ -26,11 +26,11 @@ public class ListAutocraftingCommand extends NetworkCommand {
public static void addInfo(CommandContext<CommandSource> context, ICraftingTask task) {
context.getSource().sendFeedback(
new StringTextComponent(getAmount(task.getRequested()) + "x ")
.append(getName(task.getRequested()).deepCopy().setStyle(Styles.YELLOW))
.appendSibling(getName(task.getRequested()).deepCopy().setStyle(Styles.YELLOW))
.appendString(" ")
.appendString("(" + task.getCompletionPercentage() + "%)")
.appendString(" ")
.append(new StringTextComponent("[" + task.getId().toString() + "]").setStyle(Styles.GRAY)),
.appendSibling(new StringTextComponent("[" + task.getId().toString() + "]").setStyle(Styles.GRAY)),
false
);
}

View File

@@ -32,14 +32,14 @@ public class PatternDumpCommand implements Command<CommandSource> {
ICraftingPattern pattern = PatternItem.fromCache(context.getSource().getWorld(), stack);
context.getSource().sendFeedback(new StringTextComponent("Crafting task factory ID: ").setStyle(Styles.YELLOW).append(new StringTextComponent(pattern.getCraftingTaskFactoryId().toString()).setStyle(Styles.WHITE)), false);
context.getSource().sendFeedback(new StringTextComponent("Crafting task factory ID: ").setStyle(Styles.YELLOW).appendSibling(new StringTextComponent(pattern.getCraftingTaskFactoryId().toString()).setStyle(Styles.WHITE)), false);
if (!pattern.isValid()) {
context.getSource().sendErrorMessage(new StringTextComponent("Pattern is invalid! Reason: ").append(pattern.getErrorMessage()));
context.getSource().sendErrorMessage(new StringTextComponent("Pattern is invalid! Reason: ").appendSibling(pattern.getErrorMessage()));
} else {
context.getSource().sendFeedback(new StringTextComponent("Processing: ").setStyle(Styles.YELLOW).append(new StringTextComponent(String.valueOf(processing)).setStyle(Styles.WHITE)), false);
context.getSource().sendFeedback(new StringTextComponent("Exact: ").setStyle(Styles.YELLOW).append(new StringTextComponent(String.valueOf(exact)).setStyle(Styles.WHITE)), false);
context.getSource().sendFeedback(new StringTextComponent("Has allowed tag list: ").setStyle(Styles.YELLOW).append(new StringTextComponent(String.valueOf(allowedTagList != null)).setStyle(Styles.WHITE)), false);
context.getSource().sendFeedback(new StringTextComponent("Processing: ").setStyle(Styles.YELLOW).appendSibling(new StringTextComponent(String.valueOf(processing)).setStyle(Styles.WHITE)), false);
context.getSource().sendFeedback(new StringTextComponent("Exact: ").setStyle(Styles.YELLOW).appendSibling(new StringTextComponent(String.valueOf(exact)).setStyle(Styles.WHITE)), false);
context.getSource().sendFeedback(new StringTextComponent("Has allowed tag list: ").setStyle(Styles.YELLOW).appendSibling(new StringTextComponent(String.valueOf(allowedTagList != null)).setStyle(Styles.WHITE)), false);
if (pattern.isProcessing()) {
for (int i = 0; i < pattern.getInputs().size(); ++i) {
@@ -47,7 +47,7 @@ public class PatternDumpCommand implements Command<CommandSource> {
context.getSource().sendFeedback(new StringTextComponent("Item inputs in slot " + i + ":").setStyle(Styles.YELLOW), false);
for (int j = 0; j < pattern.getInputs().get(i).size(); ++j) {
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getInputs().get(i).get(j).getCount() + "x ").append(pattern.getInputs().get(i).get(j).getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getInputs().get(i).get(j).getCount() + "x ").appendSibling(pattern.getInputs().get(i).get(j).getDisplayName()), false);
}
}
@@ -63,7 +63,7 @@ public class PatternDumpCommand implements Command<CommandSource> {
context.getSource().sendFeedback(new StringTextComponent("Fluid inputs in slot " + i + ":").setStyle(Styles.YELLOW), false);
for (int j = 0; j < pattern.getFluidInputs().get(i).size(); ++j) {
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getFluidInputs().get(i).get(j).getAmount() + " mB ").append(pattern.getFluidInputs().get(i).get(j).getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getFluidInputs().get(i).get(j).getAmount() + " mB ").appendSibling(pattern.getFluidInputs().get(i).get(j).getDisplayName()), false);
}
}
@@ -76,12 +76,12 @@ public class PatternDumpCommand implements Command<CommandSource> {
context.getSource().sendFeedback(new StringTextComponent("Outputs").setStyle(Styles.YELLOW), false);
for (ItemStack output : pattern.getOutputs()) {
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").append(output.getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").appendSibling(output.getDisplayName()), false);
}
context.getSource().sendFeedback(new StringTextComponent("Fluid outputs").setStyle(Styles.YELLOW), false);
for (FluidStack output : pattern.getFluidOutputs()) {
context.getSource().sendFeedback(new StringTextComponent("- " + output.getAmount() + " mB ").append(output.getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- " + output.getAmount() + " mB ").appendSibling(output.getDisplayName()), false);
}
} else {
for (int i = 0; i < pattern.getInputs().size(); ++i) {
@@ -89,14 +89,14 @@ public class PatternDumpCommand implements Command<CommandSource> {
context.getSource().sendFeedback(new StringTextComponent("Inputs in slot " + i + ":").setStyle(Styles.YELLOW), false);
for (int j = 0; j < pattern.getInputs().get(i).size(); ++j) {
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getInputs().get(i).get(j).getCount() + "x ").append(pattern.getInputs().get(i).get(j).getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getInputs().get(i).get(j).getCount() + "x ").appendSibling(pattern.getInputs().get(i).get(j).getDisplayName()), false);
}
}
}
context.getSource().sendFeedback(new StringTextComponent("Outputs").setStyle(Styles.YELLOW), false);
for (ItemStack output : pattern.getOutputs()) {
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").append(output.getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").appendSibling(output.getDisplayName()), false);
}
boolean anyByproducts = false;
@@ -109,7 +109,7 @@ public class PatternDumpCommand implements Command<CommandSource> {
anyByproducts = true;
}
context.getSource().sendFeedback(new StringTextComponent("- " + byproduct.getCount() + "x ").append(byproduct.getDisplayName()), false);
context.getSource().sendFeedback(new StringTextComponent("- " + byproduct.getCount() + "x ").appendSibling(byproduct.getDisplayName()), false);
}
}
}

View File

@@ -1,6 +1,8 @@
package com.refinedmods.refinedstorage.inventory.item.validator;
import com.refinedmods.refinedstorage.RSItems;
import com.refinedmods.refinedstorage.api.autocrafting.ICraftingPatternProvider;
import com.refinedmods.refinedstorage.item.PatternItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@@ -15,6 +17,9 @@ public class PatternItemValidator implements Predicate<ItemStack> {
@Override
public boolean test(ItemStack stack) {
if (stack.getItem() == RSItems.PATTERN.get()) {
return PatternItem.fromCache(world, stack).isValid();
}
return stack.getItem() instanceof ICraftingPatternProvider && ((ICraftingPatternProvider) stack.getItem()).create(world, stack, null).isValid();
}
}

View File

@@ -41,7 +41,7 @@ public class NetworkCardItem extends Item {
tag.putInt(NBT_RECEIVER_X, ctx.getPos().getX());
tag.putInt(NBT_RECEIVER_Y, ctx.getPos().getY());
tag.putInt(NBT_RECEIVER_Z, ctx.getPos().getZ());
tag.putString(NBT_DIMENSION, ctx.getWorld().func_234923_W_().func_240901_a_().toString());
tag.putString(NBT_DIMENSION, ctx.getWorld().getDimensionKey().getLocation().toString());
ctx.getPlayer().getHeldItem(ctx.getHand()).setTag(tag);
@@ -64,7 +64,7 @@ public class NetworkCardItem extends Item {
pos.getX(),
pos.getY(),
pos.getZ(),
type.func_240901_a_().toString()
type.getLocation().toString()
).setStyle(Styles.GRAY));
}
}
@@ -93,7 +93,7 @@ public class NetworkCardItem extends Item {
return null;
}
return RegistryKey.func_240903_a_(Registry.WORLD_KEY, name);
return RegistryKey.getOrCreateKey(Registry.WORLD_KEY, name);
}
return null;

View File

@@ -97,7 +97,7 @@ public abstract class NetworkItem extends EnergyItem implements INetworkItemProv
tag.putInt(NBT_NODE_X, network.getPosition().getX());
tag.putInt(NBT_NODE_Y, network.getPosition().getY());
tag.putInt(NBT_NODE_Z, network.getPosition().getZ());
tag.putString(NBT_DIMENSION, ctx.getWorld().func_234923_W_().func_240901_a_().toString());
tag.putString(NBT_DIMENSION, ctx.getWorld().getDimensionKey().getLocation().toString());
stack.setTag(tag);
@@ -115,7 +115,7 @@ public abstract class NetworkItem extends EnergyItem implements INetworkItemProv
return null;
}
return RegistryKey.func_240903_a_(Registry.WORLD_KEY, name);
return RegistryKey.getOrCreateKey(Registry.WORLD_KEY, name);
}
return null;

View File

@@ -10,6 +10,7 @@ import com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingPattern;
import com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingPatternFactory;
import com.refinedmods.refinedstorage.render.Styles;
import com.refinedmods.refinedstorage.render.tesr.PatternItemStackTileRenderer;
import com.refinedmods.refinedstorage.util.ItemStackKey;
import com.refinedmods.refinedstorage.util.RenderUtils;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.ITooltipFlag;
@@ -35,7 +36,7 @@ import java.util.Set;
import java.util.stream.Collectors;
public class PatternItem extends Item implements ICraftingPatternProvider {
private static final Map<ItemStack, ICraftingPattern> CACHE = new HashMap<>();
private static final Map<ItemStackKey, ICraftingPattern> CACHE = new HashMap<>();
private static final String NBT_VERSION = "Version";
private static final String NBT_INPUT_SLOT = "Input_%d";
@@ -53,11 +54,18 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
}
public static ICraftingPattern fromCache(World world, ItemStack stack) {
if (!CACHE.containsKey(stack)) {
CACHE.put(stack, CraftingPatternFactory.INSTANCE.create(world, null, stack));
ICraftingPattern pattern = CACHE.computeIfAbsent(
new ItemStackKey(stack),
s -> CraftingPatternFactory.INSTANCE.create(world, null, s.getStack())
);
// A number that is not too crazy but hopefully is not normally reachable,
// just reset the cache to keep its size limited so this is not a memory leak
if (CACHE.size() > 16384) {
CACHE.clear();
}
return CACHE.get(stack);
return pattern;
}
@Override

View File

@@ -83,7 +83,7 @@ public class SecurityCardItem extends Item {
for (Permission permission : Permission.values()) {
if (hasPermission(stack, permission)) {
tooltip.add(new StringTextComponent("- ").append(new TranslationTextComponent("gui.refinedstorage.security_manager.permission." + permission.getId())).setStyle(Styles.GRAY));
tooltip.add(new StringTextComponent("- ").appendSibling(new TranslationTextComponent("gui.refinedstorage.security_manager.permission." + permission.getId())).setStyle(Styles.GRAY));
}
}
}

View File

@@ -92,7 +92,7 @@ public class UpgradeItem extends Item {
tooltip.add(
new TranslationTextComponent("enchantment.minecraft.fortune")
.appendString(" ")
.append(new TranslationTextComponent("enchantment.level." + type.getFortuneLevel()))
.appendSibling(new TranslationTextComponent("enchantment.level." + type.getFortuneLevel()))
.setStyle(Styles.GRAY)
);
}

View File

@@ -14,7 +14,9 @@ public class ColoredBlockItem extends BaseBlockItem {
super(block, builder);
if (color != ColorMap.DEFAULT_COLOR) {
this.displayName = new TranslationTextComponent("color.minecraft." + color.getTranslationKey()).appendString(" ").append(displayName);
this.displayName = new TranslationTextComponent("color.minecraft." + color.getTranslationKey())
.appendString(" ")
.appendSibling(displayName);
} else {
this.displayName = displayName;
}

View File

@@ -17,7 +17,9 @@ public class ControllerBlockItem extends EnergyBlockItem {
super(block, new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), block.getType() == NetworkType.CREATIVE, () -> RS.SERVER_CONFIG.getController().getCapacity());
if (color != ColorMap.DEFAULT_COLOR) {
this.displayName = new TranslationTextComponent("color.minecraft." + color.getTranslationKey()).appendString(" ").append(displayName);
this.displayName = new TranslationTextComponent("color.minecraft." + color.getTranslationKey())
.appendString(" ")
.appendSibling(displayName);
} else {
this.displayName = displayName;
}

View File

@@ -33,7 +33,7 @@ public class ControllerLootFunction extends LootFunction {
}
@Override
public LootFunctionType func_230425_b_() {
public LootFunctionType getFunctionType() {
return RSLootFunctions.getController();
}

View File

@@ -35,7 +35,7 @@ public class CrafterLootFunction extends LootFunction {
}
@Override
public LootFunctionType func_230425_b_() {
public LootFunctionType getFunctionType() {
return RSLootFunctions.getCrafter();
}

View File

@@ -29,7 +29,7 @@ public class PortableGridBlockLootFunction extends LootFunction {
}
@Override
public LootFunctionType func_230425_b_() {
public LootFunctionType getFunctionType() {
return RSLootFunctions.getPortableGrid();
}

View File

@@ -50,7 +50,7 @@ public class StorageBlockLootFunction extends LootFunction {
}
@Override
public LootFunctionType func_230425_b_() {
public LootFunctionType getFunctionType() {
return RSLootFunctions.getStorageBlock();
}

View File

@@ -1,22 +0,0 @@
package com.refinedmods.refinedstorage.render;
import net.minecraft.util.text.*;
import net.minecraftforge.common.ForgeConfig;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class ExperimentalLightingPipelineNagger {
@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent e) {
if (Boolean.FALSE.equals(ForgeConfig.CLIENT.experimentalForgeLightPipelineEnabled.get())) {
IFormattableTextComponent message = new StringTextComponent("[Refined Storage] ").setStyle(Styles.AQUA.setBold(true));
message.append(new StringTextComponent("Please set ").setStyle(Styles.WHITE.setBold(false)));
message.append(new StringTextComponent("experimentalForgeLightPipelineEnabled").setStyle(Styles.GRAY.setItalic(true)));
message.append(new StringTextComponent(" to ").setStyle(Styles.WHITE.setBold(false)));
message.append(new StringTextComponent("true").setStyle(Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.GREEN)).setBold(true).setItalic(true)));
message.append(new StringTextComponent(" in the Forge client config to ensure correct rendering of Refined Storage blocks.").setStyle(Styles.WHITE.setBold(false)));
e.getPlayer().sendStatusMessage(message, false);
}
}
}

View File

@@ -5,12 +5,12 @@ import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextFormatting;
public final class Styles {
public static final Style WHITE = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.WHITE));
public static final Style GRAY = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.GRAY));
public static final Style YELLOW = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.YELLOW));
public static final Style RED = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.RED));
public static final Style BLUE = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.BLUE));
public static final Style AQUA = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.AQUA));
public static final Style WHITE = Style.EMPTY.setColor(Color.fromTextFormatting(TextFormatting.WHITE));
public static final Style GRAY = Style.EMPTY.setColor(Color.fromTextFormatting(TextFormatting.GRAY));
public static final Style YELLOW = Style.EMPTY.setColor(Color.fromTextFormatting(TextFormatting.YELLOW));
public static final Style RED = Style.EMPTY.setColor(Color.fromTextFormatting(TextFormatting.RED));
public static final Style BLUE = Style.EMPTY.setColor(Color.fromTextFormatting(TextFormatting.BLUE));
public static final Style AQUA = Style.EMPTY.setColor(Color.fromTextFormatting(TextFormatting.AQUA));
private Styles() {
}

View File

@@ -37,8 +37,8 @@ public class DelegateBakedModel implements IBakedModel {
}
@Override
public boolean func_230044_c_() {
return base.func_230044_c_();
public boolean isSideLit() {
return base.isSideLit();
}
@Override

View File

@@ -57,7 +57,7 @@ public class FullbrightBakedModel extends DelegateBakedModel {
for (int i = 0; i < quads.size(); ++i) {
BakedQuad quad = quads.get(i);
if (textures.contains(quad.func_187508_a().getName())) {
if (textures.contains(quad.getSprite().getName())) {
quads.set(i, transformQuad(quad));
}
}
@@ -79,8 +79,8 @@ public class FullbrightBakedModel extends DelegateBakedModel {
vertexData,
quad.getTintIndex(),
quad.getFace(),
quad.func_187508_a(),
quad.func_239287_f_() // shouldApplyDiffuseLighting
quad.getSprite(),
quad.applyDiffuseLighting()
);
}

View File

@@ -25,7 +25,7 @@ public class PatternBakedModel extends DelegateBakedModel {
return new ItemOverrideList() {
@Nullable
@Override
public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
public IBakedModel getOverrideModel(IBakedModel model, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
if (entity != null) {
ICraftingPattern pattern = PatternItem.fromCache(entity.world, stack);
@@ -36,7 +36,7 @@ public class PatternBakedModel extends DelegateBakedModel {
}
}
return super.func_239290_a_(model, stack, world, entity);
return super.getOverrideModel(model, stack, world, entity);
}
@Override

View File

@@ -110,7 +110,7 @@ public class PortableGridBakedModel extends DelegateBakedModel {
private class CustomItemOverrideList extends ItemOverrideList {
@Nullable
@Override
public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
public IBakedModel getOverrideModel(IBakedModel model, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
PortableGrid portableGrid = new PortableGrid(null, stack, -1);
if (portableGrid.isGridActive()) {

View File

@@ -59,8 +59,8 @@ public class PortableGridItemBakedModel implements IBakedModel {
}
@Override
public boolean func_230044_c_() {
return base.func_230044_c_();
public boolean isSideLit() {
return base.isSideLit();
}
@Override

View File

@@ -34,7 +34,7 @@ public final class QuadTransformer {
}
for (BakedQuad quad : model.getQuads(state, side, rand, EmptyModelData.INSTANCE)) {
BakedQuadBuilder builder = new BakedQuadBuilder(quad.func_187508_a());
BakedQuadBuilder builder = new BakedQuadBuilder(quad.getSprite());
TRSRTransformer transformer = new TRSRTransformer(builder, transformation.blockCenterToCorner());
quad.pipe(transformer);

View File

@@ -1,17 +1,20 @@
package com.refinedmods.refinedstorage.render.tesr;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.refinedmods.refinedstorage.RSBlocks;
import com.refinedmods.refinedstorage.apiimpl.API;
import com.refinedmods.refinedstorage.block.StorageMonitorBlock;
import com.refinedmods.refinedstorage.tile.StorageMonitorTile;
import com.refinedmods.refinedstorage.tile.config.IType;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -22,6 +25,7 @@ import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Matrix3f;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraftforge.common.model.TransformationHelper;
import net.minecraftforge.fluids.FluidAttributes;
@@ -71,9 +75,9 @@ public class StorageMonitorTileRenderer extends TileEntityRenderer<StorageMonito
matrixStack.translate(0.5D, 0.5D, 0.5D);
matrixStack.translate(
((float) direction.getXOffset() * 0.5F) + (direction.getZOffset() * stringOffset),
-0.275,
((float) direction.getZOffset() * 0.5F) - (direction.getXOffset() * stringOffset)
((float) direction.getXOffset() * 0.501F) + (direction.getZOffset() * stringOffset),
-0.275,
((float) direction.getZOffset() * 0.501F) - (direction.getXOffset() * stringOffset)
);
matrixStack.rotate(TransformationHelper.quatFromXYZ(new Vector3f(direction.getXOffset() * 180, 0, direction.getZOffset() * 180), true));
@@ -82,16 +86,16 @@ public class StorageMonitorTileRenderer extends TileEntityRenderer<StorageMonito
matrixStack.scale(0.01F, 0.01F, 0.01F);
Minecraft.getInstance().fontRenderer.renderString(
amount,
0,
0,
-1,
false,
matrixStack.getLast().getMatrix(),
renderTypeBuffer,
false,
0,
light
amount,
0,
0,
-1,
false,
matrixStack.getLast().getMatrix(),
renderTypeBuffer,
false,
0,
light
);
matrixStack.pop();
@@ -101,19 +105,36 @@ public class StorageMonitorTileRenderer extends TileEntityRenderer<StorageMonito
private void renderItem(MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, Direction direction, float rotation, int light, ItemStack itemStack) {
matrixStack.push();
// Put it in the middle, outwards, and facing the correct direction
matrixStack.translate(0.5D, 0.5D, 0.5D);
matrixStack.translate((float) direction.getXOffset() * 0.5F, 0, (float) direction.getZOffset() * 0.5F);
matrixStack.translate((float) direction.getXOffset() * 0.501F, 0, (float) direction.getZOffset() * 0.501F);
matrixStack.rotate(TransformationHelper.quatFromXYZ(new Vector3f(0, rotation, 0), false));
matrixStack.scale(0.5F, 0.5F, 0.5F);
// Make it look "flat"
matrixStack.scale(0.5F, -0.5F, -0.00005f);
// Fix rotation after making it look flat
matrixStack.rotate(TransformationHelper.quatFromXYZ(new Vector3f(0, 0, 180), true));
IBakedModel itemModel = Minecraft.getInstance().getItemRenderer().getItemModelWithOverrides(itemStack, null, null);
boolean render3D = itemModel.isGui3d();
if (render3D) {
RenderHelper.setupGui3DDiffuseLighting();
} else {
RenderHelper.setupGuiFlatDiffuseLighting();
}
matrixStack.getLast().getNormal().set(Matrix3f.makeScaleMatrix(1, -1, 1));
Minecraft.getInstance().getItemRenderer().renderItem(
itemStack,
ItemCameraTransforms.TransformType.FIXED,
light,
OverlayTexture.NO_OVERLAY,
matrixStack,
renderTypeBuffer
itemStack,
ItemCameraTransforms.TransformType.GUI,
false,
matrixStack,
renderTypeBuffer,
light,
OverlayTexture.NO_OVERLAY,
itemModel
);
matrixStack.pop();
@@ -142,25 +163,25 @@ public class StorageMonitorTileRenderer extends TileEntityRenderer<StorageMonito
final int colorAlpha = fluidColor >> 24 & 0xFF;
buffer.pos(matrixStack.getLast().getMatrix(), -0.5F, -0.5F, 0F)
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMinU(), sprite.getMinV())
.lightmap(light)
.endVertex();
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMinU(), sprite.getMinV())
.lightmap(light)
.endVertex();
buffer.pos(matrixStack.getLast().getMatrix(), 0.5F, -0.5F, 0F)
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMaxU(), sprite.getMinV())
.lightmap(light)
.endVertex();
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMaxU(), sprite.getMinV())
.lightmap(light)
.endVertex();
buffer.pos(matrixStack.getLast().getMatrix(), 0.5F, -1.5F, 0F)
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMaxU(), sprite.getMaxV())
.lightmap(light)
.endVertex();
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMaxU(), sprite.getMaxV())
.lightmap(light)
.endVertex();
buffer.pos(matrixStack.getLast().getMatrix(), -0.5F, -1.5F, 0F)
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMinU(), sprite.getMaxV())
.lightmap(light)
.endVertex();
.color(colorRed, colorGreen, colorBlue, colorAlpha)
.tex(sprite.getMinU(), sprite.getMaxV())
.lightmap(light)
.endVertex();
matrixStack.pop();
}

View File

@@ -159,7 +159,7 @@ public abstract class AmountSpecifyingScreen<T extends Container> extends BaseSc
blit(matrixStack, x, y, 0, 0, xSize, ySize);
amountField.renderButton(matrixStack, 0, 0, 0);
amountField.renderWidget(matrixStack, 0, 0, 0);
}
@Override

View File

@@ -126,7 +126,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
super.render(matrixStack, mouseX, mouseY, partialTicks);
func_230459_a_(matrixStack, mouseX, mouseY);
renderHoveredTooltip(matrixStack, mouseX, mouseY);
}
@Override

View File

@@ -71,7 +71,7 @@ public class SecurityManagerScreen extends BaseScreen<SecurityManagerContainer>
CheckboxWidget permission = permissions[i];
// getWidth_CLASH => getHeight
if (RenderUtils.inBounds(permission.x - guiLeft, permission.y - guiTop, permission.getWidth(), permission.getWidth_CLASH(), mouseX, mouseY)) {
if (RenderUtils.inBounds(permission.x - guiLeft, permission.y - guiTop, permission.getWidth(), permission.getHeight(), mouseX, mouseY)) {
renderTooltip(matrixStack, mouseX, mouseY, I18n.format("gui.refinedstorage.security_manager.permission." + i + ".tooltip"));
}
}

View File

@@ -47,7 +47,7 @@ public class CheckboxWidget extends CheckboxButton {
}
@Override
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void renderWidget(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
Minecraft minecraft = Minecraft.getInstance();
minecraft.getTextureManager().bindTexture(TEXTURE);
RenderSystem.enableDepthTest();

View File

@@ -173,10 +173,10 @@ public class SearchWidget extends TextFieldWidget {
}
@Override
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void renderWidget(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (canSyncFromJEINow() && RSJeiPlugin.getRuntime().getIngredientListOverlay().hasKeyboardFocus()) {
setTextFromJEI();
}
super.renderButton(matrixStack, mouseX, mouseY, partialTicks);
super.renderWidget(matrixStack, mouseX, mouseY, partialTicks);
}
}

View File

@@ -25,7 +25,7 @@ public abstract class SideButton extends Button {
}
@Override
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void renderWidget(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.enableAlphaTest();

View File

@@ -9,7 +9,6 @@ import com.refinedmods.refinedstorage.item.property.ControllerItemPropertyGetter
import com.refinedmods.refinedstorage.item.property.NetworkItemPropertyGetter;
import com.refinedmods.refinedstorage.item.property.SecurityCardItemPropertyGetter;
import com.refinedmods.refinedstorage.render.BakedModelOverrideRegistry;
import com.refinedmods.refinedstorage.render.ExperimentalLightingPipelineNagger;
import com.refinedmods.refinedstorage.render.color.PatternItemColor;
import com.refinedmods.refinedstorage.render.model.*;
import com.refinedmods.refinedstorage.render.resourcepack.ResourcePackListener;
@@ -27,10 +26,9 @@ import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AddReloadListenerEvent;
@@ -143,7 +141,7 @@ public class ClientSetup {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onModelBake);
MinecraftForge.EVENT_BUS.addListener(new ExperimentalLightingPipelineNagger()::onPlayerLoggedIn);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onModelRegistry);
MinecraftForge.EVENT_BUS.addListener(this::addReloadListener);
API.instance().addPatternRenderHandler(pattern -> Screen.hasShiftDown());
@@ -196,24 +194,6 @@ public class ClientSetup {
public void onClientSetup(FMLClientSetupEvent e) {
MinecraftForge.EVENT_BUS.register(new KeyInputListener());
ModelLoader.addSpecialModel(DISK_RESOURCE);
ModelLoader.addSpecialModel(DISK_NEAR_CAPACITY_RESOURCE);
ModelLoader.addSpecialModel(DISK_FULL_RESOURCE);
ModelLoader.addSpecialModel(DISK_DISCONNECTED_RESOURCE);
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator/disconnected"));
for (DyeColor color : DyeColor.values()) {
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator/" + color));
}
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_connected"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_disconnected"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_near_capacity"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_full"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_disconnected"));
ScreenManager.registerFactory(RSContainers.FILTER, FilterScreen::new);
ScreenManager.registerFactory(RSContainers.CONTROLLER, ControllerScreen::new);
ScreenManager.registerFactory(RSContainers.DISK_DRIVE, DiskDriveScreen::new);
@@ -273,19 +253,19 @@ public class ClientSetup {
e.getMinecraftSupplier().get().getItemColors().register(new PatternItemColor(), RSItems.PATTERN.get());
ItemModelsProperties.func_239418_a_(RSItems.SECURITY_CARD.get(), new ResourceLocation("active"), new SecurityCardItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.SECURITY_CARD.get(), new ResourceLocation("active"), new SecurityCardItemPropertyGetter());
RSItems.CONTROLLER.values().forEach(controller -> ItemModelsProperties.func_239418_a_(controller.get(), new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()));
RSItems.CREATIVE_CONTROLLER.values().forEach(controller -> ItemModelsProperties.func_239418_a_(controller.get(), new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()));
RSItems.CONTROLLER.values().forEach(controller -> ItemModelsProperties.registerProperty(controller.get(), new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()));
RSItems.CREATIVE_CONTROLLER.values().forEach(controller -> ItemModelsProperties.registerProperty(controller.get(), new ResourceLocation("energy_type"), new ControllerItemPropertyGetter()));
ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_CRAFTING_MONITOR.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.WIRELESS_CRAFTING_MONITOR.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.CREATIVE_WIRELESS_CRAFTING_MONITOR.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.WIRELESS_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.CREATIVE_WIRELESS_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.func_239418_a_(RSItems.WIRELESS_FLUID_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.func_239418_a_(RSItems.CREATIVE_WIRELESS_FLUID_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.WIRELESS_FLUID_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
ItemModelsProperties.registerProperty(RSItems.CREATIVE_WIRELESS_FLUID_GRID.get(), CONNECTED, new NetworkItemPropertyGetter());
}
@SubscribeEvent
@@ -293,6 +273,27 @@ public class ClientSetup {
event.addListener(new ResourcePackListener());
}
@SubscribeEvent
public void onModelRegistry(ModelRegistryEvent e) {
ModelLoader.addSpecialModel(DISK_RESOURCE);
ModelLoader.addSpecialModel(DISK_NEAR_CAPACITY_RESOURCE);
ModelLoader.addSpecialModel(DISK_FULL_RESOURCE);
ModelLoader.addSpecialModel(DISK_DISCONNECTED_RESOURCE);
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator/disconnected"));
for (DyeColor color : DyeColor.values()) {
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator/" + color));
}
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_connected"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_disconnected"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_near_capacity"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_full"));
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_disconnected"));
}
@SubscribeEvent
public void onModelBake(ModelBakeEvent e) {
FullbrightBakedModel.invalidateCache();

View File

@@ -22,7 +22,7 @@ public class NetworkTransmitterTile extends NetworkNodeTile<NetworkTransmitterNe
public static final TileDataParameter<Integer, NetworkTransmitterTile> DISTANCE = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.getNode().getDistance());
public static final TileDataParameter<Optional<ResourceLocation>, NetworkTransmitterTile> RECEIVER_DIMENSION = new TileDataParameter<>(RSSerializers.OPTIONAL_RESOURCE_LOCATION_SERIALIZER, Optional.empty(), t -> {
if (t.getNode().getReceiverDimension() != null) {
return Optional.of(t.getNode().getReceiverDimension().func_240901_a_());
return Optional.of(t.getNode().getReceiverDimension().getLocation());
}
return Optional.empty();

View File

@@ -0,0 +1,26 @@
package com.refinedmods.refinedstorage.util;
import com.refinedmods.refinedstorage.apiimpl.API;
import net.minecraft.item.ItemStack;
public final class ItemStackKey {
private final ItemStack stack;
public ItemStackKey(ItemStack stack) {
this.stack = stack;
}
public ItemStack getStack() {
return stack;
}
@Override
public boolean equals(Object other) {
return other instanceof ItemStackKey && API.instance().getComparer().isEqualNoQuantity(stack, ((ItemStackKey) other).stack);
}
@Override
public int hashCode() {
return API.instance().getItemStackHashCode(stack);
}
}

View File

@@ -62,7 +62,7 @@ public final class RenderUtils {
}
if (displayAmount) {
data = new StringTextComponent(amount + "x ").append(data);
data = new StringTextComponent(amount + "x ").appendSibling(data);
}
tooltip.add(data.setStyle(Styles.GRAY));
@@ -90,7 +90,7 @@ public final class RenderUtils {
}
if (displayMb) {
data = new StringTextComponent(API.instance().getQuantityFormatter().formatInBucketForm(amount) + " ").append(data);
data = new StringTextComponent(API.instance().getQuantityFormatter().formatInBucketForm(amount) + " ").appendSibling(data);
}
tooltip.add(data.setStyle(Styles.GRAY));
@@ -165,7 +165,7 @@ public final class RenderUtils {
List<ITextProperties> wrappedTextLines = new ArrayList<>();
for (int i = 0; i < textLines.size(); i++) {
ITextProperties textLine = textLines.get(i);
List<ITextProperties> wrappedLine = font.func_238420_b_().func_238362_b_(textLine, tooltipTextWidth, Style.EMPTY);
List<ITextProperties> wrappedLine = font.getCharacterManager().func_238362_b_(textLine, tooltipTextWidth, Style.EMPTY);
if (i == 0)
titleLinesCount = wrappedLine.size();
@@ -238,7 +238,7 @@ public final class RenderUtils {
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
ITextProperties line = textLines.get(lineNumber);
if (line != null)
font.func_238416_a_(LanguageMap.getInstance().func_241870_a(line), (float) tooltipX, (float) tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
font.drawEntityText(LanguageMap.getInstance().func_241870_a(line), (float) tooltipX, (float) tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
if (lineNumber + 1 == titleLinesCount)
tooltipY += 2;
@@ -259,7 +259,7 @@ public final class RenderUtils {
RenderSystem.enableAlphaTest();
// FontRenderer#drawStringWithShadow - call to func_228078_a_ (private)
// FontRenderer#drawStringWithShadow - call to renderString (private)
MatrixStack smallTextStack = new MatrixStack();
smallTextStack.translate(0.0D, 0.0D, zLevel);
smallTextStack.scale(textScale, textScale, 1);

View File

@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[34,)"
loaderVersion = "[36,)"
issueTrackerURL = "https://github.com/refinedmods/refinedstorage"
license="MIT"
[[mods]]
@@ -13,14 +13,3 @@ authors = "Refined Mods"
description = '''
An elegant solution to your hoarding problem
'''
[[dependencies.refinedstorage]] #optional
# the modid of the dependency
modId = "forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory = true #mandatory
# The version range of the dependency
versionRange = "[34.1.0,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering = "NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
side = "BOTH"