MC1.16.5 supported. Fixed Labeled Crate import (issue #157), additional Labeled Crate tile sync added on frame slot change.
This commit is contained in:
parent
915ef88029
commit
47936fb76f
9 changed files with 98 additions and 37 deletions
|
@ -5,4 +5,4 @@ version_minecraft=1.16.4
|
||||||
version_forge_minecraft=1.16.4-35.1.10
|
version_forge_minecraft=1.16.4-35.1.10
|
||||||
version_fml_mappings=20201028-1.16.3
|
version_fml_mappings=20201028-1.16.3
|
||||||
version_jei=1.16.4:7.6.1.63
|
version_jei=1.16.4:7.6.1.63
|
||||||
version_engineersdecor=1.1.6
|
version_engineersdecor=1.1.7
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||||
"1.16.4": {
|
"1.16.4": {
|
||||||
|
"1.1.7": "[M] 1.16.5 support.\n[F] Fixed Labeled Crate include (issue #157, ty NillerMedDild).",
|
||||||
"1.1.6": "[F] Added common-config opt-out specification for pack level opt-outs (issue #154, ty gekkone), will replace server config opt-out in MC1.17.",
|
"1.1.6": "[F] Added common-config opt-out specification for pack level opt-outs (issue #154, ty gekkone), will replace server config opt-out in MC1.17.",
|
||||||
"1.1.6-b3": "[M] Config logging edited, E-Furnace GUI capacitor tooltip added, E-Furnace power consumption independent of config speed setting (issue #152 ty Staegrin).",
|
"1.1.6-b3": "[M] Config logging edited, E-Furnace GUI capacitor tooltip added, E-Furnace power consumption independent of config speed setting (issue #152 ty Staegrin).",
|
||||||
"1.1.6-b2": "[M] Alternative Clinker Brick recipe (swapped Bricks/Nether Bricks) added.\n[M] Furnace XP handling simplified (simply stores/releases XP for each smelting process).\n[M] Mod devices do not propagate strong Redstone power to adjacent blocks.\n[M] Minor \"librarizing\" changes under the hood.",
|
"1.1.6-b2": "[M] Alternative Clinker Brick recipe (swapped Bricks/Nether Bricks) added.\n[M] Furnace XP handling simplified (simply stores/releases XP for each smelting process).\n[M] Mod devices do not propagate strong Redstone power to adjacent blocks.\n[M] Minor \"librarizing\" changes under the hood.",
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
||||||
},
|
},
|
||||||
"promos": {
|
"promos": {
|
||||||
"1.16.4-recommended": "1.1.6",
|
"1.16.4-recommended": "1.1.7",
|
||||||
"1.16.4-latest": "1.1.6"
|
"1.16.4-latest": "1.1.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.16.x.
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
- v1.1.7 [M] 1.16.5 support.
|
||||||
|
[F] Fixed Labeled Crate include (issue #157, ty NillerMedDild).
|
||||||
|
|
||||||
- v1.1.6 [F] Added common-config opt-out specification for pack level opt-outs (issue #154,
|
- v1.1.6 [F] Added common-config opt-out specification for pack level opt-outs (issue #154,
|
||||||
ty gekkone), will replace server config opt-out in MC1.17.
|
ty gekkone), will replace server config opt-out in MC1.17.
|
||||||
|
|
||||||
|
|
|
@ -585,7 +585,6 @@ public class ModConfig
|
||||||
if(SERVER_CONFIG_SPEC.isLoaded()) {
|
if(SERVER_CONFIG_SPEC.isLoaded()) {
|
||||||
/// @todo: remove for MC1.17/1.16.5
|
/// @todo: remove for MC1.17/1.16.5
|
||||||
String inc = SERVER.pattern_includes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", "");
|
String inc = SERVER.pattern_includes.get().toLowerCase().replaceAll(MODID+":", "").replaceAll("[^*_,a-z0-9]", "");
|
||||||
if(SERVER.pattern_includes.get() != inc) SERVER.pattern_includes.set(inc);
|
|
||||||
String[] incl = inc.split(",");
|
String[] incl = inc.split(",");
|
||||||
for(int i=0; i< incl.length; ++i) {
|
for(int i=0; i< incl.length; ++i) {
|
||||||
incl[i] = incl[i].replaceAll("[*]", ".*?");
|
incl[i] = incl[i].replaceAll("[*]", ".*?");
|
||||||
|
@ -601,8 +600,8 @@ public class ModConfig
|
||||||
if(!excl[i].isEmpty()) excludes.add(excl[i]);
|
if(!excl[i].isEmpty()) excludes.add(excl[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!excludes.isEmpty()) LOGGER.info("Config pattern excludes: '" + String.join(",", excludes) + "'");
|
if(!excludes.isEmpty()) log("Config pattern excludes: '" + String.join(",", excludes) + "'");
|
||||||
if(!includes.isEmpty()) LOGGER.info("Config pattern includes: '" + String.join(",", includes) + "'");
|
if(!includes.isEmpty()) log("Config pattern includes: '" + String.join(",", includes) + "'");
|
||||||
{
|
{
|
||||||
HashSet<String> optouts = new HashSet<>();
|
HashSet<String> optouts = new HashSet<>();
|
||||||
ModContent.getRegisteredItems().stream().filter((item)->(item!=null)).forEach(
|
ModContent.getRegisteredItems().stream().filter((item)->(item!=null)).forEach(
|
||||||
|
@ -701,7 +700,7 @@ public class ModConfig
|
||||||
);
|
);
|
||||||
optouts_ = optouts;
|
optouts_ = optouts;
|
||||||
}
|
}
|
||||||
OptionalRecipeCondition.on_config(withExperimental(), withoutRecipes(), (block)->isOptedOut(block), (item)->isOptedOut(item));
|
OptionalRecipeCondition.on_config(withExperimental(), withoutRecipes(), ModConfig::isOptedOut, ModConfig::isOptedOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void apply()
|
public static final void apply()
|
||||||
|
|
|
@ -10,7 +10,6 @@ package wile.engineersdecor.blocks;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import javafx.util.Pair;
|
|
||||||
import net.minecraft.world.IWorldReader;
|
import net.minecraft.world.IWorldReader;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -195,12 +194,12 @@ public class EdLabeledCrate
|
||||||
total_items += e.getCount();
|
total_items += e.getCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Pair<String,Integer>> itmes = new ArrayList<>();
|
List<Tuple<String,Integer>> itmes = new ArrayList<>();
|
||||||
for(Map.Entry<Item,Integer> e:item_map.entrySet()) itmes.add(new Pair<>(e.getKey().getTranslationKey(), e.getValue()));
|
for(Map.Entry<Item,Integer> e:item_map.entrySet()) itmes.add(new Tuple<>(e.getKey().getTranslationKey(), e.getValue()));
|
||||||
itmes.sort((a,b)->b.getValue()-a.getValue());
|
itmes.sort((a,b)->b.getB()-a.getB());
|
||||||
boolean dotdotdot = false;
|
boolean dotdotdot = false;
|
||||||
if(itmes.size() > 8) { itmes.subList(8, itmes.size()).clear(); dotdotdot = true; }
|
if(itmes.size() > 8) { itmes.subList(8, itmes.size()).clear(); dotdotdot = true; }
|
||||||
stats = itmes.stream().map(e->Auxiliaries.localize(e.getKey())).collect(Collectors.joining(", "));
|
stats = itmes.stream().map(e->Auxiliaries.localize(e.getA())).collect(Collectors.joining(", "));
|
||||||
if(dotdotdot) stats += "...";
|
if(dotdotdot) stats += "...";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,8 +229,9 @@ public class EdLabeledCrate
|
||||||
public static final int NUM_OF_STORAGE_ROWS = 6;
|
public static final int NUM_OF_STORAGE_ROWS = 6;
|
||||||
public static final int ITEMFRAME_SLOTNO = NUM_OF_STORAGE_SLOTS;
|
public static final int ITEMFRAME_SLOTNO = NUM_OF_STORAGE_SLOTS;
|
||||||
|
|
||||||
protected final Inventories.StorageInventory main_inventory_ = new StorageInventory(this, NUM_OF_SLOTS, 1);
|
protected final Inventories.StorageInventory main_inventory_;
|
||||||
protected final InventoryRange storage_range_ = new InventoryRange(main_inventory_, 0, NUM_OF_STORAGE_SLOTS, NUM_OF_STORAGE_ROWS);
|
protected LazyOptional<IItemHandler> item_handler_;
|
||||||
|
protected final InventoryRange storage_range_;
|
||||||
private @Nullable ITextComponent custom_name_;
|
private @Nullable ITextComponent custom_name_;
|
||||||
|
|
||||||
public LabeledCrateTileEntity()
|
public LabeledCrateTileEntity()
|
||||||
|
@ -239,9 +239,17 @@ public class EdLabeledCrate
|
||||||
|
|
||||||
public LabeledCrateTileEntity(TileEntityType<?> te_type)
|
public LabeledCrateTileEntity(TileEntityType<?> te_type)
|
||||||
{
|
{
|
||||||
super(te_type); reset();
|
super(te_type);
|
||||||
main_inventory_.setCloseAction(player->{
|
main_inventory_ = new StorageInventory(this, NUM_OF_SLOTS, 1);
|
||||||
if(!getWorld().isRemote()) Networking.PacketTileNotifyServerToClient.sendToPlayers(this, writenbt(new CompoundNBT()));
|
storage_range_ = new InventoryRange(main_inventory_, 0, NUM_OF_STORAGE_SLOTS, NUM_OF_STORAGE_ROWS);
|
||||||
|
item_handler_ = MappedItemHandler.createGenericHandler(storage_range_,
|
||||||
|
(slot,stack)->(slot!=ITEMFRAME_SLOTNO),
|
||||||
|
(slot,stack)->(slot!=ITEMFRAME_SLOTNO),
|
||||||
|
IntStream.range(0, NUM_OF_STORAGE_SLOTS).boxed().collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
main_inventory_.setCloseAction((player)->{ Networking.PacketTileNotifyServerToClient.sendToPlayers(this, writenbt(new CompoundNBT())); });
|
||||||
|
main_inventory_.setSlotChangeAction((index,stack)->{
|
||||||
|
if(index==ITEMFRAME_SLOTNO) Networking.PacketTileNotifyServerToClient.sendToPlayers(this, writenbt(new CompoundNBT()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +290,15 @@ public class EdLabeledCrate
|
||||||
public void onServerPacketReceived(CompoundNBT nbt)
|
public void onServerPacketReceived(CompoundNBT nbt)
|
||||||
{ readnbt(nbt); }
|
{ readnbt(nbt); }
|
||||||
|
|
||||||
|
// Capability export ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing)
|
||||||
|
{
|
||||||
|
if(capability==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return item_handler_.cast();
|
||||||
|
return super.getCapability(capability, facing);
|
||||||
|
}
|
||||||
|
|
||||||
// TileEntity ------------------------------------------------------------------------------
|
// TileEntity ------------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -373,20 +390,6 @@ public class EdLabeledCrate
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Capability export ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected LazyOptional<IItemHandler> item_handler_ = MappedItemHandler.createGenericHandler(storage_range_,
|
|
||||||
(slot,stack)->(slot!=ITEMFRAME_SLOTNO),
|
|
||||||
(slot,stack)->(slot!=ITEMFRAME_SLOTNO),
|
|
||||||
IntStream.range(0, NUM_OF_STORAGE_SLOTS).boxed().collect(Collectors.toList())
|
|
||||||
);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable Direction facing)
|
|
||||||
{
|
|
||||||
if(capability==CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return item_handler_.cast();
|
|
||||||
return super.getCapability(capability, facing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -528,8 +531,8 @@ public class EdLabeledCrate
|
||||||
@Override
|
@Override
|
||||||
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
|
public void onClientPacketReceived(int windowId, PlayerEntity player, CompoundNBT nbt)
|
||||||
{
|
{
|
||||||
boolean changed = false;
|
|
||||||
if(!nbt.contains("action")) return;
|
if(!nbt.contains("action")) return;
|
||||||
|
boolean changed = false;
|
||||||
final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1;
|
final int slotId = nbt.contains("slot") ? nbt.getInt("slot") : -1;
|
||||||
switch(nbt.getString("action")) {
|
switch(nbt.getString("action")) {
|
||||||
case QUICK_MOVE_ALL: {
|
case QUICK_MOVE_ALL: {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package wile.engineersdecor.eapi.jei;
|
package wile.engineersdecor.eapi.jei;
|
||||||
//public class JEIPlugin {}
|
//public class JEIPlugin {}
|
||||||
|
|
||||||
|
import mezz.jei.api.registration.IRecipeCatalystRegistration;
|
||||||
import wile.engineersdecor.ModEngineersDecor;
|
import wile.engineersdecor.ModEngineersDecor;
|
||||||
import wile.engineersdecor.ModConfig;
|
import wile.engineersdecor.ModConfig;
|
||||||
import wile.engineersdecor.ModContent;
|
import wile.engineersdecor.ModContent;
|
||||||
|
@ -75,4 +76,18 @@ public class JEIPlugin implements mezz.jei.api.IModPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipeCatalysts(IRecipeCatalystRegistration registration)
|
||||||
|
{
|
||||||
|
if(!ModConfig.isOptedOut(ModContent.CRAFTING_TABLE)) {
|
||||||
|
registration.addRecipeCatalyst(new ItemStack(ModContent.CRAFTING_TABLE), VanillaRecipeCategoryUid.CRAFTING);
|
||||||
|
}
|
||||||
|
if(!ModConfig.isOptedOut(ModContent.SMALL_LAB_FURNACE)) {
|
||||||
|
registration.addRecipeCatalyst(new ItemStack(ModContent.SMALL_LAB_FURNACE), VanillaRecipeCategoryUid.FURNACE);
|
||||||
|
}
|
||||||
|
if(!ModConfig.isOptedOut(ModContent.SMALL_ELECTRICAL_FURNACE)) {
|
||||||
|
registration.addRecipeCatalyst(new ItemStack(ModContent.SMALL_ELECTRICAL_FURNACE), VanillaRecipeCategoryUid.FURNACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -287,6 +288,8 @@ public class Inventories
|
||||||
{
|
{
|
||||||
public final IInventory inventory;
|
public final IInventory inventory;
|
||||||
public final int offset, size, num_rows;
|
public final int offset, size, num_rows;
|
||||||
|
protected int max_stack_size_ = 64;
|
||||||
|
protected BiPredicate<Integer, ItemStack> validator_ = (index, stack)->true;
|
||||||
|
|
||||||
public InventoryRange(IInventory inventory, int offset, int size, int num_rows)
|
public InventoryRange(IInventory inventory, int offset, int size, int num_rows)
|
||||||
{
|
{
|
||||||
|
@ -308,46 +311,71 @@ public class Inventories
|
||||||
public static InventoryRange fromPlayerInventory(PlayerEntity player)
|
public static InventoryRange fromPlayerInventory(PlayerEntity player)
|
||||||
{ return new InventoryRange(player.inventory, 0, 36, 4); }
|
{ return new InventoryRange(player.inventory, 0, 36, 4); }
|
||||||
|
|
||||||
|
public InventoryRange setValidator(BiPredicate<Integer, ItemStack> validator)
|
||||||
|
{ validator_ = validator; return this; }
|
||||||
|
|
||||||
|
public BiPredicate<Integer, ItemStack> getValidator()
|
||||||
|
{ return validator_; }
|
||||||
|
|
||||||
|
public InventoryRange setMaxStackSize(int count)
|
||||||
|
{ max_stack_size_ = Math.max(count, 1) ; return this; }
|
||||||
|
|
||||||
|
public int getMaxStackSize()
|
||||||
|
{ return max_stack_size_ ; }
|
||||||
|
|
||||||
// IInventory ------------------------------------------------------------------------------------------------------
|
// IInventory ------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear()
|
public void clear()
|
||||||
{ inventory.clear(); }
|
{ inventory.clear(); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory()
|
||||||
{ return size; }
|
{ return size; }
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{ for(int i=0; i<size; ++i) if(!inventory.getStackInSlot(offset+i).isEmpty()){return false;} return true; }
|
{ for(int i=0; i<size; ++i) if(!inventory.getStackInSlot(offset+i).isEmpty()){return false;} return true; }
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack getStackInSlot(int index)
|
public ItemStack getStackInSlot(int index)
|
||||||
{ return inventory.getStackInSlot(offset+index); }
|
{ return inventory.getStackInSlot(offset+index); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack decrStackSize(int index, int count)
|
public ItemStack decrStackSize(int index, int count)
|
||||||
{ return inventory.decrStackSize(offset+index, count); }
|
{ return inventory.decrStackSize(offset+index, count); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public ItemStack removeStackFromSlot(int index)
|
public ItemStack removeStackFromSlot(int index)
|
||||||
{ return inventory.removeStackFromSlot(offset+index); }
|
{ return inventory.removeStackFromSlot(offset+index); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setInventorySlotContents(int index, ItemStack stack)
|
public void setInventorySlotContents(int index, ItemStack stack)
|
||||||
{ inventory.setInventorySlotContents(offset+index, stack); }
|
{ inventory.setInventorySlotContents(offset+index, stack); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getInventoryStackLimit()
|
public int getInventoryStackLimit()
|
||||||
{ return inventory.getInventoryStackLimit(); }
|
{ return Math.min(max_stack_size_, inventory.getInventoryStackLimit()); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public void markDirty()
|
public void markDirty()
|
||||||
{ inventory.markDirty(); }
|
{ inventory.markDirty(); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isUsableByPlayer(PlayerEntity player)
|
public boolean isUsableByPlayer(PlayerEntity player)
|
||||||
{ return inventory.isUsableByPlayer(player); }
|
{ return inventory.isUsableByPlayer(player); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public void openInventory(PlayerEntity player)
|
public void openInventory(PlayerEntity player)
|
||||||
{ inventory.openInventory(player); }
|
{ inventory.openInventory(player); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public void closeInventory(PlayerEntity player)
|
public void closeInventory(PlayerEntity player)
|
||||||
{ inventory.closeInventory(player); }
|
{ inventory.closeInventory(player); }
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isItemValidForSlot(int index, ItemStack stack)
|
public boolean isItemValidForSlot(int index, ItemStack stack)
|
||||||
{ return inventory.isItemValidForSlot(offset+index, stack); }
|
{ return validator_.test(offset+index, stack) && inventory.isItemValidForSlot(offset+index, stack); }
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -597,6 +625,7 @@ public class Inventories
|
||||||
protected BiPredicate<Integer, ItemStack> validator_ = (index, stack)->true;
|
protected BiPredicate<Integer, ItemStack> validator_ = (index, stack)->true;
|
||||||
protected Consumer<PlayerEntity> open_action_ = (player)->{};
|
protected Consumer<PlayerEntity> open_action_ = (player)->{};
|
||||||
protected Consumer<PlayerEntity> close_action_ = (player)->{};
|
protected Consumer<PlayerEntity> close_action_ = (player)->{};
|
||||||
|
protected BiConsumer<Integer,ItemStack> slot_set_action_ = (index, stack)->{};
|
||||||
|
|
||||||
public StorageInventory(TileEntity te, int size)
|
public StorageInventory(TileEntity te, int size)
|
||||||
{ this(te, size, 1); }
|
{ this(te, size, 1); }
|
||||||
|
@ -637,12 +666,18 @@ public class Inventories
|
||||||
public StorageInventory setCloseAction(Consumer<PlayerEntity> fn)
|
public StorageInventory setCloseAction(Consumer<PlayerEntity> fn)
|
||||||
{ close_action_ = fn; return this; }
|
{ close_action_ = fn; return this; }
|
||||||
|
|
||||||
|
public StorageInventory setSlotChangeAction(BiConsumer<Integer,ItemStack> fn)
|
||||||
|
{ slot_set_action_ = fn; return this; }
|
||||||
|
|
||||||
public StorageInventory setStackLimit(int max_slot_stack_size)
|
public StorageInventory setStackLimit(int max_slot_stack_size)
|
||||||
{ stack_limit_ = Math.max(max_slot_stack_size, 1); return this; }
|
{ stack_limit_ = Math.max(max_slot_stack_size, 1); return this; }
|
||||||
|
|
||||||
public StorageInventory setValidator(BiPredicate<Integer, ItemStack> validator)
|
public StorageInventory setValidator(BiPredicate<Integer, ItemStack> validator)
|
||||||
{ validator_ = validator; return this; }
|
{ validator_ = validator; return this; }
|
||||||
|
|
||||||
|
public BiPredicate<Integer, ItemStack> getValidator()
|
||||||
|
{ return validator_; }
|
||||||
|
|
||||||
// Iterable<ItemStack> ---------------------------------------------------------------------
|
// Iterable<ItemStack> ---------------------------------------------------------------------
|
||||||
|
|
||||||
public Iterator<ItemStack> iterator()
|
public Iterator<ItemStack> iterator()
|
||||||
|
@ -675,7 +710,12 @@ public class Inventories
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int index, ItemStack stack)
|
public void setInventorySlotContents(int index, ItemStack stack)
|
||||||
{ stacks_.set(index, stack); }
|
{
|
||||||
|
stacks_.set(index, stack);
|
||||||
|
if((stack.getCount() != stacks_.get(index).getCount()) || !areItemStacksDifferent(stacks_.get(index),stack)) {
|
||||||
|
slot_set_action_.accept(index, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit()
|
public int getInventoryStackLimit()
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class Networking
|
||||||
|
|
||||||
public static void sendToPlayers(TileEntity te, CompoundNBT nbt)
|
public static void sendToPlayers(TileEntity te, CompoundNBT nbt)
|
||||||
{
|
{
|
||||||
if(te==null) return;
|
if(te==null || te.getWorld().isRemote()) return;
|
||||||
for(PlayerEntity player: te.getWorld().getPlayers()) sendToPlayer(player, te, nbt);
|
for(PlayerEntity player: te.getWorld().getPlayers()) sendToPlayer(player, te, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,6 @@ logoFile="logo.png"
|
||||||
[[dependencies.engineersdecor]]
|
[[dependencies.engineersdecor]]
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[1.16.4]"
|
versionRange="[1.16.4,)"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue