Fixed storage blocks not being dismantable
This commit is contained in:
@@ -7,7 +7,9 @@
|
|||||||
- Fixed recipes not supporting ore dictionary
|
- Fixed recipes not supporting ore dictionary
|
||||||
- Fixed destructor not being able to destroy some blocks
|
- Fixed destructor not being able to destroy some blocks
|
||||||
- Fixed not being able to place or destroy sugar cane
|
- Fixed not being able to place or destroy sugar cane
|
||||||
|
- Fixed storage blocks not being dismantable
|
||||||
- New items now go to the first available storage that has items in it already
|
- New items now go to the first available storage that has items in it already
|
||||||
|
- Tweak some recipes
|
||||||
- Performance improvements
|
- Performance improvements
|
||||||
|
|
||||||
**Features**
|
**Features**
|
||||||
|
|||||||
@@ -2,10 +2,15 @@ package refinedstorage.item;
|
|||||||
|
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.InventoryHelper;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import refinedstorage.RefinedStorageBlocks;
|
import refinedstorage.RefinedStorageBlocks;
|
||||||
|
import refinedstorage.RefinedStorageItems;
|
||||||
import refinedstorage.block.EnumStorageType;
|
import refinedstorage.block.EnumStorageType;
|
||||||
import refinedstorage.storage.NBTStorage;
|
import refinedstorage.storage.NBTStorage;
|
||||||
import refinedstorage.tile.TileStorage;
|
import refinedstorage.tile.TileStorage;
|
||||||
@@ -21,7 +26,7 @@ public class ItemBlockStorage extends ItemBlockBase {
|
|||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) {
|
||||||
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
if (type != null && stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE)) {
|
if (type != null && isValid(stack)) {
|
||||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE);
|
||||||
|
|
||||||
if (type == EnumStorageType.TYPE_CREATIVE) {
|
if (type == EnumStorageType.TYPE_CREATIVE) {
|
||||||
@@ -32,6 +37,33 @@ public class ItemBlockStorage extends ItemBlockBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
EnumStorageType type = EnumStorageType.getById(stack.getMetadata());
|
||||||
|
|
||||||
|
if (type != null && isValid(stack) && NBTStorage.getStoredFromNBT(stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE)) == 0 && stack.getMetadata() != ItemStorageDisk.TYPE_CREATIVE && !world.isRemote && player.isSneaking()) {
|
||||||
|
ItemStack storagePart = new ItemStack(RefinedStorageItems.STORAGE_PART, 1, stack.getMetadata());
|
||||||
|
|
||||||
|
if (!player.inventory.addItemStackToInventory(storagePart.copy())) {
|
||||||
|
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), storagePart);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack processor = new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC);
|
||||||
|
|
||||||
|
if (!player.inventory.addItemStackToInventory(processor.copy())) {
|
||||||
|
InventoryHelper.spawnItemStack(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), processor);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ActionResult(EnumActionResult.SUCCESS, new ItemStack(RefinedStorageBlocks.MACHINE_CASING));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ActionResult(EnumActionResult.PASS, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isValid(ItemStack stack) {
|
||||||
|
return stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
public void onCreated(ItemStack stack, World world, EntityPlayer player) {
|
||||||
super.onCreated(stack, world, player);
|
super.onCreated(stack, world, player);
|
||||||
|
|||||||
@@ -325,8 +325,8 @@ public class CommonProxy {
|
|||||||
|
|
||||||
// Storage Parts
|
// Storage Parts
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K),
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K),
|
||||||
"EPE",
|
"ESE",
|
||||||
"GSG",
|
"GRG",
|
||||||
"EGE",
|
"EGE",
|
||||||
'R', new ItemStack(Items.REDSTONE),
|
'R', new ItemStack(Items.REDSTONE),
|
||||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class WirelessGrid implements IGrid {
|
|||||||
private int sortingType;
|
private int sortingType;
|
||||||
private int sortingDirection;
|
private int sortingDirection;
|
||||||
private int searchBoxMode;
|
private int searchBoxMode;
|
||||||
private static List<ClientItem> items = new ArrayList<ClientItem>();
|
private List<ClientItem> items = new ArrayList<ClientItem>();
|
||||||
private long lastUpdate;
|
private long lastUpdate;
|
||||||
|
|
||||||
public WirelessGrid(ItemStack stack, EnumHand hand) {
|
public WirelessGrid(ItemStack stack, EnumHand hand) {
|
||||||
|
|||||||
Reference in New Issue
Block a user