Porting 2
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
package com.refinedmods.refinedstorage;
|
||||||
|
|
||||||
|
import com.refinedmods.refinedstorage.loottable.ControllerLootFunction;
|
||||||
|
import com.refinedmods.refinedstorage.loottable.CrafterLootFunction;
|
||||||
|
import com.refinedmods.refinedstorage.loottable.PortableGridBlockLootFunction;
|
||||||
|
import com.refinedmods.refinedstorage.loottable.StorageBlockLootFunction;
|
||||||
|
import net.minecraft.loot.LootFunctionType;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
|
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 final LootFunctionType PORTABLE_GRID = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "portable_grid"), new LootFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
||||||
|
public static final LootFunctionType CRAFTER = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "crafter"), new LootFunctionType(new CrafterLootFunction.Serializer()));
|
||||||
|
public static final LootFunctionType CONTROLLER = Registry.register(Registry.field_239694_aZ_, new ResourceLocation(RS.ID, "controller"), new LootFunctionType(new ControllerLootFunction.Serializer()));
|
||||||
|
}
|
@@ -7,7 +7,7 @@ import com.refinedmods.refinedstorage.tile.grid.portable.PortableGridTile;
|
|||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraftforge.registries.ObjectHolder;
|
import net.minecraftforge.registries.ObjectHolder;
|
||||||
|
|
||||||
public class RSTiles {
|
public final class RSTiles {
|
||||||
@ObjectHolder(RS.ID + ":controller")
|
@ObjectHolder(RS.ID + ":controller")
|
||||||
public static final TileEntityType<ControllerTile> CONTROLLER = null;
|
public static final TileEntityType<ControllerTile> CONTROLLER = null;
|
||||||
@ObjectHolder(RS.ID + ":creative_controller")
|
@ObjectHolder(RS.ID + ":creative_controller")
|
||||||
|
@@ -1,32 +1,35 @@
|
|||||||
package com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor;
|
package com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
|
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementList;
|
import com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementList;
|
||||||
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.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a crafting monitor element.
|
* Represents a crafting monitor element.
|
||||||
*/
|
*/
|
||||||
public interface ICraftingMonitorElement {
|
public interface ICraftingMonitorElement {
|
||||||
/**
|
/**
|
||||||
* @param x position on the x axis to render
|
* @param matrixStack the matrix stack
|
||||||
* @param y position on the y axis to render
|
* @param x position on the x axis to render
|
||||||
* @param drawers the drawers that this element can use
|
* @param y position on the y axis to render
|
||||||
|
* @param drawers the drawers that this element can use
|
||||||
*/
|
*/
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void draw(int x, int y, IElementDrawers drawers);
|
void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id for the base of this element, used for sorting in the {@link CraftingMonitorElementList}
|
* Returns the id for the base of this element, used for sorting in the {@link CraftingMonitorElementList}
|
||||||
*
|
*
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ResourceLocation getBaseId();
|
ResourceLocation getBaseId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,11 +40,10 @@ public interface ICraftingMonitorElement {
|
|||||||
ResourceLocation getId();
|
ResourceLocation getId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the tooltip of this element, or null for no tooltip
|
* @return the tooltip of this element
|
||||||
*/
|
*/
|
||||||
@Nullable
|
default List<ITextComponent> getTooltip() {
|
||||||
default String getTooltip() {
|
return Collections.emptyList();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,6 +60,7 @@ public interface ICraftingMonitorElement {
|
|||||||
* @return true if merge was successful, false otherwise
|
* @return true if merge was successful, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean merge(ICraftingMonitorElement element);
|
boolean merge(ICraftingMonitorElement element);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the hash code for the underlying base item/fluid element
|
* @return the hash code for the underlying base item/fluid element
|
||||||
*/
|
*/
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.api.autocrafting.preview;
|
package com.refinedmods.refinedstorage.api.autocrafting.preview;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
|
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@@ -16,12 +17,13 @@ public interface ICraftingPreviewElement<T> {
|
|||||||
T getElement();
|
T getElement();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param x position on the x axis to render
|
* @param matrixStack the matrix stack
|
||||||
* @param y position on the y axis to render
|
* @param x position on the x axis to render
|
||||||
* @param drawers the drawers this element can use
|
* @param y position on the y axis to render
|
||||||
|
* @param drawers the drawers this element can use
|
||||||
*/
|
*/
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
void draw(int x, int y, IElementDrawers drawers);
|
void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return available amount of the {@link #getElement()}
|
* @return available amount of the {@link #getElement()}
|
||||||
|
@@ -36,7 +36,7 @@ public enum GridType implements IStringSerializable {
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.api.render;
|
package com.refinedmods.refinedstorage.api.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
||||||
|
|
||||||
@@ -14,9 +15,10 @@ import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewE
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IElementDrawer<T> {
|
public interface IElementDrawer<T> {
|
||||||
/**
|
/**
|
||||||
* @param x the x axis
|
* @param matrixStack the matrix stack
|
||||||
* @param y the y axis
|
* @param x the x axis
|
||||||
* @param element the element type
|
* @param y the y axis
|
||||||
|
* @param element the element type
|
||||||
*/
|
*/
|
||||||
void draw(int x, int y, T element);
|
void draw(MatrixStack matrixStack, int x, int y, T element);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.api.render;
|
package com.refinedmods.refinedstorage.api.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
@@ -52,7 +53,7 @@ public interface IElementDrawers {
|
|||||||
* @return a drawer that does nothing
|
* @return a drawer that does nothing
|
||||||
*/
|
*/
|
||||||
default <T> IElementDrawer<T> getNullDrawer() {
|
default <T> IElementDrawer<T> getNullDrawer() {
|
||||||
return (x, y, element) -> {
|
return (matrixStack, x, y, element) -> {
|
||||||
// NO OP
|
// NO OP
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@ public class CraftingMonitorElementList implements ICraftingMonitorElementList {
|
|||||||
private final Map<ResourceLocation, Map<Integer, ICraftingMonitorElement>> currentProcessingLists = new LinkedHashMap<>();
|
private final Map<ResourceLocation, Map<Integer, ICraftingMonitorElement>> currentProcessingLists = new LinkedHashMap<>();
|
||||||
private final Map<ResourceLocation, Map<Integer, ICraftingMonitorElement>> currentStorageLists = new LinkedHashMap<>();
|
private final Map<ResourceLocation, Map<Integer, ICraftingMonitorElement>> currentStorageLists = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void directAdd(ICraftingMonitorElement element) {
|
public void directAdd(ICraftingMonitorElement element) {
|
||||||
elements.add(element);
|
elements.add(element);
|
||||||
|
@@ -1,15 +1,21 @@
|
|||||||
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||||
import com.refinedmods.refinedstorage.api.render.IElementDrawers;
|
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.util.PacketBufferUtils;
|
import com.refinedmods.refinedstorage.util.PacketBufferUtils;
|
||||||
import net.minecraft.client.resources.I18n;
|
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.StringTextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ErrorCraftingMonitorElement implements ICraftingMonitorElement {
|
public class ErrorCraftingMonitorElement implements ICraftingMonitorElement {
|
||||||
public static final ResourceLocation ID = new ResourceLocation("error");
|
public static final ResourceLocation ID = new ResourceLocation("error");
|
||||||
@@ -24,16 +30,18 @@ public class ErrorCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void draw(int x, int y, IElementDrawers drawers) {
|
public void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers) {
|
||||||
base.draw(x, y, drawers);
|
base.draw(matrixStack, x, y, drawers);
|
||||||
|
|
||||||
drawers.getErrorDrawer().draw(x, y, null);
|
drawers.getErrorDrawer().draw(matrixStack, x, y, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip() {
|
public List<ITextComponent> getTooltip() {
|
||||||
return base.getTooltip() + "\n" + TextFormatting.RED + I18n.format(message);
|
List<ITextComponent> items = base.getTooltip(); // TODO Make sure this doesn't crash
|
||||||
|
items.add(new TranslationTextComponent(message).func_230530_a_(Styles.RED));
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||||
@@ -10,11 +11,14 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.resources.I18n;
|
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.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
|
public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
|
||||||
private static final int COLOR_PROCESSING = 0xFFD9EDF7;
|
private static final int COLOR_PROCESSING = 0xFFD9EDF7;
|
||||||
@@ -42,18 +46,18 @@ public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void draw(int x, int y, IElementDrawers drawers) {
|
public void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers) {
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_MISSING);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_MISSING);
|
||||||
} else if (processing > 0) {
|
} else if (processing > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_PROCESSING);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_PROCESSING);
|
||||||
} else if (scheduled > 0) {
|
} else if (scheduled > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_SCHEDULED);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_SCHEDULED);
|
||||||
} else if (crafting > 0) {
|
} else if (crafting > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_CRAFTING);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_CRAFTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawers.getFluidDrawer().draw(x + 4, y + 6, stack);
|
drawers.getFluidDrawer().draw(matrixStack, x + 4, y + 6, stack);
|
||||||
|
|
||||||
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
||||||
|
|
||||||
@@ -63,31 +67,31 @@ public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
int yy = y + 7;
|
int yy = y + 7;
|
||||||
|
|
||||||
if (stored > 0) {
|
if (stored > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.stored", API.instance().getQuantityFormatter().formatInBucketForm(stored)));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.stored", API.instance().getQuantityFormatter().formatInBucketForm(stored)));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.missing", API.instance().getQuantityFormatter().formatInBucketForm(missing)));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.missing", API.instance().getQuantityFormatter().formatInBucketForm(missing)));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processing > 0) {
|
if (processing > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.processing", API.instance().getQuantityFormatter().formatInBucketForm(processing)));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.processing", API.instance().getQuantityFormatter().formatInBucketForm(processing)));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheduled > 0) {
|
if (scheduled > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.scheduled", API.instance().getQuantityFormatter().formatInBucketForm(scheduled)));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.scheduled", API.instance().getQuantityFormatter().formatInBucketForm(scheduled)));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crafting > 0) {
|
if (crafting > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.crafting", API.instance().getQuantityFormatter().formatInBucketForm(crafting)));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.crafting", API.instance().getQuantityFormatter().formatInBucketForm(crafting)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
@@ -105,8 +109,8 @@ public class FluidCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip() {
|
public List<ITextComponent> getTooltip() {
|
||||||
return I18n.format(stack.getTranslationKey());
|
return Collections.singletonList(stack.getFluid().getAttributes().getDisplayName(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
package com.refinedmods.refinedstorage.apiimpl.autocrafting.craftingmonitor;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
|
||||||
@@ -12,10 +13,12 @@ import net.minecraft.client.resources.I18n;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
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.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
|
public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
|
||||||
private static final int COLOR_PROCESSING = 0xFFD9EDF7;
|
private static final int COLOR_PROCESSING = 0xFFD9EDF7;
|
||||||
@@ -43,18 +46,18 @@ public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void draw(int x, int y, IElementDrawers drawers) {
|
public void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers) {
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_MISSING);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_MISSING);
|
||||||
} else if (processing > 0) {
|
} else if (processing > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_PROCESSING);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_PROCESSING);
|
||||||
} else if (scheduled > 0) {
|
} else if (scheduled > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_SCHEDULED);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_SCHEDULED);
|
||||||
} else if (crafting > 0) {
|
} else if (crafting > 0) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, COLOR_CRAFTING);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, COLOR_CRAFTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawers.getItemDrawer().draw(x + 4, y + 6, stack);
|
drawers.getItemDrawer().draw(matrixStack, x + 4, y + 6, stack);
|
||||||
|
|
||||||
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
||||||
|
|
||||||
@@ -64,31 +67,31 @@ public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
int yy = y + 7;
|
int yy = y + 7;
|
||||||
|
|
||||||
if (stored > 0) {
|
if (stored > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.stored", stored));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.stored", stored));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing > 0) {
|
if (missing > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.missing", missing));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.missing", missing));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processing > 0) {
|
if (processing > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.processing", processing));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.processing", processing));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheduled > 0) {
|
if (scheduled > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.scheduled", scheduled));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.scheduled", scheduled));
|
||||||
|
|
||||||
yy += 7;
|
yy += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crafting > 0) {
|
if (crafting > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.crafting", crafting));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 25, scale), RenderUtils.getOffsetOnScale(yy, scale), I18n.format("gui.refinedstorage.crafting_monitor.crafting", crafting));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
@@ -106,8 +109,8 @@ public class ItemCraftingMonitorElement implements ICraftingMonitorElement {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip() {
|
public List<ITextComponent> getTooltip() {
|
||||||
return String.join("\n", RenderUtils.getTooltipFromItem(this.stack));
|
return RenderUtils.getTooltipFromItem(this.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
|
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.task.CraftingTaskErrorType;
|
import com.refinedmods.refinedstorage.api.autocrafting.task.CraftingTaskErrorType;
|
||||||
@@ -25,7 +26,7 @@ public class ErrorCraftingPreviewElement implements ICraftingPreviewElement<Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(int x, int y, IElementDrawers drawers) {
|
public void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers) {
|
||||||
// NO OP
|
// NO OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
|
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
||||||
@@ -14,6 +15,8 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class FluidCraftingPreviewElement implements ICraftingPreviewElement<FluidStack> {
|
public class FluidCraftingPreviewElement implements ICraftingPreviewElement<FluidStack> {
|
||||||
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid");
|
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "fluid");
|
||||||
|
|
||||||
@@ -58,15 +61,15 @@ public class FluidCraftingPreviewElement implements ICraftingPreviewElement<Flui
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void draw(int x, int y, IElementDrawers drawers) {
|
public void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers) {
|
||||||
if (missing) {
|
if (missing) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, 0xFFF2DEDE);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, 0xFFF2DEDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += 5;
|
x += 5;
|
||||||
y += 7;
|
y += 7;
|
||||||
|
|
||||||
drawers.getFluidDrawer().draw(x, y, getElement());
|
drawers.getFluidDrawer().draw(matrixStack, x, y, getElement());
|
||||||
|
|
||||||
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
||||||
|
|
||||||
@@ -77,13 +80,13 @@ public class FluidCraftingPreviewElement implements ICraftingPreviewElement<Flui
|
|||||||
|
|
||||||
if (getToCraft() > 0) {
|
if (getToCraft() > 0) {
|
||||||
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft";
|
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft";
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format(format, API.instance().getQuantityFormatter().formatInBucketForm(getToCraft())));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format(format, API.instance().getQuantityFormatter().formatInBucketForm(getToCraft())));
|
||||||
|
|
||||||
y += 7;
|
y += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getAvailable() > 0) {
|
if (getAvailable() > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format("gui.refinedstorage.crafting_preview.available", API.instance().getQuantityFormatter().formatInBucketForm(getAvailable())));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format("gui.refinedstorage.crafting_preview.available", API.instance().getQuantityFormatter().formatInBucketForm(getAvailable())));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
|
package com.refinedmods.refinedstorage.apiimpl.autocrafting.preview;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
import com.refinedmods.refinedstorage.api.autocrafting.preview.ICraftingPreviewElement;
|
||||||
@@ -58,15 +59,15 @@ public class ItemCraftingPreviewElement implements ICraftingPreviewElement<ItemS
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public void draw(int x, int y, IElementDrawers drawers) {
|
public void draw(MatrixStack matrixStack, int x, int y, IElementDrawers drawers) {
|
||||||
if (missing) {
|
if (missing) {
|
||||||
drawers.getOverlayDrawer().draw(x, y, 0xFFF2DEDE);
|
drawers.getOverlayDrawer().draw(matrixStack, x, y, 0xFFF2DEDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
x += 5;
|
x += 5;
|
||||||
y += 7;
|
y += 7;
|
||||||
|
|
||||||
drawers.getItemDrawer().draw(x, y, getElement());
|
drawers.getItemDrawer().draw(matrixStack, x, y, getElement());
|
||||||
|
|
||||||
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
float scale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.5F;
|
||||||
|
|
||||||
@@ -77,13 +78,13 @@ public class ItemCraftingPreviewElement implements ICraftingPreviewElement<ItemS
|
|||||||
|
|
||||||
if (getToCraft() > 0) {
|
if (getToCraft() > 0) {
|
||||||
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft";
|
String format = hasMissing() ? "gui.refinedstorage.crafting_preview.missing" : "gui.refinedstorage.crafting_preview.to_craft";
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format(format, getToCraft()));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format(format, getToCraft()));
|
||||||
|
|
||||||
y += 7;
|
y += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getAvailable() > 0) {
|
if (getAvailable() > 0) {
|
||||||
drawers.getStringDrawer().draw(RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format("gui.refinedstorage.crafting_preview.available", getAvailable()));
|
drawers.getStringDrawer().draw(matrixStack, RenderUtils.getOffsetOnScale(x + 23, scale), RenderUtils.getOffsetOnScale(y, scale), I18n.format("gui.refinedstorage.crafting_preview.available", getAvailable()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
@@ -49,9 +49,9 @@ public class GridTab implements IGridTab {
|
|||||||
if (!icon.isEmpty()) {
|
if (!icon.isEmpty()) {
|
||||||
RenderHelper.setupGui3DDiffuseLighting();
|
RenderHelper.setupGui3DDiffuseLighting();
|
||||||
|
|
||||||
itemDrawer.draw(x, y, icon);
|
itemDrawer.draw(matrixStack, x, y, icon);
|
||||||
} else {
|
} else {
|
||||||
fluidDrawer.draw(x, y, fluidIcon);
|
fluidDrawer.draw(matrixStack, x, y, fluidIcon);
|
||||||
|
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
}
|
}
|
||||||
|
@@ -183,7 +183,7 @@ public class CrafterNetworkNode extends NetworkNode implements ICraftingPatternC
|
|||||||
StackUtils.readItems(upgrades, 1, tag);
|
StackUtils.readItems(upgrades, 1, tag);
|
||||||
|
|
||||||
if (tag.contains(NBT_DISPLAY_NAME)) {
|
if (tag.contains(NBT_DISPLAY_NAME)) {
|
||||||
displayName = ITextComponent.Serializer.fromJson(tag.getString(NBT_DISPLAY_NAME));
|
displayName = ITextComponent.Serializer.func_240643_a_(tag.getString(NBT_DISPLAY_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.hasUniqueId(NBT_UUID)) {
|
if (tag.hasUniqueId(NBT_UUID)) {
|
||||||
|
@@ -12,19 +12,19 @@ public class CraftingMonitorElementDrawers extends ElementDrawers {
|
|||||||
private int itemWidth;
|
private int itemWidth;
|
||||||
private int itemHeight;
|
private int itemHeight;
|
||||||
|
|
||||||
private final IElementDrawer<Integer> overlayDrawer = (x, y, color) -> {
|
private final IElementDrawer<Integer> overlayDrawer = (matrixStack, x, y, color) -> {
|
||||||
RenderSystem.color4f(1, 1, 1, 1);
|
RenderSystem.color4f(1, 1, 1, 1);
|
||||||
RenderSystem.disableLighting();
|
RenderSystem.disableLighting();
|
||||||
|
|
||||||
AbstractGui.fill(x, y, x + itemWidth, y + itemHeight, color);
|
AbstractGui.fill(matrixStack, x, y, x + itemWidth, y + itemHeight, color);
|
||||||
};
|
};
|
||||||
|
|
||||||
private final IElementDrawer<?> errorDrawer = (x, y, nothing) -> {
|
private final IElementDrawer<?> errorDrawer = (matrixStack, x, y, nothing) -> {
|
||||||
RenderSystem.color4f(1, 1, 1, 1);
|
RenderSystem.color4f(1, 1, 1, 1);
|
||||||
RenderSystem.disableLighting();
|
RenderSystem.disableLighting();
|
||||||
|
|
||||||
screen.bindTexture(RS.ID, "gui/crafting_preview.png");
|
screen.bindTexture(RS.ID, "gui/crafting_preview.png");
|
||||||
screen.blit(x + itemWidth - 12 - 2, y + itemHeight - 12 - 2, 0, 244, 12, 12);
|
screen.blit(matrixStack, x + itemWidth - 12 - 2, y + itemHeight - 12 - 2, 0, 244, 12, 12);
|
||||||
};
|
};
|
||||||
|
|
||||||
public CraftingMonitorElementDrawers(BaseScreen<CraftingMonitorContainer> gui, FontRenderer fontRenderer, int itemWidth, int itemHeight) {
|
public CraftingMonitorElementDrawers(BaseScreen<CraftingMonitorContainer> gui, FontRenderer fontRenderer, int itemWidth, int itemHeight) {
|
||||||
|
@@ -7,11 +7,11 @@ import net.minecraft.client.gui.AbstractGui;
|
|||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
|
||||||
public class CraftingPreviewElementDrawers extends ElementDrawers {
|
public class CraftingPreviewElementDrawers extends ElementDrawers {
|
||||||
private final IElementDrawer<Integer> overlayDrawer = (x, y, colour) -> {
|
private final IElementDrawer<Integer> overlayDrawer = (matrixStack, x, y, color) -> {
|
||||||
RenderSystem.color4f(1, 1, 1, 1);
|
RenderSystem.color4f(1, 1, 1, 1);
|
||||||
RenderSystem.disableLighting();
|
RenderSystem.disableLighting();
|
||||||
|
|
||||||
AbstractGui.fill(x, y, x + 73, y + 29, colour);
|
AbstractGui.fill(matrixStack, x, y, x + 73, y + 29, color);
|
||||||
};
|
};
|
||||||
|
|
||||||
public CraftingPreviewElementDrawers(CraftingPreviewScreen screen, FontRenderer fontRenderer) {
|
public CraftingPreviewElementDrawers(CraftingPreviewScreen screen, FontRenderer fontRenderer) {
|
||||||
|
@@ -28,7 +28,7 @@ public class GridBlock extends NetworkNodeBlock {
|
|||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
this.setRegistryName(RS.ID, type == GridType.NORMAL ? "grid" : type.getName() + "_grid");
|
this.setRegistryName(RS.ID, type == GridType.NORMAL ? "grid" : type.getString() + "_grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -34,22 +34,22 @@ public class PatternDumpCommand implements Command<CommandSource> {
|
|||||||
|
|
||||||
CraftingPattern pattern = PatternItem.fromCache(context.getSource().getWorld(), stack);
|
CraftingPattern pattern = PatternItem.fromCache(context.getSource().getWorld(), stack);
|
||||||
|
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Crafting task factory ID: ").setStyle(Styles.YELLOW).appendSibling(new StringTextComponent(pattern.getCraftingTaskFactoryId().toString()).setStyle(Styles.WHITE)), false);
|
context.getSource().sendFeedback(new StringTextComponent("Crafting task factory ID: ").func_230530_a_(Styles.YELLOW).func_230529_a_(new StringTextComponent(pattern.getCraftingTaskFactoryId().toString()).func_230530_a_(Styles.WHITE)), false);
|
||||||
|
|
||||||
if (!pattern.isValid()) {
|
if (!pattern.isValid()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Pattern is invalid! Reason: ").appendSibling(pattern.getErrorMessage()).setStyle(Styles.RED), false);
|
context.getSource().sendFeedback(new StringTextComponent("Pattern is invalid! Reason: ").func_230529_a_(pattern.getErrorMessage()).func_230530_a_(Styles.RED), false);
|
||||||
} else {
|
} else {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Processing: ").setStyle(Styles.YELLOW).appendSibling(new StringTextComponent(String.valueOf(processing)).setStyle(Styles.WHITE)), false);
|
context.getSource().sendFeedback(new StringTextComponent("Processing: ").func_230530_a_(Styles.YELLOW).func_230529_a_(new StringTextComponent(String.valueOf(processing)).func_230530_a_(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("Exact: ").func_230530_a_(Styles.YELLOW).func_230529_a_(new StringTextComponent(String.valueOf(exact)).func_230530_a_(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);
|
context.getSource().sendFeedback(new StringTextComponent("Has allowed tag list: ").func_230530_a_(Styles.YELLOW).func_230529_a_(new StringTextComponent(String.valueOf(allowedTagList != null)).func_230530_a_(Styles.WHITE)), false);
|
||||||
|
|
||||||
if (pattern.isProcessing()) {
|
if (pattern.isProcessing()) {
|
||||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||||
if (!pattern.getInputs().get(i).isEmpty()) {
|
if (!pattern.getInputs().get(i).isEmpty()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Item inputs in slot " + i + ":").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Item inputs in slot " + i + ":").func_230530_a_(Styles.YELLOW), false);
|
||||||
|
|
||||||
for (int j = 0; j < pattern.getInputs().get(i).size(); ++j) {
|
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 ").appendSibling(pattern.getInputs().get(i).get(j).getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getInputs().get(i).get(j).getCount() + "x ").func_230529_a_(pattern.getInputs().get(i).get(j).getDisplayName()), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,10 +62,10 @@ public class PatternDumpCommand implements Command<CommandSource> {
|
|||||||
|
|
||||||
for (int i = 0; i < pattern.getFluidInputs().size(); ++i) {
|
for (int i = 0; i < pattern.getFluidInputs().size(); ++i) {
|
||||||
if (!pattern.getFluidInputs().get(i).isEmpty()) {
|
if (!pattern.getFluidInputs().get(i).isEmpty()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Fluid inputs in slot " + i + ":").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Fluid inputs in slot " + i + ":").func_230530_a_(Styles.YELLOW), false);
|
||||||
|
|
||||||
for (int j = 0; j < pattern.getFluidInputs().get(i).size(); ++j) {
|
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 ").appendSibling(pattern.getFluidInputs().get(i).get(j).getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getFluidInputs().get(i).get(j).getAmount() + " mB ").func_230529_a_(pattern.getFluidInputs().get(i).get(j).getDisplayName()), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,29 +76,29 @@ public class PatternDumpCommand implements Command<CommandSource> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Outputs").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Outputs").func_230530_a_(Styles.YELLOW), false);
|
||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").appendSibling(output.getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").func_230529_a_(output.getDisplayName()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Fluid outputs").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Fluid outputs").func_230530_a_(Styles.YELLOW), false);
|
||||||
for (FluidStack output : pattern.getFluidOutputs()) {
|
for (FluidStack output : pattern.getFluidOutputs()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("- " + output.getAmount() + " mB ").appendSibling(output.getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- " + output.getAmount() + " mB ").func_230529_a_(output.getDisplayName()), false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||||
if (!pattern.getInputs().get(i).isEmpty()) {
|
if (!pattern.getInputs().get(i).isEmpty()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Inputs in slot " + i + ":").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Inputs in slot " + i + ":").func_230530_a_(Styles.YELLOW), false);
|
||||||
|
|
||||||
for (int j = 0; j < pattern.getInputs().get(i).size(); ++j) {
|
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 ").appendSibling(pattern.getInputs().get(i).get(j).getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- Possibility #" + j + ": " + pattern.getInputs().get(i).get(j).getCount() + "x ").func_230529_a_(pattern.getInputs().get(i).get(j).getDisplayName()), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Outputs").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Outputs").func_230530_a_(Styles.YELLOW), false);
|
||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").appendSibling(output.getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- " + output.getCount() + "x ").func_230529_a_(output.getDisplayName()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean anyByproducts = false;
|
boolean anyByproducts = false;
|
||||||
@@ -106,18 +106,18 @@ public class PatternDumpCommand implements Command<CommandSource> {
|
|||||||
for (ItemStack byproduct : pattern.getByproducts()) {
|
for (ItemStack byproduct : pattern.getByproducts()) {
|
||||||
if (!byproduct.isEmpty()) {
|
if (!byproduct.isEmpty()) {
|
||||||
if (!anyByproducts) {
|
if (!anyByproducts) {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("Byproducts").setStyle(Styles.YELLOW), false);
|
context.getSource().sendFeedback(new StringTextComponent("Byproducts").func_230530_a_(Styles.YELLOW), false);
|
||||||
|
|
||||||
anyByproducts = true;
|
anyByproducts = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.getSource().sendFeedback(new StringTextComponent("- " + byproduct.getCount() + "x ").appendSibling(byproduct.getDisplayName()), false);
|
context.getSource().sendFeedback(new StringTextComponent("- " + byproduct.getCount() + "x ").func_230529_a_(byproduct.getDisplayName()), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.getSource().sendFeedback(new StringTextComponent("You need to be holding a pattern in your hand.").setStyle(Styles.RED), false);
|
context.getSource().sendFeedback(new StringTextComponent("You need to be holding a pattern in your hand.").func_230530_a_(Styles.RED), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -21,7 +21,7 @@ public class CrafterManagerContainerFactory implements IContainerFactory<Crafter
|
|||||||
int size = buf.readInt();
|
int size = buf.readInt();
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
data.put(buf.readTextComponent().getFormattedText(), buf.readInt());
|
data.put(buf.readTextComponent().getString(), buf.readInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
CrafterManagerContainer container = new CrafterManagerContainer((CrafterManagerTile) inv.player.world.getTileEntity(pos), inv.player, windowId);
|
CrafterManagerContainer container = new CrafterManagerContainer((CrafterManagerTile) inv.player.world.getTileEntity(pos), inv.player, windowId);
|
||||||
|
@@ -64,7 +64,7 @@ public abstract class EnergyItem extends Item {
|
|||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
if (!creative) {
|
if (!creative) {
|
||||||
stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(energy -> tooltip.add(new TranslationTextComponent("misc.refinedstorage.energy_stored", energy.getEnergyStored(), energy.getMaxEnergyStored()).setStyle(Styles.GRAY)));
|
stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(energy -> tooltip.add(new TranslationTextComponent("misc.refinedstorage.energy_stored", energy.getEnergyStored(), energy.getMaxEnergyStored()).func_230530_a_(Styles.GRAY)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -78,10 +78,10 @@ public class FilterItem extends Item {
|
|||||||
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
tooltip.add(new TranslationTextComponent("sidebutton.refinedstorage.mode." + (getMode(stack) == IFilter.MODE_WHITELIST ? "whitelist" : "blacklist")).setStyle(Styles.YELLOW));
|
tooltip.add(new TranslationTextComponent("sidebutton.refinedstorage.mode." + (getMode(stack) == IFilter.MODE_WHITELIST ? "whitelist" : "blacklist")).func_230530_a_(Styles.YELLOW));
|
||||||
|
|
||||||
if (isModFilter(stack)) {
|
if (isModFilter(stack)) {
|
||||||
tooltip.add(new TranslationTextComponent("gui.refinedstorage.filter.mod_filter").setStyle(Styles.BLUE));
|
tooltip.add(new TranslationTextComponent("gui.refinedstorage.filter.mod_filter").func_230530_a_(Styles.BLUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterItemsItemHandler items = new FilterItemsItemHandler(stack);
|
FilterItemsItemHandler items = new FilterItemsItemHandler(stack);
|
||||||
|
@@ -68,14 +68,14 @@ public class FluidStorageDiskItem extends Item implements IStorageDiskProvider {
|
|||||||
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.getCapacity() == -1) {
|
if (data.getCapacity() == -1) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).func_230530_a_(Styles.GRAY));
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag.isAdvanced()) {
|
if (flag.isAdvanced()) {
|
||||||
tooltip.add(new StringTextComponent(id.toString()).setStyle(Styles.GRAY));
|
tooltip.add(new StringTextComponent(id.toString()).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ public class FluidStorageDiskItem extends Item implements IStorageDiskProvider {
|
|||||||
ItemStack storagePart = new ItemStack(FluidStoragePartItem.getByType(type), diskStack.getCount());
|
ItemStack storagePart = new ItemStack(FluidStoragePartItem.getByType(type), diskStack.getCount());
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
|
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), storagePart);
|
||||||
}
|
}
|
||||||
|
|
||||||
API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack));
|
API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack));
|
||||||
|
@@ -7,6 +7,7 @@ import com.refinedmods.refinedstorage.util.NetworkUtils;
|
|||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemModelsProperties;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUseContext;
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
@@ -36,7 +37,7 @@ public abstract class NetworkItem extends EnergyItem implements INetworkItemProv
|
|||||||
public NetworkItem(Item.Properties item, boolean creative, Supplier<Integer> energyCapacity) {
|
public NetworkItem(Item.Properties item, boolean creative, Supplier<Integer> energyCapacity) {
|
||||||
super(item, creative, energyCapacity);
|
super(item, creative, energyCapacity);
|
||||||
|
|
||||||
addPropertyOverride(new ResourceLocation("connected"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f);
|
ItemModelsProperties.func_239418_a_(this, new ResourceLocation("connected"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -44,7 +45,7 @@ public abstract class NetworkItem extends EnergyItem implements INetworkItemProv
|
|||||||
ItemStack stack = player.getHeldItem(hand);
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
applyNetwork(world.getServer(), stack, n -> n.getNetworkItemManager().open(player, player.getHeldItem(hand), player.inventory.currentItem), player::sendMessage);
|
applyNetwork(world.getServer(), stack, n -> n.getNetworkItemManager().open(player, player.getHeldItem(hand), player.inventory.currentItem), err -> player.sendMessage(err, player.getUniqueID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActionResult.resultSuccess(stack);
|
return ActionResult.resultSuccess(stack);
|
||||||
@@ -84,7 +85,7 @@ public abstract class NetworkItem extends EnergyItem implements INetworkItemProv
|
|||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
if (isValid(stack)) {
|
if (isValid(stack)) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.network_item.tooltip", getX(stack), getY(stack), getZ(stack)).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.network_item.tooltip", getX(stack), getY(stack), getZ(stack)).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,12 +74,12 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
|||||||
|
|
||||||
if (pattern.isValid()) {
|
if (pattern.isValid()) {
|
||||||
if (ContainerScreen.hasShiftDown() || isProcessing(stack)) {
|
if (ContainerScreen.hasShiftDown() || isProcessing(stack)) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.inputs").setStyle(Styles.YELLOW));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.inputs").func_230530_a_(Styles.YELLOW));
|
||||||
|
|
||||||
RenderUtils.addCombinedItemsToTooltip(tooltip, true, pattern.getInputs().stream().map(i -> i.size() > 0 ? i.get(0) : ItemStack.EMPTY).collect(Collectors.toList()));
|
RenderUtils.addCombinedItemsToTooltip(tooltip, true, pattern.getInputs().stream().map(i -> i.size() > 0 ? i.get(0) : ItemStack.EMPTY).collect(Collectors.toList()));
|
||||||
RenderUtils.addCombinedFluidsToTooltip(tooltip, true, pattern.getFluidInputs().stream().map(i -> i.size() > 0 ? i.get(0) : FluidStack.EMPTY).collect(Collectors.toList()));
|
RenderUtils.addCombinedFluidsToTooltip(tooltip, true, pattern.getFluidInputs().stream().map(i -> i.size() > 0 ? i.get(0) : FluidStack.EMPTY).collect(Collectors.toList()));
|
||||||
|
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.outputs").setStyle(Styles.YELLOW));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.outputs").func_230530_a_(Styles.YELLOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderUtils.addCombinedItemsToTooltip(tooltip, true, pattern.getOutputs());
|
RenderUtils.addCombinedItemsToTooltip(tooltip, true, pattern.getOutputs());
|
||||||
@@ -94,7 +94,7 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
|||||||
"misc.refinedstorage.pattern.allowed_item_tag",
|
"misc.refinedstorage.pattern.allowed_item_tag",
|
||||||
tag.toString(),
|
tag.toString(),
|
||||||
pattern.getInputs().get(i).get(0).getDisplayName()
|
pattern.getInputs().get(i).get(0).getDisplayName()
|
||||||
).setStyle(Styles.AQUA));
|
).func_230530_a_(Styles.AQUA));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,21 +106,21 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
|||||||
"misc.refinedstorage.pattern.allowed_fluid_tag",
|
"misc.refinedstorage.pattern.allowed_fluid_tag",
|
||||||
tag.toString(),
|
tag.toString(),
|
||||||
pattern.getFluidInputs().get(i).get(0).getDisplayName()
|
pattern.getFluidInputs().get(i).get(0).getDisplayName()
|
||||||
).setStyle(Styles.AQUA));
|
).func_230530_a_(Styles.AQUA));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isExact(stack)) {
|
if (isExact(stack)) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.exact").setStyle(Styles.BLUE));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.exact").func_230530_a_(Styles.BLUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isProcessing(stack)) {
|
if (isProcessing(stack)) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.processing").setStyle(Styles.BLUE));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.processing").func_230530_a_(Styles.BLUE));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.invalid").setStyle(Styles.RED));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.pattern.invalid").func_230530_a_(Styles.RED));
|
||||||
tooltip.add(pattern.getErrorMessage().setStyle(Styles.GRAY));
|
tooltip.add(pattern.getErrorMessage().copyRaw().func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,8 +4,10 @@ import com.refinedmods.refinedstorage.RS;
|
|||||||
import com.refinedmods.refinedstorage.api.network.security.Permission;
|
import com.refinedmods.refinedstorage.api.network.security.Permission;
|
||||||
import com.refinedmods.refinedstorage.render.Styles;
|
import com.refinedmods.refinedstorage.render.Styles;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.data.ItemModelProvider;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemModelsProperties;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
@@ -30,7 +32,7 @@ public class SecurityCardItem extends Item {
|
|||||||
|
|
||||||
this.setRegistryName(RS.ID, "security_card");
|
this.setRegistryName(RS.ID, "security_card");
|
||||||
|
|
||||||
addPropertyOverride(new ResourceLocation("active"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f);
|
ItemModelsProperties.func_239418_a_(this, new ResourceLocation("active"), (stack, world, entity) -> (entity != null && isValid(stack)) ? 1.0f : 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -83,12 +85,12 @@ public class SecurityCardItem extends Item {
|
|||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
if (stack.hasTag() && stack.getTag().contains(NBT_OWNER_NAME)) {
|
if (stack.hasTag() && stack.getTag().contains(NBT_OWNER_NAME)) {
|
||||||
tooltip.add(new TranslationTextComponent("item.refinedstorage.security_card.owner", stack.getTag().getString(NBT_OWNER_NAME)).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("item.refinedstorage.security_card.owner", stack.getTag().getString(NBT_OWNER_NAME)).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Permission permission : Permission.values()) {
|
for (Permission permission : Permission.values()) {
|
||||||
if (hasPermission(stack, permission)) {
|
if (hasPermission(stack, permission)) {
|
||||||
tooltip.add(new StringTextComponent("- ").appendSibling(new TranslationTextComponent("gui.refinedstorage.security_manager.permission." + permission.getId())).setStyle(Styles.GRAY));
|
tooltip.add(new StringTextComponent("- ").func_230529_a_(new TranslationTextComponent("gui.refinedstorage.security_manager.permission." + permission.getId())).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,14 +68,14 @@ public class StorageDiskItem extends Item implements IStorageDiskProvider {
|
|||||||
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.getCapacity() == -1) {
|
if (data.getCapacity() == -1) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).func_230530_a_(Styles.GRAY));
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag.isAdvanced()) {
|
if (flag.isAdvanced()) {
|
||||||
tooltip.add(new StringTextComponent(id.toString()).setStyle(Styles.GRAY));
|
tooltip.add(new StringTextComponent(id.toString()).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ public class StorageDiskItem extends Item implements IStorageDiskProvider {
|
|||||||
ItemStack storagePart = new ItemStack(StoragePartItem.getByType(type), diskStack.getCount());
|
ItemStack storagePart = new ItemStack(StoragePartItem.getByType(type), diskStack.getCount());
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
|
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), storagePart);
|
||||||
}
|
}
|
||||||
|
|
||||||
API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack));
|
API.instance().getStorageDiskManager((ServerWorld) world).remove(getId(diskStack));
|
||||||
|
@@ -4,7 +4,9 @@ import com.refinedmods.refinedstorage.RS;
|
|||||||
import com.refinedmods.refinedstorage.api.network.NetworkType;
|
import com.refinedmods.refinedstorage.api.network.NetworkType;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.Network;
|
import com.refinedmods.refinedstorage.apiimpl.network.Network;
|
||||||
import com.refinedmods.refinedstorage.block.ControllerBlock;
|
import com.refinedmods.refinedstorage.block.ControllerBlock;
|
||||||
|
import net.minecraft.data.ItemModelProvider;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemModelsProperties;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
@@ -14,7 +16,8 @@ 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());
|
super(block, new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1), block.getType() == NetworkType.CREATIVE, () -> RS.SERVER_CONFIG.getController().getCapacity());
|
||||||
|
|
||||||
this.setRegistryName(block.getRegistryName());
|
this.setRegistryName(block.getRegistryName());
|
||||||
this.addPropertyOverride(new ResourceLocation("energy_type"), (stack, world, entity) -> {
|
|
||||||
|
ItemModelsProperties.func_239418_a_(this, new ResourceLocation("energy_type"), (stack, world, entity) -> {
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY).orElse(null);
|
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY).orElse(null);
|
||||||
if (storage != null) {
|
if (storage != null) {
|
||||||
return Network.getEnergyType(storage.getEnergyStored(), storage.getMaxEnergyStored()).ordinal();
|
return Network.getEnergyType(storage.getEnergyStored(), storage.getMaxEnergyStored()).ordinal();
|
||||||
|
@@ -65,7 +65,7 @@ public abstract class EnergyBlockItem extends BaseBlockItem {
|
|||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
if (!creative) {
|
if (!creative) {
|
||||||
stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(energy -> tooltip.add(new TranslationTextComponent("misc.refinedstorage.energy_stored", energy.getEnergyStored(), energy.getMaxEnergyStored()).setStyle(Styles.GRAY)));
|
stack.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(energy -> tooltip.add(new TranslationTextComponent("misc.refinedstorage.energy_stored", energy.getEnergyStored(), energy.getMaxEnergyStored()).func_230530_a_(Styles.GRAY)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,14 +53,14 @@ public class FluidStorageBlockItem extends BaseBlockItem {
|
|||||||
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.getCapacity() == -1) {
|
if (data.getCapacity() == -1) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).func_230530_a_(Styles.GRAY));
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag.isAdvanced()) {
|
if (flag.isAdvanced()) {
|
||||||
tooltip.add(new StringTextComponent(id.toString()).setStyle(Styles.GRAY));
|
tooltip.add(new StringTextComponent(id.toString()).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,19 +83,19 @@ public class FluidStorageBlockItem extends BaseBlockItem {
|
|||||||
ItemStack fluidStoragePart = new ItemStack(FluidStoragePartItem.getByType(type));
|
ItemStack fluidStoragePart = new ItemStack(FluidStoragePartItem.getByType(type));
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(fluidStoragePart.copy())) {
|
if (!player.inventory.addItemStackToInventory(fluidStoragePart.copy())) {
|
||||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), fluidStoragePart);
|
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), fluidStoragePart);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack processor = new ItemStack(RSItems.BASIC_PROCESSOR);
|
ItemStack processor = new ItemStack(RSItems.BASIC_PROCESSOR);
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(processor.copy())) {
|
if (!player.inventory.addItemStackToInventory(processor.copy())) {
|
||||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), processor);
|
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), processor);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack bucket = new ItemStack(Items.BUCKET);
|
ItemStack bucket = new ItemStack(Items.BUCKET);
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(bucket.copy())) {
|
if (!player.inventory.addItemStackToInventory(bucket.copy())) {
|
||||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), bucket);
|
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk != null) {
|
if (disk != null) {
|
||||||
|
@@ -61,7 +61,7 @@ public class PortableGridBlockItem extends EnergyBlockItem {
|
|||||||
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
tooltip.add(new TranslationTextComponent("block.refinedstorage.portable_grid.tooltip").setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("block.refinedstorage.portable_grid.tooltip").func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -51,14 +51,14 @@ public class StorageBlockItem extends BaseBlockItem {
|
|||||||
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(id);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
if (data.getCapacity() == -1) {
|
if (data.getCapacity() == -1) {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored", API.instance().getQuantityFormatter().format(data.getStored())).func_230530_a_(Styles.GRAY));
|
||||||
} else {
|
} else {
|
||||||
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("misc.refinedstorage.storage.stored_capacity", API.instance().getQuantityFormatter().format(data.getStored()), API.instance().getQuantityFormatter().format(data.getCapacity())).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag.isAdvanced()) {
|
if (flag.isAdvanced()) {
|
||||||
tooltip.add(new StringTextComponent(id.toString()).setStyle(Styles.GRAY));
|
tooltip.add(new StringTextComponent(id.toString()).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ public class StorageBlockItem extends BaseBlockItem {
|
|||||||
ItemStack storagePart = new ItemStack(StoragePartItem.getByType(type));
|
ItemStack storagePart = new ItemStack(StoragePartItem.getByType(type));
|
||||||
|
|
||||||
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||||
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
|
InventoryHelper.spawnItemStack(world, player.getPosX(), player.getPosY(), player.getPosZ(), storagePart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk != null) {
|
if (disk != null) {
|
||||||
|
@@ -24,6 +24,6 @@ public class WirelessTransmitterBlockItem extends BaseBlockItem {
|
|||||||
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
||||||
super.addInformation(stack, world, tooltip, flag);
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
tooltip.add(new TranslationTextComponent("block.refinedstorage.wireless_transmitter.tooltip", new TranslationTextComponent("block.refinedstorage.cable")).setStyle(Styles.GRAY));
|
tooltip.add(new TranslationTextComponent("block.refinedstorage.wireless_transmitter.tooltip", new TranslationTextComponent("block.refinedstorage.cable")).func_230530_a_(Styles.GRAY));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,26 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
package com.refinedmods.refinedstorage.loottable;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.refinedmods.refinedstorage.RSLootFunctions;
|
||||||
import com.refinedmods.refinedstorage.api.network.INetwork;
|
import com.refinedmods.refinedstorage.api.network.INetwork;
|
||||||
import com.refinedmods.refinedstorage.tile.ControllerTile;
|
import com.refinedmods.refinedstorage.tile.ControllerTile;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.LootContext;
|
||||||
|
import net.minecraft.loot.LootFunction;
|
||||||
|
import net.minecraft.loot.LootFunctionType;
|
||||||
|
import net.minecraft.loot.LootParameters;
|
||||||
|
import net.minecraft.loot.conditions.ILootCondition;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.storage.loot.LootContext;
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
|
|
||||||
public class ControllerLootFunction implements ILootFunction {
|
public class ControllerLootFunction extends LootFunction {
|
||||||
|
protected ControllerLootFunction(ILootCondition[] conditions) {
|
||||||
|
super(conditions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack apply(ItemStack itemStack, LootContext lootContext) {
|
protected ItemStack doApply(ItemStack itemStack, LootContext lootContext) {
|
||||||
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
||||||
|
|
||||||
if (tile instanceof ControllerTile) {
|
if (tile instanceof ControllerTile) {
|
||||||
@@ -22,4 +31,16 @@ public class ControllerLootFunction implements ILootFunction {
|
|||||||
|
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LootFunctionType func_230425_b_() {
|
||||||
|
return RSLootFunctions.CONTROLLER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Serializer extends LootFunction.Serializer<ControllerLootFunction> {
|
||||||
|
@Override
|
||||||
|
public ControllerLootFunction deserialize(JsonObject object, JsonDeserializationContext deserializationContext, ILootCondition[] conditions) {
|
||||||
|
return new ControllerLootFunction(conditions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonSerializationContext;
|
|
||||||
import com.refinedmods.refinedstorage.RS;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class ControllerLootFunctionSerializer extends ILootFunction.Serializer<ControllerLootFunction> {
|
|
||||||
public ControllerLootFunctionSerializer() {
|
|
||||||
super(new ResourceLocation(RS.ID, "controller"), ControllerLootFunction.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(JsonObject jsonObject, ControllerLootFunction controllerLootFunction, JsonSerializationContext jsonSerializationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ControllerLootFunction deserialize(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
|
|
||||||
return new ControllerLootFunction();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,16 +1,25 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
package com.refinedmods.refinedstorage.loottable;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.refinedmods.refinedstorage.RSLootFunctions;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.CrafterNetworkNode;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.CrafterNetworkNode;
|
||||||
import com.refinedmods.refinedstorage.tile.CrafterTile;
|
import com.refinedmods.refinedstorage.tile.CrafterTile;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.LootContext;
|
||||||
|
import net.minecraft.loot.LootFunction;
|
||||||
|
import net.minecraft.loot.LootFunctionType;
|
||||||
|
import net.minecraft.loot.LootParameters;
|
||||||
|
import net.minecraft.loot.conditions.ILootCondition;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.storage.loot.LootContext;
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class CrafterLootFunction implements ILootFunction {
|
public class CrafterLootFunction extends LootFunction {
|
||||||
|
protected CrafterLootFunction(ILootCondition[] conditions) {
|
||||||
|
super(conditions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack apply(ItemStack stack, LootContext lootContext) {
|
public ItemStack doApply(ItemStack stack, LootContext lootContext) {
|
||||||
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
||||||
|
|
||||||
CrafterNetworkNode removedNode = ((CrafterTile) tile).getRemovedNode();
|
CrafterNetworkNode removedNode = ((CrafterTile) tile).getRemovedNode();
|
||||||
@@ -24,4 +33,16 @@ public class CrafterLootFunction implements ILootFunction {
|
|||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LootFunctionType func_230425_b_() {
|
||||||
|
return RSLootFunctions.CRAFTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Serializer extends LootFunction.Serializer<CrafterLootFunction> {
|
||||||
|
@Override
|
||||||
|
public CrafterLootFunction deserialize(JsonObject object, JsonDeserializationContext deserializationContext, ILootCondition[] conditions) {
|
||||||
|
return new CrafterLootFunction(conditions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonSerializationContext;
|
|
||||||
import com.refinedmods.refinedstorage.RS;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class CrafterLootFunctionSerializer extends ILootFunction.Serializer<CrafterLootFunction> {
|
|
||||||
public CrafterLootFunctionSerializer() {
|
|
||||||
super(new ResourceLocation(RS.ID, "crafter"), CrafterLootFunction.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(JsonObject jsonObject, CrafterLootFunction crafterLootFunction, JsonSerializationContext jsonSerializationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CrafterLootFunction deserialize(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
|
|
||||||
return new CrafterLootFunction();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,15 +1,24 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
package com.refinedmods.refinedstorage.loottable;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.refinedmods.refinedstorage.RSLootFunctions;
|
||||||
import com.refinedmods.refinedstorage.tile.grid.portable.PortableGridTile;
|
import com.refinedmods.refinedstorage.tile.grid.portable.PortableGridTile;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.LootContext;
|
||||||
|
import net.minecraft.loot.LootFunction;
|
||||||
|
import net.minecraft.loot.LootFunctionType;
|
||||||
|
import net.minecraft.loot.LootParameters;
|
||||||
|
import net.minecraft.loot.conditions.ILootCondition;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.storage.loot.LootContext;
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class PortableGridBlockLootFunction implements ILootFunction {
|
public class PortableGridBlockLootFunction extends LootFunction {
|
||||||
|
protected PortableGridBlockLootFunction(ILootCondition[] conditions) {
|
||||||
|
super(conditions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack apply(ItemStack stack, LootContext lootContext) {
|
public ItemStack doApply(ItemStack stack, LootContext lootContext) {
|
||||||
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
||||||
|
|
||||||
if (tile instanceof PortableGridTile) {
|
if (tile instanceof PortableGridTile) {
|
||||||
@@ -18,4 +27,16 @@ public class PortableGridBlockLootFunction implements ILootFunction {
|
|||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LootFunctionType func_230425_b_() {
|
||||||
|
return RSLootFunctions.PORTABLE_GRID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Serializer extends LootFunction.Serializer<PortableGridBlockLootFunction> {
|
||||||
|
@Override
|
||||||
|
public PortableGridBlockLootFunction deserialize(JsonObject object, JsonDeserializationContext deserializationContext, ILootCondition[] conditions) {
|
||||||
|
return new PortableGridBlockLootFunction(conditions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonSerializationContext;
|
|
||||||
import com.refinedmods.refinedstorage.RS;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class PortableGridBlockLootFunctionSerializer extends ILootFunction.Serializer<PortableGridBlockLootFunction> {
|
|
||||||
public PortableGridBlockLootFunctionSerializer() {
|
|
||||||
super(new ResourceLocation(RS.ID, "portable_grid"), PortableGridBlockLootFunction.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(JsonObject jsonObject, PortableGridBlockLootFunction function, JsonSerializationContext jsonSerializationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PortableGridBlockLootFunction deserialize(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
|
|
||||||
return new PortableGridBlockLootFunction();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,19 +1,28 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
package com.refinedmods.refinedstorage.loottable;
|
||||||
|
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.refinedmods.refinedstorage.RSLootFunctions;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
|
||||||
import com.refinedmods.refinedstorage.tile.FluidStorageTile;
|
import com.refinedmods.refinedstorage.tile.FluidStorageTile;
|
||||||
import com.refinedmods.refinedstorage.tile.StorageTile;
|
import com.refinedmods.refinedstorage.tile.StorageTile;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.LootContext;
|
||||||
|
import net.minecraft.loot.LootFunction;
|
||||||
|
import net.minecraft.loot.LootFunctionType;
|
||||||
|
import net.minecraft.loot.LootParameters;
|
||||||
|
import net.minecraft.loot.conditions.ILootCondition;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.storage.loot.LootContext;
|
|
||||||
import net.minecraft.world.storage.loot.LootParameters;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class StorageBlockLootFunction implements ILootFunction {
|
public class StorageBlockLootFunction extends LootFunction {
|
||||||
|
protected StorageBlockLootFunction(ILootCondition[] conditions) {
|
||||||
|
super(conditions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack apply(ItemStack stack, LootContext lootContext) {
|
public ItemStack doApply(ItemStack stack, LootContext lootContext) {
|
||||||
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
TileEntity tile = lootContext.get(LootParameters.BLOCK_ENTITY);
|
||||||
|
|
||||||
// This code needs to work without the node being removed as well.
|
// This code needs to work without the node being removed as well.
|
||||||
@@ -39,4 +48,16 @@ public class StorageBlockLootFunction implements ILootFunction {
|
|||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LootFunctionType func_230425_b_() {
|
||||||
|
return RSLootFunctions.STORAGE_BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Serializer extends LootFunction.Serializer<StorageBlockLootFunction> {
|
||||||
|
@Override
|
||||||
|
public StorageBlockLootFunction deserialize(JsonObject object, JsonDeserializationContext deserializationContext, ILootCondition[] conditions) {
|
||||||
|
return new StorageBlockLootFunction(conditions);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.loottable;
|
|
||||||
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonSerializationContext;
|
|
||||||
import com.refinedmods.refinedstorage.RS;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.world.storage.loot.functions.ILootFunction;
|
|
||||||
|
|
||||||
public class StorageBlockLootFunctionSerializer extends ILootFunction.Serializer<StorageBlockLootFunction> {
|
|
||||||
public StorageBlockLootFunctionSerializer() {
|
|
||||||
super(new ResourceLocation(RS.ID, "storage_block"), StorageBlockLootFunction.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(JsonObject jsonObject, StorageBlockLootFunction storageBlockLootFunction, JsonSerializationContext jsonSerializationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public StorageBlockLootFunction deserialize(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
|
|
||||||
return new StorageBlockLootFunction();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -34,7 +34,7 @@ public class OpenNetworkItemMessage {
|
|||||||
ItemStack stack = player.inventory.getStackInSlot(message.slotId);
|
ItemStack stack = player.inventory.getStackInSlot(message.slotId);
|
||||||
|
|
||||||
if (stack.getItem() instanceof NetworkItem) {
|
if (stack.getItem() instanceof NetworkItem) {
|
||||||
((NetworkItem) stack.getItem()).applyNetwork(player.getServer(), stack, n -> n.getNetworkItemManager().open(player, stack, message.slotId), player::sendMessage);
|
((NetworkItem) stack.getItem()).applyNetwork(player.getServer(), stack, n -> n.getNetworkItemManager().open(player, stack, message.slotId), err -> player.sendMessage(err, player.getUniqueID()));
|
||||||
} else if (stack.getItem() instanceof PortableGridBlockItem) {
|
} else if (stack.getItem() instanceof PortableGridBlockItem) {
|
||||||
API.instance().getGridManager().openGrid(PortableGridGridFactory.ID, player, stack, message.slotId);
|
API.instance().getGridManager().openGrid(PortableGridGridFactory.ID, player, stack, message.slotId);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.render;
|
package com.refinedmods.refinedstorage.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
@@ -9,10 +10,12 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.inventory.container.PlayerContainer;
|
import net.minecraft.inventory.container.PlayerContainer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
import net.minecraftforge.fluids.FluidAttributes;
|
import net.minecraftforge.fluids.FluidAttributes;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @link https://github.com/mezz/JustEnoughItems/blob/1.15/src/main/java/mezz/jei/plugins/vanilla/ingredients/fluid/FluidStackRenderer.java
|
* @link https://github.com/mezz/JustEnoughItems/blob/1.15/src/main/java/mezz/jei/plugins/vanilla/ingredients/fluid/FluidStackRenderer.java
|
||||||
@@ -35,11 +38,11 @@ public class FluidRenderer {
|
|||||||
this.minHeight = minHeight;
|
this.minHeight = minHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(final int xPosition, final int yPosition, @Nonnull FluidStack fluidStack) {
|
public void render(MatrixStack matrixStack, final int xPosition, final int yPosition, @Nullable FluidStack fluidStack) {
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
|
|
||||||
drawFluid(xPosition, yPosition, fluidStack);
|
drawFluid(matrixStack, xPosition, yPosition, fluidStack);
|
||||||
|
|
||||||
RenderSystem.color4f(1, 1, 1, 1);
|
RenderSystem.color4f(1, 1, 1, 1);
|
||||||
|
|
||||||
@@ -47,12 +50,14 @@ public class FluidRenderer {
|
|||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawFluid(final int xPosition, final int yPosition, @Nonnull FluidStack fluidStack) {
|
private void drawFluid(MatrixStack matrixStack, final int xPosition, final int yPosition, @Nullable FluidStack fluidStack) {
|
||||||
if (fluidStack.isEmpty()) {
|
if (fluidStack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fluid fluid = fluidStack.getFluid();
|
Fluid fluid = fluidStack.getFluid();
|
||||||
|
if (fluid == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TextureAtlasSprite fluidStillSprite = getStillFluidSprite(fluidStack);
|
TextureAtlasSprite fluidStillSprite = getStillFluidSprite(fluidStack);
|
||||||
|
|
||||||
@@ -68,12 +73,13 @@ public class FluidRenderer {
|
|||||||
scaledAmount = height;
|
scaledAmount = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawTiledSprite(xPosition, yPosition, width, height, fluidColor, scaledAmount, fluidStillSprite);
|
drawTiledSprite(matrixStack, xPosition, yPosition, width, height, fluidColor, scaledAmount, fluidStillSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawTiledSprite(final int xPosition, final int yPosition, final int tiledWidth, final int tiledHeight, int color, int scaledAmount, TextureAtlasSprite sprite) {
|
private void drawTiledSprite(MatrixStack matrixStack, final int xPosition, final int yPosition, final int tiledWidth, final int tiledHeight, int color, int scaledAmount, TextureAtlasSprite sprite) {
|
||||||
Minecraft minecraft = Minecraft.getInstance();
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
minecraft.getTextureManager().bindTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE);
|
minecraft.getTextureManager().bindTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE);
|
||||||
|
Matrix4f matrix = matrixStack.getLast().getMatrix();
|
||||||
setGLColorFromInt(color);
|
setGLColorFromInt(color);
|
||||||
|
|
||||||
final int xTileCount = tiledWidth / TEX_WIDTH;
|
final int xTileCount = tiledWidth / TEX_WIDTH;
|
||||||
@@ -93,17 +99,18 @@ public class FluidRenderer {
|
|||||||
int maskTop = TEX_HEIGHT - height;
|
int maskTop = TEX_HEIGHT - height;
|
||||||
int maskRight = TEX_WIDTH - width;
|
int maskRight = TEX_WIDTH - width;
|
||||||
|
|
||||||
drawTextureWithMasking(x, y, sprite, maskTop, maskRight, 100);
|
drawTextureWithMasking(matrix, x, y, sprite, maskTop, maskRight, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextureAtlasSprite getStillFluidSprite(FluidStack fluidStack) {
|
private static TextureAtlasSprite getStillFluidSprite(FluidStack fluidStack) {
|
||||||
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
Fluid fluid = fluidStack.getFluid();
|
Fluid fluid = fluidStack.getFluid();
|
||||||
FluidAttributes attributes = fluid.getAttributes();
|
FluidAttributes attributes = fluid.getAttributes();
|
||||||
ResourceLocation fluidStill = attributes.getStillTexture(fluidStack);
|
ResourceLocation fluidStill = attributes.getStillTexture(fluidStack);
|
||||||
return Minecraft.getInstance().getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(fluidStill);
|
return minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(fluidStill);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setGLColorFromInt(int color) {
|
private static void setGLColorFromInt(int color) {
|
||||||
@@ -115,21 +122,21 @@ public class FluidRenderer {
|
|||||||
RenderSystem.color4f(red, green, blue, alpha);
|
RenderSystem.color4f(red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
private static void drawTextureWithMasking(Matrix4f matrix, float xCoord, float yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, float zLevel) {
|
||||||
double uMin = textureSprite.getMinU();
|
float uMin = textureSprite.getMinU();
|
||||||
double uMax = textureSprite.getMaxU();
|
float uMax = textureSprite.getMaxU();
|
||||||
double vMin = textureSprite.getMinV();
|
float vMin = textureSprite.getMinV();
|
||||||
double vMax = textureSprite.getMaxV();
|
float vMax = textureSprite.getMaxV();
|
||||||
uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
|
uMax = uMax - (maskRight / 16F * (uMax - uMin));
|
||||||
vMax = vMax - (maskTop / 16.0 * (vMax - vMin));
|
vMax = vMax - (maskTop / 16F * (vMax - vMin));
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||||
bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
|
bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
|
||||||
bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex((float) uMin, (float) vMax).endVertex();
|
bufferBuilder.pos(matrix, xCoord, yCoord + 16, zLevel).tex((float) uMin, (float) vMax).endVertex();
|
||||||
bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex((float) uMax, (float) vMax).endVertex();
|
bufferBuilder.pos(matrix, xCoord + 16 - maskRight, yCoord + 16, zLevel).tex((float) uMax, (float) vMax).endVertex();
|
||||||
bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex((float) uMax, (float) vMin).endVertex();
|
bufferBuilder.pos(matrix, xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex((float) uMax, (float) vMin).endVertex();
|
||||||
bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex((float) uMin, (float) vMin).endVertex();
|
bufferBuilder.pos(matrix, xCoord, yCoord + maskTop, zLevel).tex((float) uMin, (float) vMin).endVertex();
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
package com.refinedmods.refinedstorage.render;
|
package com.refinedmods.refinedstorage.render;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.Color;
|
||||||
import net.minecraft.util.text.Style;
|
import net.minecraft.util.text.Style;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
public class Styles {
|
public final class Styles {
|
||||||
public static final Style WHITE = new Style().setColor(TextFormatting.WHITE);
|
public static final Style WHITE = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.WHITE));
|
||||||
public static final Style GRAY = new Style().setColor(TextFormatting.GRAY);
|
public static final Style GRAY = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.GRAY));
|
||||||
public static final Style YELLOW = new Style().setColor(TextFormatting.YELLOW);
|
public static final Style YELLOW = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.YELLOW));
|
||||||
public static final Style RED = new Style().setColor(TextFormatting.RED);
|
public static final Style RED = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.RED));
|
||||||
public static final Style BLUE = new Style().setColor(TextFormatting.BLUE);
|
public static final Style BLUE = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.BLUE));
|
||||||
public static final Style AQUA = new Style().setColor(TextFormatting.AQUA);
|
public static final Style AQUA = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.AQUA));
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ public class FullbrightBakedModel extends DelegateBakedModel {
|
|||||||
quad.getTintIndex(),
|
quad.getTintIndex(),
|
||||||
quad.getFace(),
|
quad.getFace(),
|
||||||
quad.func_187508_a(),
|
quad.func_187508_a(),
|
||||||
quad.shouldApplyDiffuseLighting()
|
quad.func_239287_f_() // shouldApplyDiffuseLighting
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ import net.minecraft.client.Minecraft;
|
|||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ItemOverride;
|
import net.minecraft.client.renderer.model.ItemOverride;
|
||||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -25,7 +26,7 @@ public class PatternBakedModel extends DelegateBakedModel {
|
|||||||
return new ItemOverrideList() {
|
return new ItemOverrideList() {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity) {
|
public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
CraftingPattern pattern = PatternItem.fromCache(entity.world, stack);
|
CraftingPattern pattern = PatternItem.fromCache(entity.world, stack);
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class PatternBakedModel extends DelegateBakedModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getModelWithOverrides(model, stack, world, entity);
|
return super.func_239290_a_(model, stack, world, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.client.renderer.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@@ -110,7 +111,7 @@ public class PortableGridBakedModel extends DelegateBakedModel {
|
|||||||
private class CustomItemOverrideList extends ItemOverrideList {
|
private class CustomItemOverrideList extends ItemOverrideList {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {
|
public IBakedModel func_239290_a_(IBakedModel model, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
|
||||||
PortableGrid portableGrid = new PortableGrid(null, stack, -1);
|
PortableGrid portableGrid = new PortableGrid(null, stack, -1);
|
||||||
|
|
||||||
if (portableGrid.isGridActive()) {
|
if (portableGrid.isGridActive()) {
|
||||||
|
@@ -4,16 +4,17 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||||||
import com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
import com.refinedmods.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||||
import com.refinedmods.refinedstorage.item.PatternItem;
|
import com.refinedmods.refinedstorage.item.PatternItem;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class PatternItemStackTileRenderer extends ItemStackTileEntityRenderer {
|
public class PatternItemStackTileRenderer extends ItemStackTileEntityRenderer {
|
||||||
@Override
|
@Override
|
||||||
public void render(ItemStack stack, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int p_228364_4_, int p_228364_5_) {
|
public void func_239207_a_(ItemStack stack, ItemCameraTransforms.TransformType transformType, MatrixStack matrixStack, IRenderTypeBuffer renderTypeBuffer, int p_239207_5_, int p_239207_6_) {
|
||||||
CraftingPattern pattern = PatternItem.fromCache(null, stack);
|
CraftingPattern pattern = PatternItem.fromCache(null, stack);
|
||||||
|
|
||||||
ItemStack outputStack = pattern.getOutputs().get(0);
|
ItemStack outputStack = pattern.getOutputs().get(0);
|
||||||
|
|
||||||
outputStack.getItem().getItemStackTileEntityRenderer().render(outputStack, matrixStack, renderTypeBuffer, p_228364_4_, p_228364_5_);
|
outputStack.getItem().getItemStackTileEntityRenderer().func_239207_a_(outputStack, transformType, matrixStack, renderTypeBuffer, p_239207_5_, p_239207_6_);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -137,7 +137,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
|||||||
FluidStack stack = ((FluidFilterSlot) slot).getFluidInventory().getFluid(slot.getSlotIndex());
|
FluidStack stack = ((FluidFilterSlot) slot).getFluidInventory().getFluid(slot.getSlotIndex());
|
||||||
|
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
FluidRenderer.INSTANCE.render(guiLeft + slot.xPos, guiTop + slot.yPos, stack);
|
FluidRenderer.INSTANCE.render(matrixStack, guiLeft + slot.xPos, guiTop + slot.yPos, stack);
|
||||||
|
|
||||||
if (((FluidFilterSlot) slot).isSizeAllowed()) {
|
if (((FluidFilterSlot) slot).isSizeAllowed()) {
|
||||||
renderQuantity(matrixStack, guiLeft + slot.xPos, guiTop + slot.yPos, API.instance().getQuantityFormatter().formatInBucketForm(stack.getAmount()), RenderSettings.INSTANCE.getSecondaryColor());
|
renderQuantity(matrixStack, guiLeft + slot.xPos, guiTop + slot.yPos, API.instance().getQuantityFormatter().formatInBucketForm(stack.getAmount()), RenderSettings.INSTANCE.getSecondaryColor());
|
||||||
|
@@ -80,9 +80,9 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
|||||||
if (requested.getItem() != null) {
|
if (requested.getItem() != null) {
|
||||||
RenderHelper.setupGui3DDiffuseLighting();
|
RenderHelper.setupGui3DDiffuseLighting();
|
||||||
|
|
||||||
itemDrawer.draw(x, y, requested.getItem());
|
itemDrawer.draw(matrixStack, x, y, requested.getItem());
|
||||||
} else {
|
} else {
|
||||||
fluidDrawer.draw(x, y, requested.getFluid());
|
fluidDrawer.draw(matrixStack, x, y, requested.getFluid());
|
||||||
|
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
}
|
}
|
||||||
@@ -261,16 +261,16 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
|||||||
int x = 7;
|
int x = 7;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
|
|
||||||
String itemSelectedTooltip = null;
|
List<ITextComponent> tooltip = null;
|
||||||
|
|
||||||
for (int i = 0; i < 3 * 5; ++i) {
|
for (int i = 0; i < 3 * 5; ++i) {
|
||||||
if (item < getElements().size()) {
|
if (item < getElements().size()) {
|
||||||
ICraftingMonitorElement element = getElements().get(item);
|
ICraftingMonitorElement element = getElements().get(item);
|
||||||
|
|
||||||
element.draw(x, y, drawers);
|
element.draw(matrixStack, x, y, drawers);
|
||||||
|
|
||||||
if (RenderUtils.inBounds(x, y, ITEM_WIDTH, ITEM_HEIGHT, mouseX, mouseY)) {
|
if (RenderUtils.inBounds(x, y, ITEM_WIDTH, ITEM_HEIGHT, mouseX, mouseY)) {
|
||||||
itemSelectedTooltip = element.getTooltip();
|
tooltip = element.getTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i + 1) % 3 == 0) {
|
if ((i + 1) % 3 == 0) {
|
||||||
@@ -284,8 +284,8 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
|
|||||||
item++;
|
item++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemSelectedTooltip != null && !itemSelectedTooltip.isEmpty()) {
|
if (tooltip != null && !tooltip.isEmpty()) {
|
||||||
renderTooltip(matrixStack, mouseX, mouseY, I18n.format(itemSelectedTooltip));
|
renderTooltip(matrixStack, ItemStack.EMPTY, mouseX, mouseY, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabs.drawTooltip(matrixStack, font, mouseX, mouseY);
|
tabs.drawTooltip(matrixStack, font, mouseX, mouseY);
|
||||||
|
@@ -37,11 +37,11 @@ public class FluidInterfaceScreen extends BaseScreen<FluidInterfaceContainer> {
|
|||||||
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
blit(matrixStack, x, y, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
if (!FluidInterfaceTile.TANK_IN.getValue().isEmpty()) {
|
if (!FluidInterfaceTile.TANK_IN.getValue().isEmpty()) {
|
||||||
TANK_RENDERER.render(x + 46, y + 56, FluidInterfaceTile.TANK_IN.getValue());
|
TANK_RENDERER.render(matrixStack, x + 46, y + 56, FluidInterfaceTile.TANK_IN.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FluidInterfaceTile.TANK_OUT.getValue().isEmpty()) {
|
if (!FluidInterfaceTile.TANK_OUT.getValue().isEmpty()) {
|
||||||
TANK_RENDERER.render(x + 118, y + 56, FluidInterfaceTile.TANK_OUT.getValue());
|
TANK_RENDERER.render(matrixStack, x + 118, y + 56, FluidInterfaceTile.TANK_OUT.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -299,7 +299,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, int x, int y) {
|
public void render(MatrixStack matrixStack, int x, int y) {
|
||||||
FluidRenderer.INSTANCE.render(x + 3, y + 2, fluid);
|
FluidRenderer.INSTANCE.render(matrixStack, x + 3, y + 2, fluid);
|
||||||
renderString(matrixStack, x + 4 + 19, y + 7, fluid.getDisplayName().getString());
|
renderString(matrixStack, x + 4 + 19, y + 7, fluid.getDisplayName().getString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
|||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, int x, int y) {
|
public void render(MatrixStack matrixStack, int x, int y) {
|
||||||
for (FluidStack fluid : fluids) {
|
for (FluidStack fluid : fluids) {
|
||||||
FluidRenderer.INSTANCE.render(x + 3, y, fluid);
|
FluidRenderer.INSTANCE.render(matrixStack, x + 3, y, fluid);
|
||||||
|
|
||||||
x += 17;
|
x += 17;
|
||||||
}
|
}
|
||||||
|
@@ -178,9 +178,9 @@ public class CraftingPreviewScreen extends BaseScreen<Container> {
|
|||||||
|
|
||||||
for (int i = 0; i < 3 * 5; ++i) {
|
for (int i = 0; i < 3 * 5; ++i) {
|
||||||
if (slot < stacks.size()) {
|
if (slot < stacks.size()) {
|
||||||
ICraftingPreviewElement stack = stacks.get(slot);
|
ICraftingPreviewElement<?> stack = stacks.get(slot);
|
||||||
|
|
||||||
stack.draw(x, y + 5, drawers);
|
stack.draw(matrixStack, x, y + 5, drawers);
|
||||||
|
|
||||||
if (RenderUtils.inBounds(x + 5, y + 7, 16, 16, mouseX, mouseY)) {
|
if (RenderUtils.inBounds(x + 5, y + 7, 16, 16, mouseX, mouseY)) {
|
||||||
this.hoveringStack = stack.getId().equals(ItemCraftingPreviewElement.ID) ? (ItemStack) stack.getElement() : null;
|
this.hoveringStack = stack.getId().equals(ItemCraftingPreviewElement.ID) ? (ItemStack) stack.getElement() : null;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.refinedmods.refinedstorage.screen.grid.filtering;
|
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 java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@@ -13,6 +14,15 @@ public class TooltipGridFilter implements Predicate<IGridStack> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(IGridStack stack) {
|
public boolean test(IGridStack stack) {
|
||||||
|
for (ITextComponent item : stack.getTooltip()) {
|
||||||
|
if (item.getString().contains(tooltip)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* TODO Check if we still need to rem first line?
|
||||||
String otherTooltip = stack.getTooltip().trim().toLowerCase();
|
String otherTooltip = stack.getTooltip().trim().toLowerCase();
|
||||||
|
|
||||||
if (!otherTooltip.contains("\n")) {
|
if (!otherTooltip.contains("\n")) {
|
||||||
@@ -21,6 +31,6 @@ public class TooltipGridFilter implements Predicate<IGridStack> {
|
|||||||
|
|
||||||
otherTooltip = otherTooltip.substring(otherTooltip.indexOf('\n') + 1); // Remove the first line as that states the item name
|
otherTooltip = otherTooltip.substring(otherTooltip.indexOf('\n') + 1); // Remove the first line as that states the item name
|
||||||
|
|
||||||
return otherTooltip.contains(tooltip);
|
return otherTooltip.contains(tooltip); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -161,7 +161,7 @@ public class FluidGridStack implements IGridStack {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(MatrixStack matrixStack, BaseScreen<?> screen, int x, int y) {
|
public void draw(MatrixStack matrixStack, BaseScreen<?> screen, int x, int y) {
|
||||||
FluidRenderer.INSTANCE.render(x, y, stack);
|
FluidRenderer.INSTANCE.render(matrixStack, x, y, stack);
|
||||||
|
|
||||||
String text;
|
String text;
|
||||||
int color = RenderSettings.INSTANCE.getSecondaryColor();
|
int color = RenderSettings.INSTANCE.getSecondaryColor();
|
||||||
|
@@ -36,10 +36,6 @@ import com.refinedmods.refinedstorage.integration.craftingtweaks.CraftingTweaksI
|
|||||||
import com.refinedmods.refinedstorage.integration.inventorysorter.InventorySorterIntegration;
|
import com.refinedmods.refinedstorage.integration.inventorysorter.InventorySorterIntegration;
|
||||||
import com.refinedmods.refinedstorage.item.*;
|
import com.refinedmods.refinedstorage.item.*;
|
||||||
import com.refinedmods.refinedstorage.item.blockitem.*;
|
import com.refinedmods.refinedstorage.item.blockitem.*;
|
||||||
import com.refinedmods.refinedstorage.loottable.ControllerLootFunctionSerializer;
|
|
||||||
import com.refinedmods.refinedstorage.loottable.CrafterLootFunctionSerializer;
|
|
||||||
import com.refinedmods.refinedstorage.loottable.PortableGridBlockLootFunctionSerializer;
|
|
||||||
import com.refinedmods.refinedstorage.loottable.StorageBlockLootFunctionSerializer;
|
|
||||||
import com.refinedmods.refinedstorage.recipe.UpgradeWithEnchantedBookRecipeSerializer;
|
import com.refinedmods.refinedstorage.recipe.UpgradeWithEnchantedBookRecipeSerializer;
|
||||||
import com.refinedmods.refinedstorage.tile.*;
|
import com.refinedmods.refinedstorage.tile.*;
|
||||||
import com.refinedmods.refinedstorage.tile.craftingmonitor.CraftingMonitorTile;
|
import com.refinedmods.refinedstorage.tile.craftingmonitor.CraftingMonitorTile;
|
||||||
@@ -54,7 +50,6 @@ import net.minecraft.item.crafting.IRecipeSerializer;
|
|||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.world.storage.loot.functions.LootFunctionManager;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
@@ -132,11 +127,6 @@ public class CommonSetup {
|
|||||||
|
|
||||||
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
||||||
|
|
||||||
LootFunctionManager.registerFunction(new StorageBlockLootFunctionSerializer());
|
|
||||||
LootFunctionManager.registerFunction(new PortableGridBlockLootFunctionSerializer());
|
|
||||||
LootFunctionManager.registerFunction(new CrafterLootFunctionSerializer());
|
|
||||||
LootFunctionManager.registerFunction(new ControllerLootFunctionSerializer());
|
|
||||||
|
|
||||||
if (CraftingTweaksIntegration.isLoaded()) {
|
if (CraftingTweaksIntegration.isLoaded()) {
|
||||||
CraftingTweaksIntegration.register();
|
CraftingTweaksIntegration.register();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.refinedmods.refinedstorage.tile;
|
package com.refinedmods.refinedstorage.tile;
|
||||||
|
|
||||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||||
@@ -32,7 +33,6 @@ public abstract class BaseTile extends TileEntity {
|
|||||||
return writeUpdate(super.getUpdateTag());
|
return writeUpdate(super.getUpdateTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public final SUpdateTileEntityPacket getUpdatePacket() {
|
public final SUpdateTileEntityPacket getUpdatePacket() {
|
||||||
return new SUpdateTileEntityPacket(pos, 1, getUpdateTag());
|
return new SUpdateTileEntityPacket(pos, 1, getUpdateTag());
|
||||||
@@ -44,8 +44,8 @@ public abstract class BaseTile extends TileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void handleUpdateTag(CompoundNBT tag) {
|
public void handleUpdateTag(BlockState state, CompoundNBT tag) {
|
||||||
super.read(tag);
|
super.read(state, tag);
|
||||||
|
|
||||||
readUpdate(tag);
|
readUpdate(tag);
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ public enum PortableGridDiskState implements IStringSerializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getString() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,15 +30,5 @@ public enum PortableGridDiskState implements IStringSerializable {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PortableGridDiskState getById(int id) {
|
|
||||||
for (PortableGridDiskState diskState : values()) {
|
|
||||||
if (diskState.getId() == id) {
|
|
||||||
return diskState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NONE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -655,8 +655,8 @@ public class PortableGridTile extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(CompoundNBT tag) {
|
public void read(BlockState blockState, CompoundNBT tag) {
|
||||||
super.read(tag);
|
super.read(blockState, tag);
|
||||||
|
|
||||||
if (tag.contains(GridNetworkNode.NBT_SORTING_DIRECTION)) {
|
if (tag.contains(GridNetworkNode.NBT_SORTING_DIRECTION)) {
|
||||||
sortingDirection = tag.getInt(GridNetworkNode.NBT_SORTING_DIRECTION);
|
sortingDirection = tag.getInt(GridNetworkNode.NBT_SORTING_DIRECTION);
|
||||||
|
Reference in New Issue
Block a user