Fix some TODOs, fix checkbox rendering
This commit is contained in:
@@ -9,8 +9,15 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public final class RSLootFunctions {
|
public final class RSLootFunctions {
|
||||||
public static final LootFunctionType STORAGE_BLOCK = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "storage_block"), new LootFunctionType(new StorageBlockLootFunction.Serializer()));
|
public static LootFunctionType STORAGE_BLOCK;
|
||||||
public static final LootFunctionType PORTABLE_GRID = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "portable_grid"), new LootFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
public static LootFunctionType PORTABLE_GRID;
|
||||||
public static final LootFunctionType CRAFTER = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "crafter"), new LootFunctionType(new CrafterLootFunction.Serializer()));
|
public static LootFunctionType CRAFTER;
|
||||||
public static final LootFunctionType CONTROLLER = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "controller"), new LootFunctionType(new ControllerLootFunction.Serializer()));
|
public static LootFunctionType CONTROLLER;
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
STORAGE_BLOCK = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "storage_block"), new LootFunctionType(new StorageBlockLootFunction.Serializer()));
|
||||||
|
PORTABLE_GRID = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "portable_grid"), new LootFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
||||||
|
CRAFTER = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "crafter"), new LootFunctionType(new CrafterLootFunction.Serializer()));
|
||||||
|
CONTROLLER = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "controller"), new LootFunctionType(new ControllerLootFunction.Serializer()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -312,7 +312,7 @@ public class API implements IRSAPI {
|
|||||||
@Override
|
@Override
|
||||||
public int getNetworkNodeHashCode(INetworkNode node) {
|
public int getNetworkNodeHashCode(INetworkNode node) {
|
||||||
int result = node.getPos().hashCode();
|
int result = node.getPos().hashCode();
|
||||||
result = 31 * result + node.getWorld().func_234923_W_().hashCode(); // TODO check
|
result = 31 * result + node.getWorld().func_234923_W_().hashCode();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,7 @@ public class API implements IRSAPI {
|
|||||||
|
|
||||||
INetworkNode rightNode = (INetworkNode) right;
|
INetworkNode rightNode = (INetworkNode) right;
|
||||||
|
|
||||||
if (left.getWorld().func_234923_W_() != rightNode.getWorld().func_234923_W_()) { // TODO check
|
if (left.getWorld().func_234923_W_() != rightNode.getWorld().func_234923_W_()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,15 +6,13 @@ import com.refinedmods.refinedstorage.api.render.IElementDrawers;
|
|||||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||||
import com.refinedmods.refinedstorage.render.Styles;
|
import com.refinedmods.refinedstorage.render.Styles;
|
||||||
import com.refinedmods.refinedstorage.util.PacketBufferUtils;
|
import com.refinedmods.refinedstorage.util.PacketBufferUtils;
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.util.text.TranslationTextComponent;
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ErrorCraftingMonitorElement implements ICraftingMonitorElement {
|
public class ErrorCraftingMonitorElement implements ICraftingMonitorElement {
|
||||||
@@ -39,7 +37,7 @@ public class ErrorCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public List<ITextComponent> getTooltip() {
|
public List<ITextComponent> getTooltip() {
|
||||||
List<ITextComponent> items = base.getTooltip(); // TODO Make sure this doesn't crash
|
List<ITextComponent> items = new ArrayList<>(base.getTooltip());
|
||||||
items.add(new TranslationTextComponent(message).func_230530_a_(Styles.RED));
|
items.add(new TranslationTextComponent(message).func_230530_a_(Styles.RED));
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ public class NetworkCardItem extends Item {
|
|||||||
pos.getX(),
|
pos.getX(),
|
||||||
pos.getY(),
|
pos.getY(),
|
||||||
pos.getZ(),
|
pos.getZ(),
|
||||||
type.func_240901_a_().toString() // TODO check
|
type.func_240901_a_().toString()
|
||||||
).func_230530_a_(Styles.GRAY));
|
).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ package com.refinedmods.refinedstorage.screen.grid.filtering;
|
|||||||
import com.refinedmods.refinedstorage.screen.grid.stack.IGridStack;
|
import com.refinedmods.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public class TooltipGridFilter implements Predicate<IGridStack> {
|
public class TooltipGridFilter implements Predicate<IGridStack> {
|
||||||
@@ -14,23 +15,14 @@ public class TooltipGridFilter implements Predicate<IGridStack> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(IGridStack stack) {
|
public boolean test(IGridStack stack) {
|
||||||
for (ITextComponent item : stack.getTooltip()) {
|
List<ITextComponent> tooltip = stack.getTooltip();
|
||||||
if (item.getString().contains(tooltip)) {
|
|
||||||
|
for (int i = 1; i < tooltip.size(); ++i) {
|
||||||
|
if (tooltip.get(i).getString().toLowerCase().contains(this.tooltip.toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* TODO Check if we still need to rem first line?
|
|
||||||
String otherTooltip = stack.getTooltip().trim().toLowerCase();
|
|
||||||
|
|
||||||
if (!otherTooltip.contains("\n")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
otherTooltip = otherTooltip.substring(otherTooltip.indexOf('\n') + 1); // Remove the first line as that states the item name
|
|
||||||
|
|
||||||
return otherTooltip.contains(tooltip); */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,15 @@ public class CheckboxWidget extends CheckboxButton {
|
|||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
blit(matrixStack, this.x, this.y, this.isFocused() ? 20.0F : 0.0F, this.checked ? 20.0F : 0.0F, 20, this.height, 64, 64);
|
|
||||||
|
float textureX = (this.isFocused() ? 10.0F : 0.0F);
|
||||||
|
float textureY = (this.checked ? 10.0F : 0.0F);
|
||||||
|
|
||||||
|
int width = 10;
|
||||||
|
int height = 10;
|
||||||
|
|
||||||
|
blit(matrixStack, this.x, this.y, textureX, textureY, width, height, 32, 32);
|
||||||
|
|
||||||
this.renderBg(matrixStack, minecraft, p_230431_2_, p_230431_3_);
|
this.renderBg(matrixStack, minecraft, p_230431_2_, p_230431_3_);
|
||||||
|
|
||||||
int color = 14737632;
|
int color = 14737632;
|
||||||
|
@@ -2,6 +2,7 @@ package com.refinedmods.refinedstorage.setup;
|
|||||||
|
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.RSBlocks;
|
import com.refinedmods.refinedstorage.RSBlocks;
|
||||||
|
import com.refinedmods.refinedstorage.RSLootFunctions;
|
||||||
import com.refinedmods.refinedstorage.api.network.NetworkType;
|
import com.refinedmods.refinedstorage.api.network.NetworkType;
|
||||||
import com.refinedmods.refinedstorage.api.network.grid.GridType;
|
import com.refinedmods.refinedstorage.api.network.grid.GridType;
|
||||||
import com.refinedmods.refinedstorage.api.network.node.INetworkNode;
|
import com.refinedmods.refinedstorage.api.network.node.INetworkNode;
|
||||||
@@ -67,6 +68,8 @@ public class CommonSetup {
|
|||||||
MinecraftForge.EVENT_BUS.register(new NetworkListener());
|
MinecraftForge.EVENT_BUS.register(new NetworkListener());
|
||||||
MinecraftForge.EVENT_BUS.register(new BlockListener());
|
MinecraftForge.EVENT_BUS.register(new BlockListener());
|
||||||
|
|
||||||
|
RSLootFunctions.register();
|
||||||
|
|
||||||
API.instance().getStorageDiskRegistry().add(ItemStorageDiskFactory.ID, new ItemStorageDiskFactory());
|
API.instance().getStorageDiskRegistry().add(ItemStorageDiskFactory.ID, new ItemStorageDiskFactory());
|
||||||
API.instance().getStorageDiskRegistry().add(FluidStorageDiskFactory.ID, new FluidStorageDiskFactory());
|
API.instance().getStorageDiskRegistry().add(FluidStorageDiskFactory.ID, new FluidStorageDiskFactory());
|
||||||
|
|
||||||
|
@@ -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<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 -> {
|
public static final TileDataParameter<Optional<ResourceLocation>, NetworkTransmitterTile> RECEIVER_DIMENSION = new TileDataParameter<>(RSSerializers.OPTIONAL_RESOURCE_LOCATION_SERIALIZER, Optional.empty(), t -> {
|
||||||
if (t.getNode().getReceiverDimension() != null) {
|
if (t.getNode().getReceiverDimension() != null) {
|
||||||
return Optional.of(t.getNode().getReceiverDimension().func_240901_a_()); // TODO check
|
return Optional.of(t.getNode().getReceiverDimension().func_240901_a_());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@@ -235,7 +235,7 @@ public final class RenderUtils {
|
|||||||
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
|
for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) {
|
||||||
ITextProperties line = textLines.get(lineNumber);
|
ITextProperties line = textLines.get(lineNumber);
|
||||||
if (line != null)
|
if (line != null)
|
||||||
font.renderString(line.getString(), (float) tooltipX, (float) tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
|
font.func_238416_a_(line, (float) tooltipX, (float) tooltipY, -1, true, textLocation, renderType, false, 0, 15728880);
|
||||||
|
|
||||||
if (lineNumber + 1 == titleLinesCount)
|
if (lineNumber + 1 == titleLinesCount)
|
||||||
tooltipY += 2;
|
tooltipY += 2;
|
||||||
|
Reference in New Issue
Block a user