Make it work again!!!
This commit is contained in:
@@ -9,7 +9,6 @@ import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -18,6 +17,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.item.ItemBlockBase;
|
||||
import refinedstorage.tile.TileBase;
|
||||
import refinedstorage.util.InventoryUtils;
|
||||
|
||||
@@ -128,6 +128,6 @@ public abstract class BlockBase extends Block {
|
||||
}
|
||||
|
||||
public Item createItemForBlock() {
|
||||
return new ItemBlock(this).setRegistryName(getRegistryName());
|
||||
return new ItemBlockBase(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -18,7 +17,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.item.ItemBlockController;
|
||||
import refinedstorage.item.ItemBlockBase;
|
||||
import refinedstorage.tile.TileController;
|
||||
|
||||
import java.util.List;
|
||||
@@ -100,7 +99,7 @@ public class BlockController extends BlockBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBlock createItemForBlock() {
|
||||
return new ItemBlockController();
|
||||
public Item createItemForBlock() {
|
||||
return new ItemBlockBase(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -16,7 +15,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageGui;
|
||||
import refinedstorage.item.ItemBlockGrid;
|
||||
import refinedstorage.item.ItemBlockBase;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
|
||||
import java.util.List;
|
||||
@@ -69,7 +68,7 @@ public class BlockGrid extends BlockMachine {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBlock createItemForBlock() {
|
||||
return new ItemBlockGrid();
|
||||
public Item createItemForBlock() {
|
||||
return new ItemBlockBase(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -116,7 +115,7 @@ public class BlockStorage extends BlockMachine {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBlock createItemForBlock() {
|
||||
public Item createItemForBlock() {
|
||||
return new ItemBlockStorage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import refinedstorage.container.slot.SlotGridCraftingResult;
|
||||
import refinedstorage.tile.TileController;
|
||||
import refinedstorage.tile.grid.IGrid;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
import refinedstorage.tile.grid.WirelessGrid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -80,7 +81,7 @@ public class ContainerGrid extends ContainerBase {
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
|
||||
if (grid.getController() instanceof TileController && grid.isWireless()) {
|
||||
if (grid instanceof WirelessGrid && ((WirelessGrid) grid).getBoundTile() instanceof TileController) {
|
||||
grid.getController().onCloseWirelessGrid(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import refinedstorage.storage.ItemGroup;
|
||||
import refinedstorage.tile.TileController;
|
||||
import refinedstorage.tile.grid.IGrid;
|
||||
import refinedstorage.tile.grid.TileGrid;
|
||||
import refinedstorage.tile.grid.WirelessGrid;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@@ -165,7 +166,7 @@ public class GuiGrid extends GuiBase {
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
scrollbar.update(this, mouseX, mouseY);
|
||||
|
||||
drawString(7, 7, t(grid.isWireless() ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
|
||||
drawString(7, 7, t(grid instanceof WirelessGrid ? "gui.refinedstorage:wireless_grid" : "gui.refinedstorage:grid"));
|
||||
|
||||
if (grid.getType() == EnumGridType.CRAFTING) {
|
||||
drawString(7, 94, t("container.crafting"));
|
||||
|
||||
@@ -1,18 +1,32 @@
|
||||
package refinedstorage.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemColored;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class ItemBlockBase extends ItemColored {
|
||||
public ItemBlockBase(Block block) {
|
||||
super(block, true);
|
||||
public class ItemBlockBase extends ItemBlock {
|
||||
public ItemBlockBase(Block block, boolean subtypes) {
|
||||
super(block);
|
||||
|
||||
setRegistryName(block.getRegistryName());
|
||||
|
||||
if (subtypes) {
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
if (getHasSubtypes()) {
|
||||
return getUnlocalizedName() + "." + stack.getItemDamage();
|
||||
}
|
||||
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package refinedstorage.item;
|
||||
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
|
||||
public class ItemBlockController extends ItemBlockBase {
|
||||
public ItemBlockController() {
|
||||
super(RefinedStorageBlocks.CONTROLLER);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package refinedstorage.item;
|
||||
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
|
||||
public class ItemBlockGrid extends ItemBlockBase {
|
||||
public ItemBlockGrid() {
|
||||
super(RefinedStorageBlocks.GRID);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
public class ItemBlockStorage extends ItemBlockBase {
|
||||
public ItemBlockStorage() {
|
||||
super(RefinedStorageBlocks.STORAGE);
|
||||
super(RefinedStorageBlocks.STORAGE, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,4 @@ public interface IGrid {
|
||||
IRedstoneModeConfig getRedstoneModeSetting();
|
||||
|
||||
boolean isConnected();
|
||||
|
||||
boolean isWireless();
|
||||
}
|
||||
|
||||
@@ -209,11 +209,6 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWireless() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setSearchBoxMode(int searchBoxMode) {
|
||||
this.searchBoxMode = searchBoxMode;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package refinedstorage.tile.grid;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -33,9 +34,13 @@ public class WirelessGrid implements IGrid {
|
||||
return EnumGridType.NORMAL;
|
||||
}
|
||||
|
||||
public TileEntity getBoundTile() {
|
||||
return world.getTileEntity(new BlockPos(ItemWirelessGrid.getX(stack), ItemWirelessGrid.getY(stack), ItemWirelessGrid.getZ(stack)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileController getController() {
|
||||
return (TileController) world.getTileEntity(new BlockPos(ItemWirelessGrid.getX(stack), ItemWirelessGrid.getY(stack), ItemWirelessGrid.getZ(stack)));
|
||||
return (TileController) getBoundTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,11 +86,6 @@ public class WirelessGrid implements IGrid {
|
||||
|
||||
@Override
|
||||
public boolean isConnected() {
|
||||
return getController() instanceof TileController && getController().isActiveClientSide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWireless() {
|
||||
return true;
|
||||
return getBoundTile() instanceof TileController && getController().isActiveClientSide();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user