mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-20 04:09:49 +00:00
Merge branch '1.2.x' of https://github.com/jaquadro/StorageDrawers into gui-test
Conflicts: StorageDrawers.iml build.gradle resources/assets/storagedrawers/textures/items/upgrade_lock.png src/com/jaquadro/minecraft/storagedrawers/StorageDrawers.java src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityCompDrawers.java src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawers.java src/com/jaquadro/minecraft/storagedrawers/block/tile/TileEntityDrawersBase.java
This commit is contained in:
commit
17f1f73533
19 files changed
+759
-199
No files matched your search
@@ -1,196 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions>
|
||||
<entry name=".+\.(properties|xml|html|dtd|tld)" />
|
||||
<entry name=".+\.(gif|png|jpeg|jpg)" />
|
||||
</resourceExtensions>
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.java" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="CopyrightManager" default="" />
|
||||
<component name="DependencyValidationManager">
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</component>
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="GradleUISettings">
|
||||
<setting name="root" />
|
||||
</component>
|
||||
<component name="GradleUISettings2">
|
||||
<setting name="root" />
|
||||
</component>
|
||||
<component name="IdProvider" IDEtalkID="11DA1DB66DD62DDA1ED602B7079FE97C" />
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="LOCALE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<XML>
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
</value>
|
||||
</option>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/StorageDrawers.iml" filepath="$PROJECT_DIR$/StorageDrawers.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="JDK 1.7 64-bit" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
<option name="mySupportsUserInfoFilter" value="true" />
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +1,9 @@
|
||||
itemGroup.storageDrawers=Storage Drawers
|
||||
itemGroup.storageDrawersSorting=Storage Drawers - Sorting
|
||||
|
||||
container.drawers=Drawers
|
||||
storageDrawers.container.upgrades=Upgrades
|
||||
|
||||
# Items
|
||||
item.upgradeTemplate.name=Upgrade Template
|
||||
item.upgrade.iron.name=Storage Upgrade (II)
|
||||
@@ -141,4 +144,4 @@ storageDrawers.config.integration.enableAE2=Enable Applied Energistics 2 Integra
|
||||
storageDrawers.config.integration.enableWaila=Enable WAILA Integration
|
||||
storageDrawers.config.integration.enableThaumcraft=Enable Thaumcraft Integration
|
||||
storageDrawers.config.integration.enableMineTweaker=Enable MineTweaker Integration
|
||||
storageDrawers.config.integration.enableRefinedRelocation=Enable Refined Relocation Integration
|
||||
storageDrawers.config.integration.enableRefinedRelocation=Enable Refined Relocation Integration
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -2,6 +2,7 @@ package com.jaquadro.minecraft.storagedrawers;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.config.*;
|
||||
import com.jaquadro.minecraft.storagedrawers.core.*;
|
||||
import com.jaquadro.minecraft.storagedrawers.core.handlers.GuiHandler;
|
||||
import com.jaquadro.minecraft.storagedrawers.integration.IntegrationRegistry;
|
||||
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
|
||||
import com.jaquadro.minecraft.storagedrawers.network.CountUpdateMessage;
|
||||
@@ -77,6 +78,7 @@ public class StorageDrawers
|
||||
public void init (FMLInitializationEvent event) {
|
||||
proxy.registerRenderers();
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
FMLCommonHandler.instance().bus().register(instance);
|
||||
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersStandard;
|
||||
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
|
||||
import com.jaquadro.minecraft.storagedrawers.core.ModItems;
|
||||
import com.jaquadro.minecraft.storagedrawers.core.handlers.GuiHandler;
|
||||
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
@@ -242,6 +243,10 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (true) {
|
||||
player.openGui(StorageDrawers.instance, GuiHandler.drawersGuiID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tileDrawers.getDirection() != side)
|
||||
return false;
|
||||
|
||||
@@ -438,7 +438,7 @@ public abstract class TileEntityDrawers extends TileEntity implements IDrawerGro
|
||||
|
||||
@Override
|
||||
public String getInventoryName () {
|
||||
return inventory.getInventoryName();
|
||||
return "container.drawers";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -453,7 +453,11 @@ public abstract class TileEntityDrawers extends TileEntity implements IDrawerGro
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer player) {
|
||||
return inventory.isUseableByPlayer(player);
|
||||
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
return false;
|
||||
|
||||
return player.getDistanceSq(xCoord + .5, yCoord + .5, zCoord + .5) <= 64;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.client.gui;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.client.renderer.StorageRenderItem;
|
||||
import com.jaquadro.minecraft.storagedrawers.integration.IntegrationRegistry;
|
||||
import com.jaquadro.minecraft.storagedrawers.integration.NotEnoughItems;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerDrawers2;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerDrawers4;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GuiDrawers extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation guiTextures2 = new ResourceLocation("storagedrawers", "textures/gui/drawers_2.png");
|
||||
private static final ResourceLocation guiTextures4 = new ResourceLocation("storagedrawers", "textures/gui/drawers_4.png");
|
||||
private static final ResourceLocation guiTexturesComp = new ResourceLocation("storagedrawers", "textures/gui/drawers_comp.png");
|
||||
|
||||
private static final int smDisabledX = 176;
|
||||
private static final int smDisabledY = 0;
|
||||
|
||||
private static final Object[] empty = new Object[0];
|
||||
|
||||
private static StorageRenderItem storageItemRender = new StorageRenderItem();
|
||||
|
||||
private TileEntityDrawers tileDrawers;
|
||||
|
||||
public GuiDrawers (InventoryPlayer inventory, TileEntityDrawers tileEntity) {
|
||||
super(getContainer(inventory, tileEntity));
|
||||
tileDrawers = tileEntity;
|
||||
|
||||
xSize = 176;
|
||||
ySize = 199;
|
||||
|
||||
itemRender = storageItemRender;
|
||||
}
|
||||
|
||||
private static Container getContainer (InventoryPlayer inventory, TileEntityDrawers tile) {
|
||||
switch (tile.getDrawerCount()) {
|
||||
case 2:
|
||||
return new ContainerDrawers2(inventory, tile);
|
||||
case 4:
|
||||
return new ContainerDrawers4(inventory, tile);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int p_73863_1_, int p_73863_2_, float p_73863_3_) {
|
||||
RenderItem ri = setItemRender(storageItemRender);
|
||||
|
||||
if (inventorySlots instanceof ContainerDrawers) {
|
||||
((ContainerDrawers) inventorySlots).getStorageInventory().activeRenderItem = storageItemRender;
|
||||
}
|
||||
|
||||
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
|
||||
|
||||
if (inventorySlots instanceof ContainerDrawers) {
|
||||
((ContainerDrawers) inventorySlots).getStorageInventory().activeRenderItem = null;
|
||||
storageItemRender.overrideStack = null;
|
||||
}
|
||||
|
||||
setItemRender(ri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int p_146979_1_, int p_146979_2_) {
|
||||
String name = tileDrawers.hasCustomInventoryName() ? tileDrawers.getInventoryName() : I18n.format(tileDrawers.getInventoryName(), empty);
|
||||
fontRendererObj.drawString(name, 8, 6, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("storageDrawers.container.upgrades", empty), 8, 75, 4210752);
|
||||
fontRendererObj.drawString(I18n.format("container.inventory",empty), 8, ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
if (tileDrawers.getDrawerCount() == 2)
|
||||
mc.getTextureManager().bindTexture(guiTextures2);
|
||||
else if (tileDrawers.getDrawerCount() == 4)
|
||||
mc.getTextureManager().bindTexture(guiTextures4);
|
||||
else
|
||||
mc.getTextureManager().bindTexture(guiTexturesComp);
|
||||
|
||||
int guiX = (width - xSize) / 2;
|
||||
int guiY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiX, guiY, 0, 0, xSize, ySize);
|
||||
|
||||
if (inventorySlots instanceof ContainerDrawers) {
|
||||
ContainerDrawers container = (ContainerDrawers) inventorySlots;
|
||||
List<Slot> storageSlots = container.getStorageSlots();
|
||||
for (int i = 0, n = storageSlots.size(); i < n; i++) {
|
||||
Slot slot = container.getSlot(i);
|
||||
drawTexturedModalRect(guiX + slot.xDisplayPosition, guiY + slot.yDisplayPosition, smDisabledX, smDisabledY, 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private RenderItem setItemRender (RenderItem renderItem) {
|
||||
if (IntegrationRegistry.instance().isModLoaded("NotEnoughItems"))
|
||||
return NotEnoughItems.setItemRender(renderItem);
|
||||
else {
|
||||
RenderItem prev = itemRender;
|
||||
itemRender = renderItem;
|
||||
|
||||
return prev;
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void func_146977_a (Slot slot) {
|
||||
RenderItem ri = setItemRender(storageItemRender);
|
||||
|
||||
super.func_146977_a(slot);
|
||||
|
||||
setItemRender(ri);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.client.renderer;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class StorageRenderItem extends RenderItem
|
||||
{
|
||||
public ItemStack overrideStack;
|
||||
|
||||
@Override
|
||||
public void renderItemOverlayIntoGUI (FontRenderer font, TextureManager texManager, ItemStack item, int x, int y, String text)
|
||||
{
|
||||
if (item != overrideStack) {
|
||||
super.renderItemOverlayIntoGUI(font, texManager, item, x, y, text);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
float scale = .5f;
|
||||
|
||||
if (item.stackSize > 1 || text != null)
|
||||
{
|
||||
text = (text == null) ? String.valueOf(item.stackSize) : text;
|
||||
int textX = (int)((x + 16 - font.getStringWidth(text) * scale) / scale) - 1;
|
||||
int textY = (int)((y + 16 - 7 * scale) / scale) - 1;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
font.drawStringWithShadow(text, textX, textY, 16777215);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (item.getItem().showDurabilityBar(item))
|
||||
{
|
||||
double health = item.getItem().getDurabilityForDisplay(item);
|
||||
int j1 = (int)Math.round(13.0D - health * 13.0D);
|
||||
int k = (int)Math.round(255.0D - health * 255.0D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int l = 255 - k << 16 | k << 8;
|
||||
int i1 = (255 - k) / 4 << 16 | 16128;
|
||||
this.renderQuad(tessellator, x + 2, y + 13, 13, 2, 0);
|
||||
this.renderQuad(tessellator, x + 2, y + 13, 12, 1, i1);
|
||||
this.renderQuad(tessellator, x + 2, y + 13, j1, 1, l);
|
||||
//GL11.glEnable(GL11.GL_BLEND); // Forge: Disable Bled because it screws with a lot of things down the line.
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderQuad (Tessellator tessellator, int x, int y, int w, int h, int color)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(color);
|
||||
tessellator.addVertex(x + 0, y + 0, 0);
|
||||
tessellator.addVertex(x + 0, y + h, 0);
|
||||
tessellator.addVertex(x + w, y + h, 0);
|
||||
tessellator.addVertex(x + w, y + 0, 0);
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.core.handlers;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.client.gui.GuiDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerDrawers2;
|
||||
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerDrawers4;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class GuiHandler implements IGuiHandler
|
||||
{
|
||||
public static int drawersGuiID = 0;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityDrawers)
|
||||
return new ContainerDrawers(player.inventory, (TileEntityDrawers) tile);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityDrawers)
|
||||
return new GuiDrawers(player.inventory, (TileEntityDrawers) tile);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ContainerDrawers getContainer (TileEntityDrawers tile, InventoryPlayer playerInventory) {
|
||||
switch (tile.getDrawerCount()) {
|
||||
case 2:
|
||||
return new ContainerDrawers2(playerInventory, tile);
|
||||
case 4:
|
||||
return new ContainerDrawers4(playerInventory, tile);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ public class IntegrationRegistry
|
||||
reg.add(new MineTweaker());
|
||||
if (Loader.isModLoaded("RefinedRelocation") && StorageDrawers.config.cache.enableRefinedRelocationIntegration)
|
||||
reg.add(new RefinedRelocation());
|
||||
if (Loader.isModLoaded("NotEnoughItems"))
|
||||
reg.add(new NotEnoughItems());
|
||||
}
|
||||
|
||||
private IntegrationRegistry () {
|
||||
@@ -66,4 +68,13 @@ public class IntegrationRegistry
|
||||
for (IntegrationModule module : registry)
|
||||
module.postInit();
|
||||
}
|
||||
|
||||
public boolean isModLoaded (String mod_id) {
|
||||
for (IntegrationModule module : registry) {
|
||||
if (module.getModID().equals(mod_id))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.integration;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class NotEnoughItems extends IntegrationModule
|
||||
{
|
||||
private static final String MOD_ID = "NotEnoughItems";
|
||||
|
||||
boolean loaded;
|
||||
|
||||
static Class clGuiContainerManager;
|
||||
static Field fdDrawItems;
|
||||
|
||||
@Override
|
||||
public String getModID () {
|
||||
return MOD_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init () throws Throwable {
|
||||
clGuiContainerManager = Class.forName("codechicken.nei.guihook.GuiContainerManager");
|
||||
fdDrawItems = clGuiContainerManager.getDeclaredField("drawItems");
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit () { }
|
||||
|
||||
public static RenderItem setItemRender (RenderItem itemRender) {
|
||||
if (fdDrawItems == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
RenderItem prev = (RenderItem) fdDrawItems.get(null);
|
||||
fdDrawItems.set(null, itemRender);
|
||||
return prev;
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.inventory;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ContainerDrawers extends Container
|
||||
{
|
||||
private static final int InventoryX = 8;
|
||||
private static final int InventoryY = 117;
|
||||
private static final int HotbarY = 175;
|
||||
|
||||
private static final int UpgradeX = 44;
|
||||
private static final int UpgradeY = 86;
|
||||
|
||||
private IInventory storageInventory;
|
||||
private IInventory upgradeInventory;
|
||||
|
||||
private List<Slot> storageSlots;
|
||||
private List<Slot> upgradeSlots;
|
||||
private List<Slot> playerSlots;
|
||||
private List<Slot> hotbarSlots;
|
||||
|
||||
public ContainerDrawers (InventoryPlayer playerInventory, TileEntityDrawers tileEntity) {
|
||||
//storageInventory = new InventoryStorage(tileEntity, this);
|
||||
storageInventory = new InventoryStorage(tileEntity);
|
||||
upgradeInventory = new InventoryUpgrade(tileEntity);
|
||||
|
||||
storageSlots = new ArrayList<Slot>();
|
||||
for (int i = 0; i < tileEntity.getDrawerCount(); i++)
|
||||
storageSlots.add(addSlotToContainer(new SlotStorage(storageInventory, i, getStorageSlotX(i), getStorageSlotY(i))));
|
||||
|
||||
upgradeSlots = new ArrayList<Slot>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
upgradeSlots.add(addSlotToContainer(new Slot(upgradeInventory, i, UpgradeX + i * 18, UpgradeY)));
|
||||
|
||||
playerSlots = new ArrayList<Slot>();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++)
|
||||
playerSlots.add(addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, InventoryX + j * 18, InventoryY + i * 18)));
|
||||
}
|
||||
|
||||
hotbarSlots = new ArrayList<Slot>();
|
||||
for (int i = 0; i < 9; i++)
|
||||
hotbarSlots.add(addSlotToContainer(new Slot(playerInventory, i, InventoryX + i * 18, HotbarY)));
|
||||
}
|
||||
|
||||
public InventoryStorage getStorageInventory () {
|
||||
return (InventoryStorage)storageInventory;
|
||||
}
|
||||
|
||||
protected int getStorageSlotX (int slot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected int getStorageSlotY (int slot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public List<Slot> getStorageSlots () {
|
||||
return storageSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer player) {
|
||||
return storageInventory.isUseableByPlayer(player) || upgradeInventory.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotIndex) {
|
||||
ItemStack itemStack = null;
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
|
||||
int storageStart = storageSlots.get(0).slotNumber;
|
||||
int storageEnd = storageSlots.get(storageSlots.size() - 1).slotNumber + 1;
|
||||
int upgradeStart = upgradeSlots.get(0).slotNumber;
|
||||
int upgradeEnd = upgradeSlots.get(upgradeSlots.size() - 1).slotNumber + 1;
|
||||
|
||||
// Assume inventory and hotbar slot IDs are contiguous
|
||||
int inventoryStart = playerSlots.get(0).slotNumber;
|
||||
int hotbarStart = hotbarSlots.get(0).slotNumber;
|
||||
int hotbarEnd = hotbarSlots.get(hotbarSlots.size() - 1).slotNumber + 1;
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
itemStack = slotStack.copy();
|
||||
|
||||
// Try merge upgrades to inventory
|
||||
if (slotIndex >= upgradeStart && slotIndex < upgradeEnd) {
|
||||
if (!mergeItemStack(slotStack, inventoryStart, hotbarEnd, true))
|
||||
return null;
|
||||
slot.onSlotChange(slotStack, itemStack);
|
||||
}
|
||||
|
||||
// Try merge stack into inventory
|
||||
else if (!mergeItemStack(slotStack, inventoryStart, hotbarEnd, false))
|
||||
return null;
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
slot.putStack(null);
|
||||
else
|
||||
slot.onSlotChanged();
|
||||
|
||||
if (slotStack.stackSize == itemStack.stackSize)
|
||||
return null;
|
||||
|
||||
slot.onPickupFromSlot(player, slotStack);
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.inventory;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerDrawers2 extends ContainerDrawers
|
||||
{
|
||||
private static final int[][] slotCoordinates = new int[][] {
|
||||
{ 80, 23 }, { 80, 49 }
|
||||
};
|
||||
|
||||
public ContainerDrawers2 (InventoryPlayer playerInventory, TileEntityDrawers tileEntity) {
|
||||
super(playerInventory, tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getStorageSlotX (int slot) {
|
||||
return slotCoordinates[slot][0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getStorageSlotY (int slot) {
|
||||
return slotCoordinates[slot][1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.inventory;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerDrawers4 extends ContainerDrawers
|
||||
{
|
||||
private static final int[][] slotCoordinates = new int[][] {
|
||||
{ 67, 23 }, { 67, 49 }, { 93, 23 }, { 93, 49 }
|
||||
};
|
||||
|
||||
public ContainerDrawers4 (InventoryPlayer playerInventory, TileEntityDrawers tileEntity) {
|
||||
super(playerInventory, tileEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getStorageSlotX (int slot) {
|
||||
return slotCoordinates[slot][0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getStorageSlotY (int slot) {
|
||||
return slotCoordinates[slot][1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.inventory;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.client.renderer.StorageRenderItem;
|
||||
import cpw.mods.fml.common.asm.transformers.ItemStackTransformer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InventoryStorage implements IInventory
|
||||
{
|
||||
public StorageRenderItem activeRenderItem;
|
||||
|
||||
private static class InventorySnapshot {
|
||||
private ItemStack[] snapshotItems;
|
||||
private int[] snapshotCounts;
|
||||
|
||||
public InventorySnapshot (int size) {
|
||||
snapshotItems = new ItemStack[size];
|
||||
snapshotCounts = new int[snapshotItems.length];
|
||||
}
|
||||
|
||||
public ItemStack takeSnapshot (ItemStack stack, int slot) {
|
||||
if (stack != null) {
|
||||
snapshotItems[slot] = stack;
|
||||
snapshotCounts[slot] = stack.stackSize;
|
||||
}
|
||||
else {
|
||||
snapshotItems[slot] = null;
|
||||
snapshotCounts[slot] = 0;
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getDiff (int slot) {
|
||||
if (snapshotItems[slot] == null)
|
||||
return 0;
|
||||
|
||||
return snapshotItems[slot].stackSize - snapshotCounts[slot];
|
||||
}
|
||||
|
||||
public int splitDiff (int slot) {
|
||||
int diff = getDiff(slot);
|
||||
if (diff != 0) {
|
||||
snapshotCounts[slot] = snapshotItems[slot].stackSize;
|
||||
}
|
||||
|
||||
return diff;
|
||||
}
|
||||
}
|
||||
|
||||
private TileEntityDrawers tile;
|
||||
private InventorySnapshot snapshot;
|
||||
|
||||
public InventoryStorage (TileEntityDrawers tileEntity) {
|
||||
tile = tileEntity;
|
||||
snapshot = new InventorySnapshot(tile.getSizeInventory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory () {
|
||||
return tile.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot) {
|
||||
int drawerSlot = tile.getDrawerInventory().getDrawerSlot(slot);
|
||||
if (!tile.isDrawerEnabled(drawerSlot))
|
||||
return null;
|
||||
|
||||
IDrawer drawer = tile.getDrawer(drawerSlot);
|
||||
ItemStack stack = drawer.getStoredItemCopy();
|
||||
if (stack == null)
|
||||
return null;
|
||||
|
||||
stack.stackSize = drawer.getStoredItemCount();
|
||||
|
||||
ItemStack snapStack = snapshot.takeSnapshot(stack, slot);
|
||||
|
||||
if (activeRenderItem != null)
|
||||
activeRenderItem.overrideStack = snapStack;
|
||||
|
||||
return snapStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int count) {
|
||||
return snapshot.takeSnapshot(tile.decrStackSize(slot, count), slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack stack) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName () {
|
||||
return tile.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName () {
|
||||
return tile.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit () {
|
||||
int limit = tile.getInventoryStackLimit();
|
||||
return (limit > 64) ? 64 : limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty () {
|
||||
for (int i = 0, n = getSizeInventory(); i < n; i++) {
|
||||
int diff = snapshot.splitDiff(i);
|
||||
if (diff != 0)
|
||||
tile.getStackInSlot(i).stackSize += diff;
|
||||
}
|
||||
|
||||
tile.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer player) {
|
||||
return tile.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory () {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory () {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int slot, ItemStack stack) {
|
||||
return tile.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.inventory;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgrade;
|
||||
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgradeStatus;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InventoryUpgrade implements IInventory
|
||||
{
|
||||
private static final int upgradeCapacity = 5;
|
||||
|
||||
private TileEntityDrawers tile;
|
||||
|
||||
public InventoryUpgrade (TileEntityDrawers tileEntity) {
|
||||
tile = tileEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory () {
|
||||
return upgradeCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot) {
|
||||
return null; //tile.getUpgrade(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int count) {
|
||||
//if (count > 0)
|
||||
// tile.setUpgrade(slot, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack item) {
|
||||
//tile.setUpgrade(slot, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName () {
|
||||
return tile.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName () {
|
||||
return tile.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit () {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty () {
|
||||
tile.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer player) {
|
||||
return tile.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory () {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory () {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int slot, ItemStack item) {
|
||||
if (item.getItem() instanceof ItemUpgrade || item.getItem() instanceof ItemUpgradeStatus)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class SlotStorage extends Slot
|
||||
{
|
||||
public SlotStorage (IInventory inventory, int index, int x, int y) {
|
||||
super(inventory, index, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack (EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user