Move to other package
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.ListNBT;
|
import net.minecraft.nbt.ListNBT;
|
||||||
@@ -12,7 +12,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class AllowedTags {
|
public class AllowedTagList {
|
||||||
private static final String NBT_ALLOWED_ITEM_TAGS = "AllowedItemTags";
|
private static final String NBT_ALLOWED_ITEM_TAGS = "AllowedItemTags";
|
||||||
private static final String NBT_ALLOWED_FLUID_TAGS = "AllowedFluidTags";
|
private static final String NBT_ALLOWED_FLUID_TAGS = "AllowedFluidTags";
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ public class AllowedTags {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private final Runnable listener;
|
private final Runnable listener;
|
||||||
|
|
||||||
public AllowedTags(@Nullable Runnable listener) {
|
public AllowedTagList(@Nullable Runnable listener) {
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
allowedItemTags.add(new HashSet<>());
|
allowedItemTags.add(new HashSet<>());
|
||||||
allowedFluidTags.add(new HashSet<>());
|
allowedFluidTags.add(new HashSet<>());
|
@@ -5,7 +5,6 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContaine
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.AllowedTags;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
@@ -35,9 +34,9 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
private final List<NonNullList<FluidStack>> fluidInputs;
|
private final List<NonNullList<FluidStack>> fluidInputs;
|
||||||
private final NonNullList<FluidStack> fluidOutputs;
|
private final NonNullList<FluidStack> fluidOutputs;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final AllowedTags allowedTags;
|
private final AllowedTagList allowedTagList;
|
||||||
|
|
||||||
public CraftingPattern(ICraftingPatternContainer container, ItemStack stack, boolean processing, boolean exact, @Nullable ITextComponent errorMessage, boolean valid, @Nullable ICraftingRecipe recipe, List<NonNullList<ItemStack>> inputs, NonNullList<ItemStack> outputs, NonNullList<ItemStack> byproducts, List<NonNullList<FluidStack>> fluidInputs, NonNullList<FluidStack> fluidOutputs, @Nullable AllowedTags allowedTags) {
|
public CraftingPattern(ICraftingPatternContainer container, ItemStack stack, boolean processing, boolean exact, @Nullable ITextComponent errorMessage, boolean valid, @Nullable ICraftingRecipe recipe, List<NonNullList<ItemStack>> inputs, NonNullList<ItemStack> outputs, NonNullList<ItemStack> byproducts, List<NonNullList<FluidStack>> fluidInputs, NonNullList<FluidStack> fluidOutputs, @Nullable AllowedTagList allowedTagList) {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
@@ -50,12 +49,12 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
this.byproducts = byproducts;
|
this.byproducts = byproducts;
|
||||||
this.fluidInputs = fluidInputs;
|
this.fluidInputs = fluidInputs;
|
||||||
this.fluidOutputs = fluidOutputs;
|
this.fluidOutputs = fluidOutputs;
|
||||||
this.allowedTags = allowedTags;
|
this.allowedTagList = allowedTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public AllowedTags getAllowedTags() {
|
public AllowedTagList getAllowedTagList() {
|
||||||
return allowedTags;
|
return allowedTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting;
|
package com.raoulvdberge.refinedstorage.apiimpl.autocrafting;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.AllowedTags;
|
|
||||||
import com.raoulvdberge.refinedstorage.item.PatternItem;
|
import com.raoulvdberge.refinedstorage.item.PatternItem;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
@@ -27,7 +26,7 @@ public class CraftingPatternFactory {
|
|||||||
public CraftingPattern create(World world, ICraftingPatternContainer container, ItemStack stack) {
|
public CraftingPattern create(World world, ICraftingPatternContainer container, ItemStack stack) {
|
||||||
boolean processing = PatternItem.isProcessing(stack);
|
boolean processing = PatternItem.isProcessing(stack);
|
||||||
boolean exact = PatternItem.isExact(stack);
|
boolean exact = PatternItem.isExact(stack);
|
||||||
AllowedTags allowedTags = PatternItem.getAllowedTags(stack);
|
AllowedTagList allowedTagList = PatternItem.getAllowedTags(stack);
|
||||||
|
|
||||||
List<NonNullList<ItemStack>> inputs = new ArrayList<>();
|
List<NonNullList<ItemStack>> inputs = new ArrayList<>();
|
||||||
NonNullList<ItemStack> outputs = NonNullList.create();
|
NonNullList<ItemStack> outputs = NonNullList.create();
|
||||||
@@ -41,8 +40,8 @@ public class CraftingPatternFactory {
|
|||||||
try {
|
try {
|
||||||
if (processing) {
|
if (processing) {
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
fillProcessingInputs(i, stack, inputs, outputs, allowedTags);
|
fillProcessingInputs(i, stack, inputs, outputs, allowedTagList);
|
||||||
fillProcessingFluidInputs(i, stack, fluidInputs, fluidOutputs, allowedTags);
|
fillProcessingFluidInputs(i, stack, fluidInputs, fluidOutputs, allowedTagList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outputs.isEmpty() && fluidOutputs.isEmpty()) {
|
if (outputs.isEmpty() && fluidOutputs.isEmpty()) {
|
||||||
@@ -81,10 +80,10 @@ public class CraftingPatternFactory {
|
|||||||
errorMessage = e.getErrorMessage();
|
errorMessage = e.getErrorMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CraftingPattern(container, stack, processing, exact, errorMessage, valid, recipe, inputs, outputs, byproducts, fluidInputs, fluidOutputs, allowedTags);
|
return new CraftingPattern(container, stack, processing, exact, errorMessage, valid, recipe, inputs, outputs, byproducts, fluidInputs, fluidOutputs, allowedTagList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillProcessingInputs(int i, ItemStack stack, List<NonNullList<ItemStack>> inputs, NonNullList<ItemStack> outputs, @Nullable AllowedTags allowedTags) throws CraftingPatternFactoryException {
|
private void fillProcessingInputs(int i, ItemStack stack, List<NonNullList<ItemStack>> inputs, NonNullList<ItemStack> outputs, @Nullable AllowedTagList allowedTagList) throws CraftingPatternFactoryException {
|
||||||
ItemStack input = PatternItem.getInputSlot(stack, i);
|
ItemStack input = PatternItem.getInputSlot(stack, i);
|
||||||
|
|
||||||
if (input.isEmpty()) {
|
if (input.isEmpty()) {
|
||||||
@@ -94,9 +93,9 @@ public class CraftingPatternFactory {
|
|||||||
|
|
||||||
possibilities.add(input.copy());
|
possibilities.add(input.copy());
|
||||||
|
|
||||||
if (allowedTags != null) {
|
if (allowedTagList != null) {
|
||||||
Collection<ResourceLocation> tagsOfItem = ItemTags.getCollection().getOwningTags(input.getItem());
|
Collection<ResourceLocation> tagsOfItem = ItemTags.getCollection().getOwningTags(input.getItem());
|
||||||
Set<ResourceLocation> declaredAllowedTags = allowedTags.getAllowedItemTags().get(i);
|
Set<ResourceLocation> declaredAllowedTags = allowedTagList.getAllowedItemTags().get(i);
|
||||||
|
|
||||||
for (ResourceLocation declaredAllowedTag : declaredAllowedTags) {
|
for (ResourceLocation declaredAllowedTag : declaredAllowedTags) {
|
||||||
if (!tagsOfItem.contains(declaredAllowedTag)) {
|
if (!tagsOfItem.contains(declaredAllowedTag)) {
|
||||||
@@ -124,7 +123,7 @@ public class CraftingPatternFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillProcessingFluidInputs(int i, ItemStack stack, List<NonNullList<FluidStack>> fluidInputs, NonNullList<FluidStack> fluidOutputs, @Nullable AllowedTags allowedTags) throws CraftingPatternFactoryException {
|
private void fillProcessingFluidInputs(int i, ItemStack stack, List<NonNullList<FluidStack>> fluidInputs, NonNullList<FluidStack> fluidOutputs, @Nullable AllowedTagList allowedTagList) throws CraftingPatternFactoryException {
|
||||||
FluidStack input = PatternItem.getFluidInputSlot(stack, i);
|
FluidStack input = PatternItem.getFluidInputSlot(stack, i);
|
||||||
if (input.isEmpty()) {
|
if (input.isEmpty()) {
|
||||||
fluidInputs.add(NonNullList.create());
|
fluidInputs.add(NonNullList.create());
|
||||||
@@ -133,9 +132,9 @@ public class CraftingPatternFactory {
|
|||||||
|
|
||||||
possibilities.add(input.copy());
|
possibilities.add(input.copy());
|
||||||
|
|
||||||
if (allowedTags != null) {
|
if (allowedTagList != null) {
|
||||||
Collection<ResourceLocation> tagsOfFluid = FluidTags.getCollection().getOwningTags(input.getFluid());
|
Collection<ResourceLocation> tagsOfFluid = FluidTags.getCollection().getOwningTags(input.getFluid());
|
||||||
Set<ResourceLocation> declaredAllowedTags = allowedTags.getAllowedFluidTags().get(i);
|
Set<ResourceLocation> declaredAllowedTags = allowedTagList.getAllowedFluidTags().get(i);
|
||||||
|
|
||||||
for (ResourceLocation declaredAllowedTag : declaredAllowedTags) {
|
for (ResourceLocation declaredAllowedTag : declaredAllowedTags) {
|
||||||
if (!tagsOfFluid.contains(declaredAllowedTag)) {
|
if (!tagsOfFluid.contains(declaredAllowedTag)) {
|
||||||
|
@@ -11,6 +11,7 @@ import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCacheListener;
|
|||||||
import com.raoulvdberge.refinedstorage.api.util.Action;
|
import com.raoulvdberge.refinedstorage.api.util.Action;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.AllowedTagList;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.FluidGridStorageCacheListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.FluidGridStorageCacheListener;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.ItemGridStorageCacheListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.ItemGridStorageCacheListener;
|
||||||
import com.raoulvdberge.refinedstorage.block.NetworkNodeBlock;
|
import com.raoulvdberge.refinedstorage.block.NetworkNodeBlock;
|
||||||
@@ -76,7 +77,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
private static final String NBT_PROCESSING_MATRIX_FLUIDS = "ProcessingMatrixFluids";
|
private static final String NBT_PROCESSING_MATRIX_FLUIDS = "ProcessingMatrixFluids";
|
||||||
private static final String NBT_ALLOWED_TAGS = "AllowedTags";
|
private static final String NBT_ALLOWED_TAGS = "AllowedTags";
|
||||||
|
|
||||||
private final AllowedTags allowedTags = new AllowedTags(this::updateAllowedTags);
|
private final AllowedTagList allowedTagList = new AllowedTagList(this::updateAllowedTags);
|
||||||
|
|
||||||
private Container craftingContainer = new Container(ContainerType.CRAFTING, 0) {
|
private Container craftingContainer = new Container(ContainerType.CRAFTING, 0) {
|
||||||
@Override
|
@Override
|
||||||
@@ -98,14 +99,14 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
.addListener(new NetworkNodeInventoryListener(this))
|
.addListener(new NetworkNodeInventoryListener(this))
|
||||||
.addListener((handler, slot, reading) -> {
|
.addListener((handler, slot, reading) -> {
|
||||||
if (!reading && slot < 9) {
|
if (!reading && slot < 9) {
|
||||||
allowedTags.clearItemTags(slot);
|
allowedTagList.clearItemTags(slot);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
private FluidInventory processingMatrixFluids = new FluidInventory(9 * 2, FluidAttributes.BUCKET_VOLUME * 64)
|
private FluidInventory processingMatrixFluids = new FluidInventory(9 * 2, FluidAttributes.BUCKET_VOLUME * 64)
|
||||||
.addListener(new NetworkNodeFluidInventoryListener(this))
|
.addListener(new NetworkNodeFluidInventoryListener(this))
|
||||||
.addListener((handler, slot, reading) -> {
|
.addListener((handler, slot, reading) -> {
|
||||||
if (!reading && slot < 9) {
|
if (!reading && slot < 9) {
|
||||||
allowedTags.clearFluidTags(slot);
|
allowedTagList.clearFluidTags(slot);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -153,11 +154,11 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
processingMatrixFluids.setFluid(9 + i, PatternItem.getFluidOutputSlot(pattern, i));
|
processingMatrixFluids.setFluid(9 + i, PatternItem.getFluidOutputSlot(pattern, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
AllowedTags allowedTagsFromPattern = PatternItem.getAllowedTags(pattern);
|
AllowedTagList allowedTagsFromPattern = PatternItem.getAllowedTags(pattern);
|
||||||
|
|
||||||
if (allowedTagsFromPattern != null) {
|
if (allowedTagsFromPattern != null) {
|
||||||
allowedTags.setAllowedItemTags(allowedTagsFromPattern.getAllowedItemTags());
|
allowedTagList.setAllowedItemTags(allowedTagsFromPattern.getAllowedItemTags());
|
||||||
allowedTags.setAllowedFluidTags(allowedTagsFromPattern.getAllowedFluidTags());
|
allowedTagList.setAllowedFluidTags(allowedTagsFromPattern.getAllowedFluidTags());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
@@ -195,8 +196,8 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AllowedTags getAllowedTags() {
|
public AllowedTagList getAllowedTagList() {
|
||||||
return allowedTags;
|
return allowedTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAllowedTags() {
|
private void updateAllowedTags() {
|
||||||
@@ -448,7 +449,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
if (!processingPattern) {
|
if (!processingPattern) {
|
||||||
PatternItem.setExact(pattern, exactPattern);
|
PatternItem.setExact(pattern, exactPattern);
|
||||||
} else {
|
} else {
|
||||||
PatternItem.setAllowedTags(pattern, allowedTags);
|
PatternItem.setAllowedTags(pattern, allowedTagList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (processingPattern) {
|
if (processingPattern) {
|
||||||
@@ -627,7 +628,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
super.read(tag);
|
super.read(tag);
|
||||||
|
|
||||||
if (tag.contains(NBT_ALLOWED_TAGS)) {
|
if (tag.contains(NBT_ALLOWED_TAGS)) {
|
||||||
allowedTags.readFromNbt(tag.getCompound(NBT_ALLOWED_TAGS));
|
allowedTagList.readFromNbt(tag.getCompound(NBT_ALLOWED_TAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
reading = true;
|
reading = true;
|
||||||
@@ -661,7 +662,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
public CompoundNBT write(CompoundNBT tag) {
|
public CompoundNBT write(CompoundNBT tag) {
|
||||||
super.write(tag);
|
super.write(tag);
|
||||||
|
|
||||||
tag.put(NBT_ALLOWED_TAGS, allowedTags.writeToNbt());
|
tag.put(NBT_ALLOWED_TAGS, allowedTagList.writeToNbt());
|
||||||
|
|
||||||
StackUtils.writeItems(matrix, 0, tag);
|
StackUtils.writeItems(matrix, 0, tag);
|
||||||
StackUtils.writeItems(patterns, 1, tag);
|
StackUtils.writeItems(patterns, 1, tag);
|
||||||
|
@@ -5,9 +5,9 @@ import com.raoulvdberge.refinedstorage.RSItems;
|
|||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||||
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.AllowedTagList;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPatternFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.autocrafting.CraftingPatternFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.AllowedTags;
|
|
||||||
import com.raoulvdberge.refinedstorage.render.tesr.PatternItemStackTileRenderer;
|
import com.raoulvdberge.refinedstorage.render.tesr.PatternItemStackTileRenderer;
|
||||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
|
||||||
@@ -91,9 +91,9 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
|||||||
RenderUtils.addCombinedItemsToTooltip(tooltip, true, pattern.getOutputs());
|
RenderUtils.addCombinedItemsToTooltip(tooltip, true, pattern.getOutputs());
|
||||||
RenderUtils.addCombinedFluidsToTooltip(tooltip, true, pattern.getFluidOutputs());
|
RenderUtils.addCombinedFluidsToTooltip(tooltip, true, pattern.getFluidOutputs());
|
||||||
|
|
||||||
if (pattern.getAllowedTags() != null) {
|
if (pattern.getAllowedTagList() != null) {
|
||||||
for (int i = 0; i < pattern.getAllowedTags().getAllowedItemTags().size(); ++i) {
|
for (int i = 0; i < pattern.getAllowedTagList().getAllowedItemTags().size(); ++i) {
|
||||||
Set<ResourceLocation> allowedTags = pattern.getAllowedTags().getAllowedItemTags().get(i);
|
Set<ResourceLocation> allowedTags = pattern.getAllowedTagList().getAllowedItemTags().get(i);
|
||||||
|
|
||||||
for (ResourceLocation tag : allowedTags) {
|
for (ResourceLocation tag : allowedTags) {
|
||||||
tooltip.add(new TranslationTextComponent(
|
tooltip.add(new TranslationTextComponent(
|
||||||
@@ -104,8 +104,8 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pattern.getAllowedTags().getAllowedFluidTags().size(); ++i) {
|
for (int i = 0; i < pattern.getAllowedTagList().getAllowedFluidTags().size(); ++i) {
|
||||||
Set<ResourceLocation> allowedTags = pattern.getAllowedTags().getAllowedFluidTags().get(i);
|
Set<ResourceLocation> allowedTags = pattern.getAllowedTagList().getAllowedFluidTags().get(i);
|
||||||
|
|
||||||
for (ResourceLocation tag : allowedTags) {
|
for (ResourceLocation tag : allowedTags) {
|
||||||
tooltip.add(new TranslationTextComponent(
|
tooltip.add(new TranslationTextComponent(
|
||||||
@@ -255,24 +255,24 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
|||||||
pattern.getTag().putInt(NBT_VERSION, VERSION);
|
pattern.getTag().putInt(NBT_VERSION, VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAllowedTags(ItemStack pattern, AllowedTags allowedTags) {
|
public static void setAllowedTags(ItemStack pattern, AllowedTagList allowedTagList) {
|
||||||
if (!pattern.hasTag()) {
|
if (!pattern.hasTag()) {
|
||||||
pattern.setTag(new CompoundNBT());
|
pattern.setTag(new CompoundNBT());
|
||||||
}
|
}
|
||||||
|
|
||||||
pattern.getTag().put(NBT_ALLOWED_TAGS, allowedTags.writeToNbt());
|
pattern.getTag().put(NBT_ALLOWED_TAGS, allowedTagList.writeToNbt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static AllowedTags getAllowedTags(ItemStack pattern) {
|
public static AllowedTagList getAllowedTags(ItemStack pattern) {
|
||||||
if (!pattern.hasTag() || !pattern.getTag().contains(NBT_ALLOWED_TAGS)) {
|
if (!pattern.hasTag() || !pattern.getTag().contains(NBT_ALLOWED_TAGS)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AllowedTags allowedTags = new AllowedTags(null);
|
AllowedTagList allowedTagList = new AllowedTagList(null);
|
||||||
|
|
||||||
allowedTags.readFromNbt(pattern.getTag().getCompound(NBT_ALLOWED_TAGS));
|
allowedTagList.readFromNbt(pattern.getTag().getCompound(NBT_ALLOWED_TAGS));
|
||||||
|
|
||||||
return allowedTags;
|
return allowedTagList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -77,14 +77,8 @@ public class GridTile extends NetworkNodeTile<GridNetworkNode> {
|
|||||||
t.getNode().markDirty();
|
t.getNode().markDirty();
|
||||||
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
}, (initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
||||||
public static final TileDataParameter<Integer, GridTile> PROCESSING_TYPE = IType.createParameter((initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
public static final TileDataParameter<Integer, GridTile> PROCESSING_TYPE = IType.createParameter((initial, p) -> BaseScreen.executeLater(GridScreen.class, BaseScreen::init));
|
||||||
|
public static final TileDataParameter<List<Set<ResourceLocation>>, GridTile> ALLOWED_ITEM_TAGS = new TileDataParameter<>(RSSerializers.LIST_OF_SET_SERIALIZER, new ArrayList<>(), t -> t.getNode().getAllowedTagList().getAllowedItemTags(), (t, v) -> t.getNode().getAllowedTagList().setAllowedItemTags(v));
|
||||||
public static final TileDataParameter<List<Set<ResourceLocation>>, GridTile> ALLOWED_ITEM_TAGS = new TileDataParameter<>(RSSerializers.LIST_OF_SET_SERIALIZER, new ArrayList<>(), t -> t.getNode().getAllowedTags().getAllowedItemTags(), (t, v) -> {
|
public static final TileDataParameter<List<Set<ResourceLocation>>, GridTile> ALLOWED_FLUID_TAGS = new TileDataParameter<>(RSSerializers.LIST_OF_SET_SERIALIZER, new ArrayList<>(), t -> t.getNode().getAllowedTagList().getAllowedFluidTags(), (t, v) -> t.getNode().getAllowedTagList().setAllowedFluidTags(v));
|
||||||
t.getNode().getAllowedTags().setAllowedItemTags(v);
|
|
||||||
});
|
|
||||||
|
|
||||||
public static final TileDataParameter<List<Set<ResourceLocation>>, GridTile> ALLOWED_FLUID_TAGS = new TileDataParameter<>(RSSerializers.LIST_OF_SET_SERIALIZER, new ArrayList<>(), t -> t.getNode().getAllowedTags().getAllowedFluidTags(), (t, v) -> {
|
|
||||||
t.getNode().getAllowedTags().setAllowedFluidTags(v);
|
|
||||||
});
|
|
||||||
|
|
||||||
public static void trySortGrid(boolean initial) {
|
public static void trySortGrid(boolean initial) {
|
||||||
if (!initial) {
|
if (!initial) {
|
||||||
|
Reference in New Issue
Block a user