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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ControllerLootFunction extends LootFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootFunctionType func_230425_b_() {
|
||||
public LootFunctionType getFunctionType() {
|
||||
return RSLootFunctions.getController();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class CrafterLootFunction extends LootFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootFunctionType func_230425_b_() {
|
||||
public LootFunctionType getFunctionType() {
|
||||
return RSLootFunctions.getCrafter();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PortableGridBlockLootFunction extends LootFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootFunctionType func_230425_b_() {
|
||||
public LootFunctionType getFunctionType() {
|
||||
return RSLootFunctions.getPortableGrid();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class StorageBlockLootFunction extends LootFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootFunctionType func_230425_b_() {
|
||||
public LootFunctionType getFunctionType() {
|
||||
return RSLootFunctions.getStorageBlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user