Storage housing

This commit is contained in:
Raoul Van den Berge
2016-05-10 22:51:58 +02:00
parent a7d15d116a
commit 2ae904cceb
9 changed files with 66 additions and 41 deletions

View File

@@ -12,4 +12,5 @@ public final class RefinedStorageItems {
public static final ItemStoragePart STORAGE_PART = new ItemStoragePart();
public static final ItemPattern PATTERN = new ItemPattern();
public static final ItemUpgrade UPGRADE = new ItemUpgrade();
public static final ItemStorageHousing STORAGE_HOUSING = new ItemStorageHousing();
}

View File

@@ -4,8 +4,13 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import refinedstorage.RefinedStorageItems;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.block.EnumStorageType;
import refinedstorage.storage.NBTStorage;
@@ -44,6 +49,21 @@ public class ItemStorageDisk extends ItemBase {
}
}
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote && NBTStorage.getStored(stack.getTagCompound()) == 0 && stack.getMetadata() != TYPE_CREATIVE) {
ItemStack storagePart = new ItemStack(RefinedStorageItems.STORAGE_PART, 1, stack.getMetadata());
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
RefinedStorageUtils.dropStack(world, storagePart, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ());
}
return new ActionResult(EnumActionResult.SUCCESS, new ItemStack(RefinedStorageItems.STORAGE_HOUSING));
}
return new ActionResult(EnumActionResult.PASS, stack);
}
@Override
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
super.onCreated(stack, world, player);

View File

@@ -0,0 +1,7 @@
package refinedstorage.item;
public class ItemStorageHousing extends ItemBase {
public ItemStorageHousing() {
super("storage_housing");
}
}

View File

@@ -77,15 +77,14 @@ public class ClientProxy extends CommonProxy {
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.PROCESSOR, ItemProcessor.TYPE_PRINTED_SILICON, new ModelResourceLocation("refinedstorage:printed_silicon", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.SILICON, 0, new ModelResourceLocation("refinedstorage:silicon", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.QUARTZ_ENRICHED_IRON, 0, new ModelResourceLocation("refinedstorage:quartz_enriched_iron", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.CORE, ItemCore.TYPE_CONSTRUCTION, new ModelResourceLocation("refinedstorage:construction_core", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.CORE, ItemCore.TYPE_DESTRUCTION, new ModelResourceLocation("refinedstorage:destruction_core", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.WIRELESS_GRID, 0, new ModelResourceLocation("refinedstorage:wireless_grid", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.PATTERN, 0, new ModelResourceLocation("refinedstorage:pattern", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.STORAGE_HOUSING, 0, new ModelResourceLocation("refinedstorage:storage_housing", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.UPGRADE, 0, new ModelResourceLocation("refinedstorage:upgrade", "inventory"));
ModelLoader.setCustomModelResourceLocation(RefinedStorageItems.UPGRADE, ItemUpgrade.TYPE_RANGE, new ModelResourceLocation("refinedstorage:range_upgrade", "inventory"));

View File

@@ -99,6 +99,7 @@ public class CommonProxy {
registerItem(RefinedStorageItems.QUARTZ_ENRICHED_IRON);
registerItem(RefinedStorageItems.STORAGE_DISK);
registerItem(RefinedStorageItems.STORAGE_HOUSING);
registerItem(RefinedStorageItems.PATTERN);
registerItem(RefinedStorageItems.STORAGE_PART);
registerItem(RefinedStorageItems.WIRELESS_GRID);
@@ -355,46 +356,35 @@ public class CommonProxy {
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K)
);
// Storage Housing
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_HOUSING)),
"GRG",
"R R",
"EEE",
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
);
// Storage Disks
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_1K)),
"GRG",
"RPR",
"EEE",
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone),
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
);
for (int type = 0; type <= 3; ++type) {
ItemStack disk = NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, type));
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_4K)),
"GRG",
"RPR",
"EEE",
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone),
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
);
GameRegistry.addRecipe(disk,
"GRG",
"RPR",
"EEE",
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone),
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, type),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
);
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_16K)),
"GRG",
"RPR",
"EEE",
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone),
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
);
GameRegistry.addRecipe(NBTStorage.initNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, ItemStorageDisk.TYPE_64K)),
"GRG",
"RPR",
"EEE",
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone),
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_64K),
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
);
GameRegistry.addShapelessRecipe(disk,
new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
new ItemStack(RefinedStorageItems.STORAGE_PART, type, type)
);
}
// Pattern
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.PATTERN),

View File

@@ -140,3 +140,4 @@ item.refinedstorage:upgrade.0.name=Upgrade
item.refinedstorage:upgrade.1.name=Range Upgrade
item.refinedstorage:upgrade.2.name=Speed Upgrade
item.refinedstorage:upgrade.3.name=Crafting Upgrade
item.refinedstorage:storage_housing.name=Storage Housing

View File

@@ -140,3 +140,4 @@ item.refinedstorage:upgrade.0.name=Upgrade
item.refinedstorage:upgrade.1.name=Afstand Upgrade
item.refinedstorage:upgrade.2.name=Snelheid Upgrade
item.refinedstorage:upgrade.3.name=Crafting Upgrade
item.refinedstorage:storage_housing.name=Opslagomhulsel

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "refinedstorage:items/storage_housing"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B