base storage block
This commit is contained in:
@@ -17,4 +17,5 @@ public final class StorageCraftBlocks
|
|||||||
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
|
public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter();
|
||||||
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
public static final BlockDestructor DESTRUCTOR = new BlockDestructor();
|
||||||
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
public static final BlockConstructor CONSTRUCTOR = new BlockConstructor();
|
||||||
|
public static final BlockStorage STORAGE = new BlockStorage();
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package storagecraft.block;
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.block.state.BlockState;
|
import net.minecraft.block.state.BlockState;
|
||||||
@@ -16,8 +17,6 @@ import storagecraft.StorageCraft;
|
|||||||
import storagecraft.StorageCraftGUI;
|
import storagecraft.StorageCraftGUI;
|
||||||
import storagecraft.tile.TileGrid;
|
import storagecraft.tile.TileGrid;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BlockGrid extends BlockMachine
|
public class BlockGrid extends BlockMachine
|
||||||
{
|
{
|
||||||
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumGridType.class);
|
||||||
@@ -46,11 +45,11 @@ public class BlockGrid extends BlockMachine
|
|||||||
protected BlockState createBlockState()
|
protected BlockState createBlockState()
|
||||||
{
|
{
|
||||||
return new BlockState(this, new IProperty[]
|
return new BlockState(this, new IProperty[]
|
||||||
{
|
{
|
||||||
DIRECTION,
|
DIRECTION,
|
||||||
CONNECTED,
|
CONNECTED,
|
||||||
TYPE
|
TYPE
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
52
src/main/java/storagecraft/block/BlockStorage.java
Normal file
52
src/main/java/storagecraft/block/BlockStorage.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.block.state.BlockState;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import static storagecraft.block.BlockBase.DIRECTION;
|
||||||
|
|
||||||
|
public class BlockStorage extends BlockBase
|
||||||
|
{
|
||||||
|
public static final PropertyEnum TYPE = PropertyEnum.create("type", EnumStorageType.class);
|
||||||
|
|
||||||
|
public BlockStorage()
|
||||||
|
{
|
||||||
|
super("storage");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(Item item, CreativeTabs tab, List subItems)
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 4; i++)
|
||||||
|
{
|
||||||
|
subItems.add(new ItemStack(item, 1, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockState createBlockState()
|
||||||
|
{
|
||||||
|
return new BlockState(this, new IProperty[]
|
||||||
|
{
|
||||||
|
DIRECTION,
|
||||||
|
TYPE
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
|
return getDefaultState().withProperty(TYPE, EnumStorageType.getById(meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
|
return ((EnumStorageType) state.getValue(TYPE)).getId();
|
||||||
|
}
|
||||||
|
}
|
58
src/main/java/storagecraft/block/EnumStorageType.java
Normal file
58
src/main/java/storagecraft/block/EnumStorageType.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package storagecraft.block;
|
||||||
|
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
|
public enum EnumStorageType implements IStringSerializable
|
||||||
|
{
|
||||||
|
TYPE_1K(0, 1000, "1k"),
|
||||||
|
TYPE_4K(1, 4000, "4k"),
|
||||||
|
TYPE_16K(2, 16000, "16k"),
|
||||||
|
TYPE_64K(3, 64000, "64k"),
|
||||||
|
TYPE_CREATIVE(4, -1, "creative");
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private int capacity;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
EnumStorageType(int id, int capacity, String name)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
this.capacity = capacity;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCapacity()
|
||||||
|
{
|
||||||
|
return capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EnumStorageType getById(int id)
|
||||||
|
{
|
||||||
|
for (EnumStorageType type : EnumStorageType.values())
|
||||||
|
{
|
||||||
|
if (type.getId() == id)
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
11
src/main/java/storagecraft/item/ItemBlockStorage.java
Normal file
11
src/main/java/storagecraft/item/ItemBlockStorage.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package storagecraft.item;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
|
public class ItemBlockStorage extends ItemBlockBase
|
||||||
|
{
|
||||||
|
public ItemBlockStorage(Block block)
|
||||||
|
{
|
||||||
|
super(block);
|
||||||
|
}
|
||||||
|
}
|
@@ -17,6 +17,7 @@ import storagecraft.StorageCraftBlocks;
|
|||||||
import storagecraft.StorageCraftItems;
|
import storagecraft.StorageCraftItems;
|
||||||
import storagecraft.block.EnumControllerType;
|
import storagecraft.block.EnumControllerType;
|
||||||
import storagecraft.block.EnumGridType;
|
import storagecraft.block.EnumGridType;
|
||||||
|
import storagecraft.block.EnumStorageType;
|
||||||
import storagecraft.item.*;
|
import storagecraft.item.*;
|
||||||
import storagecraft.render.BlockCableRenderer;
|
import storagecraft.render.BlockCableRenderer;
|
||||||
import storagecraft.tile.TileCable;
|
import storagecraft.tile.TileCable;
|
||||||
@@ -129,5 +130,10 @@ public class ClientProxy extends CommonProxy
|
|||||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.SOLDERER), 0, new ModelResourceLocation("storagecraft:solderer", "inventory"));
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.SOLDERER), 0, new ModelResourceLocation("storagecraft:solderer", "inventory"));
|
||||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.WIRELESS_TRANSMITTER), 0, new ModelResourceLocation("storagecraft:wireless_transmitter", "inventory"));
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.WIRELESS_TRANSMITTER), 0, new ModelResourceLocation("storagecraft:wireless_transmitter", "inventory"));
|
||||||
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.DETECTOR), 0, new ModelResourceLocation("storagecraft:detector", "inventory"));
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.DETECTOR), 0, new ModelResourceLocation("storagecraft:detector", "inventory"));
|
||||||
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.STORAGE), EnumStorageType.TYPE_1K.getId(), new ModelResourceLocation("storagecraft:storage", "inventory"));
|
||||||
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.STORAGE), EnumStorageType.TYPE_4K.getId(), new ModelResourceLocation("storagecraft:storage", "inventory"));
|
||||||
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.STORAGE), EnumStorageType.TYPE_16K.getId(), new ModelResourceLocation("storagecraft:storage", "inventory"));
|
||||||
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.STORAGE), EnumStorageType.TYPE_64K.getId(), new ModelResourceLocation("storagecraft:storage", "inventory"));
|
||||||
|
mesher.register(Item.getItemFromBlock(StorageCraftBlocks.STORAGE), EnumStorageType.TYPE_CREATIVE.getId(), new ModelResourceLocation("storagecraft:storage", "inventory"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,7 @@ public class CommonProxy
|
|||||||
GameRegistry.registerBlock(StorageCraftBlocks.WIRELESS_TRANSMITTER, "wireless_transmitter");
|
GameRegistry.registerBlock(StorageCraftBlocks.WIRELESS_TRANSMITTER, "wireless_transmitter");
|
||||||
GameRegistry.registerBlock(StorageCraftBlocks.DESTRUCTOR, "destructor");
|
GameRegistry.registerBlock(StorageCraftBlocks.DESTRUCTOR, "destructor");
|
||||||
GameRegistry.registerBlock(StorageCraftBlocks.CONSTRUCTOR, "constructor");
|
GameRegistry.registerBlock(StorageCraftBlocks.CONSTRUCTOR, "constructor");
|
||||||
|
GameRegistry.registerBlock(StorageCraftBlocks.STORAGE, ItemBlockStorage.class, "storage");
|
||||||
|
|
||||||
GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storage_cell");
|
GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storage_cell");
|
||||||
GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID, "wireless_grid");
|
GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID, "wireless_grid");
|
||||||
|
@@ -1,45 +1,45 @@
|
|||||||
{
|
{
|
||||||
"forge_marker": 1,
|
"forge_marker": 1,
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"model": "orientable",
|
"model": "orientable",
|
||||||
"textures": {
|
"textures": {
|
||||||
"side": "storagecraft:blocks/side",
|
"side": "storagecraft:blocks/side",
|
||||||
"top": "storagecraft:blocks/side",
|
"top": "storagecraft:blocks/side",
|
||||||
"front": "storagecraft:blocks/drive"
|
"front": "storagecraft:blocks/drive"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants": {
|
"variants": {
|
||||||
"inventory": [
|
"inventory": [
|
||||||
{
|
{
|
||||||
"transform": "forge:default-block",
|
"transform": "forge:default-block",
|
||||||
"y": 0
|
"y": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"connected": {
|
"connected": {
|
||||||
"true": {
|
"true": {
|
||||||
},
|
},
|
||||||
"false": {
|
"false": {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"direction": {
|
"direction": {
|
||||||
"north": {
|
"north": {
|
||||||
"y": 0
|
"y": 0
|
||||||
},
|
},
|
||||||
"east": {
|
"east": {
|
||||||
"y": 90
|
"y": 90
|
||||||
},
|
},
|
||||||
"south": {
|
"south": {
|
||||||
"y": 180
|
"y": 180
|
||||||
},
|
},
|
||||||
"west": {
|
"west": {
|
||||||
"y": 270
|
"y": 270
|
||||||
},
|
},
|
||||||
"up": {
|
"up": {
|
||||||
"x": 270
|
"x": 270
|
||||||
},
|
},
|
||||||
"down": {
|
"down": {
|
||||||
"x": 90
|
"x": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"model": "cube_all"
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"inventory": [
|
||||||
|
{
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/1k_storage_block"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/4k_storage_block"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/16k_storage_block"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/64k_storage_block"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/creative_storage_block"
|
||||||
|
},
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": {
|
||||||
|
"1k": {
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/1k_storage_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"4k": {
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/4k_storage_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16k": {
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/16k_storage_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"64k": {
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/64k_storage_block"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"creative": {
|
||||||
|
"textures": {
|
||||||
|
"all": "storagecraft:blocks/creative_storage_block"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"north": {
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
},
|
||||||
|
"up": {
|
||||||
|
},
|
||||||
|
"down": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -72,6 +72,11 @@ block.storagecraft:solderer.name=Solderer
|
|||||||
block.storagecraft:wireless_transmitter.name=Wireless Transmitter
|
block.storagecraft:wireless_transmitter.name=Wireless Transmitter
|
||||||
block.storagecraft:destructor.name=Destructor
|
block.storagecraft:destructor.name=Destructor
|
||||||
block.storagecraft:constructor.name=Constructor
|
block.storagecraft:constructor.name=Constructor
|
||||||
|
block.storagecraft:storage.0.name=1k Storage Block
|
||||||
|
block.storagecraft:storage.1.name=4k Storage Block
|
||||||
|
block.storagecraft:storage.2.name=16k Storage Block
|
||||||
|
block.storagecraft:storage.3.name=64k Storage Block
|
||||||
|
block.storagecraft:storage.4.name=Creative Storage Block
|
||||||
|
|
||||||
item.storagecraft:storage_cell.0.name=1k Storage Cell
|
item.storagecraft:storage_cell.0.name=1k Storage Cell
|
||||||
item.storagecraft:storage_cell.1.name=4k Storage Cell
|
item.storagecraft:storage_cell.1.name=4k Storage Cell
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 365 B |
Binary file not shown.
After Width: | Height: | Size: 366 B |
Binary file not shown.
After Width: | Height: | Size: 363 B |
Binary file not shown.
After Width: | Height: | Size: 365 B |
Binary file not shown.
After Width: | Height: | Size: 368 B |
Reference in New Issue
Block a user