Make the portable grid a placeable block
@@ -32,4 +32,5 @@ public final class RSBlocks {
|
||||
public static final BlockSecurityManager SECURITY_MANAGER = new BlockSecurityManager();
|
||||
public static final BlockQuartzEnrichedIron QUARTZ_ENRICHED_IRON = new BlockQuartzEnrichedIron();
|
||||
public static final BlockStorageMonitor STORAGE_MONITOR = new BlockStorageMonitor();
|
||||
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
|
||||
}
|
||||
@@ -28,4 +28,5 @@ public final class RSGui {
|
||||
public static final int READER_WRITER = 24;
|
||||
public static final int SECURITY_MANAGER = 25;
|
||||
public static final int STORAGE_MONITOR = 26;
|
||||
public static final int PORTABLE_GRID = 27;
|
||||
}
|
||||
|
||||
@@ -22,5 +22,4 @@ public final class RSItems {
|
||||
public static final ItemFluidStoragePart FLUID_STORAGE_PART = new ItemFluidStoragePart();
|
||||
public static final ItemWrench WRENCH = new ItemWrench();
|
||||
public static final ItemSecurityCard SECURITY_CARD = new ItemSecurityCard();
|
||||
public static final ItemPortableGrid PORTABLE_GRID = new ItemPortableGrid();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -16,15 +17,17 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemGridHandlerPortable implements IItemGridHandler {
|
||||
private PortableGrid portableGrid;
|
||||
private IPortableGrid portableGrid;
|
||||
private IGrid grid;
|
||||
|
||||
public ItemGridHandlerPortable(PortableGrid portableGrid) {
|
||||
public ItemGridHandlerPortable(IPortableGrid portableGrid, IGrid grid) {
|
||||
this.portableGrid = portableGrid;
|
||||
this.grid = grid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExtract(EntityPlayerMP player, int hash, int flags) {
|
||||
if (portableGrid.getStorage() == null || !portableGrid.isActive()) {
|
||||
if (portableGrid.getStorage() == null || !grid.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,7 +98,7 @@ public class ItemGridHandlerPortable implements IItemGridHandler {
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack onInsert(EntityPlayerMP player, ItemStack stack) {
|
||||
if (portableGrid.getStorage() == null || !portableGrid.isActive()) {
|
||||
if (portableGrid.getStorage() == null || !grid.isActive()) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ public class ItemGridHandlerPortable implements IItemGridHandler {
|
||||
|
||||
@Override
|
||||
public void onInsertHeldItem(EntityPlayerMP player, boolean single) {
|
||||
if (player.inventory.getItemStack().isEmpty() || portableGrid.getStorage() == null || !portableGrid.isActive()) {
|
||||
if (player.inventory.getItemStack().isEmpty() || portableGrid.getStorage() == null || !grid.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageGridItemDelta;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageGridItemUpdate;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -17,10 +18,10 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class StorageCacheItemPortable implements IStorageCache<ItemStack> {
|
||||
private PortableGrid portableGrid;
|
||||
private IPortableGrid portableGrid;
|
||||
private IStackList<ItemStack> list = API.instance().createItemStackList();
|
||||
|
||||
public StorageCacheItemPortable(PortableGrid portableGrid) {
|
||||
public StorageCacheItemPortable(IPortableGrid portableGrid) {
|
||||
this.portableGrid = portableGrid;
|
||||
}
|
||||
|
||||
@@ -32,13 +33,7 @@ public class StorageCacheItemPortable implements IStorageCache<ItemStack> {
|
||||
portableGrid.getStorage().getStacks().forEach(list::add);
|
||||
}
|
||||
|
||||
RS.INSTANCE.network.sendTo(new MessageGridItemUpdate(buf -> {
|
||||
buf.writeInt(list.getStacks().size());
|
||||
|
||||
for (ItemStack stack : list.getStacks()) {
|
||||
RSUtils.writeItemStack(buf, stack, null, false);
|
||||
}
|
||||
}, false), (EntityPlayerMP) portableGrid.getPlayer());
|
||||
portableGrid.getWatchers().forEach(this::sendTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,14 +41,14 @@ public class StorageCacheItemPortable implements IStorageCache<ItemStack> {
|
||||
list.add(stack, size);
|
||||
|
||||
if (!rebuilding) {
|
||||
RS.INSTANCE.network.sendTo(new MessageGridItemDelta(null, stack, size), (EntityPlayerMP) portableGrid.getPlayer());
|
||||
portableGrid.getWatchers().forEach(w -> RS.INSTANCE.network.sendTo(new MessageGridItemDelta(null, stack, size), (EntityPlayerMP) w));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(@Nonnull ItemStack stack, int size) {
|
||||
if (list.remove(stack, size)) {
|
||||
RS.INSTANCE.network.sendTo(new MessageGridItemDelta(null, stack, -size), (EntityPlayerMP) portableGrid.getPlayer());
|
||||
portableGrid.getWatchers().forEach(w -> RS.INSTANCE.network.sendTo(new MessageGridItemDelta(null, stack, -size), (EntityPlayerMP) w));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,4 +66,14 @@ public class StorageCacheItemPortable implements IStorageCache<ItemStack> {
|
||||
public List<IStorage<ItemStack>> getStorages() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public void sendTo(EntityPlayer player) {
|
||||
RS.INSTANCE.network.sendTo(new MessageGridItemUpdate(buf -> {
|
||||
buf.writeInt(list.getStacks().size());
|
||||
|
||||
for (ItemStack stack : list.getStacks()) {
|
||||
RSUtils.writeItemStack(buf, stack, null, false);
|
||||
}
|
||||
}, false), (EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.raoulvdberge.refinedstorage.apiimpl.storage;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.AccessType;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.StorageDiskType;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -13,9 +13,9 @@ import java.util.function.Supplier;
|
||||
|
||||
public class StorageDiskItemPortable implements IStorageDisk<ItemStack> {
|
||||
private IStorageDisk<ItemStack> parent;
|
||||
private PortableGrid portableGrid;
|
||||
private IPortableGrid portableGrid;
|
||||
|
||||
public StorageDiskItemPortable(IStorageDisk<ItemStack> parent, PortableGrid portableGrid) {
|
||||
public StorageDiskItemPortable(IStorageDisk<ItemStack> parent, IPortableGrid portableGrid) {
|
||||
this.parent = parent;
|
||||
this.portableGrid = portableGrid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.raoulvdberge.refinedstorage.block;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSGui;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemBlockPortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPortableGrid extends BlockBase {
|
||||
public BlockPortableGrid() {
|
||||
super("portable_grid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TilePortableGrid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createItem() {
|
||||
return new ItemBlockPortableGrid();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Direction getDirection() {
|
||||
return Direction.HORIZONTAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
|
||||
if (!world.isRemote) {
|
||||
((TilePortableGrid) world.getTileEntity(pos)).onPassItemContext(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
drops.add(((TilePortableGrid) world.getTileEntity(pos)).getAsItem());
|
||||
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(RS.INSTANCE, RSGui.PORTABLE_GRID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
((TilePortableGrid) world.getTileEntity(pos)).onOpened(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,11 @@ import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
||||
import com.raoulvdberge.refinedstorage.block.GridType;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.*;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.IGridDisplay;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
@@ -31,7 +32,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
private SlotGridCraftingResult craftingResultSlot;
|
||||
private SlotDisabled patternResultSlot;
|
||||
|
||||
public ContainerGrid(IGrid grid, IGridDisplay display, @Nullable TileGrid gridTile, EntityPlayer player) {
|
||||
public ContainerGrid(IGrid grid, IGridDisplay display, @Nullable TileBase gridTile, EntityPlayer player) {
|
||||
super(gridTile, player);
|
||||
|
||||
this.grid = grid;
|
||||
@@ -49,7 +50,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
if (grid.getType() != GridType.FLUID) {
|
||||
int yStart = 6;
|
||||
|
||||
if (grid instanceof PortableGrid) {
|
||||
if (grid instanceof IPortableGrid) {
|
||||
yStart = 38;
|
||||
}
|
||||
|
||||
@@ -63,8 +64,8 @@ public class ContainerGrid extends ContainerBase {
|
||||
addSlotToContainer(new SlotOutput(((NetworkNodeGrid) grid).getPatterns(), 1, 152, headerAndSlots + 40));
|
||||
}
|
||||
|
||||
if (grid instanceof PortableGrid) {
|
||||
addSlotToContainer(new SlotItemHandler(((PortableGrid) grid).getDisk(), 0, 204, 6 + getTabDelta()));
|
||||
if (grid instanceof IPortableGrid) {
|
||||
addSlotToContainer(new SlotItemHandler(((IPortableGrid) grid).getDisk(), 0, 204, 6 + getTabDelta()));
|
||||
}
|
||||
|
||||
addPlayerInventory(8, display.getYPlayerInventory());
|
||||
@@ -174,7 +175,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
} else if ((grid.getType() == GridType.PATTERN && stack.getItem() == RSItems.PATTERN) || (grid instanceof PortableGrid && stack.getItem() instanceof IStorageDiskProvider)) {
|
||||
} else if ((grid.getType() == GridType.PATTERN && stack.getItem() == RSItems.PATTERN) || (grid instanceof IPortableGrid && stack.getItem() instanceof IStorageDiskProvider)) {
|
||||
int startIndex = 4;
|
||||
int endIndex = startIndex + 1;
|
||||
|
||||
@@ -190,8 +191,8 @@ public class ContainerGrid extends ContainerBase {
|
||||
detectAndSendChanges();
|
||||
|
||||
// For some reason it doesn't detect when moving the disk from disk inventory to player inventory...
|
||||
if (grid instanceof PortableGrid && slotIndex == 4) {
|
||||
((PortableGrid) grid).getDisk().setStackInSlot(0, ItemStack.EMPTY);
|
||||
if (grid instanceof IPortableGrid && slotIndex == 4) {
|
||||
((IPortableGrid) grid).getDisk().setStackInSlot(0, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
@@ -227,6 +228,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
|
||||
@Override
|
||||
protected boolean isHeldItemDisabled() {
|
||||
// Here we check for the concrete portable grid type, not IPortableGrid, because we can move the held item in the tile
|
||||
return grid instanceof WirelessGrid || grid instanceof PortableGrid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,12 @@ import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
|
||||
import com.raoulvdberge.refinedstorage.tile.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
||||
import com.raoulvdberge.refinedstorage.tile.craftingmonitor.WirelessCraftingMonitor;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessFluidGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -27,6 +32,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new ContainerController((TileController) tile, player);
|
||||
case RSGui.GRID:
|
||||
return new ContainerGrid(((TileGrid) tile).getNode(), new GridDisplayDummy(), (TileGrid) tile, player);
|
||||
case RSGui.PORTABLE_GRID:
|
||||
return new ContainerGrid((TilePortableGrid) tile, new GridDisplayDummy(), (TilePortableGrid) tile, player);
|
||||
case RSGui.DISK_DRIVE:
|
||||
return new ContainerDiskDrive((TileDiskDrive) tile, player);
|
||||
case RSGui.IMPORTER:
|
||||
@@ -97,7 +104,8 @@ public class GuiHandler implements IGuiHandler {
|
||||
case RSGui.CONTROLLER:
|
||||
return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile);
|
||||
case RSGui.GRID:
|
||||
IGrid grid = ((TileGrid) tile).getNode();
|
||||
case RSGui.PORTABLE_GRID:
|
||||
IGrid grid = ID == RSGui.GRID ? ((TileGrid) tile).getNode() : (TilePortableGrid) tile;
|
||||
GuiGrid gui = new GuiGrid(null, grid);
|
||||
gui.inventorySlots = new ContainerGrid(grid, gui, null, player);
|
||||
return gui;
|
||||
|
||||
@@ -26,8 +26,8 @@ import com.raoulvdberge.refinedstorage.item.filter.FilterTab;
|
||||
import com.raoulvdberge.refinedstorage.network.*;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -380,7 +380,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
bindTexture("gui/crafting_grid.png");
|
||||
} else if (grid.getType() == GridType.PATTERN) {
|
||||
bindTexture("gui/pattern_grid.png");
|
||||
} else if (grid instanceof PortableGrid) {
|
||||
} else if (grid instanceof IPortableGrid) {
|
||||
bindTexture("gui/portable_grid.png");
|
||||
} else {
|
||||
bindTexture("gui/grid.png");
|
||||
@@ -391,7 +391,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
drawTexture(x, yy, 0, 0, screenWidth - (grid.getType() != GridType.FLUID ? 34 : 0), getHeader());
|
||||
|
||||
if (grid.getType() != GridType.FLUID) {
|
||||
drawTexture(x + screenWidth - 34 + 4, y + getTabDelta(), 197, 0, 30, grid instanceof PortableGrid ? 114 : 82);
|
||||
drawTexture(x + screenWidth - 34 + 4, y + getTabDelta(), 197, 0, 30, grid instanceof IPortableGrid ? 114 : 82);
|
||||
}
|
||||
|
||||
int rows = getVisibleRows();
|
||||
|
||||
@@ -4,12 +4,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
|
||||
public class NetworkItemEnergyForge extends EnergyStorage {
|
||||
public class ItemEnergyForge extends EnergyStorage {
|
||||
private static final String NBT_ENERGY = "Energy";
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public NetworkItemEnergyForge(ItemStack stack, int capacity) {
|
||||
public ItemEnergyForge(ItemStack stack, int capacity) {
|
||||
super(capacity, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
this.stack = stack;
|
||||
@@ -5,10 +5,10 @@ import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
|
||||
public class NetworkItemEnergyTesla implements ITeslaHolder, ITeslaConsumer {
|
||||
public class ItemEnergyTesla implements ITeslaHolder, ITeslaConsumer {
|
||||
private ItemStack stack;
|
||||
|
||||
public NetworkItemEnergyTesla(ItemStack stack) {
|
||||
public ItemEnergyTesla(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.raoulvdberge.refinedstorage.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.integration.forgeenergy.ItemEnergyForge;
|
||||
import com.raoulvdberge.refinedstorage.integration.tesla.IntegrationTesla;
|
||||
import com.raoulvdberge.refinedstorage.integration.tesla.ItemEnergyTesla;
|
||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CapabilityProviderEnergy implements ICapabilityProvider {
|
||||
private ItemStack stack;
|
||||
|
||||
public CapabilityProviderEnergy(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityEnergy.ENERGY ||
|
||||
(IntegrationTesla.isLoaded() && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(new ItemEnergyForge(stack, 3200));
|
||||
}
|
||||
|
||||
if (IntegrationTesla.isLoaded()) {
|
||||
if (capability == TeslaCapabilities.CAPABILITY_HOLDER) {
|
||||
return TeslaCapabilities.CAPABILITY_HOLDER.cast(new ItemEnergyTesla(stack));
|
||||
}
|
||||
|
||||
if (capability == TeslaCapabilities.CAPABILITY_CONSUMER) {
|
||||
return TeslaCapabilities.CAPABILITY_CONSUMER.cast(new ItemEnergyTesla(stack));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.raoulvdberge.refinedstorage.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.block.Direction;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemBlockEnergyItem extends ItemBlockBase {
|
||||
public static final int TYPE_NORMAL = 0;
|
||||
public static final int TYPE_CREATIVE = 1;
|
||||
|
||||
public ItemBlockEnergyItem(Block block, Direction direction) {
|
||||
super(block, direction, true);
|
||||
|
||||
setMaxDamage(3200);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound tag) {
|
||||
return new CapabilityProviderEnergy(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
IEnergyStorage energy = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
|
||||
return 1D - ((double) energy.getEnergyStored() / (double) energy.getMaxEnergyStored());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRGBDurabilityForDisplay(ItemStack stack) {
|
||||
IEnergyStorage energy = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
|
||||
return MathHelper.hsvToRGB(Math.max(0.0F, (float) energy.getEnergyStored() / (float) energy.getMaxEnergyStored()) / 3.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamaged(ItemStack stack) {
|
||||
return stack.getItemDamage() != TYPE_CREATIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(ItemStack stack, int damage) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(item, 1, TYPE_NORMAL));
|
||||
|
||||
ItemStack fullyCharged = new ItemStack(item, 1, TYPE_NORMAL);
|
||||
|
||||
IEnergyStorage energy = fullyCharged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
energy.receiveEnergy(energy.getMaxEnergyStored(), false);
|
||||
|
||||
list.add(fullyCharged);
|
||||
|
||||
list.add(new ItemStack(item, 1, TYPE_CREATIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
super.addInformation(stack, playerIn, tooltip, advanced);
|
||||
|
||||
if (stack.getItemDamage() != TYPE_CREATIVE) {
|
||||
IEnergyStorage energy = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
|
||||
tooltip.add(I18n.format("misc.refinedstorage:energy_stored", energy.getEnergyStored(), energy.getMaxEnergyStored()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.raoulvdberge.refinedstorage.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||
import com.raoulvdberge.refinedstorage.RSGui;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
@@ -10,9 +11,9 @@ import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemPortableGrid extends ItemEnergyItem {
|
||||
public ItemPortableGrid() {
|
||||
super("portable_grid");
|
||||
public class ItemBlockPortableGrid extends ItemBlockEnergyItem {
|
||||
public ItemBlockPortableGrid() {
|
||||
super(RSBlocks.PORTABLE_GRID, RSBlocks.PORTABLE_GRID.getDirection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,24 +1,17 @@
|
||||
package com.raoulvdberge.refinedstorage.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.integration.forgeenergy.NetworkItemEnergyForge;
|
||||
import com.raoulvdberge.refinedstorage.integration.tesla.IntegrationTesla;
|
||||
import com.raoulvdberge.refinedstorage.integration.tesla.NetworkItemEnergyTesla;
|
||||
import net.darkhax.tesla.capability.TeslaCapabilities;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemEnergyItem extends ItemBase {
|
||||
@@ -35,7 +28,7 @@ public abstract class ItemEnergyItem extends ItemBase {
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound tag) {
|
||||
return new NetworkItemCapabilityProvider(stack);
|
||||
return new CapabilityProviderEnergy(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,37 +89,4 @@ public abstract class ItemEnergyItem extends ItemBase {
|
||||
tooltip.add(I18n.format("misc.refinedstorage:energy_stored", energy.getEnergyStored(), energy.getMaxEnergyStored()));
|
||||
}
|
||||
}
|
||||
|
||||
private class NetworkItemCapabilityProvider implements ICapabilityProvider {
|
||||
private ItemStack stack;
|
||||
|
||||
public NetworkItemCapabilityProvider(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityEnergy.ENERGY ||
|
||||
(IntegrationTesla.isLoaded() && (capability == TeslaCapabilities.CAPABILITY_HOLDER || capability == TeslaCapabilities.CAPABILITY_CONSUMER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(new NetworkItemEnergyForge(stack, 3200));
|
||||
}
|
||||
|
||||
if (IntegrationTesla.isLoaded()) {
|
||||
if (capability == TeslaCapabilities.CAPABILITY_HOLDER) {
|
||||
return TeslaCapabilities.CAPABILITY_HOLDER.cast(new NetworkItemEnergyTesla(stack));
|
||||
}
|
||||
|
||||
if (capability == TeslaCapabilities.CAPABILITY_CONSUMER) {
|
||||
return TeslaCapabilities.CAPABILITY_CONSUMER.cast(new NetworkItemEnergyTesla(stack));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ package com.raoulvdberge.refinedstorage.network;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
||||
import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -84,6 +85,26 @@ public class MessageGridSettingsUpdate extends MessageHandlerPlayerToServer<Mess
|
||||
}
|
||||
|
||||
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_TAB_SELECTED, message.tabSelected);
|
||||
} else if (grid instanceof TilePortableGrid) {
|
||||
if (NetworkNodeGrid.isValidSortingDirection(message.sortingDirection)) {
|
||||
((TilePortableGrid) grid).setSortingDirection(message.sortingDirection);
|
||||
}
|
||||
|
||||
if (NetworkNodeGrid.isValidSortingType(message.sortingType)) {
|
||||
((TilePortableGrid) grid).setSortingType(message.sortingType);
|
||||
}
|
||||
|
||||
if (NetworkNodeGrid.isValidSearchBoxMode(message.searchBoxMode)) {
|
||||
((TilePortableGrid) grid).setSearchBoxMode(message.searchBoxMode);
|
||||
}
|
||||
|
||||
if (NetworkNodeGrid.isValidSize(message.size)) {
|
||||
((TilePortableGrid) grid).setSize(message.size);
|
||||
}
|
||||
|
||||
((TilePortableGrid) grid).setTabSelected(message.tabSelected);
|
||||
|
||||
((TilePortableGrid) grid).markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@ public class ProxyClient extends ProxyCommon {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.SECURITY_MANAGER), 0, new ModelResourceLocation("refinedstorage:security_manager", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.QUARTZ_ENRICHED_IRON), 0, new ModelResourceLocation("refinedstorage:quartz_enriched_iron_block", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.STORAGE_MONITOR), 0, new ModelResourceLocation("refinedstorage:storage_monitor", "connected=false,direction=north"));
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RSBlocks.PORTABLE_GRID), 0, new ModelResourceLocation("refinedstorage:portable_grid", "inventory"));
|
||||
|
||||
ModelLoaderRegistry.registerLoader(new ICustomModelLoader() {
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.ContainerListener;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -157,9 +158,11 @@ public class ProxyCommon {
|
||||
registerTile(TileReader.class, "reader");
|
||||
registerTile(TileWriter.class, "writer");
|
||||
registerTile(TileStorageMonitor.class, "storage_monitor");
|
||||
registerTile(TilePortableGrid.class, "portable_grid");
|
||||
|
||||
registerBlock(RSBlocks.CONTROLLER);
|
||||
registerBlock(RSBlocks.GRID);
|
||||
registerBlock(RSBlocks.PORTABLE_GRID);
|
||||
registerBlock(RSBlocks.CRAFTING_MONITOR);
|
||||
registerBlock(RSBlocks.STORAGE_MONITOR);
|
||||
registerBlock(RSBlocks.SECURITY_MANAGER);
|
||||
@@ -177,7 +180,6 @@ public class ProxyCommon {
|
||||
registerBlock(RSBlocks.DESTRUCTOR);
|
||||
registerBlock(RSBlocks.READER);
|
||||
registerBlock(RSBlocks.WRITER);
|
||||
|
||||
registerBlock(RSBlocks.DETECTOR);
|
||||
registerBlock(RSBlocks.RELAY);
|
||||
registerBlock(RSBlocks.INTERFACE);
|
||||
@@ -199,7 +201,6 @@ public class ProxyCommon {
|
||||
registerItem(RSItems.WIRELESS_GRID);
|
||||
registerItem(RSItems.WIRELESS_FLUID_GRID);
|
||||
registerItem(RSItems.WIRELESS_CRAFTING_MONITOR);
|
||||
registerItem(RSItems.PORTABLE_GRID);
|
||||
registerItem(RSItems.PROCESSOR);
|
||||
registerItem(RSItems.CORE);
|
||||
registerItem(RSItems.SILICON);
|
||||
@@ -376,7 +377,7 @@ public class ProxyCommon {
|
||||
);
|
||||
|
||||
// Portable Grid
|
||||
GameRegistry.addRecipe(new ItemStack(RSItems.PORTABLE_GRID),
|
||||
GameRegistry.addRecipe(new ItemStack(RSBlocks.PORTABLE_GRID),
|
||||
"EHE",
|
||||
"ECE",
|
||||
"EAE",
|
||||
|
||||
@@ -20,13 +20,13 @@ public class ContainerListener {
|
||||
|
||||
manager.sendParametersTo((EntityPlayerMP) e.getEntityPlayer());
|
||||
|
||||
int watchers = manager.getWatchers();
|
||||
int watchers = manager.getWatchers().size();
|
||||
|
||||
manager.setWatchers(watchers + 1);
|
||||
manager.getWatchers().add(e.getEntityPlayer());
|
||||
|
||||
if (watchers == 0) {
|
||||
Thread listenerThread = new Thread(() -> {
|
||||
while (manager.getWatchers() > 0) {
|
||||
while (manager.getWatchers().size() > 0) {
|
||||
manager.detectAndSendChanges();
|
||||
}
|
||||
}, "RS tile listener " + tile.getPos().getX() + ", " + tile.getPos().getY() + ", " + tile.getPos().getZ());
|
||||
@@ -45,7 +45,7 @@ public class ContainerListener {
|
||||
TileBase tile = ((ContainerBase) container).getTile();
|
||||
|
||||
if (tile != null && !tile.getWorld().isRemote) {
|
||||
tile.getDataManager().setWatchers(tile.getDataManager().getWatchers() - 1);
|
||||
tile.getDataManager().getWatchers().remove(e.getEntityPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TileDataManager {
|
||||
private List<TileDataParameter> watchedParameters = new ArrayList<>();
|
||||
private List<Object> watchedParametersCache = new ArrayList<>();
|
||||
|
||||
private int watchers = 0;
|
||||
private List<EntityPlayer> watchers = new ArrayList<>();
|
||||
|
||||
public static void registerParameter(TileDataParameter<?> parameter) {
|
||||
parameter.setId(LAST_ID);
|
||||
@@ -46,14 +46,10 @@ public class TileDataManager {
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public int getWatchers() {
|
||||
public List<EntityPlayer> getWatchers() {
|
||||
return watchers;
|
||||
}
|
||||
|
||||
public void setWatchers(int watchers) {
|
||||
this.watchers = Math.max(0, watchers);
|
||||
}
|
||||
|
||||
public void addParameter(TileDataParameter<?> parameter) {
|
||||
parameters.add(parameter);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.api.storage.IStorage;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.IStorageCache;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPortableGrid {
|
||||
IStorageCache<ItemStack> getCache();
|
||||
|
||||
IStorage<ItemStack> getStorage();
|
||||
|
||||
List<EntityPlayer> getWatchers();
|
||||
|
||||
void drainEnergy(int energy);
|
||||
|
||||
ItemHandlerBase getDisk();
|
||||
|
||||
ItemHandlerBase getFilter();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.raoulvdberge.refinedstorage.tile.grid;
|
||||
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
@@ -16,12 +16,13 @@ import com.raoulvdberge.refinedstorage.block.GridType;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemPortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemBlockPortableGrid;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid;
|
||||
import com.raoulvdberge.refinedstorage.item.filter.Filter;
|
||||
import com.raoulvdberge.refinedstorage.item.filter.FilterTab;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
@@ -32,17 +33,19 @@ import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PortableGrid implements IGrid {
|
||||
public class PortableGrid implements IGrid, IPortableGrid {
|
||||
public static final int GRID_TYPE = 2;
|
||||
|
||||
@Nullable
|
||||
private IStorageDisk<ItemStack> storage;
|
||||
private StorageCacheItemPortable cache = new StorageCacheItemPortable(this);
|
||||
private ItemGridHandlerPortable handler = new ItemGridHandlerPortable(this);
|
||||
private ItemGridHandlerPortable handler = new ItemGridHandlerPortable(this, this);
|
||||
|
||||
private EntityPlayer player;
|
||||
private ItemStack stack;
|
||||
@@ -89,6 +92,16 @@ public class PortableGrid implements IGrid {
|
||||
RSUtils.writeItems(this, 4, stack.getTagCompound());
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
if (storage != null) {
|
||||
storage.writeToNBT();
|
||||
}
|
||||
|
||||
return super.extractItem(slot, amount, simulate);
|
||||
}
|
||||
};
|
||||
|
||||
public PortableGrid(EntityPlayer player, ItemStack stack) {
|
||||
@@ -117,12 +130,6 @@ public class PortableGrid implements IGrid {
|
||||
RSUtils.readItems(disk, 4, stack.getTagCompound());
|
||||
}
|
||||
|
||||
public void drainEnergy(int energy) {
|
||||
if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemPortableGrid.TYPE_CREATIVE) {
|
||||
stack.getCapability(CapabilityEnergy.ENERGY, null).extractEnergy(energy, false);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
@@ -136,6 +143,18 @@ public class PortableGrid implements IGrid {
|
||||
return storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityPlayer> getWatchers() {
|
||||
return Collections.singletonList(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drainEnergy(int energy) {
|
||||
if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemBlockPortableGrid.TYPE_CREATIVE) {
|
||||
stack.getCapability(CapabilityEnergy.ENERGY, null).extractEnergy(energy, false);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemHandlerBase getDisk() {
|
||||
return disk;
|
||||
}
|
||||
@@ -307,7 +326,7 @@ public class PortableGrid implements IGrid {
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemPortableGrid.TYPE_CREATIVE && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() <= RS.INSTANCE.config.portableGridOpenUsage) {
|
||||
if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemBlockPortableGrid.TYPE_CREATIVE && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() <= RS.INSTANCE.config.portableGridOpenUsage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,437 @@
|
||||
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||
import com.raoulvdberge.refinedstorage.RSUtils;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetworkMaster;
|
||||
import com.raoulvdberge.refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.*;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.ItemGridHandlerPortable;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.diskdrive.NetworkNodeDiskDrive;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageCacheItemPortable;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageDiskItemPortable;
|
||||
import com.raoulvdberge.refinedstorage.block.GridType;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.GuiGrid;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerBase;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerFilter;
|
||||
import com.raoulvdberge.refinedstorage.inventory.ItemHandlerListenerTile;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemWirelessGrid;
|
||||
import com.raoulvdberge.refinedstorage.item.filter.Filter;
|
||||
import com.raoulvdberge.refinedstorage.item.filter.FilterTab;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageGridSettingsUpdate;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.ITileDataProducer;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataParameter;
|
||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.EnergyStorage;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid {
|
||||
public static final TileDataParameter<Integer> ENERGY_STORED = new TileDataParameter<>(DataSerializers.VARINT, 0, new ITileDataProducer<Integer, TilePortableGrid>() {
|
||||
@Override
|
||||
public Integer getValue(TilePortableGrid tile) {
|
||||
return tile.energyStorage.getEnergyStored();
|
||||
}
|
||||
});
|
||||
|
||||
private static final String NBT_ENERGY = "Energy";
|
||||
|
||||
// @todo: make non-extractable
|
||||
private EnergyStorage energyStorage = new EnergyStorage(3200);
|
||||
|
||||
private int sortingType;
|
||||
private int sortingDirection;
|
||||
private int searchBoxMode;
|
||||
private int tabSelected;
|
||||
private int size;
|
||||
|
||||
private List<Filter> filters = new ArrayList<>();
|
||||
private List<FilterTab> tabs = new ArrayList<>();
|
||||
private ItemHandlerFilter filter = new ItemHandlerFilter(filters, tabs, new ItemHandlerListenerTile(this));
|
||||
private ItemHandlerBase disk = new ItemHandlerBase(1, new ItemHandlerListenerTile(this), s -> NetworkNodeDiskDrive.VALIDATOR_STORAGE_DISK.test(s) && ((IStorageDiskProvider) s.getItem()).create(s).getType() == StorageDiskType.ITEMS) {
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||
if (getStackInSlot(slot).isEmpty()) {
|
||||
storage = null;
|
||||
} else {
|
||||
IStorageDiskProvider provider = (IStorageDiskProvider) getStackInSlot(slot).getItem();
|
||||
|
||||
storage = new StorageDiskItemPortable(provider.create(getStackInSlot(slot)), TilePortableGrid.this);
|
||||
storage.readFromNBT();
|
||||
storage.onPassContainerContext(TilePortableGrid.this::markDirty, () -> false, () -> AccessType.INSERT_EXTRACT);
|
||||
}
|
||||
|
||||
cache.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
if (storage != null) {
|
||||
storage.writeToNBT();
|
||||
}
|
||||
|
||||
return super.extractItem(slot, amount, simulate);
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
private IStorageDisk<ItemStack> storage;
|
||||
private StorageCacheItemPortable cache = new StorageCacheItemPortable(this);
|
||||
private ItemGridHandlerPortable handler = new ItemGridHandlerPortable(this, this);
|
||||
|
||||
public TilePortableGrid() {
|
||||
dataManager.addWatchedParameter(ENERGY_STORED);
|
||||
}
|
||||
|
||||
public void onPassItemContext(ItemStack stack) {
|
||||
this.sortingType = ItemWirelessGrid.getSortingType(stack);
|
||||
this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack);
|
||||
this.searchBoxMode = ItemWirelessGrid.getSearchBoxMode(stack);
|
||||
this.tabSelected = ItemWirelessGrid.getTabSelected(stack);
|
||||
this.size = ItemWirelessGrid.getSize(stack);
|
||||
|
||||
energyStorage.receiveEnergy(stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored(), false);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
RSUtils.readItems(filter, i, stack.getTagCompound());
|
||||
}
|
||||
|
||||
RSUtils.readItems(disk, 4, stack.getTagCompound());
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public ItemStack getAsItem() {
|
||||
if (storage != null) {
|
||||
storage.writeToNBT();
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(RSBlocks.PORTABLE_GRID);
|
||||
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
|
||||
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SORTING_DIRECTION, sortingDirection);
|
||||
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SORTING_TYPE, sortingType);
|
||||
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SEARCH_BOX_MODE, searchBoxMode);
|
||||
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SIZE, size);
|
||||
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_TAB_SELECTED, tabSelected);
|
||||
|
||||
stack.getCapability(CapabilityEnergy.ENERGY, null).receiveEnergy(energyStorage.getEnergyStored(), false);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
RSUtils.writeItems(filter, i, stack.getTagCompound());
|
||||
}
|
||||
|
||||
RSUtils.writeItems(disk, 4, stack.getTagCompound());
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridType getType() {
|
||||
return GridType.NORMAL;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public INetworkMaster getNetwork() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IItemGridHandler getItemHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTitle() {
|
||||
return "gui.refinedstorage:portable_grid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingType() {
|
||||
return sortingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSortingDirection() {
|
||||
return sortingDirection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSearchBoxMode() {
|
||||
return searchBoxMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabSelected() {
|
||||
return tabSelected;
|
||||
}
|
||||
|
||||
public void setSortingType(int sortingType) {
|
||||
this.sortingType = sortingType;
|
||||
}
|
||||
|
||||
public void setSortingDirection(int sortingDirection) {
|
||||
this.sortingDirection = sortingDirection;
|
||||
}
|
||||
|
||||
public void setSearchBoxMode(int searchBoxMode) {
|
||||
this.searchBoxMode = searchBoxMode;
|
||||
}
|
||||
|
||||
public void setTabSelected(int tabSelected) {
|
||||
this.tabSelected = tabSelected;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewTypeChanged(int type) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSortingTypeChanged(int type) {
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), type, getSearchBoxMode(), getSize(), getTabSelected()));
|
||||
|
||||
this.sortingType = type;
|
||||
|
||||
GuiGrid.markForSorting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSortingDirectionChanged(int direction) {
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), direction, getSortingType(), getSearchBoxMode(), getSize(), getTabSelected()));
|
||||
|
||||
this.sortingDirection = direction;
|
||||
|
||||
GuiGrid.markForSorting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchBoxModeChanged(int searchBoxMode) {
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), searchBoxMode, getSize(), getTabSelected()));
|
||||
|
||||
this.searchBoxMode = searchBoxMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSizeChanged(int size) {
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), size, getTabSelected()));
|
||||
|
||||
this.size = size;
|
||||
|
||||
if (Minecraft.getMinecraft().currentScreen != null) {
|
||||
Minecraft.getMinecraft().currentScreen.initGui();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabSelectionChanged(int tab) {
|
||||
this.tabSelected = tab == tabSelected ? -1 : tab;
|
||||
|
||||
RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected));
|
||||
|
||||
GuiGrid.markForSorting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Filter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FilterTab> getTabs() {
|
||||
return tabs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemHandlerBase getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileDataParameter<Integer> getRedstoneModeConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryCrafting getCraftingMatrix() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryCraftResult getCraftingResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftingMatrixChanged() {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCrafted(EntityPlayer player) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftedShift(EntityPlayer player) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecipeTransfer(EntityPlayer player, ItemStack[][] recipe) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed(EntityPlayer player) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
int stored = !world.isRemote ? energyStorage.getEnergyStored() : ENERGY_STORED.getValue();
|
||||
|
||||
// @todo: handle creative
|
||||
if (RS.INSTANCE.config.portableGridUsesEnergy && stored <= RS.INSTANCE.config.portableGridOpenUsage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageCache<ItemStack> getCache() {
|
||||
return cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorage<ItemStack> getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityPlayer> getWatchers() {
|
||||
return dataManager.getWatchers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drainEnergy(int energy) {
|
||||
// @todo: handle creative
|
||||
if (RS.INSTANCE.config.portableGridUsesEnergy) {
|
||||
energyStorage.extractEnergy(energy, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemHandlerBase getDisk() {
|
||||
return disk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound write(NBTTagCompound tag) {
|
||||
super.write(tag);
|
||||
|
||||
tag.setInteger(NetworkNodeGrid.NBT_SORTING_DIRECTION, sortingDirection);
|
||||
tag.setInteger(NetworkNodeGrid.NBT_SORTING_TYPE, sortingType);
|
||||
tag.setInteger(NetworkNodeGrid.NBT_SEARCH_BOX_MODE, searchBoxMode);
|
||||
tag.setInteger(NetworkNodeGrid.NBT_SIZE, size);
|
||||
tag.setInteger(NetworkNodeGrid.NBT_TAB_SELECTED, tabSelected);
|
||||
|
||||
RSUtils.writeItems(disk, 0, tag);
|
||||
RSUtils.writeItems(filter, 1, tag);
|
||||
|
||||
tag.setInteger(NBT_ENERGY, energyStorage.getEnergyStored());
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NBTTagCompound tag) {
|
||||
super.read(tag);
|
||||
|
||||
if (tag.hasKey(NetworkNodeGrid.NBT_SORTING_DIRECTION)) {
|
||||
sortingDirection = tag.getInteger(NetworkNodeGrid.NBT_SORTING_DIRECTION);
|
||||
}
|
||||
|
||||
if (tag.hasKey(NetworkNodeGrid.NBT_SORTING_TYPE)) {
|
||||
sortingType = tag.getInteger(NetworkNodeGrid.NBT_SORTING_TYPE);
|
||||
}
|
||||
|
||||
if (tag.hasKey(NetworkNodeGrid.NBT_SEARCH_BOX_MODE)) {
|
||||
searchBoxMode = tag.getInteger(NetworkNodeGrid.NBT_SEARCH_BOX_MODE);
|
||||
}
|
||||
|
||||
if (tag.hasKey(NetworkNodeGrid.NBT_SIZE)) {
|
||||
size = tag.getInteger(NetworkNodeGrid.NBT_SIZE);
|
||||
}
|
||||
|
||||
if (tag.hasKey(NetworkNodeGrid.NBT_TAB_SELECTED)) {
|
||||
tabSelected = tag.getInteger(NetworkNodeGrid.NBT_TAB_SELECTED);
|
||||
}
|
||||
|
||||
if (tag.hasKey(NBT_ENERGY)) {
|
||||
energyStorage.receiveEnergy(tag.getInteger(NBT_ENERGY), false);
|
||||
}
|
||||
|
||||
RSUtils.readItems(disk, 0, tag);
|
||||
RSUtils.readItems(filter, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY) {
|
||||
return CapabilityEnergy.ENERGY.cast(energyStorage);
|
||||
}
|
||||
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
public void onOpened(EntityPlayer player) {
|
||||
cache.sendTo(player);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "refinedstorage:portable_grid",
|
||||
"textures": {
|
||||
"texture0": "refinedstorage:blocks/portable_grid_0",
|
||||
"texture1": "refinedstorage:blocks/portable_grid_1",
|
||||
"texture2": "refinedstorage:blocks/portable_grid_2",
|
||||
"texture3": "refinedstorage:blocks/portable_grid_3",
|
||||
"texture4": "refinedstorage:blocks/portable_grid_4",
|
||||
"texture5": "refinedstorage:blocks/portable_grid_5",
|
||||
"texture6": "refinedstorage:blocks/portable_grid_6",
|
||||
"texture7": "refinedstorage:blocks/portable_grid_7",
|
||||
"particle": "refinedstorage:blocks/portable_grid_0"
|
||||
},
|
||||
"uvlock": false
|
||||
},
|
||||
"variants": {
|
||||
"inventory": [
|
||||
{
|
||||
"transform": "forge:default-block",
|
||||
"y": 180
|
||||
}
|
||||
],
|
||||
"direction": {
|
||||
"north": {
|
||||
"y": 0
|
||||
},
|
||||
"east": {
|
||||
"y": 90
|
||||
},
|
||||
"south": {
|
||||
"y": 180
|
||||
},
|
||||
"west": {
|
||||
"y": 270
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,6 +226,8 @@ block.refinedstorage:writer.name=Writer
|
||||
block.refinedstorage:security_manager.name=Security Manager
|
||||
block.refinedstorage:quartz_enriched_iron_block.name=Block of Quartz Enriched Iron
|
||||
block.refinedstorage:storage_monitor.name=Storage Monitor
|
||||
block.refinedstorage:portable_grid.0.name=Portable Grid
|
||||
block.refinedstorage:portable_grid.1.name=Creative Portable Grid
|
||||
|
||||
item.refinedstorage:storage_disk.0.name=1k Storage Disk
|
||||
item.refinedstorage:storage_disk.1.name=4k Storage Disk
|
||||
@@ -285,5 +287,3 @@ item.refinedstorage:wrench.mode.1=Configuration
|
||||
item.refinedstorage:wrench.mode.2=Dismantling
|
||||
item.refinedstorage:security_card.name=Security Card
|
||||
item.refinedstorage:security_card.owner=Bound to: %s
|
||||
item.refinedstorage:portable_grid.0.name=Portable Grid
|
||||
item.refinedstorage:portable_grid.1.name=Creative Portable Grid
|
||||
|
||||
@@ -0,0 +1,489 @@
|
||||
{
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
0.0,
|
||||
6.0,
|
||||
9.0
|
||||
],
|
||||
"to": [
|
||||
16.0,
|
||||
13.0,
|
||||
11.0
|
||||
],
|
||||
"rotation": {
|
||||
"origin": [
|
||||
8.0,
|
||||
6.0,
|
||||
9.0
|
||||
],
|
||||
"axis": "x",
|
||||
"angle": -22.5
|
||||
},
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
14,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
14,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#texture0"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
7
|
||||
],
|
||||
"texture": "#texture0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
7,
|
||||
16,
|
||||
14
|
||||
],
|
||||
"texture": "#texture0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
7,
|
||||
2,
|
||||
14
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
7
|
||||
],
|
||||
"texture": "#texture1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
16.0,
|
||||
2.0,
|
||||
2.0
|
||||
],
|
||||
"to": [
|
||||
17.0,
|
||||
4.0,
|
||||
7.0
|
||||
],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
3,
|
||||
8,
|
||||
4,
|
||||
13
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
2,
|
||||
8,
|
||||
3,
|
||||
13
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
2
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
2,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
2,
|
||||
6,
|
||||
7,
|
||||
8
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
2,
|
||||
4,
|
||||
7,
|
||||
6
|
||||
],
|
||||
"texture": "#texture1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
0.0,
|
||||
4.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
16.0,
|
||||
6.0,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
9
|
||||
],
|
||||
"texture": "#texture3"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
2,
|
||||
16,
|
||||
11
|
||||
],
|
||||
"texture": "#texture2"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2
|
||||
],
|
||||
"texture": "#texture2"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
14,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#texture0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
3,
|
||||
2,
|
||||
12,
|
||||
4
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
3,
|
||||
0,
|
||||
12,
|
||||
2
|
||||
],
|
||||
"texture": "#texture1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"to": [
|
||||
16.0,
|
||||
4.0,
|
||||
16.0
|
||||
],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#texture6"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#texture5"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
11,
|
||||
16,
|
||||
15
|
||||
],
|
||||
"texture": "#texture2"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
9,
|
||||
16,
|
||||
13
|
||||
],
|
||||
"texture": "#texture3"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
4,
|
||||
16,
|
||||
8
|
||||
],
|
||||
"texture": "#texture4"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
4
|
||||
],
|
||||
"texture": "#texture4"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
1.0,
|
||||
4.0,
|
||||
9.0
|
||||
],
|
||||
"to": [
|
||||
15.0,
|
||||
5.0,
|
||||
15.0
|
||||
],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14,
|
||||
6
|
||||
],
|
||||
"texture": "#texture7"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
8,
|
||||
14,
|
||||
14
|
||||
],
|
||||
"texture": "#texture4"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
2,
|
||||
13,
|
||||
16,
|
||||
14
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
15,
|
||||
14,
|
||||
16
|
||||
],
|
||||
"texture": "#texture2"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
4,
|
||||
9,
|
||||
10,
|
||||
10
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
4,
|
||||
8,
|
||||
10,
|
||||
9
|
||||
],
|
||||
"texture": "#texture1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
12.0,
|
||||
4.5,
|
||||
8.0
|
||||
],
|
||||
"to": [
|
||||
13.0,
|
||||
6.5,
|
||||
10.0
|
||||
],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
8,
|
||||
6,
|
||||
9,
|
||||
8
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
7,
|
||||
6,
|
||||
8,
|
||||
8
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
4,
|
||||
10,
|
||||
5,
|
||||
12
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
5,
|
||||
10,
|
||||
6,
|
||||
12
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
7,
|
||||
4,
|
||||
9,
|
||||
6
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
6,
|
||||
10,
|
||||
8,
|
||||
12
|
||||
],
|
||||
"texture": "#texture1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
3.0,
|
||||
4.5,
|
||||
8.0
|
||||
],
|
||||
"to": [
|
||||
4.0,
|
||||
6.5,
|
||||
10.0
|
||||
],
|
||||
"faces": {
|
||||
"down": {
|
||||
"uv": [
|
||||
8,
|
||||
6,
|
||||
9,
|
||||
8
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
7,
|
||||
6,
|
||||
8,
|
||||
8
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"north": {
|
||||
"uv": [
|
||||
8,
|
||||
10,
|
||||
9,
|
||||
12
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
9,
|
||||
4,
|
||||
10,
|
||||
6
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12
|
||||
],
|
||||
"texture": "#texture1"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
9,
|
||||
6,
|
||||
11,
|
||||
8
|
||||
],
|
||||
"texture": "#texture1"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 439 B |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 616 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 485 B |
|
After Width: | Height: | Size: 220 B |
|
After Width: | Height: | Size: 522 B |
|
After Width: | Height: | Size: 150 B |