Re-add the portable grid (item form)
This commit is contained in:
@@ -6,10 +6,7 @@ import com.raoulvdberge.refinedstorage.container.CrafterManagerContainer;
|
|||||||
import com.raoulvdberge.refinedstorage.container.slot.CrafterManagerSlot;
|
import com.raoulvdberge.refinedstorage.container.slot.CrafterManagerSlot;
|
||||||
import com.raoulvdberge.refinedstorage.render.BakedModelOverrideRegistry;
|
import com.raoulvdberge.refinedstorage.render.BakedModelOverrideRegistry;
|
||||||
import com.raoulvdberge.refinedstorage.render.color.PatternItemColor;
|
import com.raoulvdberge.refinedstorage.render.color.PatternItemColor;
|
||||||
import com.raoulvdberge.refinedstorage.render.model.DiskDriveBakedModel;
|
import com.raoulvdberge.refinedstorage.render.model.*;
|
||||||
import com.raoulvdberge.refinedstorage.render.model.DiskManipulatorBakedModel;
|
|
||||||
import com.raoulvdberge.refinedstorage.render.model.FullbrightBakedModel;
|
|
||||||
import com.raoulvdberge.refinedstorage.render.model.PatternBakedModel;
|
|
||||||
import com.raoulvdberge.refinedstorage.render.tesr.StorageMonitorTileRenderer;
|
import com.raoulvdberge.refinedstorage.render.tesr.StorageMonitorTileRenderer;
|
||||||
import com.raoulvdberge.refinedstorage.screen.*;
|
import com.raoulvdberge.refinedstorage.screen.*;
|
||||||
import com.raoulvdberge.refinedstorage.screen.factory.GridScreenFactory;
|
import com.raoulvdberge.refinedstorage.screen.factory.GridScreenFactory;
|
||||||
@@ -88,6 +85,23 @@ public class ClientSetup {
|
|||||||
new ResourceLocation(RS.ID, "block/disks/leds")
|
new ResourceLocation(RS.ID, "block/disks/leds")
|
||||||
).disableCache());
|
).disableCache());
|
||||||
|
|
||||||
|
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "portable_grid"), (base, registry) -> new PortableGridBakedModel(
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/portable_grid_connected")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/portable_grid_disconnected")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_near_capacity")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_full")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_disconnected"))
|
||||||
|
));
|
||||||
|
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "creative_portable_grid"), (base, registry) -> new PortableGridBakedModel(
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/portable_grid_connected")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/portable_grid_disconnected")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_near_capacity")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_full")),
|
||||||
|
registry.get(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_disconnected"))
|
||||||
|
));
|
||||||
|
|
||||||
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "pattern"), (base, registry) -> new PatternBakedModel(base));
|
bakedModelOverrideRegistry.add(new ResourceLocation(RS.ID, "pattern"), (base, registry) -> new PatternBakedModel(base));
|
||||||
|
|
||||||
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/disk"));
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/disk"));
|
||||||
@@ -98,6 +112,13 @@ public class ClientSetup {
|
|||||||
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator_disconnected"));
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator_disconnected"));
|
||||||
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator_connected"));
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disk_manipulator_connected"));
|
||||||
|
|
||||||
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_connected"));
|
||||||
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/portable_grid_disconnected"));
|
||||||
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk"));
|
||||||
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_near_capacity"));
|
||||||
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_full"));
|
||||||
|
ModelLoader.addSpecialModel(new ResourceLocation(RS.ID + ":block/disks/portable_grid_disk_disconnected"));
|
||||||
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onModelBake);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onModelBake);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.API;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkListener;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.NetworkNodeListener;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.GridBlockGridFactory;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.PortableGridGridFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.WirelessFluidGridGridFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.WirelessFluidGridGridFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.WirelessGridGridFactory;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.WirelessGridGridFactory;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.*;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.*;
|
||||||
@@ -29,10 +30,7 @@ import com.raoulvdberge.refinedstorage.container.*;
|
|||||||
import com.raoulvdberge.refinedstorage.container.factory.GridContainerFactory;
|
import com.raoulvdberge.refinedstorage.container.factory.GridContainerFactory;
|
||||||
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerFactory;
|
import com.raoulvdberge.refinedstorage.container.factory.PositionalTileContainerFactory;
|
||||||
import com.raoulvdberge.refinedstorage.item.*;
|
import com.raoulvdberge.refinedstorage.item.*;
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.ControllerBlockItem;
|
import com.raoulvdberge.refinedstorage.item.blockitem.*;
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.FluidStorageBlockItem;
|
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.StorageBlockItem;
|
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.WirelessTransmitterBlockItem;
|
|
||||||
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
|
import com.raoulvdberge.refinedstorage.item.group.MainItemGroup;
|
||||||
import com.raoulvdberge.refinedstorage.loottable.StorageBlockLootFunctionSerializer;
|
import com.raoulvdberge.refinedstorage.loottable.StorageBlockLootFunctionSerializer;
|
||||||
import com.raoulvdberge.refinedstorage.network.NetworkHandler;
|
import com.raoulvdberge.refinedstorage.network.NetworkHandler;
|
||||||
@@ -138,6 +136,7 @@ public final class RS {
|
|||||||
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
API.instance().getGridManager().add(GridBlockGridFactory.ID, new GridBlockGridFactory());
|
||||||
API.instance().getGridManager().add(WirelessGridGridFactory.ID, new WirelessGridGridFactory());
|
API.instance().getGridManager().add(WirelessGridGridFactory.ID, new WirelessGridGridFactory());
|
||||||
API.instance().getGridManager().add(WirelessFluidGridGridFactory.ID, new WirelessFluidGridGridFactory());
|
API.instance().getGridManager().add(WirelessFluidGridGridFactory.ID, new WirelessFluidGridGridFactory());
|
||||||
|
API.instance().getGridManager().add(PortableGridGridFactory.ID, new PortableGridGridFactory());
|
||||||
|
|
||||||
API.instance().addExternalStorageProvider(StorageType.ITEM, new ItemExternalStorageProvider());
|
API.instance().addExternalStorageProvider(StorageType.ITEM, new ItemExternalStorageProvider());
|
||||||
API.instance().addExternalStorageProvider(StorageType.FLUID, new FluidExternalStorageProvider());
|
API.instance().addExternalStorageProvider(StorageType.FLUID, new FluidExternalStorageProvider());
|
||||||
@@ -192,6 +191,8 @@ public final class RS {
|
|||||||
e.getRegistry().register(new ConstructorBlock());
|
e.getRegistry().register(new ConstructorBlock());
|
||||||
e.getRegistry().register(new DestructorBlock());
|
e.getRegistry().register(new DestructorBlock());
|
||||||
e.getRegistry().register(new DiskManipulatorBlock());
|
e.getRegistry().register(new DiskManipulatorBlock());
|
||||||
|
e.getRegistry().register(new PortableGridBlock(PortableGridBlockItem.Type.NORMAL));
|
||||||
|
e.getRegistry().register(new PortableGridBlock(PortableGridBlockItem.Type.CREATIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@@ -307,6 +308,8 @@ public final class RS {
|
|||||||
e.getRegistry().register(new WrenchItem());
|
e.getRegistry().register(new WrenchItem());
|
||||||
e.getRegistry().register(new PatternItem());
|
e.getRegistry().register(new PatternItem());
|
||||||
e.getRegistry().register(new FilterItem());
|
e.getRegistry().register(new FilterItem());
|
||||||
|
e.getRegistry().register(new PortableGridBlockItem(PortableGridBlockItem.Type.NORMAL));
|
||||||
|
e.getRegistry().register(new PortableGridBlockItem(PortableGridBlockItem.Type.CREATIVE));
|
||||||
|
|
||||||
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.QUARTZ_ENRICHED_IRON));
|
e.getRegistry().register(BlockUtils.createBlockItemFor(RSBlocks.QUARTZ_ENRICHED_IRON));
|
||||||
e.getRegistry().register(new ControllerBlockItem(RSBlocks.CONTROLLER));
|
e.getRegistry().register(new ControllerBlockItem(RSBlocks.CONTROLLER));
|
||||||
|
|||||||
@@ -74,9 +74,12 @@ public final class RSBlocks {
|
|||||||
public static final DestructorBlock DESTRUCTOR = null;
|
public static final DestructorBlock DESTRUCTOR = null;
|
||||||
@ObjectHolder(RS.ID + ":disk_manipulator")
|
@ObjectHolder(RS.ID + ":disk_manipulator")
|
||||||
public static final DiskManipulatorBlock DISK_MANIPULATOR = null;
|
public static final DiskManipulatorBlock DISK_MANIPULATOR = null;
|
||||||
|
@ObjectHolder(RS.ID + ":portable_grid")
|
||||||
|
public static final PortableGridBlock PORTABLE_GRID = null;
|
||||||
|
@ObjectHolder(RS.ID + ":creative_portable_grid")
|
||||||
|
public static final PortableGridBlock CREATIVE_PORTABLE_GRID = null;
|
||||||
|
|
||||||
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
public static final BlockCraftingMonitor CRAFTING_MONITOR = new BlockCraftingMonitor();
|
||||||
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
public static final BlockCrafter CRAFTER = new BlockCrafter();
|
||||||
public static final BlockPortableGrid PORTABLE_GRID = new BlockPortableGrid();
|
|
||||||
public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();
|
public static final BlockCrafterManager CRAFTER_MANAGER = new BlockCrafterManager();
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.raoulvdberge.refinedstorage;
|
package com.raoulvdberge.refinedstorage;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.item.*;
|
import com.raoulvdberge.refinedstorage.item.*;
|
||||||
|
import com.raoulvdberge.refinedstorage.item.blockitem.PortableGridBlockItem;
|
||||||
import net.minecraftforge.registries.ObjectHolder;
|
import net.minecraftforge.registries.ObjectHolder;
|
||||||
|
|
||||||
public final class RSItems {
|
public final class RSItems {
|
||||||
@@ -100,6 +101,10 @@ public final class RSItems {
|
|||||||
public static final FluidStorageDiskItem FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_DISK = null;
|
public static final FluidStorageDiskItem FOUR_THOUSAND_NINETY_SIX_K_FLUID_STORAGE_DISK = null;
|
||||||
@ObjectHolder(RS.ID + ":creative_fluid_storage_disk")
|
@ObjectHolder(RS.ID + ":creative_fluid_storage_disk")
|
||||||
public static final FluidStorageDiskItem CREATIVE_FLUID_STORAGE_DISK = null;
|
public static final FluidStorageDiskItem CREATIVE_FLUID_STORAGE_DISK = null;
|
||||||
|
@ObjectHolder(RS.ID + ":portable_grid")
|
||||||
|
public static final PortableGridBlockItem PORTABLE_GRID = null;
|
||||||
|
@ObjectHolder(RS.ID + ":creative_portable_grid")
|
||||||
|
public static final PortableGridBlockItem CREATIVE_PORTABLE_GRID = null;
|
||||||
|
|
||||||
public static final ItemWirelessCraftingMonitor WIRELESS_CRAFTING_MONITOR = null;
|
public static final ItemWirelessCraftingMonitor WIRELESS_CRAFTING_MONITOR = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,6 @@ public class RSOldConfig {
|
|||||||
public int crafterManagerUsage;
|
public int crafterManagerUsage;
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Portable Grid
|
|
||||||
public boolean portableGridUsesEnergy;
|
|
||||||
public int portableGridCapacity;
|
|
||||||
public int portableGridOpenUsage;
|
|
||||||
public int portableGridExtractUsage;
|
|
||||||
public int portableGridInsertUsage;
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region Wireless Crafting Monitor
|
//region Wireless Crafting Monitor
|
||||||
public boolean wirelessCraftingMonitorUsesEnergy;
|
public boolean wirelessCraftingMonitorUsesEnergy;
|
||||||
public int wirelessCraftingMonitorCapacity;
|
public int wirelessCraftingMonitorCapacity;
|
||||||
@@ -30,7 +22,6 @@ public class RSOldConfig {
|
|||||||
|
|
||||||
//region Categories
|
//region Categories
|
||||||
private static final String ENERGY = "energy";
|
private static final String ENERGY = "energy";
|
||||||
private static final String PORTABLE_GRID = "portableGrid";
|
|
||||||
private static final String WIRELESS_CRAFTING_MONITOR = "wirelessCraftingMonitor";
|
private static final String WIRELESS_CRAFTING_MONITOR = "wirelessCraftingMonitor";
|
||||||
private static final String AUTOCRAFTING = "autocrafting";
|
private static final String AUTOCRAFTING = "autocrafting";
|
||||||
//endregion
|
//endregion
|
||||||
@@ -43,14 +34,6 @@ public class RSOldConfig {
|
|||||||
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
crafterManagerUsage = config.getInt("crafterManager", ENERGY, 4, 0, Integer.MAX_VALUE, "The energy used by Crafter Managers");
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region Portable Grid
|
|
||||||
portableGridUsesEnergy = config.getBoolean("usesEnergy", PORTABLE_GRID, true, "Whether the Portable Grid uses energy");
|
|
||||||
portableGridCapacity = config.getInt("capacity", PORTABLE_GRID, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Portable Grid");
|
|
||||||
portableGridOpenUsage = config.getInt("open", PORTABLE_GRID, 30, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to open");
|
|
||||||
portableGridInsertUsage = config.getInt("insert", PORTABLE_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to insert items");
|
|
||||||
portableGridExtractUsage = config.getInt("extract", PORTABLE_GRID, 3, 0, Integer.MAX_VALUE, "The energy used by the Portable Grid to extract items");
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
//region Wireless Crafting Monitor
|
//region Wireless Crafting Monitor
|
||||||
wirelessCraftingMonitorUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_CRAFTING_MONITOR, true, "Whether the Wireless Crafting Monitor uses energy");
|
wirelessCraftingMonitorUsesEnergy = config.getBoolean("usesEnergy", WIRELESS_CRAFTING_MONITOR, true, "Whether the Wireless Crafting Monitor uses energy");
|
||||||
wirelessCraftingMonitorCapacity = config.getInt("capacity", WIRELESS_CRAFTING_MONITOR, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Crafting Monitor");
|
wirelessCraftingMonitorCapacity = config.getInt("capacity", WIRELESS_CRAFTING_MONITOR, 3200, 0, Integer.MAX_VALUE, "The energy capacity of the Wireless Crafting Monitor");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory;
|
package com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridFactoryType;
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridFactoryType;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGridFactory;
|
||||||
@@ -7,16 +8,23 @@ import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
|||||||
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.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class PortableGridGridFactory implements IGridFactory {
|
public class PortableGridGridFactory implements IGridFactory {
|
||||||
|
public static final ResourceLocation ID = new ResourceLocation(RS.ID, "portable_grid_item");
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IGrid createFromStack(PlayerEntity player, ItemStack stack) {
|
public IGrid createFromStack(PlayerEntity player, ItemStack stack) {
|
||||||
return new PortableGrid(player, stack);
|
PortableGrid portableGrid = new PortableGrid(player, stack);
|
||||||
|
|
||||||
|
portableGrid.onOpen();
|
||||||
|
|
||||||
|
return portableGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class PortableFluidGridHandler implements IFluidGridHandler {
|
|||||||
player.updateHeldItem();
|
player.updateHeldItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
portableGrid.drainEnergy(RS.INSTANCE.config.portableGridExtractUsage);
|
portableGrid.drainEnergy(RS.SERVER_CONFIG.getPortableGrid().getExtractUsage());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public class PortableFluidGridHandler implements IFluidGridHandler {
|
|||||||
|
|
||||||
portableGrid.getFluidStorage().insert(result.getValue(), result.getValue().getAmount(), Action.PERFORM);
|
portableGrid.getFluidStorage().insert(result.getValue(), result.getValue().getAmount(), Action.PERFORM);
|
||||||
|
|
||||||
portableGrid.drainEnergy(RS.INSTANCE.config.portableGridInsertUsage);
|
portableGrid.drainEnergy(RS.SERVER_CONFIG.getPortableGrid().getInsertUsage());
|
||||||
|
|
||||||
return result.getLeft();
|
return result.getLeft();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class PortableItemGridHandler implements IItemGridHandler {
|
|||||||
player.updateHeldItem();
|
player.updateHeldItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
portableGrid.drainEnergy(RS.INSTANCE.config.portableGridExtractUsage);
|
portableGrid.drainEnergy(RS.SERVER_CONFIG.getPortableGrid().getExtractUsage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public class PortableItemGridHandler implements IItemGridHandler {
|
|||||||
|
|
||||||
ItemStack remainder = portableGrid.getItemStorage().insert(stack, stack.getCount(), Action.PERFORM);
|
ItemStack remainder = portableGrid.getItemStorage().insert(stack, stack.getCount(), Action.PERFORM);
|
||||||
|
|
||||||
portableGrid.drainEnergy(RS.INSTANCE.config.portableGridInsertUsage);
|
portableGrid.drainEnergy(RS.SERVER_CONFIG.getPortableGrid().getInsertUsage());
|
||||||
|
|
||||||
return remainder;
|
return remainder;
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ public class PortableItemGridHandler implements IItemGridHandler {
|
|||||||
|
|
||||||
player.updateHeldItem();
|
player.updateHeldItem();
|
||||||
|
|
||||||
portableGrid.drainEnergy(RS.INSTANCE.config.portableGridInsertUsage);
|
portableGrid.drainEnergy(RS.SERVER_CONFIG.getPortableGrid().getInsertUsage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener;
|
package com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCacheListener;
|
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCacheListener;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.StackListResult;
|
import com.raoulvdberge.refinedstorage.api.util.StackListResult;
|
||||||
|
import com.raoulvdberge.refinedstorage.network.grid.PortableGridFluidDeltaMessage;
|
||||||
|
import com.raoulvdberge.refinedstorage.network.grid.PortableGridFluidUpdateMessage;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PortableFluidGridStorageCacheListener implements IStorageCacheListener<FluidStack> {
|
public class PortableFluidGridStorageCacheListener implements IStorageCacheListener<FluidStack> {
|
||||||
@@ -19,25 +23,7 @@ public class PortableFluidGridStorageCacheListener implements IStorageCacheListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttached() {
|
public void onAttached() {
|
||||||
/*RS.INSTANCE.network.sendTo(new MessageGridFluidUpdate(buf -> {
|
RS.NETWORK_HANDLER.sendTo(player, new PortableGridFluidUpdateMessage(portableGrid));
|
||||||
int size = portableGrid.getFluidCache().getList().getStacks().size();
|
|
||||||
|
|
||||||
buf.writeInt(size);
|
|
||||||
|
|
||||||
for (FluidStack stack : portableGrid.getFluidCache().getList().getStacks()) {
|
|
||||||
StackUtils.writeFluidStackAndHash(buf, stack);
|
|
||||||
|
|
||||||
IStorageTracker.IStorageTrackerEntry entry = portableGrid.getFluidStorageTracker().get(stack);
|
|
||||||
buf.writeBoolean(entry != null);
|
|
||||||
if (entry != null) {
|
|
||||||
buf.writeLong(entry.getTime());
|
|
||||||
ByteBufUtils.writeUTF8String(buf, entry.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.writeBoolean(false);
|
|
||||||
buf.writeBoolean(false);
|
|
||||||
}
|
|
||||||
}, false), player); TODO */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,17 +33,15 @@ public class PortableFluidGridStorageCacheListener implements IStorageCacheListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(StackListResult<FluidStack> delta) {
|
public void onChanged(StackListResult<FluidStack> delta) {
|
||||||
// TODO RS.INSTANCE.network.sendTo(new MessageGridFluidDelta(null, portableGrid.getFluidStorageTracker(), stack, size), player);
|
List<StackListResult<FluidStack>> deltas = new ArrayList<>();
|
||||||
|
|
||||||
|
deltas.add(delta);
|
||||||
|
|
||||||
|
onChangedBulk(deltas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChangedBulk(List<StackListResult<FluidStack>> storageCacheDeltas) {
|
public void onChangedBulk(List<StackListResult<FluidStack>> storageCacheDeltas) {
|
||||||
/* TODO
|
RS.NETWORK_HANDLER.sendTo(player, new PortableGridFluidDeltaMessage(portableGrid, storageCacheDeltas));
|
||||||
for (Pair<FluidStack, Integer> stack : stacks) {
|
|
||||||
onChanged(stack.getLeft(), stack.getRight());
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener;
|
package com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCacheListener;
|
import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCacheListener;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.StackListResult;
|
import com.raoulvdberge.refinedstorage.api.util.StackListResult;
|
||||||
|
import com.raoulvdberge.refinedstorage.network.grid.PortableGridItemDeltaMessage;
|
||||||
|
import com.raoulvdberge.refinedstorage.network.grid.PortableGridItemUpdateMessage;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PortableItemGridStorageCacheListener implements IStorageCacheListener<ItemStack> {
|
public class PortableItemGridStorageCacheListener implements IStorageCacheListener<ItemStack> {
|
||||||
@@ -19,20 +23,7 @@ public class PortableItemGridStorageCacheListener implements IStorageCacheListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttached() {
|
public void onAttached() {
|
||||||
/*RS.INSTANCE.network.sendTo(new MessageGridItemUpdate(buf -> {
|
RS.NETWORK_HANDLER.sendTo(player, new PortableGridItemUpdateMessage(portableGrid));
|
||||||
buf.writeInt(portableGrid.getItemCache().getList().getStacks().size());
|
|
||||||
|
|
||||||
for (ItemStack stack : portableGrid.getItemCache().getList().getStacks()) {
|
|
||||||
StackUtils.writeItemStack(buf, stack, null, false);
|
|
||||||
|
|
||||||
IStorageTracker.IStorageTrackerEntry entry = portableGrid.getItemStorageTracker().get(stack);
|
|
||||||
buf.writeBoolean(entry != null);
|
|
||||||
if (entry != null) {
|
|
||||||
buf.writeLong(entry.getTime());
|
|
||||||
ByteBufUtils.writeUTF8String(buf, entry.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, false), player); TODO */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -42,11 +33,15 @@ public class PortableItemGridStorageCacheListener implements IStorageCacheListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(StackListResult<ItemStack> delta) {
|
public void onChanged(StackListResult<ItemStack> delta) {
|
||||||
// TODO RS.INSTANCE.network.sendTo(new MessageGridItemDelta(null, portableGrid.getItemStorageTracker(), stack, size), player);
|
List<StackListResult<ItemStack>> deltas = new ArrayList<>();
|
||||||
|
|
||||||
|
deltas.add(delta);
|
||||||
|
|
||||||
|
onChangedBulk(deltas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChangedBulk(List<StackListResult<ItemStack>> storageCacheDeltas) {
|
public void onChangedBulk(List<StackListResult<ItemStack>> storageCacheDeltas) {
|
||||||
// TODO RS.INSTANCE.network.sendTo(new MessageGridItemDelta(null, portableGrid.getItemStorageTracker(), stacks), player);
|
RS.NETWORK_HANDLER.sendTo(player, new PortableGridItemDeltaMessage(portableGrid, storageCacheDeltas));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import net.minecraftforge.fml.network.NetworkHooks;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ControllerBlock extends Block {
|
public class ControllerBlock extends BaseBlock {
|
||||||
public enum EnergyType implements IStringSerializable {
|
public enum EnergyType implements IStringSerializable {
|
||||||
OFF("off"),
|
OFF("off"),
|
||||||
NEARLY_OFF("nearly_off"),
|
NEARLY_OFF("nearly_off"),
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block;
|
package com.raoulvdberge.refinedstorage.block;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.block.enums.PortableGridDiskState;
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
import com.raoulvdberge.refinedstorage.block.enums.PortableGridType;
|
import com.raoulvdberge.refinedstorage.block.enums.PortableGridType;
|
||||||
import com.raoulvdberge.refinedstorage.block.info.BlockInfoBuilder;
|
import com.raoulvdberge.refinedstorage.item.blockitem.PortableGridBlockItem;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGridDiskState;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.BlockUtils;
|
||||||
import net.minecraft.state.BooleanProperty;
|
import net.minecraft.state.BooleanProperty;
|
||||||
import net.minecraft.state.EnumProperty;
|
import net.minecraft.state.EnumProperty;
|
||||||
|
|
||||||
public class BlockPortableGrid extends BlockBase {
|
public class PortableGridBlock extends BaseBlock {
|
||||||
public static final EnumProperty<PortableGridType> TYPE = EnumProperty.create("type", PortableGridType.class);
|
public static final EnumProperty<PortableGridType> TYPE = EnumProperty.create("type", PortableGridType.class);
|
||||||
public static final EnumProperty<PortableGridDiskState> DISK_STATE = EnumProperty.create("disk_state", PortableGridDiskState.class);
|
public static final EnumProperty<PortableGridDiskState> DISK_STATE = EnumProperty.create("disk_state", PortableGridDiskState.class);
|
||||||
public static final BooleanProperty CONNECTED = BooleanProperty.create("connected");
|
public static final BooleanProperty CONNECTED = BooleanProperty.create("connected");
|
||||||
|
|
||||||
public BlockPortableGrid() {
|
private final PortableGridBlockItem.Type type;
|
||||||
super(BlockInfoBuilder.forId("portable_grid").tileEntity(TilePortableGrid::new).create());
|
|
||||||
|
public PortableGridBlock(PortableGridBlockItem.Type type) {
|
||||||
|
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
|
||||||
|
|
||||||
|
this.type = type;
|
||||||
|
this.setRegistryName(RS.ID, (type == PortableGridBlockItem.Type.CREATIVE ? "creative_" : "") + "portable_grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -30,6 +30,7 @@ public class ServerConfig {
|
|||||||
private Constructor constructor;
|
private Constructor constructor;
|
||||||
private Destructor destructor;
|
private Destructor destructor;
|
||||||
private DiskManipulator diskManipulator;
|
private DiskManipulator diskManipulator;
|
||||||
|
private PortableGrid portableGrid;
|
||||||
|
|
||||||
public ServerConfig() {
|
public ServerConfig() {
|
||||||
upgrades = new Upgrades();
|
upgrades = new Upgrades();
|
||||||
@@ -56,6 +57,7 @@ public class ServerConfig {
|
|||||||
constructor = new Constructor();
|
constructor = new Constructor();
|
||||||
destructor = new Destructor();
|
destructor = new Destructor();
|
||||||
diskManipulator = new DiskManipulator();
|
diskManipulator = new DiskManipulator();
|
||||||
|
portableGrid = new PortableGrid();
|
||||||
|
|
||||||
spec = builder.build();
|
spec = builder.build();
|
||||||
}
|
}
|
||||||
@@ -156,6 +158,10 @@ public class ServerConfig {
|
|||||||
return diskManipulator;
|
return diskManipulator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PortableGrid getPortableGrid() {
|
||||||
|
return portableGrid;
|
||||||
|
}
|
||||||
|
|
||||||
public ForgeConfigSpec getSpec() {
|
public ForgeConfigSpec getSpec() {
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@@ -694,6 +700,46 @@ public class ServerConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PortableGrid {
|
||||||
|
private final ForgeConfigSpec.BooleanValue useEnergy;
|
||||||
|
private final ForgeConfigSpec.IntValue capacity;
|
||||||
|
private final ForgeConfigSpec.IntValue openUsage;
|
||||||
|
private final ForgeConfigSpec.IntValue extractUsage;
|
||||||
|
private final ForgeConfigSpec.IntValue insertUsage;
|
||||||
|
|
||||||
|
public PortableGrid() {
|
||||||
|
builder.push("portableGrid");
|
||||||
|
|
||||||
|
useEnergy = builder.comment("Whether the Portable Grid uses energy").define("useEnergy", true);
|
||||||
|
capacity = builder.comment("The energy capacity of the Portable Grid").defineInRange("capacity", 3200, 0, Integer.MAX_VALUE);
|
||||||
|
openUsage = builder.comment("The energy used by the Portable Grid to open").defineInRange("openUsage", 30, 0, Integer.MAX_VALUE);
|
||||||
|
extractUsage = builder.comment("The energy used by the Portable Grid to extract items or fluids").defineInRange("extractUsage", 5, 0, Integer.MAX_VALUE);
|
||||||
|
insertUsage = builder.comment("The energy used by the Portable Grid to insert items or fluids").defineInRange("insertUsage", 5, 0, Integer.MAX_VALUE);
|
||||||
|
|
||||||
|
builder.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getUseEnergy() {
|
||||||
|
return useEnergy.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCapacity() {
|
||||||
|
return capacity.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOpenUsage() {
|
||||||
|
return openUsage.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getExtractUsage() {
|
||||||
|
return extractUsage.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInsertUsage() {
|
||||||
|
return insertUsage.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class Constructor {
|
public class Constructor {
|
||||||
private final ForgeConfigSpec.IntValue usage;
|
private final ForgeConfigSpec.IntValue usage;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.raoulvdberge.refinedstorage.item.blockitem;
|
package com.raoulvdberge.refinedstorage.item.blockitem;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.block.BaseBlock;
|
||||||
import com.raoulvdberge.refinedstorage.item.capabilityprovider.EnergyCapabilityProvider;
|
import com.raoulvdberge.refinedstorage.item.capabilityprovider.EnergyCapabilityProvider;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
@@ -21,11 +20,11 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public abstract class EnergyBlockItem extends BlockItem {
|
public abstract class EnergyBlockItem extends BaseBlockItem {
|
||||||
private final Supplier<Integer> energyCapacity;
|
private final Supplier<Integer> energyCapacity;
|
||||||
private final boolean creative;
|
private final boolean creative;
|
||||||
|
|
||||||
public EnergyBlockItem(Block block, Item.Properties properties, boolean creative, Supplier<Integer> energyCapacity) {
|
public EnergyBlockItem(BaseBlock block, Item.Properties properties, boolean creative, Supplier<Integer> energyCapacity) {
|
||||||
super(block, properties);
|
super(block, properties);
|
||||||
|
|
||||||
this.creative = creative;
|
this.creative = creative;
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.item.blockitem;
|
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.block.BaseBlock;
|
|
||||||
|
|
||||||
public class ItemBlockPortableGrid extends BaseBlockItem {
|
|
||||||
public ItemBlockPortableGrid(BaseBlock block, Properties builder) {
|
|
||||||
super(block, builder);
|
|
||||||
}
|
|
||||||
/* TODO
|
|
||||||
@Override
|
|
||||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, EnumHand hand) {
|
|
||||||
ItemStack stack = player.getHeldItem(hand);
|
|
||||||
|
|
||||||
if (!world.isRemote) {
|
|
||||||
API.instance().getGridManager().openGrid(PortableGrid.ID, (ServerPlayerEntity) player, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
|
|
||||||
super.addInformation(stack, world, tooltip, flag);
|
|
||||||
|
|
||||||
tooltip.add(I18n.format("block.refinedstorage:portable_grid.tooltip"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumActionResult onItemUse(PlayerEntity player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
|
||||||
if (!player.isSneaking()) {
|
|
||||||
return EnumActionResult.FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEntityLifespan(ItemStack stack, World world) {
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
|
||||||
if (oldStack.getItem() == newStack.getItem()) {
|
|
||||||
if (ItemWirelessGrid.getSortingDirection(oldStack) == ItemWirelessGrid.getSortingDirection(newStack) &&
|
|
||||||
ItemWirelessGrid.getSortingType(oldStack) == ItemWirelessGrid.getSortingType(newStack) &&
|
|
||||||
ItemWirelessGrid.getSearchBoxMode(oldStack) == ItemWirelessGrid.getSearchBoxMode(newStack) &&
|
|
||||||
ItemWirelessGrid.getTabSelected(oldStack) == ItemWirelessGrid.getTabSelected(newStack) &&
|
|
||||||
ItemWirelessGrid.getTabPage(oldStack) == ItemWirelessGrid.getTabPage(newStack) &&
|
|
||||||
ItemWirelessGrid.getSize(oldStack) == ItemWirelessGrid.getSize(newStack)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.shouldCauseReequipAnimation(oldStack, newStack, slotChanged);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.item.blockitem;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.RS;
|
||||||
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.PortableGridGridFactory;
|
||||||
|
import com.raoulvdberge.refinedstorage.item.WirelessGridItem;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.Style;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PortableGridBlockItem extends EnergyBlockItem {
|
||||||
|
public enum Type {
|
||||||
|
NORMAL,
|
||||||
|
CREATIVE
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
|
||||||
|
public PortableGridBlockItem(Type type) {
|
||||||
|
super(
|
||||||
|
type == Type.CREATIVE ? RSBlocks.CREATIVE_PORTABLE_GRID : RSBlocks.PORTABLE_GRID,
|
||||||
|
new Item.Properties().group(RS.MAIN_GROUP).maxStackSize(1),
|
||||||
|
type == Type.CREATIVE,
|
||||||
|
() -> RS.SERVER_CONFIG.getPortableGrid().getCapacity()
|
||||||
|
);
|
||||||
|
|
||||||
|
this.type = type;
|
||||||
|
this.setRegistryName(RS.ID, (type == Type.CREATIVE ? "creative_" : "") + "portable_grid");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
|
||||||
|
if (!world.isRemote) {
|
||||||
|
API.instance().getGridManager().openGrid(PortableGridGridFactory.ID, (ServerPlayerEntity) player, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ActionResult.newResult(ActionResultType.SUCCESS, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
|
||||||
|
super.addInformation(stack, world, tooltip, flag);
|
||||||
|
|
||||||
|
tooltip.add(new TranslationTextComponent("block.refinedstorage.portable_grid.tooltip").setStyle(new Style().setColor(TextFormatting.GRAY)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResultType onItemUse(ItemUseContext context) {
|
||||||
|
if (!context.getPlayer().isSneaking()) {
|
||||||
|
return ActionResultType.FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onItemUse(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEntityLifespan(ItemStack stack, World world) {
|
||||||
|
return Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||||
|
if (oldStack.getItem() == newStack.getItem()) {
|
||||||
|
if (WirelessGridItem.getSortingDirection(oldStack) == WirelessGridItem.getSortingDirection(newStack) &&
|
||||||
|
WirelessGridItem.getSortingType(oldStack) == WirelessGridItem.getSortingType(newStack) &&
|
||||||
|
WirelessGridItem.getSearchBoxMode(oldStack) == WirelessGridItem.getSearchBoxMode(newStack) &&
|
||||||
|
WirelessGridItem.getTabSelected(oldStack) == WirelessGridItem.getTabSelected(newStack) &&
|
||||||
|
WirelessGridItem.getTabPage(oldStack) == WirelessGridItem.getTabPage(newStack) &&
|
||||||
|
WirelessGridItem.getSize(oldStack) == WirelessGridItem.getSize(newStack)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.shouldCauseReequipAnimation(oldStack, newStack, slotChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,6 +49,11 @@ public class NetworkHandler {
|
|||||||
handler.registerMessage(id++, WirelessGridSettingsUpdateMessage.class, WirelessGridSettingsUpdateMessage::encode, WirelessGridSettingsUpdateMessage::decode, WirelessGridSettingsUpdateMessage::handle);
|
handler.registerMessage(id++, WirelessGridSettingsUpdateMessage.class, WirelessGridSettingsUpdateMessage::encode, WirelessGridSettingsUpdateMessage::decode, WirelessGridSettingsUpdateMessage::handle);
|
||||||
handler.registerMessage(id++, OpenNetworkItemMessage.class, OpenNetworkItemMessage::encode, OpenNetworkItemMessage::decode, OpenNetworkItemMessage::handle);
|
handler.registerMessage(id++, OpenNetworkItemMessage.class, OpenNetworkItemMessage::encode, OpenNetworkItemMessage::decode, OpenNetworkItemMessage::handle);
|
||||||
handler.registerMessage(id++, WirelessFluidGridSettingsUpdateMessage.class, WirelessFluidGridSettingsUpdateMessage::encode, WirelessFluidGridSettingsUpdateMessage::decode, WirelessFluidGridSettingsUpdateMessage::handle);
|
handler.registerMessage(id++, WirelessFluidGridSettingsUpdateMessage.class, WirelessFluidGridSettingsUpdateMessage::encode, WirelessFluidGridSettingsUpdateMessage::decode, WirelessFluidGridSettingsUpdateMessage::handle);
|
||||||
|
handler.registerMessage(id++, PortableGridSettingsUpdateMessage.class, PortableGridSettingsUpdateMessage::encode, PortableGridSettingsUpdateMessage::decode, PortableGridSettingsUpdateMessage::handle);
|
||||||
|
handler.registerMessage(id++, PortableGridItemUpdateMessage.class, PortableGridItemUpdateMessage::encode, PortableGridItemUpdateMessage::decode, PortableGridItemUpdateMessage::handle);
|
||||||
|
handler.registerMessage(id++, PortableGridItemDeltaMessage.class, PortableGridItemDeltaMessage::encode, PortableGridItemDeltaMessage::decode, PortableGridItemDeltaMessage::handle);
|
||||||
|
handler.registerMessage(id++, PortableGridFluidUpdateMessage.class, PortableGridFluidUpdateMessage::encode, PortableGridFluidUpdateMessage::decode, PortableGridFluidUpdateMessage::handle);
|
||||||
|
handler.registerMessage(id++, PortableGridFluidDeltaMessage.class, PortableGridFluidDeltaMessage::encode, PortableGridFluidDeltaMessage::decode, PortableGridFluidDeltaMessage::handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendToServer(Object message) {
|
public void sendToServer(Object message) {
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.network.grid;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.util.StackListResult;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class PortableGridFluidDeltaMessage {
|
||||||
|
private IPortableGrid portableGrid;
|
||||||
|
private List<StackListResult<FluidStack>> deltas;
|
||||||
|
|
||||||
|
private List<Pair<IGridStack, Integer>> clientDeltas;
|
||||||
|
|
||||||
|
public PortableGridFluidDeltaMessage(IPortableGrid portableGrid, List<StackListResult<FluidStack>> deltas) {
|
||||||
|
this.portableGrid = portableGrid;
|
||||||
|
this.deltas = deltas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PortableGridFluidDeltaMessage(List<Pair<IGridStack, Integer>> clientDeltas) {
|
||||||
|
this.clientDeltas = clientDeltas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PortableGridFluidDeltaMessage decode(PacketBuffer buf) {
|
||||||
|
int size = buf.readInt();
|
||||||
|
|
||||||
|
List<Pair<IGridStack, Integer>> clientDeltas = new LinkedList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
int delta = buf.readInt();
|
||||||
|
|
||||||
|
clientDeltas.add(Pair.of(StackUtils.readFluidGridStack(buf), delta));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PortableGridFluidDeltaMessage(clientDeltas);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void encode(PortableGridFluidDeltaMessage message, PacketBuffer buf) {
|
||||||
|
buf.writeInt(message.deltas.size());
|
||||||
|
|
||||||
|
for (StackListResult<FluidStack> delta : message.deltas) {
|
||||||
|
buf.writeInt(delta.getChange());
|
||||||
|
|
||||||
|
StackUtils.writeFluidGridStack(buf, delta.getStack(), delta.getId(), null, false, message.portableGrid.getFluidStorageTracker().get(delta.getStack()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handle(PortableGridFluidDeltaMessage message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
BaseScreen.executeLater(GridScreen.class, grid -> {
|
||||||
|
message.clientDeltas.forEach(p -> grid.getView().postChange(p.getLeft(), p.getRight()));
|
||||||
|
|
||||||
|
grid.getView().sort();
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.network.grid;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.util.StackListEntry;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.view.FluidGridView;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class PortableGridFluidUpdateMessage {
|
||||||
|
private IPortableGrid portableGrid;
|
||||||
|
|
||||||
|
private List<IGridStack> stacks = new ArrayList<>();
|
||||||
|
|
||||||
|
public PortableGridFluidUpdateMessage(List<IGridStack> stacks) {
|
||||||
|
this.stacks = stacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PortableGridFluidUpdateMessage(IPortableGrid portableGrid) {
|
||||||
|
this.portableGrid = portableGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PortableGridFluidUpdateMessage decode(PacketBuffer buf) {
|
||||||
|
int size = buf.readInt();
|
||||||
|
|
||||||
|
List<IGridStack> stacks = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
stacks.add(StackUtils.readFluidGridStack(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PortableGridFluidUpdateMessage(stacks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void encode(PortableGridFluidUpdateMessage message, PacketBuffer buf) {
|
||||||
|
int size = message.portableGrid.getFluidCache().getList().getStacks().size();
|
||||||
|
|
||||||
|
buf.writeInt(size);
|
||||||
|
|
||||||
|
for (StackListEntry<FluidStack> stack : message.portableGrid.getFluidCache().getList().getStacks()) {
|
||||||
|
StackUtils.writeFluidGridStack(buf, stack.getStack(), stack.getId(), null, false, message.portableGrid.getFluidStorageTracker().get(stack.getStack()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handle(PortableGridFluidUpdateMessage message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
BaseScreen.executeLater(GridScreen.class, grid -> {
|
||||||
|
grid.setView(new FluidGridView(grid, GridScreen.getDefaultSorter(), GridScreen.getSorters()));
|
||||||
|
grid.getView().setStacks(message.stacks);
|
||||||
|
grid.getView().sort();
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.network.grid;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.util.StackListResult;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class PortableGridItemDeltaMessage {
|
||||||
|
@Nullable
|
||||||
|
private IPortableGrid portableGrid;
|
||||||
|
private List<StackListResult<ItemStack>> deltas;
|
||||||
|
|
||||||
|
private List<Pair<IGridStack, Integer>> clientDeltas;
|
||||||
|
|
||||||
|
public PortableGridItemDeltaMessage(IPortableGrid portableGrid, List<StackListResult<ItemStack>> deltas) {
|
||||||
|
this.portableGrid = portableGrid;
|
||||||
|
this.deltas = deltas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PortableGridItemDeltaMessage(List<Pair<IGridStack, Integer>> clientDeltas) {
|
||||||
|
this.clientDeltas = clientDeltas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PortableGridItemDeltaMessage decode(PacketBuffer buf) {
|
||||||
|
int size = buf.readInt();
|
||||||
|
|
||||||
|
List<Pair<IGridStack, Integer>> clientDeltas = new LinkedList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
int delta = buf.readInt();
|
||||||
|
|
||||||
|
clientDeltas.add(Pair.of(StackUtils.readItemGridStack(buf), delta));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PortableGridItemDeltaMessage(clientDeltas);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void encode(PortableGridItemDeltaMessage message, PacketBuffer buf) {
|
||||||
|
buf.writeInt(message.deltas.size());
|
||||||
|
|
||||||
|
for (StackListResult<ItemStack> delta : message.deltas) {
|
||||||
|
buf.writeInt(delta.getChange());
|
||||||
|
|
||||||
|
StackUtils.writeItemGridStack(buf, delta.getStack(), delta.getId(), null, false, message.portableGrid.getItemStorageTracker().get(delta.getStack()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handle(PortableGridItemDeltaMessage message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
BaseScreen.executeLater(GridScreen.class, grid -> {
|
||||||
|
message.clientDeltas.forEach(p -> grid.getView().postChange(p.getLeft(), p.getRight()));
|
||||||
|
|
||||||
|
grid.getView().sort();
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.network.grid;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.util.StackListEntry;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.stack.IGridStack;
|
||||||
|
import com.raoulvdberge.refinedstorage.screen.grid.view.ItemGridView;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class PortableGridItemUpdateMessage {
|
||||||
|
private IPortableGrid portableGrid;
|
||||||
|
|
||||||
|
private List<IGridStack> stacks = new ArrayList<>();
|
||||||
|
|
||||||
|
public PortableGridItemUpdateMessage(List<IGridStack> stacks) {
|
||||||
|
this.stacks = stacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PortableGridItemUpdateMessage(IPortableGrid portableGrid) {
|
||||||
|
this.portableGrid = portableGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PortableGridItemUpdateMessage decode(PacketBuffer buf) {
|
||||||
|
int size = buf.readInt();
|
||||||
|
|
||||||
|
List<IGridStack> stacks = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
stacks.add(StackUtils.readItemGridStack(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PortableGridItemUpdateMessage(stacks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void encode(PortableGridItemUpdateMessage message, PacketBuffer buf) {
|
||||||
|
int size = message.portableGrid.getItemCache().getList().getStacks().size();
|
||||||
|
|
||||||
|
buf.writeInt(size);
|
||||||
|
|
||||||
|
for (StackListEntry<ItemStack> stack : message.portableGrid.getItemCache().getList().getStacks()) {
|
||||||
|
StackUtils.writeItemGridStack(buf, stack.getStack(), stack.getId(), null, false, message.portableGrid.getItemStorageTracker().get(stack.getStack()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handle(PortableGridItemUpdateMessage message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
BaseScreen.executeLater(GridScreen.class, grid -> {
|
||||||
|
grid.setView(new ItemGridView(grid, GridScreen.getDefaultSorter(), GridScreen.getSorters()));
|
||||||
|
grid.getView().setStacks(message.stacks);
|
||||||
|
grid.getView().sort();
|
||||||
|
});
|
||||||
|
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.network.grid;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraftforge.fml.network.NetworkEvent;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class PortableGridSettingsUpdateMessage {
|
||||||
|
private int viewType;
|
||||||
|
private int sortingDirection;
|
||||||
|
private int sortingType;
|
||||||
|
private int searchBoxMode;
|
||||||
|
private int size;
|
||||||
|
private int tabSelected;
|
||||||
|
private int tabPage;
|
||||||
|
|
||||||
|
public PortableGridSettingsUpdateMessage(int viewType, int sortingDirection, int sortingType, int searchBoxMode, int size, int tabSelected, int tabPage) {
|
||||||
|
this.viewType = viewType;
|
||||||
|
this.sortingDirection = sortingDirection;
|
||||||
|
this.sortingType = sortingType;
|
||||||
|
this.searchBoxMode = searchBoxMode;
|
||||||
|
this.size = size;
|
||||||
|
this.tabSelected = tabSelected;
|
||||||
|
this.tabPage = tabPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PortableGridSettingsUpdateMessage decode(PacketBuffer buf) {
|
||||||
|
return new PortableGridSettingsUpdateMessage(
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt(),
|
||||||
|
buf.readInt()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void encode(PortableGridSettingsUpdateMessage message, PacketBuffer buf) {
|
||||||
|
buf.writeInt(message.viewType);
|
||||||
|
buf.writeInt(message.sortingDirection);
|
||||||
|
buf.writeInt(message.sortingType);
|
||||||
|
buf.writeInt(message.searchBoxMode);
|
||||||
|
buf.writeInt(message.size);
|
||||||
|
buf.writeInt(message.tabSelected);
|
||||||
|
buf.writeInt(message.tabPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handle(PortableGridSettingsUpdateMessage message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
|
PlayerEntity player = ctx.get().getSender();
|
||||||
|
|
||||||
|
if (player != null) {
|
||||||
|
ctx.get().enqueueWork(() -> {
|
||||||
|
if (player.openContainer instanceof GridContainer) {
|
||||||
|
IGrid grid = ((GridContainer) player.openContainer).getGrid();
|
||||||
|
|
||||||
|
if (grid instanceof PortableGrid) {
|
||||||
|
ItemStack stack = ((PortableGrid) grid).getStack();
|
||||||
|
|
||||||
|
if (!stack.hasTag()) {
|
||||||
|
stack.setTag(new CompoundNBT());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IGrid.isValidViewType(message.viewType)) {
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_VIEW_TYPE, message.viewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IGrid.isValidSortingDirection(message.sortingDirection)) {
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_SORTING_DIRECTION, message.sortingDirection);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IGrid.isValidSortingType(message.sortingType)) {
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_SORTING_TYPE, message.sortingType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IGrid.isValidSearchBoxMode(message.searchBoxMode)) {
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_SEARCH_BOX_MODE, message.searchBoxMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IGrid.isValidSize(message.size)) {
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_SIZE, message.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_TAB_SELECTED, message.tabSelected);
|
||||||
|
stack.getTag().putInt(GridNetworkNode.NBT_TAB_PAGE, message.tabPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.get().setPacketHandled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.WirelessGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
|
||||||
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;
|
||||||
@@ -62,9 +61,8 @@ public class WirelessGridSettingsUpdateMessage {
|
|||||||
if (player.openContainer instanceof GridContainer) {
|
if (player.openContainer instanceof GridContainer) {
|
||||||
IGrid grid = ((GridContainer) player.openContainer).getGrid();
|
IGrid grid = ((GridContainer) player.openContainer).getGrid();
|
||||||
|
|
||||||
// TODO Duplicate for portable grid.
|
if (grid instanceof WirelessGrid) {
|
||||||
if (grid instanceof WirelessGrid || grid instanceof PortableGrid) {
|
ItemStack stack = ((WirelessGrid) grid).getStack();
|
||||||
ItemStack stack = grid instanceof WirelessGrid ? ((WirelessGrid) grid).getStack() : ((PortableGrid) grid).getStack();
|
|
||||||
|
|
||||||
if (!stack.hasTag()) {
|
if (!stack.hasTag()) {
|
||||||
stack.setTag(new CompoundNBT());
|
stack.setTag(new CompoundNBT());
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.proxy;
|
|
||||||
|
|
||||||
public class ProxyClient extends ProxyCommon {
|
|
||||||
/*@Override
|
|
||||||
public void preInit(FMLPreInitializationEvent e) {
|
|
||||||
super.preInit(e);
|
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(new KeyInputListener());
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,6 @@ public class ProxyCommon {
|
|||||||
API.deliver(e.getAsmData());
|
API.deliver(e.getAsmData());
|
||||||
|
|
||||||
TilePortableGrid.FACTORY_ID = API.instance().getGridManager().add(new GridFactoryPortableGridBlock());
|
TilePortableGrid.FACTORY_ID = API.instance().getGridManager().add(new GridFactoryPortableGridBlock());
|
||||||
PortableGrid.ID = API.instance().getGridManager().add(new GridFactoryPortableGrid());
|
|
||||||
|
|
||||||
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
API.instance().getCraftingTaskRegistry().add(CraftingTaskFactory.ID, new CraftingTaskFactory());
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.render.model;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.grid.portable.PortableGrid;
|
||||||
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class PortableGridBakedModel extends DelegateBakedModel {
|
||||||
|
private final IBakedModel baseConnected;
|
||||||
|
private final IBakedModel baseDisconnected;
|
||||||
|
private final IBakedModel disk;
|
||||||
|
private final IBakedModel diskNearCapacity;
|
||||||
|
private final IBakedModel diskFull;
|
||||||
|
private final IBakedModel diskDisconnected;
|
||||||
|
|
||||||
|
private final CustomItemOverrideList itemOverrideList = new CustomItemOverrideList();
|
||||||
|
|
||||||
|
public PortableGridBakedModel(IBakedModel baseConnected,
|
||||||
|
IBakedModel baseDisconnected,
|
||||||
|
IBakedModel disk,
|
||||||
|
IBakedModel diskNearCapacity,
|
||||||
|
IBakedModel diskFull,
|
||||||
|
IBakedModel diskDisconnected) {
|
||||||
|
super(baseConnected);
|
||||||
|
|
||||||
|
this.baseConnected = baseConnected;
|
||||||
|
this.baseDisconnected = baseDisconnected;
|
||||||
|
this.disk = disk;
|
||||||
|
this.diskNearCapacity = diskNearCapacity;
|
||||||
|
this.diskFull = diskFull;
|
||||||
|
this.diskDisconnected = diskDisconnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides() {
|
||||||
|
return itemOverrideList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CustomItemOverrideList extends ItemOverrideList {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn) {
|
||||||
|
PortableGrid portableGrid = new PortableGrid(null, stack);
|
||||||
|
|
||||||
|
IBakedModel myDisk = null;
|
||||||
|
|
||||||
|
switch (portableGrid.getDiskState()) {
|
||||||
|
case NORMAL:
|
||||||
|
myDisk = disk;
|
||||||
|
break;
|
||||||
|
case NEAR_CAPACITY:
|
||||||
|
myDisk = diskNearCapacity;
|
||||||
|
break;
|
||||||
|
case FULL:
|
||||||
|
myDisk = diskFull;
|
||||||
|
break;
|
||||||
|
case DISCONNECTED:
|
||||||
|
myDisk = diskDisconnected;
|
||||||
|
break;
|
||||||
|
case NONE:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (portableGrid.isActive()) {
|
||||||
|
return new PortableGridItemBakedModel(baseConnected, myDisk);
|
||||||
|
} else {
|
||||||
|
return new PortableGridItemBakedModel(baseDisconnected, myDisk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.render.model;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class PortableGridItemBakedModel implements IBakedModel {
|
||||||
|
private final IBakedModel base;
|
||||||
|
@Nullable
|
||||||
|
private final IBakedModel disk;
|
||||||
|
|
||||||
|
public PortableGridItemBakedModel(IBakedModel base, @Nullable IBakedModel disk) {
|
||||||
|
this.base = base;
|
||||||
|
this.disk = disk;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides() {
|
||||||
|
return ItemOverrideList.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public ItemCameraTransforms getItemCameraTransforms() {
|
||||||
|
return base.getItemCameraTransforms();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
|
||||||
|
List<BakedQuad> quads = new ArrayList<>();
|
||||||
|
|
||||||
|
quads.addAll(base.getQuads(state, side, rand));
|
||||||
|
|
||||||
|
if (disk != null) {
|
||||||
|
quads.addAll(disk.getQuads(state, side, rand));
|
||||||
|
}
|
||||||
|
|
||||||
|
return quads;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion() {
|
||||||
|
return base.isAmbientOcclusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d() {
|
||||||
|
return base.isGui3d();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer() {
|
||||||
|
return base.isBuiltInRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public TextureAtlasSprite getParticleTexture() {
|
||||||
|
return base.getParticleTexture();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,16 +11,6 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public interface IPortableGrid {
|
public interface IPortableGrid {
|
||||||
interface IPortableGridRenderInfo {
|
|
||||||
int getStored();
|
|
||||||
|
|
||||||
int getCapacity();
|
|
||||||
|
|
||||||
boolean hasStorage();
|
|
||||||
|
|
||||||
boolean isActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
IStorageCache getCache();
|
IStorageCache getCache();
|
||||||
|
|
||||||
@@ -54,4 +44,8 @@ public interface IPortableGrid {
|
|||||||
IStorageTracker<ItemStack> getItemStorageTracker();
|
IStorageTracker<ItemStack> getItemStorageTracker();
|
||||||
|
|
||||||
IStorageTracker<FluidStack> getFluidStorageTracker();
|
IStorageTracker<FluidStack> getFluidStorageTracker();
|
||||||
|
|
||||||
|
boolean isActive();
|
||||||
|
|
||||||
|
PortableGridDiskState getDiskState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ import com.raoulvdberge.refinedstorage.api.storage.cache.IStorageCacheListener;
|
|||||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskContainerContext;
|
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskContainerContext;
|
||||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
|
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
|
||||||
|
import com.raoulvdberge.refinedstorage.api.storage.disk.StorageDiskSyncData;
|
||||||
import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableFluidGridHandler;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableFluidGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableItemGridHandler;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableItemGridHandler;
|
||||||
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.DiskState;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableFluidStorageCache;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableFluidStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableItemStorageCache;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableItemStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.PortableFluidGridStorageCacheListener;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.listener.PortableFluidGridStorageCacheListener;
|
||||||
@@ -29,6 +31,9 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.ItemStorageTracke
|
|||||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.StorageDiskItemValidator;
|
import com.raoulvdberge.refinedstorage.inventory.item.validator.StorageDiskItemValidator;
|
||||||
|
import com.raoulvdberge.refinedstorage.item.WirelessGridItem;
|
||||||
|
import com.raoulvdberge.refinedstorage.item.blockitem.PortableGridBlockItem;
|
||||||
|
import com.raoulvdberge.refinedstorage.network.grid.PortableGridSettingsUpdateMessage;
|
||||||
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
import com.raoulvdberge.refinedstorage.screen.BaseScreen;
|
||||||
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
import com.raoulvdberge.refinedstorage.screen.grid.GridScreen;
|
||||||
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
import com.raoulvdberge.refinedstorage.util.StackUtils;
|
||||||
@@ -49,10 +54,9 @@ import net.minecraftforge.items.IItemHandlerModifiable;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainerContext {
|
public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainerContext {
|
||||||
public static int ID;
|
|
||||||
|
|
||||||
static final String NBT_STORAGE_TRACKER = "StorageTracker";
|
static final String NBT_STORAGE_TRACKER = "StorageTracker";
|
||||||
static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker";
|
static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker";
|
||||||
|
|
||||||
@@ -64,6 +68,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
private PortableItemGridHandler itemHandler = new PortableItemGridHandler(this, this);
|
private PortableItemGridHandler itemHandler = new PortableItemGridHandler(this, this);
|
||||||
private PortableFluidGridHandler fluidHandler = new PortableFluidGridHandler(this);
|
private PortableFluidGridHandler fluidHandler = new PortableFluidGridHandler(this);
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private PlayerEntity player;
|
private PlayerEntity player;
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
@@ -92,7 +97,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
private BaseItemHandler disk = new BaseItemHandler(1)
|
private BaseItemHandler disk = new BaseItemHandler(1)
|
||||||
.addValidator(new StorageDiskItemValidator())
|
.addValidator(new StorageDiskItemValidator())
|
||||||
.addListener(((handler, slot, reading) -> {
|
.addListener(((handler, slot, reading) -> {
|
||||||
if (!player.world.isRemote) {
|
if (player != null && !player.world.isRemote) {
|
||||||
ItemStack diskStack = handler.getStackInSlot(slot);
|
ItemStack diskStack = handler.getStackInSlot(slot);
|
||||||
|
|
||||||
if (diskStack.isEmpty()) {
|
if (diskStack.isEmpty()) {
|
||||||
@@ -130,18 +135,16 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
public PortableGrid(PlayerEntity player, ItemStack stack) {
|
public PortableGrid(@Nullable PlayerEntity player, ItemStack stack) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
|
|
||||||
if (player != null) {
|
this.sortingType = WirelessGridItem.getSortingType(stack);
|
||||||
/* TODO this.sortingType = ItemWirelessGrid.getSortingType(stack);
|
this.sortingDirection = WirelessGridItem.getSortingDirection(stack);
|
||||||
this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack);
|
this.searchBoxMode = WirelessGridItem.getSearchBoxMode(stack);
|
||||||
this.searchBoxMode = ItemWirelessGrid.getSearchBoxMode(stack);
|
this.tabSelected = WirelessGridItem.getTabSelected(stack);
|
||||||
this.tabSelected = ItemWirelessGrid.getTabSelected(stack);
|
this.tabPage = WirelessGridItem.getTabPage(stack);
|
||||||
this.tabPage = ItemWirelessGrid.getTabPage(stack);
|
this.size = WirelessGridItem.getSize(stack);
|
||||||
this.size = ItemWirelessGrid.getSize(stack);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stack.hasTag()) {
|
if (!stack.hasTag()) {
|
||||||
stack.setTag(new CompoundNBT());
|
stack.setTag(new CompoundNBT());
|
||||||
@@ -156,10 +159,11 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
StackUtils.readItems(disk, 4, stack.getTag());
|
StackUtils.readItems(disk, 4, stack.getTag());
|
||||||
|
|
||||||
StackUtils.readItems(filter, 0, stack.getTag());
|
StackUtils.readItems(filter, 0, stack.getTag());
|
||||||
|
}
|
||||||
|
|
||||||
drainEnergy(RS.INSTANCE.config.portableGridOpenUsage);
|
public void onOpen() {
|
||||||
|
drainEnergy(RS.SERVER_CONFIG.getPortableGrid().getOpenUsage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
@@ -180,21 +184,24 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drainEnergy(int energy) {
|
public void drainEnergy(int energy) {
|
||||||
//TODO if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemBlockPortableGrid.TYPE_CREATIVE) {
|
if (RS.SERVER_CONFIG.getPortableGrid().getUseEnergy() && ((PortableGridBlockItem) stack.getItem()).getType() != PortableGridBlockItem.Type.CREATIVE) {
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null).orElse(null);
|
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null).orElse(null);
|
||||||
//}
|
|
||||||
if (storage != null) {
|
if (storage != null) {
|
||||||
storage.extractEnergy(energy, false);
|
storage.extractEnergy(energy, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergy() {
|
public int getEnergy() {
|
||||||
//TODO if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemBlockPortableGrid.TYPE_CREATIVE) {
|
if (RS.SERVER_CONFIG.getPortableGrid().getUseEnergy() && ((PortableGridBlockItem) stack.getItem()).getType() != PortableGridBlockItem.Type.CREATIVE) {
|
||||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null).orElse(null);
|
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null).orElse(null);
|
||||||
// }
|
|
||||||
|
|
||||||
return storage == null ? RS.INSTANCE.config.portableGridCapacity : storage.getMaxEnergyStored();
|
return storage == null ? RS.SERVER_CONFIG.getPortableGrid().getCapacity() : storage.getEnergyStored();
|
||||||
|
}
|
||||||
|
|
||||||
|
return RS.SERVER_CONFIG.getPortableGrid().getCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -296,7 +303,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSortingTypeChanged(int type) {
|
public void onSortingTypeChanged(int type) {
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), type, getSearchBoxMode(), getSize(), getTabSelected(), getTabPage()));
|
RS.NETWORK_HANDLER.sendToServer(new PortableGridSettingsUpdateMessage(getViewType(), getSortingDirection(), type, getSearchBoxMode(), getSize(), getTabSelected(), getTabPage()));
|
||||||
|
|
||||||
this.sortingType = type;
|
this.sortingType = type;
|
||||||
|
|
||||||
@@ -305,7 +312,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSortingDirectionChanged(int direction) {
|
public void onSortingDirectionChanged(int direction) {
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), direction, getSortingType(), getSearchBoxMode(), getSize(), getTabSelected(), getTabPage()));
|
RS.NETWORK_HANDLER.sendToServer(new PortableGridSettingsUpdateMessage(getViewType(), direction, getSortingType(), getSearchBoxMode(), getSize(), getTabSelected(), getTabPage()));
|
||||||
|
|
||||||
this.sortingDirection = direction;
|
this.sortingDirection = direction;
|
||||||
|
|
||||||
@@ -314,27 +321,25 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchBoxModeChanged(int searchBoxMode) {
|
public void onSearchBoxModeChanged(int searchBoxMode) {
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), searchBoxMode, getSize(), getTabSelected(), getTabPage()));
|
RS.NETWORK_HANDLER.sendToServer(new PortableGridSettingsUpdateMessage(getViewType(), getSortingDirection(), getSortingType(), searchBoxMode, getSize(), getTabSelected(), getTabPage()));
|
||||||
|
|
||||||
this.searchBoxMode = searchBoxMode;
|
this.searchBoxMode = searchBoxMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSizeChanged(int size) {
|
public void onSizeChanged(int size) {
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), size, getTabSelected(), getTabPage()));
|
RS.NETWORK_HANDLER.sendToServer(new PortableGridSettingsUpdateMessage(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), size, getTabSelected(), getTabPage()));
|
||||||
|
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
||||||
// TODO if (Minecraft.getMinecraft().currentScreen != null) {
|
BaseScreen.executeLater(GridScreen.class, BaseScreen::init);
|
||||||
// Minecraft.getMinecraft().currentScreen.initGui();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTabSelectionChanged(int tab) {
|
public void onTabSelectionChanged(int tab) {
|
||||||
this.tabSelected = tab == tabSelected ? -1 : tab;
|
this.tabSelected = tab == tabSelected ? -1 : tab;
|
||||||
|
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
RS.NETWORK_HANDLER.sendToServer(new PortableGridSettingsUpdateMessage(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), tabSelected, getTabPage()));
|
||||||
|
|
||||||
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
BaseScreen.executeLater(GridScreen.class, grid -> grid.getView().sort());
|
||||||
}
|
}
|
||||||
@@ -342,7 +347,7 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
@Override
|
@Override
|
||||||
public void onTabPageChanged(int page) {
|
public void onTabPageChanged(int page) {
|
||||||
if (page >= 0 && page <= getTotalTabPages()) {
|
if (page >= 0 && page <= getTotalTabPages()) {
|
||||||
// TODO RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), getTabSelected(), page));
|
RS.NETWORK_HANDLER.sendToServer(new PortableGridSettingsUpdateMessage(getViewType(), getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), getTabSelected(), page));
|
||||||
|
|
||||||
this.tabPage = page;
|
this.tabPage = page;
|
||||||
}
|
}
|
||||||
@@ -415,17 +420,62 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasDisk() {
|
||||||
|
return !disk.getStackInSlot(0).isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
// TODO if (RS.INSTANCE.config.portableGridUsesEnergy && stack.getItemDamage() != ItemBlockPortableGrid.TYPE_CREATIVE && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() <= RS.INSTANCE.config.portableGridOpenUsage) {
|
if (RS.SERVER_CONFIG.getPortableGrid().getUseEnergy() &&
|
||||||
// return false;
|
((PortableGridBlockItem) stack.getItem()).getType() != PortableGridBlockItem.Type.CREATIVE &&
|
||||||
//+}
|
stack.getCapability(CapabilityEnergy.ENERGY).orElse(null).getEnergyStored() <= RS.SERVER_CONFIG.getPortableGrid().getOpenUsage()) {
|
||||||
|
|
||||||
if (disk.getStackInSlot(0).isEmpty()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return hasDisk();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private UUID getDiskId() {
|
||||||
|
return !hasDisk() ? null : ((IStorageDiskProvider) disk.getStackInSlot(0).getItem()).getId(disk.getStackInSlot(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getStored() {
|
||||||
|
API.instance().getStorageDiskSync().sendRequest(getDiskId());
|
||||||
|
|
||||||
|
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(getDiskId());
|
||||||
|
|
||||||
|
return data == null ? 0 : data.getStored();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getCapacity() {
|
||||||
|
API.instance().getStorageDiskSync().sendRequest(getDiskId());
|
||||||
|
|
||||||
|
StorageDiskSyncData data = API.instance().getStorageDiskSync().getData(getDiskId());
|
||||||
|
|
||||||
|
return data == null ? 0 : data.getCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PortableGridDiskState getDiskState() {
|
||||||
|
if (!hasDisk()) {
|
||||||
|
return PortableGridDiskState.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isActive()) {
|
||||||
|
return PortableGridDiskState.DISCONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
int stored = getStored();
|
||||||
|
int capacity = getCapacity();
|
||||||
|
|
||||||
|
if (stored == capacity) {
|
||||||
|
return PortableGridDiskState.FULL;
|
||||||
|
} else if ((int) ((float) stored / (float) capacity * 100F) >= DiskState.DISK_NEAR_CAPACITY_THRESHOLD) {
|
||||||
|
return PortableGridDiskState.NEAR_CAPACITY;
|
||||||
|
} else {
|
||||||
|
return PortableGridDiskState.NORMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.raoulvdberge.refinedstorage.block.enums;
|
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
||||||
|
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
package com.raoulvdberge.refinedstorage.tile.grid.portable;
|
||||||
|
|
||||||
import com.raoulvdberge.refinedstorage.RS;
|
|
||||||
import com.raoulvdberge.refinedstorage.RSBlocks;
|
import com.raoulvdberge.refinedstorage.RSBlocks;
|
||||||
import com.raoulvdberge.refinedstorage.RSTiles;
|
import com.raoulvdberge.refinedstorage.RSTiles;
|
||||||
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
||||||
@@ -21,7 +20,6 @@ import com.raoulvdberge.refinedstorage.api.util.IFilter;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableFluidGridHandler;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableFluidGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableItemGridHandler;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.handler.PortableItemGridHandler;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.DiskState;
|
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
import com.raoulvdberge.refinedstorage.apiimpl.network.node.GridNetworkNode;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableFluidStorageCache;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableFluidStorageCache;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableItemStorageCache;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.cache.PortableItemStorageCache;
|
||||||
@@ -31,8 +29,7 @@ import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.PortableFluidStorage
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.PortableItemStorageDisk;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.disk.PortableItemStorageDisk;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.FluidStorageTracker;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.FluidStorageTracker;
|
||||||
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.ItemStorageTracker;
|
import com.raoulvdberge.refinedstorage.apiimpl.storage.tracker.ItemStorageTracker;
|
||||||
import com.raoulvdberge.refinedstorage.block.BlockPortableGrid;
|
import com.raoulvdberge.refinedstorage.block.PortableGridBlock;
|
||||||
import com.raoulvdberge.refinedstorage.block.enums.PortableGridDiskState;
|
|
||||||
import com.raoulvdberge.refinedstorage.block.enums.PortableGridType;
|
import com.raoulvdberge.refinedstorage.block.enums.PortableGridType;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.BaseItemHandler;
|
||||||
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
import com.raoulvdberge.refinedstorage.inventory.item.FilterItemHandler;
|
||||||
@@ -76,7 +73,7 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid, IRedstoneConfigurable, IStorageDiskContainerContext, IPortableGrid.IPortableGridRenderInfo {
|
public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid, IRedstoneConfigurable, IStorageDiskContainerContext {
|
||||||
public static int FACTORY_ID;
|
public static int FACTORY_ID;
|
||||||
|
|
||||||
public static final TileDataParameter<Integer, TilePortableGrid> REDSTONE_MODE = RedstoneMode.createParameter();
|
public static final TileDataParameter<Integer, TilePortableGrid> REDSTONE_MODE = RedstoneMode.createParameter();
|
||||||
@@ -217,10 +214,6 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
WorldUtils.updateBlock(world, pos);
|
WorldUtils.updateBlock(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PortableGridDiskState getDiskState() {
|
|
||||||
return diskState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return connected;
|
return connected;
|
||||||
}
|
}
|
||||||
@@ -230,7 +223,7 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
if (state.getBlock() == RSBlocks.PORTABLE_GRID) {
|
if (state.getBlock() == RSBlocks.PORTABLE_GRID) {
|
||||||
this.type = state.get(BlockPortableGrid.TYPE);
|
this.type = state.get(PortableGridBlock.TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,13 +264,14 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.diskState = getDiskState(this);
|
this.diskState = getDiskState();
|
||||||
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnergyStorage recreateEnergyStorage(int energyStored) {
|
private EnergyStorage recreateEnergyStorage(int energyStored) {
|
||||||
return new EnergyStorage(RS.INSTANCE.config.portableGridCapacity, RS.INSTANCE.config.portableGridCapacity, 0, energyStored);
|
return null;
|
||||||
|
// TODO return new EnergyStorage(RS.INSTANCE.config.portableGridCapacity, RS.INSTANCE.config.portableGridCapacity, 0, energyStored);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getAsItem() {
|
public ItemStack getAsItem() {
|
||||||
@@ -529,9 +523,9 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
int stored = !world.isRemote ? energyStorage.getEnergyStored() : ENERGY_STORED.getValue();
|
int stored = !world.isRemote ? energyStorage.getEnergyStored() : ENERGY_STORED.getValue();
|
||||||
|
|
||||||
if (getPortableType() != PortableGridType.CREATIVE && RS.INSTANCE.config.portableGridUsesEnergy && stored <= RS.INSTANCE.config.portableGridOpenUsage) {
|
/* TODO if (getPortableType() != PortableGridType.CREATIVE && RS.INSTANCE.config.portableGridUsesEnergy && stored <= RS.INSTANCE.config.portableGridOpenUsage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (disk.getStackInSlot(0).isEmpty()) {
|
if (disk.getStackInSlot(0).isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -556,16 +550,16 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drainEnergy(int energy) {
|
public void drainEnergy(int energy) {
|
||||||
if (RS.INSTANCE.config.portableGridUsesEnergy && getPortableType() != PortableGridType.CREATIVE && redstoneMode.isEnabled(world, pos)) {
|
/* TODO if (RS.INSTANCE.config.portableGridUsesEnergy && getPortableType() != PortableGridType.CREATIVE && redstoneMode.isEnabled(world, pos)) {
|
||||||
energyStorage.extractEnergy(energy, false);
|
energyStorage.extractEnergy(energy, false);
|
||||||
|
|
||||||
checkIfDiskStateChanged();
|
checkIfDiskStateChanged();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
checkIfConnectivityChanged();
|
checkIfConnectivityChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public int getStored() {
|
public int getStored() {
|
||||||
return storage != null ? storage.getStored() : 0;
|
return storage != null ? storage.getStored() : 0;
|
||||||
}
|
}
|
||||||
@@ -578,19 +572,19 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasStorage() {
|
public boolean hasStorage() {
|
||||||
return storage != null;
|
return storage != null;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergy() {
|
public int getEnergy() {
|
||||||
if (RS.INSTANCE.config.portableGridUsesEnergy && getPortableType() != PortableGridType.CREATIVE) {
|
/* TODO if (RS.INSTANCE.config.portableGridUsesEnergy && getPortableType() != PortableGridType.CREATIVE) {
|
||||||
|
return energyStorage.getEnergyStored();
|
||||||
|
}*/
|
||||||
|
|
||||||
return energyStorage.getEnergyStored();
|
return energyStorage.getEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
return energyStorage.getMaxEnergyStored();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkIfDiskStateChanged() {
|
private void checkIfDiskStateChanged() {
|
||||||
PortableGridDiskState newDiskState = getDiskState(this);
|
PortableGridDiskState newDiskState = getDiskState();
|
||||||
|
|
||||||
if (this.diskState != newDiskState) {
|
if (this.diskState != newDiskState) {
|
||||||
this.diskState = newDiskState;
|
this.diskState = newDiskState;
|
||||||
@@ -699,7 +693,7 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
this.loadStorage();
|
this.loadStorage();
|
||||||
|
|
||||||
this.connected = getEnergy() != 0;
|
this.connected = getEnergy() != 0;
|
||||||
this.diskState = getDiskState(this);
|
this.diskState = getDiskState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -731,7 +725,7 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onOpened() {
|
public void onOpened() {
|
||||||
drainEnergy(RS.INSTANCE.config.portableGridOpenUsage);
|
// TODO drainEnergy(RS.INSTANCE.config.portableGridOpenUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -746,10 +740,11 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PortableGridDiskState getDiskState(IPortableGridRenderInfo renderInfo) {
|
@Override
|
||||||
if (!renderInfo.hasStorage()) {
|
public PortableGridDiskState getDiskState() {
|
||||||
|
//if (!renderInfo.hasStorage()) {
|
||||||
return PortableGridDiskState.NONE;
|
return PortableGridDiskState.NONE;
|
||||||
}
|
/*}
|
||||||
|
|
||||||
if (!renderInfo.isActive()) {
|
if (!renderInfo.isActive()) {
|
||||||
return PortableGridDiskState.DISCONNECTED;
|
return PortableGridDiskState.DISCONNECTED;
|
||||||
@@ -761,7 +756,7 @@ public class TilePortableGrid extends BaseTile implements IGrid, IPortableGrid,
|
|||||||
return PortableGridDiskState.NEAR_CAPACITY;
|
return PortableGridDiskState.NEAR_CAPACITY;
|
||||||
} else {
|
} else {
|
||||||
return PortableGridDiskState.NORMAL;
|
return PortableGridDiskState.NORMAL;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,62 +1,2 @@
|
|||||||
{
|
{
|
||||||
"forge_marker": 1,
|
|
||||||
"defaults": {
|
|
||||||
"model": "refinedstorage:portable_grid",
|
|
||||||
"textures": {
|
|
||||||
"particle": "refinedstorage:blocks/portable_grid_1",
|
|
||||||
"texture0": "refinedstorage:blocks/portable_grid_1",
|
|
||||||
"texture2": "refinedstorage:blocks/portable_grid_3",
|
|
||||||
"texture3": "refinedstorage:blocks/portable_grid_4",
|
|
||||||
"texture4": "refinedstorage:blocks/portable_grid_5",
|
|
||||||
"texture5": "refinedstorage:blocks/portable_grid_6",
|
|
||||||
"texture6": "refinedstorage:blocks/portable_grid_7",
|
|
||||||
"texture7": "refinedstorage:blocks/portable_grid_8"
|
|
||||||
},
|
|
||||||
"transform": "forge:default-block",
|
|
||||||
"uvlock": false
|
|
||||||
},
|
|
||||||
"variants": {
|
|
||||||
"disk_state": {
|
|
||||||
"normal": {
|
|
||||||
"submodel": "refinedstorage:disks/portable_grid_disk"
|
|
||||||
},
|
|
||||||
"near_capacity": {
|
|
||||||
"submodel": "refinedstorage:disks/portable_grid_disk_near_capacity"
|
|
||||||
},
|
|
||||||
"full": {
|
|
||||||
"submodel": "refinedstorage:disks/portable_grid_disk_full"
|
|
||||||
},
|
|
||||||
"disconnected": {
|
|
||||||
"submodel": "refinedstorage:disks/portable_grid_disk_disconnected"
|
|
||||||
},
|
|
||||||
"none": {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"connected": {
|
|
||||||
"true": {
|
|
||||||
"textures": {
|
|
||||||
"texture1": "refinedstorage:blocks/portable_grid_2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"false": {
|
|
||||||
"textures": {
|
|
||||||
"texture1": "refinedstorage:blocks/portable_grid_2_disconnected"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"direction": {
|
|
||||||
"north": {
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"east": {
|
|
||||||
"y": 90
|
|
||||||
},
|
|
||||||
"south": {
|
|
||||||
"y": 180
|
|
||||||
},
|
|
||||||
"west": {
|
|
||||||
"y": 270
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -217,9 +217,9 @@
|
|||||||
"block.refinedstorage.security_manager": "Security Manager",
|
"block.refinedstorage.security_manager": "Security Manager",
|
||||||
"block.refinedstorage.quartz_enriched_iron_block": "Block of Quartz Enriched Iron",
|
"block.refinedstorage.quartz_enriched_iron_block": "Block of Quartz Enriched Iron",
|
||||||
"block.refinedstorage.storage_monitor": "Storage Monitor",
|
"block.refinedstorage.storage_monitor": "Storage Monitor",
|
||||||
"block.refinedstorage:portable_grid.0": "Portable Grid",
|
"block.refinedstorage.portable_grid": "Portable Grid",
|
||||||
"block.refinedstorage:portable_grid.1": "Creative Portable Grid",
|
"block.refinedstorage.creative_portable_grid": "Creative Portable Grid",
|
||||||
"block.refinedstorage:portable_grid.tooltip": "Sneak to place in the world.",
|
"block.refinedstorage.portable_grid.tooltip": "Sneak to place in the world.",
|
||||||
"block.refinedstorage:crafter_manager": "Crafter Manager",
|
"block.refinedstorage:crafter_manager": "Crafter Manager",
|
||||||
"item.refinedstorage.1k_storage_disk": "1k Storage Disk",
|
"item.refinedstorage.1k_storage_disk": "1k Storage Disk",
|
||||||
"item.refinedstorage.4k_storage_disk": "4k Storage Disk",
|
"item.refinedstorage.4k_storage_disk": "4k Storage Disk",
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
{
|
{
|
||||||
|
"parent": "block/cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "refinedstorage:block/portable_grid_1",
|
||||||
|
"texture0": "refinedstorage:block/portable_grid_1",
|
||||||
|
"texture2": "refinedstorage:block/portable_grid_3",
|
||||||
|
"texture3": "refinedstorage:block/portable_grid_4",
|
||||||
|
"texture4": "refinedstorage:block/portable_grid_5",
|
||||||
|
"texture5": "refinedstorage:block/portable_grid_6",
|
||||||
|
"texture6": "refinedstorage:block/portable_grid_7",
|
||||||
|
"texture7": "refinedstorage:block/portable_grid_8"
|
||||||
|
},
|
||||||
"display": {
|
"display": {
|
||||||
"firstperson_lefthand": {
|
"firstperson_lefthand": {
|
||||||
"rotation": [10, 130, 0],
|
"rotation": [10, 130, 0],
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "refinedstorage:block/portable_grid",
|
||||||
|
"textures": {
|
||||||
|
"texture1": "refinedstorage:block/portable_grid_2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "refinedstorage:block/portable_grid",
|
||||||
|
"textures": {
|
||||||
|
"texture1": "refinedstorage:block/portable_grid_2_disconnected"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
{
|
{
|
||||||
"parent": "item/generated"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,20 +10,16 @@
|
|||||||
"item": "refinedstorage:quartz_enriched_iron"
|
"item": "refinedstorage:quartz_enriched_iron"
|
||||||
},
|
},
|
||||||
"G": {
|
"G": {
|
||||||
"item": "refinedstorage:grid",
|
"item": "refinedstorage:grid"
|
||||||
"data": 0
|
|
||||||
},
|
},
|
||||||
"F": {
|
"F": {
|
||||||
"item": "refinedstorage:grid",
|
"item": "refinedstorage:fluid_grid"
|
||||||
"data": 3
|
|
||||||
},
|
},
|
||||||
"C": {
|
"C": {
|
||||||
"item": "refinedstorage:controller",
|
"item": "refinedstorage:controller"
|
||||||
"data": 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"item": "refinedstorage:portable_grid",
|
"item": "refinedstorage:portable_grid"
|
||||||
"data": 0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user