Added config for the drawer controller range, armory cabinet doesnt sync its contents to the client

This commit is contained in:
Buuz135 2021-12-25 13:50:12 +01:00
parent c15bdc006e
commit e9f2ebbe4c
4 changed files with 15 additions and 6 deletions

View File

@ -10,4 +10,7 @@ public class FunctionalStorageConfig {
@ConfigVal.InRangeInt(min = 1)
public static int ARMORY_CABINET_SIZE = 4096;
@ConfigVal(comment = "Linking range radius")
public static int DRAWER_CONTROLLER_LINKING_RANGE = 12;
}

View File

@ -7,6 +7,8 @@ import com.hrznstudio.titanium.block.BasicTileBlock;
import com.hrznstudio.titanium.block.tile.ActiveTile;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
@ -20,7 +22,6 @@ import javax.annotation.Nullable;
public class ArmoryCabinetTile extends ActiveTile<ArmoryCabinetTile> {
//TODO Not sync nbt
//TODO Tool Efficiency
@Save
public ArmoryCabinetInventoryHandler handler;
@ -54,6 +55,11 @@ public class ArmoryCabinetTile extends ActiveTile<ArmoryCabinetTile> {
return lazyStorage;
}
@Override
public ClientboundBlockEntityDataPacket getUpdatePacket() {
return ClientboundBlockEntityDataPacket.create(this, blockEntity -> new CompoundTag());
}
@NotNull
@Override
public ArmoryCabinetTile getSelf() {

View File

@ -1,6 +1,8 @@
package com.buuz135.functionalstorage.block.tile;
import com.buuz135.functionalstorage.FunctionalStorage;
import com.buuz135.functionalstorage.block.DrawerControllerBlock;
import com.buuz135.functionalstorage.block.config.FunctionalStorageConfig;
import com.buuz135.functionalstorage.inventory.BigInventoryHandler;
import com.buuz135.functionalstorage.inventory.ControllerInventoryHandler;
import com.buuz135.functionalstorage.item.ConfigurationToolItem;
@ -117,7 +119,7 @@ public class DrawerControllerTile extends ControllableDrawerTile<DrawerControlle
public void addConnectedDrawers(LinkingToolItem.ActionMode action, BlockPos... positions){
for (BlockPos position : positions) {
if (this.getBlockPos().closerThan(position, 8)){
if (this.getBlockPos().closerThan(position, FunctionalStorageConfig.DRAWER_CONTROLLER_LINKING_RANGE)){
if (action == LinkingToolItem.ActionMode.ADD){
if (!connectedDrawers.getConnectedDrawers().contains(position.asLong())) this.connectedDrawers.getConnectedDrawers().add(position.asLong());
}

View File

@ -26,6 +26,8 @@ import java.util.Locale;
public class UpgradeItem extends BasicItem {
//TODO Add tooltip to show its type
private final Type type;
public UpgradeItem(Properties properties, Type type) {
@ -58,10 +60,6 @@ public class UpgradeItem extends BasicItem {
return type;
}
@Override
public boolean overrideStackedOnOther(ItemStack p_150888_, Slot p_150889_, ClickAction p_150890_, Player p_150891_) {
return super.overrideStackedOnOther(p_150888_, p_150889_, p_150890_, p_150891_);
}
@Override
public boolean overrideOtherStackedOnMe(ItemStack first, ItemStack second, Slot p_150894_, ClickAction clickAction, Player p_150896_, SlotAccess p_150897_) {