Remove some unneeded util classes.
This commit is contained in:
@@ -27,7 +27,6 @@ import com.refinedmods.refinedstorage.item.PatternItem;
|
|||||||
import com.refinedmods.refinedstorage.tile.config.IType;
|
import com.refinedmods.refinedstorage.tile.config.IType;
|
||||||
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
import com.refinedmods.refinedstorage.tile.data.TileDataManager;
|
||||||
import com.refinedmods.refinedstorage.tile.grid.GridTile;
|
import com.refinedmods.refinedstorage.tile.grid.GridTile;
|
||||||
import com.refinedmods.refinedstorage.util.GridUtils;
|
|
||||||
import com.refinedmods.refinedstorage.util.StackUtils;
|
import com.refinedmods.refinedstorage.util.StackUtils;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
@@ -199,6 +198,21 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getId(GridType type) {
|
||||||
|
switch (type) {
|
||||||
|
case NORMAL:
|
||||||
|
return ID;
|
||||||
|
case CRAFTING:
|
||||||
|
return CRAFTING_ID;
|
||||||
|
case PATTERN:
|
||||||
|
return PATTERN_ID;
|
||||||
|
case FLUID:
|
||||||
|
return FLUID_ID;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown grid type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public AllowedTagList getAllowedTagList() {
|
public AllowedTagList getAllowedTagList() {
|
||||||
return allowedTagList;
|
return allowedTagList;
|
||||||
}
|
}
|
||||||
@@ -686,7 +700,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getId() {
|
public ResourceLocation getId() {
|
||||||
return GridUtils.getNetworkNodeId(type);
|
return getId(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -23,7 +23,6 @@ import com.refinedmods.refinedstorage.tile.config.IComparable;
|
|||||||
import com.refinedmods.refinedstorage.tile.config.IPrioritizable;
|
import com.refinedmods.refinedstorage.tile.config.IPrioritizable;
|
||||||
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||||
import com.refinedmods.refinedstorage.util.AccessTypeUtils;
|
import com.refinedmods.refinedstorage.util.AccessTypeUtils;
|
||||||
import com.refinedmods.refinedstorage.util.FluidStorageBlockUtils;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
@@ -74,6 +73,23 @@ public class FluidStorageNetworkNode extends NetworkNode implements IStorageScre
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getId(FluidStorageType type) {
|
||||||
|
switch (type) {
|
||||||
|
case SIXTY_FOUR_K:
|
||||||
|
return SIXTY_FOUR_K_FLUID_STORAGE_BLOCK_ID;
|
||||||
|
case TWO_HUNDRED_FIFTY_SIX_K:
|
||||||
|
return TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK_ID;
|
||||||
|
case THOUSAND_TWENTY_FOUR_K:
|
||||||
|
return THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK_ID;
|
||||||
|
case FOUR_THOUSAND_NINETY_SIX_K:
|
||||||
|
return FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK_ID;
|
||||||
|
case CREATIVE:
|
||||||
|
return CREATIVE_FLUID_STORAGE_BLOCK_ID;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown storage type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -117,7 +133,7 @@ public class FluidStorageNetworkNode extends NetworkNode implements IStorageScre
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getId() {
|
public ResourceLocation getId() {
|
||||||
return FluidStorageBlockUtils.getNetworkNodeId(type);
|
return getId(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -24,7 +24,6 @@ import com.refinedmods.refinedstorage.tile.config.IPrioritizable;
|
|||||||
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||||
import com.refinedmods.refinedstorage.util.AccessTypeUtils;
|
import com.refinedmods.refinedstorage.util.AccessTypeUtils;
|
||||||
import com.refinedmods.refinedstorage.util.StackUtils;
|
import com.refinedmods.refinedstorage.util.StackUtils;
|
||||||
import com.refinedmods.refinedstorage.util.StorageBlockUtils;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
@@ -74,6 +73,23 @@ public class StorageNetworkNode extends NetworkNode implements IStorageScreen, I
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResourceLocation getId(ItemStorageType type) {
|
||||||
|
switch (type) {
|
||||||
|
case ONE_K:
|
||||||
|
return ONE_K_STORAGE_BLOCK_ID;
|
||||||
|
case FOUR_K:
|
||||||
|
return FOUR_K_STORAGE_BLOCK_ID;
|
||||||
|
case SIXTEEN_K:
|
||||||
|
return SIXTEEN_K_STORAGE_BLOCK_ID;
|
||||||
|
case SIXTY_FOUR_K:
|
||||||
|
return SIXTY_FOUR_K_STORAGE_BLOCK_ID;
|
||||||
|
case CREATIVE:
|
||||||
|
return CREATIVE_STORAGE_BLOCK_ID;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown storage type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -117,7 +133,7 @@ public class StorageNetworkNode extends NetworkNode implements IStorageScreen, I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getId() {
|
public ResourceLocation getId() {
|
||||||
return StorageBlockUtils.getNetworkNodeId(type);
|
return getId(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.tile;
|
package com.refinedmods.refinedstorage.tile;
|
||||||
|
|
||||||
|
import com.refinedmods.refinedstorage.RSTiles;
|
||||||
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType;
|
import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType;
|
||||||
@@ -9,7 +10,7 @@ import com.refinedmods.refinedstorage.tile.config.IPrioritizable;
|
|||||||
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||||
import com.refinedmods.refinedstorage.tile.data.RSSerializers;
|
import com.refinedmods.refinedstorage.tile.data.RSSerializers;
|
||||||
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.refinedmods.refinedstorage.util.FluidStorageBlockUtils;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ public class FluidStorageTile extends NetworkNodeTile<FluidStorageNetworkNode> {
|
|||||||
private final FluidStorageType type;
|
private final FluidStorageType type;
|
||||||
|
|
||||||
public FluidStorageTile(FluidStorageType type) {
|
public FluidStorageTile(FluidStorageType type) {
|
||||||
super(FluidStorageBlockUtils.getTileEntityType(type));
|
super(getType(type));
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
@@ -36,6 +37,23 @@ public class FluidStorageTile extends NetworkNodeTile<FluidStorageNetworkNode> {
|
|||||||
dataManager.addWatchedParameter(ACCESS_TYPE);
|
dataManager.addWatchedParameter(ACCESS_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TileEntityType<FluidStorageTile> getType(FluidStorageType type) {
|
||||||
|
switch (type) {
|
||||||
|
case SIXTY_FOUR_K:
|
||||||
|
return RSTiles.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK;
|
||||||
|
case TWO_HUNDRED_FIFTY_SIX_K:
|
||||||
|
return RSTiles.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK;
|
||||||
|
case THOUSAND_TWENTY_FOUR_K:
|
||||||
|
return RSTiles.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK;
|
||||||
|
case FOUR_THOUSAND_NINETY_SIX_K:
|
||||||
|
return RSTiles.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK;
|
||||||
|
case CREATIVE:
|
||||||
|
return RSTiles.CREATIVE_FLUID_STORAGE_BLOCK;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown storage type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FluidStorageType getFluidStorageType() {
|
public FluidStorageType getFluidStorageType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.tile;
|
package com.refinedmods.refinedstorage.tile;
|
||||||
|
|
||||||
|
import com.refinedmods.refinedstorage.RSTiles;
|
||||||
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType;
|
import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType;
|
||||||
@@ -9,7 +10,7 @@ import com.refinedmods.refinedstorage.tile.config.IPrioritizable;
|
|||||||
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
import com.refinedmods.refinedstorage.tile.config.IWhitelistBlacklist;
|
||||||
import com.refinedmods.refinedstorage.tile.data.RSSerializers;
|
import com.refinedmods.refinedstorage.tile.data.RSSerializers;
|
||||||
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.refinedmods.refinedstorage.util.StorageBlockUtils;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ public class StorageTile extends NetworkNodeTile<StorageNetworkNode> {
|
|||||||
private final ItemStorageType type;
|
private final ItemStorageType type;
|
||||||
|
|
||||||
public StorageTile(ItemStorageType type) {
|
public StorageTile(ItemStorageType type) {
|
||||||
super(StorageBlockUtils.getTileEntityType(type));
|
super(getType(type));
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
@@ -36,6 +37,23 @@ public class StorageTile extends NetworkNodeTile<StorageNetworkNode> {
|
|||||||
dataManager.addWatchedParameter(ACCESS_TYPE);
|
dataManager.addWatchedParameter(ACCESS_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TileEntityType<StorageTile> getType(ItemStorageType type) {
|
||||||
|
switch (type) {
|
||||||
|
case ONE_K:
|
||||||
|
return RSTiles.ONE_K_STORAGE_BLOCK;
|
||||||
|
case FOUR_K:
|
||||||
|
return RSTiles.FOUR_K_STORAGE_BLOCK;
|
||||||
|
case SIXTEEN_K:
|
||||||
|
return RSTiles.SIXTEEN_K_STORAGE_BLOCK;
|
||||||
|
case SIXTY_FOUR_K:
|
||||||
|
return RSTiles.SIXTY_FOUR_K_STORAGE_BLOCK;
|
||||||
|
case CREATIVE:
|
||||||
|
return RSTiles.CREATIVE_STORAGE_BLOCK;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown storage type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStorageType getItemStorageType() {
|
public ItemStorageType getItemStorageType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.tile.grid;
|
package com.refinedmods.refinedstorage.tile.grid;
|
||||||
|
|
||||||
|
import com.refinedmods.refinedstorage.RSTiles;
|
||||||
import com.refinedmods.refinedstorage.api.network.grid.GridType;
|
import com.refinedmods.refinedstorage.api.network.grid.GridType;
|
||||||
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
import com.refinedmods.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
import com.refinedmods.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
@@ -9,8 +10,8 @@ import com.refinedmods.refinedstorage.tile.NetworkNodeTile;
|
|||||||
import com.refinedmods.refinedstorage.tile.config.IType;
|
import com.refinedmods.refinedstorage.tile.config.IType;
|
||||||
import com.refinedmods.refinedstorage.tile.data.RSSerializers;
|
import com.refinedmods.refinedstorage.tile.data.RSSerializers;
|
||||||
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
||||||
import com.refinedmods.refinedstorage.util.GridUtils;
|
|
||||||
import net.minecraft.network.datasync.DataSerializers;
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -91,7 +92,7 @@ public class GridTile extends NetworkNodeTile<GridNetworkNode> {
|
|||||||
private final LazyOptional<IItemHandler> diskCapability = LazyOptional.of(() -> getNode().getPatterns());
|
private final LazyOptional<IItemHandler> diskCapability = LazyOptional.of(() -> getNode().getPatterns());
|
||||||
|
|
||||||
public GridTile(GridType type) {
|
public GridTile(GridType type) {
|
||||||
super(GridUtils.getTileEntityType(type));
|
super(getType(type));
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
@@ -109,6 +110,21 @@ public class GridTile extends NetworkNodeTile<GridNetworkNode> {
|
|||||||
dataManager.addParameter(ALLOWED_FLUID_TAGS);
|
dataManager.addParameter(ALLOWED_FLUID_TAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TileEntityType<GridTile> getType(GridType type) {
|
||||||
|
switch (type) {
|
||||||
|
case NORMAL:
|
||||||
|
return RSTiles.GRID;
|
||||||
|
case CRAFTING:
|
||||||
|
return RSTiles.CRAFTING_GRID;
|
||||||
|
case PATTERN:
|
||||||
|
return RSTiles.PATTERN_GRID;
|
||||||
|
case FLUID:
|
||||||
|
return RSTiles.FLUID_GRID;
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unknown grid type " + type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public GridNetworkNode createNode(World world, BlockPos pos) {
|
public GridNetworkNode createNode(World world, BlockPos pos) {
|
||||||
|
@@ -1,47 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.util;
|
|
||||||
|
|
||||||
import com.refinedmods.refinedstorage.RSTiles;
|
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.FluidStorageNetworkNode;
|
|
||||||
import com.refinedmods.refinedstorage.apiimpl.storage.FluidStorageType;
|
|
||||||
import com.refinedmods.refinedstorage.tile.FluidStorageTile;
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class FluidStorageBlockUtils {
|
|
||||||
private FluidStorageBlockUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ResourceLocation getNetworkNodeId(FluidStorageType type) {
|
|
||||||
switch (type) {
|
|
||||||
case SIXTY_FOUR_K:
|
|
||||||
return FluidStorageNetworkNode.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK_ID;
|
|
||||||
case TWO_HUNDRED_FIFTY_SIX_K:
|
|
||||||
return FluidStorageNetworkNode.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK_ID;
|
|
||||||
case THOUSAND_TWENTY_FOUR_K:
|
|
||||||
return FluidStorageNetworkNode.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK_ID;
|
|
||||||
case FOUR_THOUSAND_NINETY_SIX_K:
|
|
||||||
return FluidStorageNetworkNode.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK_ID;
|
|
||||||
case CREATIVE:
|
|
||||||
return FluidStorageNetworkNode.CREATIVE_FLUID_STORAGE_BLOCK_ID;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown storage type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileEntityType<FluidStorageTile> getTileEntityType(FluidStorageType type) {
|
|
||||||
switch (type) {
|
|
||||||
case SIXTY_FOUR_K:
|
|
||||||
return RSTiles.SIXTY_FOUR_K_FLUID_STORAGE_BLOCK;
|
|
||||||
case TWO_HUNDRED_FIFTY_SIX_K:
|
|
||||||
return RSTiles.TWO_HUNDRED_FIFTY_SIX_K_FLUID_STORAGE_BLOCK;
|
|
||||||
case THOUSAND_TWENTY_FOUR_K:
|
|
||||||
return RSTiles.THOUSAND_TWENTY_FOUR_K_FLUID_STORAGE_BLOCK;
|
|
||||||
case FOUR_THOUSAND_NINETY_SIX_K:
|
|
||||||
return RSTiles.FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_BLOCK;
|
|
||||||
case CREATIVE:
|
|
||||||
return RSTiles.CREATIVE_FLUID_STORAGE_BLOCK;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown storage type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,43 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.util;
|
|
||||||
|
|
||||||
import com.refinedmods.refinedstorage.RSTiles;
|
|
||||||
import com.refinedmods.refinedstorage.api.network.grid.GridType;
|
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
|
||||||
import com.refinedmods.refinedstorage.tile.grid.GridTile;
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class GridUtils {
|
|
||||||
private GridUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ResourceLocation getNetworkNodeId(GridType type) {
|
|
||||||
switch (type) {
|
|
||||||
case NORMAL:
|
|
||||||
return GridNetworkNode.ID;
|
|
||||||
case CRAFTING:
|
|
||||||
return GridNetworkNode.CRAFTING_ID;
|
|
||||||
case PATTERN:
|
|
||||||
return GridNetworkNode.PATTERN_ID;
|
|
||||||
case FLUID:
|
|
||||||
return GridNetworkNode.FLUID_ID;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown grid type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileEntityType<GridTile> getTileEntityType(GridType type) {
|
|
||||||
switch (type) {
|
|
||||||
case NORMAL:
|
|
||||||
return RSTiles.GRID;
|
|
||||||
case CRAFTING:
|
|
||||||
return RSTiles.CRAFTING_GRID;
|
|
||||||
case PATTERN:
|
|
||||||
return RSTiles.PATTERN_GRID;
|
|
||||||
case FLUID:
|
|
||||||
return RSTiles.FLUID_GRID;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown grid type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -24,8 +24,7 @@ public class NetworkUtils {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public static INetworkNode getNodeFromTile(@Nullable TileEntity tile) {
|
public static INetworkNode getNodeFromTile(@Nullable TileEntity tile) {
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
INetworkNodeProxy proxy = tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY).orElse(null);
|
INetworkNodeProxy<?> proxy = tile.getCapability(NetworkNodeProxyCapability.NETWORK_NODE_PROXY_CAPABILITY).orElse(null);
|
||||||
|
|
||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
return proxy.getNode();
|
return proxy.getNode();
|
||||||
}
|
}
|
||||||
|
@@ -1,47 +0,0 @@
|
|||||||
package com.refinedmods.refinedstorage.util;
|
|
||||||
|
|
||||||
import com.refinedmods.refinedstorage.RSTiles;
|
|
||||||
import com.refinedmods.refinedstorage.apiimpl.network.node.storage.StorageNetworkNode;
|
|
||||||
import com.refinedmods.refinedstorage.apiimpl.storage.ItemStorageType;
|
|
||||||
import com.refinedmods.refinedstorage.tile.StorageTile;
|
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class StorageBlockUtils {
|
|
||||||
private StorageBlockUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ResourceLocation getNetworkNodeId(ItemStorageType type) {
|
|
||||||
switch (type) {
|
|
||||||
case ONE_K:
|
|
||||||
return StorageNetworkNode.ONE_K_STORAGE_BLOCK_ID;
|
|
||||||
case FOUR_K:
|
|
||||||
return StorageNetworkNode.FOUR_K_STORAGE_BLOCK_ID;
|
|
||||||
case SIXTEEN_K:
|
|
||||||
return StorageNetworkNode.SIXTEEN_K_STORAGE_BLOCK_ID;
|
|
||||||
case SIXTY_FOUR_K:
|
|
||||||
return StorageNetworkNode.SIXTY_FOUR_K_STORAGE_BLOCK_ID;
|
|
||||||
case CREATIVE:
|
|
||||||
return StorageNetworkNode.CREATIVE_STORAGE_BLOCK_ID;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown storage type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileEntityType<StorageTile> getTileEntityType(ItemStorageType type) {
|
|
||||||
switch (type) {
|
|
||||||
case ONE_K:
|
|
||||||
return RSTiles.ONE_K_STORAGE_BLOCK;
|
|
||||||
case FOUR_K:
|
|
||||||
return RSTiles.FOUR_K_STORAGE_BLOCK;
|
|
||||||
case SIXTEEN_K:
|
|
||||||
return RSTiles.SIXTEEN_K_STORAGE_BLOCK;
|
|
||||||
case SIXTY_FOUR_K:
|
|
||||||
return RSTiles.SIXTY_FOUR_K_STORAGE_BLOCK;
|
|
||||||
case CREATIVE:
|
|
||||||
return RSTiles.CREATIVE_STORAGE_BLOCK;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Unknown storage type " + type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user