[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-29 12:07:00 -08:00
1 parent a13186a7ce
commit 6083517e84
199 files changed
+3768 -3551

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
dependencies {
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-76-GTNH:api')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.33:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.254:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.5.18:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Avaritia:1.30:dev') {transitive=false}
@@ -1,5 +1,9 @@
package com.jaquadro.minecraft.storagedrawers;
import java.io.File;
import net.minecraftforge.common.MinecraftForge;
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.config.*;
import com.jaquadro.minecraft.storagedrawers.core.*;
@@ -9,6 +13,7 @@ import com.jaquadro.minecraft.storagedrawers.integration.IntegrationRegistry;
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
import com.jaquadro.minecraft.storagedrawers.network.CountUpdateMessage;
import com.jaquadro.minecraft.storagedrawers.security.SecurityRegistry;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
@@ -20,8 +25,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import java.io.File;
import net.minecraftforge.common.MinecraftForge;
@Mod(
modid = StorageDrawers.MOD_ID,
@@ -30,6 +33,7 @@ import net.minecraftforge.common.MinecraftForge;
dependencies = "after:waila;",
guiFactory = StorageDrawers.SOURCE_PATH + "core.ModGuiFactory")
public class StorageDrawers {
public static final String MOD_ID = "StorageDrawers";
public static final String MOD_NAME = "Storage Drawers";
public static final String MOD_VERSION = "GRADLETOKEN_VERSION";
@@ -8,6 +8,7 @@ import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry;
public interface IStorageDrawersApi {
/**
* Recipe handlers are used to make custom recipes compatible with compacting drawers.
*/
@@ -4,6 +4,7 @@ package com.jaquadro.minecraft.storagedrawers.api;
* Entry point for the public API.
*/
public class StorageDrawersApi {
private static IStorageDrawersApi instance;
public static final String VERSION = "1.7.10-1.2.0";
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.config;
public interface IAddonConfig {
/**
* Gets whether the user has configured a preference for addon packs to hide their blocks and items from Vanilla
* creative tabs.
@@ -13,8 +14,8 @@ public interface IAddonConfig {
boolean showAddonItemsVanilla();
/**
* Gets whether the user has configured a preference for addon packs to provide their blocks and items through
* their own vanilla tab.
* Gets whether the user has configured a preference for addon packs to provide their blocks and items through their
* own vanilla tab.
*/
boolean addonItemsUseSeparateTab();
}
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.config;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
public interface IBlockConfig {
String getBlockConfigName(BlockConfiguration blockConfig);
boolean isBlockEnabled(String blockConfigName);
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.config;
public interface IIntegrationConfig {
boolean isRefinedRelocationEnabled();
boolean isChiselEnabled();
@@ -4,6 +4,7 @@ package com.jaquadro.minecraft.storagedrawers.api.config;
* The main hub for user-managed mod configuration.
*/
public interface IUserConfig {
/**
* Configuration options related to third party addon packs for Storage Drawers.
*/
@@ -4,12 +4,13 @@ import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import cpw.mods.fml.common.eventhandler.Event;
/**
* This event is called when a drawer has been bound to a new item. This is
* and opportunity for mods to cache extended data with the drawer.
* This event is called when a drawer has been bound to a new item. This is and opportunity for mods to cache extended
* data with the drawer.
*
* This event is also called when the drawer is changed to empty.
*/
public class DrawerPopulatedEvent extends Event {
public final IDrawer drawer;
public DrawerPopulatedEvent(IDrawer drawer) {
@@ -4,6 +4,7 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
public interface IDrawerInventory extends ISidedInventory {
/**
* Gets a drawer's group slot index from an IInventory slot index.
*
@@ -15,7 +16,7 @@ public interface IDrawerInventory extends ISidedInventory {
* Gets an IInventory slot index suitable for operations for the given type.
*
* @param drawerSlot The index of the drawer within its group.
* @param type The type of IInventory slot to return an index for.
* @param type The type of IInventory slot to return an index for.
*/
int getInventorySlot(int drawerSlot, SlotType type);
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.inventory;
import net.minecraft.item.ItemStack;
public interface IInventoryAdapter {
ItemStack getInventoryStack(SlotType slotType);
void setInStack(ItemStack stack);
@@ -4,6 +4,7 @@ package com.jaquadro.minecraft.storagedrawers.api.inventory;
* Classifies different IInventory slots according to how they should be used.
*/
public enum SlotType {
/** An inventory slot for input-only operations; stack sizes artificially held low. */
INPUT,
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;
public enum BlockConfiguration {
BasicFull1(BlockType.Drawers, 1, false),
BasicFull2(BlockType.Drawers, 2, false),
BasicFull4(BlockType.Drawers, 4, false),
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public class ExtendedDataResolver extends StandardDataResolver implements IExtendedDataResolver {
private Block[] planks = new Block[16];
private int[] planksMeta = new int[16];
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.block.Block;
public interface IExtendedDataResolver extends IPackDataResolver {
Block getBlock(BlockConfiguration blockConfig);
Block getPlankBlock(int meta);
@@ -1,5 +1,6 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;
public interface IPackBlock {
IPackDataResolver getDataResolver();
}
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.block.Block;
public interface IPackBlockFactory {
Block createBlock(BlockConfiguration blockConfig, IPackDataResolver dataResolver);
/**
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.creativetab.CreativeTabs;
public interface IPackDataResolver {
String getPackModID();
String getBlockName(BlockConfiguration blockConfig);
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.pack;
import net.minecraft.creativetab.CreativeTabs;
public class StandardDataResolver implements IPackDataResolver {
private String modID;
private String[] unlocalizedNames;
private CreativeTabs creativeTab;
@@ -3,11 +3,12 @@ package com.jaquadro.minecraft.storagedrawers.api.registry;
import net.minecraft.item.ItemStack;
/**
* Ingredient handlers are used to get ItemStacks from ingredients in custom IRecipe implementations. If you have
* registered an IRecipeHandler that returns lists of objects that aren't ItemStacks, then you will need to
* implement an ingredient handler for those objects.
* Ingredient handlers are used to get ItemStacks from ingredients in custom IRecipe implementations. If you have
* registered an IRecipeHandler that returns lists of objects that aren't ItemStacks, then you will need to implement an
* ingredient handler for those objects.
*/
public interface IIngredientHandler {
/**
* Gets an ItemStack from an object that represents an ingredient in an IRecipe.
*
@@ -1,17 +1,18 @@
package com.jaquadro.minecraft.storagedrawers.api.registry;
import java.util.List;
import net.minecraft.item.crafting.IRecipe;
/**
* Recipe handlers are used by compacting drawers to find more-compressed forms of blocks and items. If your recipe
* to craft compressed items is a custom IRecipe implementation, you will need to register a handler for it.
* Recipe handlers are used by compacting drawers to find more-compressed forms of blocks and items. If your recipe to
* craft compressed items is a custom IRecipe implementation, you will need to register a handler for it.
*/
public interface IRecipeHandler {
/**
* Get the recipe ingredient list as an array of objects (usually used for shaped recipes).
* If your array does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to
* get an ItemStack from them.
* Get the recipe ingredient list as an array of objects (usually used for shaped recipes). If your array does not
* contain ItemStack objects, you will need to register an {@link IIngredientHandler} to get an ItemStack from them.
*
* If you would prefer to return a List, return null in this method and implement {@link #getInputAsList}.
*
@@ -21,9 +22,8 @@ public interface IRecipeHandler {
Object[] getInputAsArray(IRecipe recipe);
/**
* Get the recipe ingredient list as a list of objects (usually used for shapeless recipes).
* If your list does not contain ItemStack objects, you will need to register an {@link IIngredientHandler} to
* get an ItemStack from them.
* Get the recipe ingredient list as a list of objects (usually used for shapeless recipes). If your list does not
* contain ItemStack objects, you will need to register an {@link IIngredientHandler} to get an ItemStack from them.
*
* If you would prefer to return an array, return null in this method and implement {@link #getInputAsArray}.
*
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.registry;
public interface IRecipeHandlerRegistry {
void registerRecipeHandler(Class clazz, IRecipeHandler handler);
void registerIngredientHandler(Class clazz, IIngredientHandler handler);
@@ -3,5 +3,6 @@ package com.jaquadro.minecraft.storagedrawers.api.registry;
import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel;
public interface IRenderRegistry {
void registerPreLabelRenderHandler(IRenderLabel renderHandler);
}
@@ -1,5 +1,6 @@
package com.jaquadro.minecraft.storagedrawers.api.registry;
public interface IWailaRegistry {
void registerTooltipHandler(IWailaTooltipHandler handler);
}
@@ -3,5 +3,6 @@ package com.jaquadro.minecraft.storagedrawers.api.registry;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
public interface IWailaTooltipHandler {
String transformItemName(IDrawer drawer, String defaultName);
}
@@ -1,8 +1,10 @@
package com.jaquadro.minecraft.storagedrawers.api.render;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import net.minecraft.tileentity.TileEntity;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
public interface IRenderLabel {
void render(TileEntity tileEntity, IDrawerGroup drawerGroup, int slot, float brightness, float partialTickTime);
}
@@ -4,6 +4,7 @@ import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.IProtectable;
import com.mojang.authlib.GameProfile;
public interface ISecurityProvider {
String getProviderID();
boolean hasOwnership(GameProfile profile, IProtectable target);
@@ -4,34 +4,36 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public interface IDrawer {
/**
* Gets an ItemStack of size 1 representing the type, metadata, and tags of the stored items.
* The returned ItemStack should not be modified for any reason. Make a copy if you need to store or modify it.
* Gets an ItemStack of size 1 representing the type, metadata, and tags of the stored items. The returned ItemStack
* should not be modified for any reason. Make a copy if you need to store or modify it.
*/
ItemStack getStoredItemPrototype();
/**
* Gets an ItemStack initialized to the number of items stored in this drawer.
* The returned ItemStack is guaranteed to be a new copy and can be used for any purpose. Does not affect drawer contents.
* Gets an ItemStack initialized to the number of items stored in this drawer. The returned ItemStack is guaranteed
* to be a new copy and can be used for any purpose. Does not affect drawer contents.
*/
ItemStack getStoredItemCopy();
/**
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
*
* @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store.
* @param amount The amount to initialize the stored item count to.
* @param amount The amount to initialize the stored item count to.
* @deprecated setStoredItem may redirect its set to another IDrawer, so use setStoredItemRedir instead.
*/
@Deprecated
void setStoredItem(ItemStack itemPrototype, int amount);
/**
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
* Sets the type of the stored item and initializes it to the given amount. Any existing item will be replaced.
*
* @param itemPrototype An ItemStack representing the type, metadata, and tags of the item to store.
* @param amount The amount to initialize the stored item count to.
* @return The IDrawer actually set with the prototype. Some drawer groups can redirect a set operation to another member.
* @param amount The amount to initialize the stored item count to.
* @return The IDrawer actually set with the prototype. Some drawer groups can redirect a set operation to another
* member.
*/
IDrawer setStoredItemRedir(ItemStack itemPrototype, int amount);
@@ -41,16 +43,16 @@ public interface IDrawer {
int getStoredItemCount();
/**
* Sets the number of items stored in this drawer. Triggers syncing of inventories and client data.
* Setting a drawer's count to 0 may also result in the item type being cleared, depending in implementation.
* Sets the number of items stored in this drawer. Triggers syncing of inventories and client data. Setting a
* drawer's count to 0 may also result in the item type being cleared, depending in implementation.
*
* @param amount The new amount of items stored in this drawer.
*/
void setStoredItemCount(int amount);
/**
* Gets the maximum number of items that can be stored in this drawer.
* This value will vary depending on the max stack size of the stored item type.
* Gets the maximum number of items that can be stored in this drawer. This value will vary depending on the max
* stack size of the stored item type.
*/
int getMaxCapacity();
@@ -67,17 +69,16 @@ public interface IDrawer {
int getRemainingCapacity();
/**
* Gets the max stack size of the item type stored in this drawer. Convenience method.
* Gets the max stack size of the item type stored in this drawer. Convenience method.
*/
int getStoredItemStackSize();
/**
* Gets whether or not an item of the given type and data can be stored in this drawer.
*
* Stack size and available capacity are not considered. For drawers that are not empty, this
* method can allow ore-dictionary compatible items to be accepted into the drawer, as defined by what
* the drawer considers to be an equivalent item.
* For drawers that are empty, locking status is considered.
* Stack size and available capacity are not considered. For drawers that are not empty, this method can allow
* ore-dictionary compatible items to be accepted into the drawer, as defined by what the drawer considers to be an
* equivalent item. For drawers that are empty, locking status is considered.
*
* @param itemPrototype An ItemStack representing the type, metadata, and tags of an item.
*/
@@ -86,16 +87,15 @@ public interface IDrawer {
/**
* Gets whether or not an item of the given type and data can be extracted from this drawer.
*
* This is intended to allow outbound ore-dictionary conversions of compatible items, as defined by what
* the drawer considers to be an equivalent item.
* This is intended to allow outbound ore-dictionary conversions of compatible items, as defined by what the drawer
* considers to be an equivalent item.
*
* @param itemPrototype An ItemStack representing the type, metadata, and tags of an item.
*/
boolean canItemBeExtracted(ItemStack itemPrototype);
/**
* Gets whether or not the drawer has items.
* A drawer set with an item type and 0 count is not considered empty.
* Gets whether or not the drawer has items. A drawer set with an item type and 0 count is not considered empty.
*/
boolean isEmpty();
@@ -109,7 +109,8 @@ public interface IDrawer {
/**
* Stores auxiliary data with this drawer, mainly for use in integration.
* @param key The key to identify the data with.
*
* @param key The key to identify the data with.
* @param data The data to store.
*/
void setExtendedData(String key, Object data);
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.storage;
import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory;
public interface IDrawerGroup {
/**
* Gets the number of drawers contained within this group.
*/
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public interface IDrawerGroupInteractive extends IDrawerGroup {
ItemStack takeItemsFromSlot(int slot, int count);
int putItemsIntoSlot(int slot, ItemStack stack, int count);
@@ -1,27 +1,28 @@
package com.jaquadro.minecraft.storagedrawers.api.storage;
/**
* Represents a drawer with items that are a fractional component of another item within the drawer group. Compacting
* Represents a drawer with items that are a fractional component of another item within the drawer group. Compacting
* Drawers are a primary example of this drawer type.
*/
public interface IFractionalDrawer extends IDrawer {
/**
* Gets the storage ratio between the held item and the most compressed item within the drawer group.
*
* For example, most ingots have a conversion rate of 9 compared to metal blocks, and nuggets a rate of 81.
* Actual conversion rates are implementation-defined.
* For example, most ingots have a conversion rate of 9 compared to metal blocks, and nuggets a rate of 81. Actual
* conversion rates are implementation-defined.
*/
int getConversionRate();
/**
* Gets the number of items left in the drawer if the maximum number of equivalent compressed items had been removed.
* The equivalency is determined by the next compression tier, and not necessarily the conversion rate.
* Gets the number of items left in the drawer if the maximum number of equivalent compressed items had been
* removed. The equivalency is determined by the next compression tier, and not necessarily the conversion rate.
*/
int getStoredItemRemainder();
/**
* Gets whether or not the stored item represents the smallest granularity of material that can be stored within
* the drawer group.
* Gets whether or not the stored item represents the smallest granularity of material that can be stored within the
* drawer group.
*/
boolean isSmallestUnit();
}
@@ -1,3 +1,4 @@
package com.jaquadro.minecraft.storagedrawers.api.storage;
public interface INetworked {}
public interface INetworked {
}
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.storage;
public interface IPriorityGroup {
/**
* Gets the list of available drawer slots in priority order.
*/
@@ -3,9 +3,10 @@ package com.jaquadro.minecraft.storagedrawers.api.storage;
import net.minecraft.item.ItemStack;
public interface ISmartGroup {
/**
* Gets a lazy enumeration of all slots that will accept at least one item of the given stack, ordered by
* insertion preference.
* Gets a lazy enumeration of all slots that will accept at least one item of the given stack, ordered by insertion
* preference.
*/
Iterable<Integer> enumerateDrawersForInsertion(ItemStack stack, boolean strict);
@@ -1,20 +1,20 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
public interface ILockable {
/**
* Gets whether or not a drawer or group is locked for the given lock attribute.
*/
boolean isLocked(LockAttribute attr);
/**
* Gets whether or not the lock state can be changed for the given lock attribute.
* If this method returns false, isLocked may still return true.
* Gets whether or not the lock state can be changed for the given lock attribute. If this method returns false,
* isLocked may still return true.
*/
boolean canLock(LockAttribute attr);
/**
* Sets the lock state of a drawer or group for the given lock attribute.
* If canLock returns false, this is a no-op.
* Sets the lock state of a drawer or group for the given lock attribute. If canLock returns false, this is a no-op.
*/
void setLocked(LockAttribute attr, boolean isLocked);
}
@@ -1,28 +1,33 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import java.util.UUID;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
public interface IProtectable {
/**
* Gets the owner of the drawer, or null if there is no owner.
*/
UUID getOwner();
/**
* Sets the owner of the drawer. Set to null to set no owner.
* Sets the owner of the drawer. Set to null to set no owner.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setOwner(UUID owner);
/**
* Gets the provider managing security for the target.
*
* @return null to use the default provider, which enforces strict owner access.
*/
ISecurityProvider getSecurityProvider();
/**
* Sets the provider managing security for the target. Set to null for default provider.
* Sets the provider managing security for the target. Set to null for default provider.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setSecurityProvider(ISecurityProvider provder);
@@ -1,14 +1,16 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
public interface ISealable {
/**
* Gets whether or not the drawer has the sealed attribute.
* A sealed drawer cannot be interacted with, and when broken will retain all of its items and upgrades.
* Gets whether or not the drawer has the sealed attribute. A sealed drawer cannot be interacted with, and when
* broken will retain all of its items and upgrades.
*/
boolean isSealed();
/**
* Sets whether or not the drawer is currently sealed.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setIsSealed(boolean state);
@@ -1,14 +1,16 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
public interface IShroudable {
/**
* Gets whether or not the drawer has the shrouded attribute.
* The shrouded attribute instructs the drawer to not render its item label.
* Gets whether or not the drawer has the shrouded attribute. The shrouded attribute instructs the drawer to not
* render its item label.
*/
boolean isShrouded();
/**
* Sets whether or not the drawer is currently shrouded.
*
* @return false if the operation is not supported, true otherwise.
*/
boolean setIsShrouded(boolean state);
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
public interface IVoidable {
/**
* Gets whether or not the drawer has a voiding attribute.
*/
@@ -3,6 +3,7 @@ package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;
import java.util.EnumSet;
public enum LockAttribute {
LOCK_POPULATED,
LOCK_EMPTY;
@@ -1,14 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersComp;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -20,7 +13,18 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersComp;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCompDrawers extends BlockDrawers implements INetworked {
@SideOnly(Side.CLIENT)
private IIcon[] iconFront;
@@ -133,9 +137,8 @@ public class BlockCompDrawers extends BlockDrawers implements INetworked {
for (int i = 0; i < 3; i++) {
iconFront[i] = register.registerIcon(StorageDrawers.MOD_ID + ":drawers_comp_front_" + i);
iconFrontInd[i][0] = register.registerIcon(StorageDrawers.MOD_ID + ":drawers_comp_front_" + i + "_ind");
for (int j = 1; j <= 6; j++)
iconFrontInd[i][j] =
register.registerIcon(StorageDrawers.MOD_ID + ":drawers_comp_front_" + i + "_ind" + j);
for (int j = 1; j <= 6; j++) iconFrontInd[i][j] = register
.registerIcon(StorageDrawers.MOD_ID + ":drawers_comp_front_" + i + "_ind" + j);
}
iconTrim = register.registerIcon(StorageDrawers.MOD_ID + ":drawers_comp_trim");
@@ -1,17 +1,8 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.core.ModItems;
import com.jaquadro.minecraft.storagedrawers.item.ItemPersonalKey;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -26,7 +17,20 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.core.ModItems;
import com.jaquadro.minecraft.storagedrawers.item.ItemPersonalKey;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockController extends BlockContainer implements INetworked {
@SideOnly(Side.CLIENT)
private IIcon iconFront;
@@ -113,8 +117,8 @@ public class BlockController extends BlockContainer implements INetworked {
}
@Override
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
TileEntityController te = getTileEntitySafe(world, x, y, z);
ItemStack item = player.inventory.getCurrentItem();
@@ -123,14 +127,15 @@ public class BlockController extends BlockContainer implements INetworked {
if (!world.isRemote) te.toggleShroud(player.getGameProfile());
return true;
} else if (item.getItem() == ModItems.upgradeLock) {
if (!world.isRemote)
te.toggleLock(
EnumSet.allOf(LockAttribute.class), LockAttribute.LOCK_POPULATED, player.getGameProfile());
if (!world.isRemote) te.toggleLock(
EnumSet.allOf(LockAttribute.class),
LockAttribute.LOCK_POPULATED,
player.getGameProfile());
return true;
} else if (item.getItem() == ModItems.personalKey) {
if (!world.isRemote) {
String securityKey =
((ItemPersonalKey) item.getItem()).getSecurityProviderKey(item.getItemDamage());
String securityKey = ((ItemPersonalKey) item.getItem())
.getSecurityProviderKey(item.getItemDamage());
ISecurityProvider provider = StorageDrawers.securityRegistry.getProvider(securityKey);
te.toggleProtection(player.getGameProfile(), provider);
@@ -1,28 +1,5 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
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.item.ItemPersonalKey;
import com.jaquadro.minecraft.storagedrawers.item.ItemTrim;
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgrade;
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgradeCreative;
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
import com.jaquadro.minecraft.storagedrawers.security.SecurityManager;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -31,6 +8,7 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -52,12 +30,39 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.logging.log4j.Level;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
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.item.ItemPersonalKey;
import com.jaquadro.minecraft.storagedrawers.item.ItemTrim;
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgrade;
import com.jaquadro.minecraft.storagedrawers.item.ItemUpgradeCreative;
import com.jaquadro.minecraft.storagedrawers.network.BlockClickMessage;
import com.jaquadro.minecraft.storagedrawers.security.SecurityManager;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockDrawers extends BlockContainer implements IExtendedBlockClickHandler, INetworked {
private static final ResourceLocation blockConfig =
new ResourceLocation(StorageDrawers.MOD_ID + ":textures/blocks/block_config.mcmeta");
private static final ResourceLocation blockConfig = new ResourceLocation(
StorageDrawers.MOD_ID + ":textures/blocks/block_config.mcmeta");
public final boolean halfDepth;
public final int drawerCount;
@@ -269,8 +274,8 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
}
@Override
public void addCollisionBoxesToList(
World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list,
Entity entity) {
setBlockBoundsBasedOnState(world, x, y, z);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
}
@@ -305,8 +310,8 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
}
@Override
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
if (world.isRemote && Minecraft.getMinecraft().getSystemTime() == ignoreEventTime) {
ignoreEventTime = 0;
return false;
@@ -334,51 +339,51 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
return true;
}
/**
* Gee, it'd be nice if we could make all of these Items descend from one thing, almost like children
* and it would great if we could just find if it was an instance of said thing.
* Crazy concept!
* */
else if (item.getItem() == ModItems.upgrade
|| item.getItem() == ModItems.upgradeStatus
* Gee, it'd be nice if we could make all of these Items descend from one thing, almost like children and it
* would great if we could just find if it was an instance of said thing. Crazy concept!
*/
else if (item.getItem() == ModItems.upgrade || item.getItem() == ModItems.upgradeStatus
|| item.getItem() == ModItems.upgradeVoid
|| item.getItem() == ModItems.upgradeCreative
|| item.getItem() == ModItems.upgradeRedstone
|| item.getItem() == ModItems.upgradeDowngrade) {
if (!tileDrawers.addUpgrade(item)) {
player.addChatMessage(new ChatComponentTranslation("storagedrawers.msg.maxUpgrades"));
return false;
}
if (!tileDrawers.addUpgrade(item)) {
player.addChatMessage(new ChatComponentTranslation("storagedrawers.msg.maxUpgrades"));
return false;
}
world.markBlockForUpdate(x, y, z);
world.markBlockForUpdate(x, y, z);
if (player != null && !player.capabilities.isCreativeMode) {
if (--item.stackSize <= 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
if (player != null && !player.capabilities.isCreativeMode) {
if (--item.stackSize <= 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
return true;
} else if (item.getItem() == ModItems.upgradeLock) {
boolean locked = tileDrawers.isLocked(LockAttribute.LOCK_POPULATED);
tileDrawers.setLocked(LockAttribute.LOCK_POPULATED, !locked);
tileDrawers.setLocked(LockAttribute.LOCK_EMPTY, !locked);
return true;
} else
if (item.getItem() == ModItems.upgradeLock) {
boolean locked = tileDrawers.isLocked(LockAttribute.LOCK_POPULATED);
tileDrawers.setLocked(LockAttribute.LOCK_POPULATED, !locked);
tileDrawers.setLocked(LockAttribute.LOCK_EMPTY, !locked);
return true;
} else if (item.getItem() == ModItems.shroudKey) {
tileDrawers.setIsShrouded(!tileDrawers.isShrouded());
return true;
} else if (item.getItem() instanceof ItemPersonalKey) {
String securityKey = ((ItemPersonalKey) item.getItem()).getSecurityProviderKey(item.getItemDamage());
ISecurityProvider provider = StorageDrawers.securityRegistry.getProvider(securityKey);
return true;
} else if (item.getItem() == ModItems.shroudKey) {
tileDrawers.setIsShrouded(!tileDrawers.isShrouded());
return true;
} else if (item.getItem() instanceof ItemPersonalKey) {
String securityKey = ((ItemPersonalKey) item.getItem())
.getSecurityProviderKey(item.getItemDamage());
ISecurityProvider provider = StorageDrawers.securityRegistry.getProvider(securityKey);
if (tileDrawers.getOwner() == null) {
tileDrawers.setOwner(player.getPersistentID());
tileDrawers.setSecurityProvider(provider);
} else if (SecurityManager.hasOwnership(player.getGameProfile(), tileDrawers)) {
tileDrawers.setOwner(null);
tileDrawers.setSecurityProvider(null);
} else return false;
return true;
} else if (item.getItem() == ModItems.tape) return false;
if (tileDrawers.getOwner() == null) {
tileDrawers.setOwner(player.getPersistentID());
tileDrawers.setSecurityProvider(provider);
} else if (SecurityManager.hasOwnership(player.getGameProfile(), tileDrawers)) {
tileDrawers.setOwner(null);
tileDrawers.setSecurityProvider(null);
} else return false;
return true;
} else if (item.getItem() == ModItems.tape) return false;
} else if (item == null && player.isSneaking()) {
if (tileDrawers.isSealed()) {
tileDrawers.setIsSealed(false);
@@ -438,8 +443,16 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
float hitY = (float) (posn.hitVec.yCoord - posn.blockY);
float hitZ = (float) (posn.hitVec.zCoord - posn.blockZ);
StorageDrawers.network.sendToServer(new BlockClickMessage(
x, y, z, posn.sideHit, hitX, hitY, hitZ, StorageDrawers.config.cache.invertShift));
StorageDrawers.network.sendToServer(
new BlockClickMessage(
x,
y,
z,
posn.sideHit,
hitX,
hitY,
hitZ,
StorageDrawers.config.cache.invertShift));
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "BlockDrawers.onBlockClicked with " + posn.toString());
@@ -447,23 +460,14 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
}
@Override
public void onBlockClicked(
World world,
int x,
int y,
int z,
EntityPlayer player,
int side,
float hitX,
float hitY,
float hitZ,
boolean invertShift) {
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY,
float hitZ, boolean invertShift) {
if (StorageDrawers.config.cache.debugTrace)
FMLLog.log(StorageDrawers.MOD_ID, Level.INFO, "IExtendedBlockClickHandler.onBlockClicked");
if (!player.capabilities.isCreativeMode) {
PlayerInteractEvent event = ForgeEventFactory.onPlayerInteract(
player, PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, x, y, z, side, world);
PlayerInteractEvent event = ForgeEventFactory
.onPlayerInteract(player, PlayerInteractEvent.Action.LEFT_CLICK_BLOCK, x, y, z, side, world);
if (event.isCanceled()) return;
}
@@ -491,14 +495,13 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
ForgeDirection dir = ForgeDirection.getOrientation(side);
dropItemStack(world, x + dir.offsetX, y, z + dir.offsetZ, player, item);
world.markBlockForUpdate(x, y, z);
} else
world.playSoundEffect(
x + .5f,
y + .5f,
z + .5f,
"random.pop",
.2f,
((world.rand.nextFloat() - world.rand.nextFloat()) * .7f + 1) * 2);
} else world.playSoundEffect(
x + .5f,
y + .5f,
z + .5f,
"random.pop",
.2f,
((world.rand.nextFloat() - world.rand.nextFloat()) * .7f + 1) * 2);
}
}
@@ -571,8 +574,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
if (stack.stackSize > 0) {
EntityItem entity = new EntityItem(world, x + ex, y + ey, z + ez, stack);
if (stack.hasTagCompound())
entity.getEntityItem()
.setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
entity.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
world.spawnEntityInWorld(entity);
}
}
@@ -618,8 +620,8 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
/* System.out.println("hello"); */
if (cpw.mods.fml.common.Loader.isModLoaded("Avaritia")) {
try {
Class<?> itemMatterClusterClass =
Class.forName("fox.spiteful.avaritia.items.ItemMatterCluster");
Class<?> itemMatterClusterClass = Class
.forName("fox.spiteful.avaritia.items.ItemMatterCluster");
Method method = itemMatterClusterClass.getMethod("makeClusters", List.class);
/* May not be used */
for (int i = 0; i < tile.getDrawerCount(); i++) {
@@ -632,16 +634,14 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
stacks.add(stack);
}
List<ItemStack> clusters =
(List<ItemStack>) method.invoke(itemMatterClusterClass, stacks);
List<ItemStack> clusters = (List<ItemStack>) method
.invoke(itemMatterClusterClass, stacks);
for (ItemStack stack : clusters) {
dropStackInBatches(world, x, y, z, stack);
}
}
break; /* switch */
} catch (NoSuchMethodException
| InvocationTargetException
| IllegalAccessException
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException
| ClassNotFoundException e) {
StorageDrawers.config.cache.breakDrawerDropMode = "default";
FMLLog.log(
@@ -701,8 +701,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
entity.motionZ = rand.nextGaussian() * motionUnit;
if (stack.hasTagCompound())
entity.getEntityItem()
.setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
entity.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
}
@@ -750,15 +749,8 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
}
@Override
public float getExplosionResistance(
Entity par1Entity,
World world,
int x,
int y,
int z,
double explosionX,
double explosionY,
double explosionZ) {
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX,
double explosionY, double explosionZ) {
TileEntityDrawers tile = getTileEntity(world, x, y, z);
if (tile != null) {
for (int slot = 0; slot < 5; slot++) {
@@ -803,13 +795,12 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
return super.addHitEffects(worldObj, target, effectRenderer);
}
/*@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects (World world, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityDrawers)
return super.addDestroyEffects(world, x, y, z, meta, effectRenderer);
}*/
/*
* @Override
* @SideOnly(Side.CLIENT) public boolean addDestroyEffects (World world, int x, int y, int z, int meta,
* EffectRenderer effectRenderer) { TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof
* TileEntityDrawers) return super.addDestroyEffects(world, x, y, z, meta, effectRenderer); }
*/
@Override
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
@@ -1012,7 +1003,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
iconTaped = register.registerIcon(StorageDrawers.MOD_ID + ":tape");
String[] overlays = new String[] {null, null, "iron", "gold", "obsidian", "diamond", "emerald"};
String[] overlays = new String[] { null, null, "iron", "gold", "obsidian", "diamond", "emerald" };
iconOverlay = new IIcon[overlays.length];
iconOverlayH = new IIcon[overlays.length];
@@ -1048,8 +1039,7 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
@SideOnly(Side.CLIENT)
protected void loadBlockConfig() {
try {
IResource configResource =
Minecraft.getMinecraft().getResourceManager().getResource(blockConfig);
IResource configResource = Minecraft.getMinecraft().getResourceManager().getResource(blockConfig);
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(configResource.getInputStream()));
@@ -1057,10 +1047,8 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
JsonObject entry = root.getAsJsonObject(getConfigName());
if (entry != null) {
if (entry.has("trimWidth"))
trimWidth = entry.get("trimWidth").getAsFloat();
if (entry.has("trimDepth"))
trimDepth = entry.get("trimDepth").getAsFloat();
if (entry.has("trimWidth")) trimWidth = entry.get("trimWidth").getAsFloat();
if (entry.has("trimDepth")) trimDepth = entry.get("trimDepth").getAsFloat();
if (entry.has("indStart")) indStart = entry.get("indStart").getAsFloat();
if (entry.has("indEnd")) indEnd = entry.get("indEnd").getAsFloat();
if (entry.has("indSteps")) indSteps = entry.get("indSteps").getAsInt();
@@ -1,13 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomDrawers;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,7 +10,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomDrawers;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockDrawersCustom extends BlockDrawers {
@SideOnly(Side.CLIENT)
private IIcon overlayHandle;
@@ -65,8 +69,8 @@ public class BlockDrawersCustom extends BlockDrawers {
TileEntityDrawers tile = getTileEntity(world, x, y, z);
if (tile == null) return ItemCustomDrawers.makeItemStack(this, 1, null, null, null);
return ItemCustomDrawers.makeItemStack(
this, 1, tile.getMaterialSide(), tile.getMaterialTrim(), tile.getMaterialFront());
return ItemCustomDrawers
.makeItemStack(this, 1, tile.getMaterialSide(), tile.getMaterialTrim(), tile.getMaterialFront());
}
@Override
@@ -75,8 +79,8 @@ public class BlockDrawersCustom extends BlockDrawers {
}
@Override
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
TileEntityDrawers tile = getTileEntity(world, x, y, z);
if (tile != null && tile.getMaterialSide() == null) return false;
@@ -1,14 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.core.ModBlocks;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.core.handlers.GuiHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -22,9 +15,22 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.core.ModBlocks;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.core.handlers.GuiHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockFramingTable extends BlockContainer {
public static final int[][] leftOffset = new int[][] {{0, 0}, {0, 0}, {1, 0}, {-1, 0}, {0, -1}, {0, 1}};
public static final int[][] rightOffset = new int[][] {{0, 0}, {0, 0}, {-1, 0}, {1, 0}, {0, 1}, {0, -1}};
public static final int[][] leftOffset = new int[][] { { 0, 0 }, { 0, 0 }, { 1, 0 }, { -1, 0 }, { 0, -1 },
{ 0, 1 } };
public static final int[][] rightOffset = new int[][] { { 0, 0 }, { 0, 0 }, { -1, 0 }, { 1, 0 }, { 0, 1 },
{ 0, -1 } };
private Random random = new Random();
@@ -55,8 +61,8 @@ public class BlockFramingTable extends BlockContainer {
}
@Override
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int side, float vx, float vy, float vz) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float vx, float vy,
float vz) {
int meta = world.getBlockMetadata(x, y, z);
int priX = x + getXOff(meta);
int priZ = z + getZOff(meta);
@@ -169,8 +175,7 @@ public class BlockFramingTable extends BlockContainer {
new ItemStack(stack.getItem(), amount, stack.getItemDamage()));
if (stack.hasTagCompound())
entity.getEntityItem().setTagCompound((NBTTagCompound)
stack.getTagCompound().copy());
entity.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
entity.motionX = random.nextGaussian() * .05f;
entity.motionY = random.nextGaussian() * .05f + .2f;
@@ -1,11 +1,5 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntitySlave;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -15,7 +9,16 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntitySlave;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSlave extends BlockContainer implements INetworked {
@SideOnly(Side.CLIENT)
private IIcon iconSide;
@@ -1,12 +1,8 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWood;
import net.minecraft.block.material.Material;
@@ -18,7 +14,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockTrim extends Block implements INetworked {
@SideOnly(Side.CLIENT)
protected IIcon[] iconTrim;
@@ -1,12 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityTrim;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomTrim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -18,7 +13,16 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityTrim;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomTrim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockTrimCustom extends BlockTrim implements ITileEntityProvider {
@SideOnly(Side.CLIENT)
private IIcon defaultFace;
@@ -1,17 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWood;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.api.pack.ExtendedDataResolver;
import com.jaquadro.minecraft.storagedrawers.core.ModBlocks;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.integration.RefinedRelocation;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWood;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
public class DataResolver extends ExtendedDataResolver {
private static String[] textureNames = BlockWood.field_150096_a;
public DataResolver(String modID) {
@@ -4,15 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface IExtendedBlockClickHandler {
public void onBlockClicked(
World world,
int x,
int y,
int z,
EntityPlayer player,
int side,
float hitX,
float hitY,
float hitZ,
boolean invertShift);
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY,
float hitZ, boolean invertShift);
}
@@ -1,13 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block.pack;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ModBlocks;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -15,7 +9,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ModBlocks;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockDrawersPack extends BlockDrawers implements IPackBlock {
private IPackDataResolver resolver;
public BlockDrawersPack(IPackDataResolver resolver, int drawerCount, boolean halfDepth) {
@@ -1,13 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block.pack;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.integration.RefinedRelocation;
import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.BlockSortingDrawers;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -15,7 +9,17 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.integration.RefinedRelocation;
import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.BlockSortingDrawers;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSortingDrawersPack extends BlockSortingDrawers implements IPackBlock {
private IPackDataResolver resolver;
public BlockSortingDrawersPack(IPackDataResolver resolver, int drawerCount, boolean halfDepth) {
@@ -1,19 +1,23 @@
package com.jaquadro.minecraft.storagedrawers.block.pack;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.BlockSortingTrim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.BlockSortingTrim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSortingTrimPack extends BlockSortingTrim implements IPackBlock {
IPackDataResolver resolver;
public BlockSortingTrimPack(IPackDataResolver resolver) {
@@ -1,19 +1,23 @@
package com.jaquadro.minecraft.storagedrawers.block.pack;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrim;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.*;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrim;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockTrimPack extends BlockTrim implements IPackBlock {
private IPackDataResolver resolver;
public BlockTrimPack(IPackDataResolver resolver) {
@@ -1,13 +1,17 @@
package com.jaquadro.minecraft.storagedrawers.block.tile;
import java.util.Iterator;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import org.apache.logging.log4j.Level;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import cpw.mods.fml.common.FMLLog;
import java.util.Iterator;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import org.apache.logging.log4j.Level;
public class BaseTileEntity extends TileEntity {
private NBTTagCompound failureSnapshot;
@Override
@@ -4,6 +4,7 @@ package com.jaquadro.minecraft.storagedrawers.block.tile;
* Created by Justin on 4/25/2015.
*/
class BlockCoord {
private int x;
private int y;
private int z;
@@ -1,16 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block.tile;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import com.jaquadro.minecraft.storagedrawers.api.storage.*;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockSlave;
import com.jaquadro.minecraft.storagedrawers.security.SecurityManager;
import com.jaquadro.minecraft.storagedrawers.util.ItemMetaListRegistry;
import com.mojang.authlib.GameProfile;
import java.util.*;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
@@ -22,8 +13,20 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
import com.jaquadro.minecraft.storagedrawers.api.storage.*;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockSlave;
import com.jaquadro.minecraft.storagedrawers.security.SecurityManager;
import com.jaquadro.minecraft.storagedrawers.util.ItemMetaListRegistry;
import com.mojang.authlib.GameProfile;
public class TileEntityController extends TileEntity
implements IDrawerGroup, IPriorityGroup, ISmartGroup, ISidedInventory {
private static final int PRI_VOID = 0;
private static final int PRI_LOCKED = 1;
private static final int PRI_NORMAL = 2;
@@ -35,6 +38,7 @@ public class TileEntityController extends TileEntity
private static final int[] emptySlots = new int[0];
private static class StorageRecord {
public IDrawerGroup storage;
public boolean mark;
public int invStorageSize;
@@ -51,6 +55,7 @@ public class TileEntityController extends TileEntity
}
private static class SlotRecord {
public BlockCoord coord;
public int slot;
@@ -64,6 +69,7 @@ public class TileEntityController extends TileEntity
}
private Comparator<SlotRecord> slotRecordComparator = new Comparator<SlotRecord>() {
@Override
public int compare(SlotRecord o1, SlotRecord o2) {
return o1.priority - o2.priority;
@@ -114,7 +120,7 @@ public class TileEntityController extends TileEntity
private int[] inventorySlots = new int[0];
private int[] drawerSlots = new int[0];
private int[] autoSides = new int[] {0, 1, 2, 3, 4, 5};
private int[] autoSides = new int[] { 0, 1, 2, 3, 4, 5 };
private int direction;
private int drawerSize = 0;
@@ -129,7 +135,7 @@ public class TileEntityController extends TileEntity
public TileEntityController() {
invSlotList.add(new SlotRecord(null, 0));
inventorySlots = new int[] {0};
inventorySlots = new int[] { 0 };
range = StorageDrawers.config.getControllerRange();
maxDrawers = StorageDrawers.config.getControllerMaxDrawers();
}
@@ -366,8 +372,8 @@ public class TileEntityController extends TileEntity
return slotMap;
}
private void rebuildPrimaryLookup(
ItemMetaListRegistry<SlotRecord> lookup, List<SlotRecord> records, boolean invBased) {
private void rebuildPrimaryLookup(ItemMetaListRegistry<SlotRecord> lookup, List<SlotRecord> records,
boolean invBased) {
lookup.clear();
for (SlotRecord record : records) {
@@ -515,14 +521,12 @@ public class TileEntityController extends TileEntity
record.mark = true;
record.distance = depth;
BlockCoord[] neighbors = new BlockCoord[] {
new BlockCoord(coord.x() + 1, coord.y(), coord.z()),
new BlockCoord(coord.x() - 1, coord.y(), coord.z()),
new BlockCoord(coord.x(), coord.y(), coord.z() + 1),
new BlockCoord(coord.x(), coord.y(), coord.z() - 1),
new BlockCoord(coord.x(), coord.y() + 1, coord.z()),
new BlockCoord(coord.x(), coord.y() - 1, coord.z()),
};
BlockCoord[] neighbors = new BlockCoord[] { new BlockCoord(coord.x() + 1, coord.y(), coord.z()),
new BlockCoord(coord.x() - 1, coord.y(), coord.z()),
new BlockCoord(coord.x(), coord.y(), coord.z() + 1),
new BlockCoord(coord.x(), coord.y(), coord.z() - 1),
new BlockCoord(coord.x(), coord.y() + 1, coord.z()),
new BlockCoord(coord.x(), coord.y() - 1, coord.z()), };
for (BlockCoord n : neighbors) {
if (!searchDiscovered.contains(n)) {
@@ -820,6 +824,7 @@ public class TileEntityController extends TileEntity
}
private class DrawerStackIterator implements Iterable<Integer> {
private ItemStack stack;
private boolean strict;
private boolean insert;
@@ -835,8 +840,9 @@ public class TileEntityController extends TileEntity
if (this.stack == null) return new ArrayList<Integer>(0).iterator();
return new Iterator<Integer>() {
List<SlotRecord> primaryRecords =
drawerPrimaryLookup.getEntries(stack.getItem(), stack.getItemDamage());
List<SlotRecord> primaryRecords = drawerPrimaryLookup
.getEntries(stack.getItem(), stack.getItemDamage());
Iterator<SlotRecord> iter1;
int index2;
Integer nextSlot = null;
@@ -898,7 +904,8 @@ public class TileEntityController extends TileEntity
if (insert) {
boolean voiding = (drawer instanceof IVoidable) ? ((IVoidable) drawer).isVoid() : false;
if (!(drawer.canItemBeStored(stack)
&& (drawer.isEmpty() || drawer.getRemainingCapacity() > 0 || voiding))) continue;
&& (drawer.isEmpty() || drawer.getRemainingCapacity() > 0 || voiding)))
continue;
} else {
if (!(drawer.canItemBeExtracted(stack) && drawer.getStoredItemCount() > 0)) continue;
}
@@ -913,8 +920,7 @@ public class TileEntityController extends TileEntity
}
};
}
}
;
};
public Iterable<Integer> enumerateDrawersForInsertion(ItemStack stack, boolean strict) {
return new DrawerStackIterator(stack, strict, true);
@@ -1,5 +1,21 @@
package com.jaquadro.minecraft.storagedrawers.block.tile;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.Constants;
import org.apache.logging.log4j.Level;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory;
import com.jaquadro.minecraft.storagedrawers.api.security.ISecurityProvider;
@@ -13,35 +29,18 @@ import com.jaquadro.minecraft.storagedrawers.inventory.ISideManager;
import com.jaquadro.minecraft.storagedrawers.inventory.StorageInventory;
import com.jaquadro.minecraft.storagedrawers.network.CountUpdateMessage;
import com.jaquadro.minecraft.storagedrawers.storage.IUpgradeProvider;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import java.util.EnumSet;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.Constants;
import org.apache.logging.log4j.Level;
public abstract class TileEntityDrawers extends BaseTileEntity
implements IDrawerGroupInteractive,
ISidedInventory,
IUpgradeProvider,
ILockable,
ISealable,
IProtectable,
IDowngradable {
public abstract class TileEntityDrawers extends BaseTileEntity implements IDrawerGroupInteractive, ISidedInventory,
IUpgradeProvider, ILockable, ISealable, IProtectable, IDowngradable {
private IDrawer[] drawers;
private IDrawerInventory inventory;
private int[] autoSides = new int[] {0, 1, 2, 3, 4, 5};
private int[] autoSides = new int[] { 0, 1, 2, 3, 4, 5 };
private int direction;
private int drawerCapacity = 1;
@@ -576,8 +575,7 @@ public abstract class TileEntityDrawers extends BaseTileEntity
public int interactPutItemsIntoSlot(int slot, EntityPlayer player) {
int count = 0;
if (worldObj.getTotalWorldTime() - lastClickTime < 10
&& player.getPersistentID().equals(lastClickUUID))
if (worldObj.getTotalWorldTime() - lastClickTime < 10 && player.getPersistentID().equals(lastClickUUID))
count = interactPutCurrentInventoryIntoSlot(slot, player);
else count = interactPutCurrentItemIntoSlot(slot, player);
@@ -767,8 +765,15 @@ public abstract class TileEntityDrawers extends BaseTileEntity
FMLLog.log(
StorageDrawers.MOD_ID,
Level.ERROR,
"Drawer at (" + this.xCoord + "," + this.yCoord + "," + this.zCoord + ") has no slot " + slot
+ ". Drawers.length is " + drawers.length);
"Drawer at (" + this.xCoord
+ ","
+ this.yCoord
+ ","
+ this.zCoord
+ ") has no slot "
+ slot
+ ". Drawers.length is "
+ drawers.length);
return;
}
if (drawer.getStoredItemCount() != count) {
@@ -788,8 +793,12 @@ public abstract class TileEntityDrawers extends BaseTileEntity
private void syncClientCount(int slot) {
IMessage message = new CountUpdateMessage(xCoord, yCoord, zCoord, slot, drawers[slot].getStoredItemCount());
NetworkRegistry.TargetPoint targetPoint =
new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 500);
NetworkRegistry.TargetPoint targetPoint = new NetworkRegistry.TargetPoint(
worldObj.provider.dimensionId,
xCoord,
yCoord,
zCoord,
500);
StorageDrawers.network.sendToAllAround(message, targetPoint);
}
@@ -926,6 +935,7 @@ public abstract class TileEntityDrawers extends BaseTileEntity
}
private class DefaultSideManager implements ISideManager {
@Override
public int[] getSlotsForSide(int side) {
return autoSides;
@@ -1,5 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.block.tile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import org.apache.logging.log4j.Level;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.registry.IIngredientHandler;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandler;
@@ -9,24 +23,15 @@ import com.jaquadro.minecraft.storagedrawers.config.CompTierRegistry;
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
import com.jaquadro.minecraft.storagedrawers.network.CountUpdateMessage;
import com.jaquadro.minecraft.storagedrawers.storage.*;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import org.apache.logging.log4j.Level;
public class TileEntityDrawersComp extends TileEntityDrawers {
private static InventoryLookup lookup1 = new InventoryLookup(1, 1);
private static InventoryLookup lookup2 = new InventoryLookup(2, 2);
private static InventoryLookup lookup3 = new InventoryLookup(3, 3);
@@ -147,20 +152,18 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
ItemStack uTier1 = findHigherTier(stack);
if (uTier1 != null) {
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + uTier1.toString() + " with conv=" + lookupSizeResult);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + uTier1.toString() + " with conv=" + lookupSizeResult);
int uCount1 = lookupSizeResult;
ItemStack uTier2 = findHigherTier(uTier1);
if (uTier2 != null) {
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + uTier2.toString() + " with conv=" + lookupSizeResult);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + uTier2.toString() + " with conv=" + lookupSizeResult);
populateSlot(index++, uTier2, lookupSizeResult * uCount1);
}
@@ -174,11 +177,10 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
ItemStack lTier1 = findLowerTier(stack);
if (lTier1 != null) {
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + lTier1.toString() + " with conv=" + lookupSizeResult);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + lTier1.toString() + " with conv=" + lookupSizeResult);
populateSlot(index++, lTier1, 1);
for (int i = 0; i < index - 1; i++) convRate[i] *= lookupSizeResult;
@@ -188,11 +190,10 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
ItemStack lTier2 = findLowerTier(lTier1);
if (lTier2 != null) {
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + lTier2.toString() + " with conv=" + lookupSizeResult);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Picked candidate " + lTier2.toString() + " with conv=" + lookupSizeResult);
populateSlot(index++, lTier2, 1);
for (int i = 0; i < index - 1; i++) convRate[i] *= lookupSizeResult;
@@ -205,8 +206,7 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
// centralInventory.setStoredItem(slot, stack, 0);
// getDrawer(slot).setStoredItem(stack, 0);
if (worldObj != null && worldObj.isRemote)
getWorldObj().func_147479_m(xCoord, yCoord, zCoord); // markBlockForRenderUpdate
if (worldObj != null && worldObj.isRemote) getWorldObj().func_147479_m(xCoord, yCoord, zCoord); // markBlockForRenderUpdate
}
private ItemStack findHigherTier(ItemStack stack) {
@@ -215,11 +215,10 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
CompTierRegistry.Record record = StorageDrawers.compRegistry.findHigherTier(stack);
if (record != null) {
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found " + record.upper.toString() + " in registry with conv=" + record.convRate);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found " + record.upper.toString() + " in registry with conv=" + record.convRate);
lookupSizeResult = record.convRate;
return record.upper;
@@ -251,12 +250,16 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
if (!DrawerData.areItemsEqual(comp, stack, false)) continue;
candidates.add(match);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found ascending candidate for " + stack.toString() + ": " + match.toString() + " size="
+ lookupSizeResult + ", inverse=" + comp.toString());
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found ascending candidate for " + stack.toString()
+ ": "
+ match.toString()
+ " size="
+ lookupSizeResult
+ ", inverse="
+ comp.toString());
break;
}
@@ -299,11 +302,10 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
CompTierRegistry.Record record = StorageDrawers.compRegistry.findLowerTier(stack);
if (record != null) {
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found " + record.lower.toString() + " in registry with conv=" + record.convRate);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found " + record.lower.toString() + " in registry with conv=" + record.convRate);
lookupSizeResult = record.convRate;
return record.lower;
@@ -348,18 +350,21 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
candidates.add(match);
candidatesRate.put(match, lookupSizeResult);
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Found descending candidate for " + stack.toString() + ": " + match.toString()
+ " size=" + lookupSizeResult + ", inverse=" + comp.toString());
} else if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace)
FMLLog.log(
if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Back-check failed for " + match.toString() + " size=" + lookupSizeResult + ", inverse="
"Found descending candidate for " + stack.toString()
+ ": "
+ match.toString()
+ " size="
+ lookupSizeResult
+ ", inverse="
+ comp.toString());
} else if (!worldObj.isRemote && StorageDrawers.config.cache.debugTrace) FMLLog.log(
StorageDrawers.MOD_ID,
Level.INFO,
"Back-check failed for " + match
.toString() + " size=" + lookupSizeResult + ", inverse=" + comp.toString());
}
}
}
@@ -481,6 +486,7 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
}
private class CompCentralInventory implements ICentralInventory {
@Override
public ItemStack getStoredItemPrototype(int slot) {
return protoStack[slot];
@@ -564,8 +570,7 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
return Integer.MAX_VALUE / convRate[slot];
}
return protoStack[0].getItem().getItemStackLimit(protoStack[0])
* getStackCapacity(0)
return protoStack[0].getItem().getItemStackLimit(protoStack[0]) * getStackCapacity(0)
* getConversionRate(slot);
}
@@ -708,8 +713,12 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
if (getWorldObj().isRemote) return;
IMessage message = new CountUpdateMessage(xCoord, yCoord, zCoord, 0, pooledCount);
NetworkRegistry.TargetPoint targetPoint =
new NetworkRegistry.TargetPoint(getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 500);
NetworkRegistry.TargetPoint targetPoint = new NetworkRegistry.TargetPoint(
getWorldObj().provider.dimensionId,
xCoord,
yCoord,
zCoord,
500);
StorageDrawers.network.sendToAllAround(message, targetPoint);
}
@@ -722,6 +731,7 @@ public class TileEntityDrawersComp extends TileEntityDrawers {
}
private static class InventoryLookup extends InventoryCrafting {
private ItemStack[] stackList;
public InventoryLookup(int width, int height) {
@@ -30,6 +30,7 @@ public class TileEntityDrawersStandard extends TileEntityDrawers {
}
private class StandardStorageProvider extends DefaultStorageProvider {
public StandardStorageProvider() {
super(TileEntityDrawersStandard.this, TileEntityDrawersStandard.this);
}
@@ -1,7 +1,5 @@
package com.jaquadro.minecraft.storagedrawers.block.tile;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@@ -15,7 +13,11 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.Constants;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
public class TileEntityFramingTable extends TileEntity implements IInventory {
private ItemStack[] tableItemStacks = new ItemStack[5];
private String customName;
@@ -1,11 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.block.tile;
import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import com.jaquadro.minecraft.storagedrawers.api.storage.IPriorityGroup;
import com.jaquadro.minecraft.storagedrawers.api.storage.ISmartGroup;
import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@@ -16,12 +12,19 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.Constants;
import com.jaquadro.minecraft.storagedrawers.api.inventory.IDrawerInventory;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import com.jaquadro.minecraft.storagedrawers.api.storage.IPriorityGroup;
import com.jaquadro.minecraft.storagedrawers.api.storage.ISmartGroup;
public class TileEntitySlave extends TileEntity implements IDrawerGroup, IPriorityGroup, ISmartGroup, ISidedInventory {
private BlockCoord controllerCoord;
private BlockCoord selfCoord;
private int[] inventorySlots = new int[] {0};
private int[] drawerSlots = new int[] {0};
private int[] inventorySlots = new int[] { 0 };
private int[] drawerSlots = new int[] { 0 };
public void ensureInitialized() {
if (selfCoord == null) {
@@ -8,6 +8,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileEntityTrim extends TileEntity {
private ItemStack materialSide;
private ItemStack materialTrim;
@@ -1,11 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.client.gui;
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.*;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.I18n;
@@ -13,17 +9,29 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
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.*;
public class GuiDrawers extends GuiContainer {
private static final ResourceLocation guiTextures1 =
new ResourceLocation("storagedrawers", "textures/gui/drawers_1.png");
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 ResourceLocation guiTextures1 = new ResourceLocation(
"storagedrawers",
"textures/gui/drawers_1.png");
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;
@@ -79,8 +87,7 @@ public class GuiDrawers extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String name = tileDrawers.hasCustomInventoryName()
? tileDrawers.getInventoryName()
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);
@@ -105,20 +112,24 @@ public class GuiDrawers extends GuiContainer {
for (int i = 0, n = storageSlots.size(); i < n; i++) {
Slot slot = storageSlots.get(i);
drawTexturedModalRect(
guiX + slot.xDisplayPosition, guiY + slot.yDisplayPosition, smDisabledX, smDisabledY, 16, 16);
guiX + slot.xDisplayPosition,
guiY + slot.yDisplayPosition,
smDisabledX,
smDisabledY,
16,
16);
}
List<Slot> upgradeSlots = container.getUpgradeSlots();
for (int i = 0, n = upgradeSlots.size(); i < n; i++) {
Slot slot = upgradeSlots.get(i);
if (slot instanceof SlotUpgrade && !((SlotUpgrade) slot).canTakeStack())
drawTexturedModalRect(
guiX + slot.xDisplayPosition,
guiY + slot.yDisplayPosition,
smDisabledX,
smDisabledY,
16,
16);
if (slot instanceof SlotUpgrade && !((SlotUpgrade) slot).canTakeStack()) drawTexturedModalRect(
guiX + slot.xDisplayPosition,
guiY + slot.yDisplayPosition,
smDisabledX,
smDisabledY,
16,
16);
}
}
}
@@ -137,10 +148,10 @@ public class GuiDrawers extends GuiContainer {
List<Slot> upgradeSlots = container.getUpgradeSlots();
for (int i = 0, n = upgradeSlots.size(); i < n; i++) {
Slot slot = upgradeSlots.get(i);
if (slot instanceof SlotUpgrade
&& !((SlotUpgrade) slot).canTakeStack()
if (slot instanceof SlotUpgrade && !((SlotUpgrade) slot).canTakeStack()
&& slot.xDisplayPosition == x
&& slot.yDisplayPosition == y) return false;
&& slot.yDisplayPosition == y)
return false;
}
}
@@ -158,12 +169,8 @@ public class GuiDrawers extends GuiContainer {
}
}
/*@Override
public void func_146977_a (Slot slot) {
RenderItem ri = setItemRender(storageItemRender);
super.func_146977_a(slot);
setItemRender(ri);
}*/
/*
* @Override public void func_146977_a (Slot slot) { RenderItem ri = setItemRender(storageItemRender);
* super.func_146977_a(slot); setItemRender(ri); }
*/
}
@@ -1,20 +1,25 @@
package com.jaquadro.minecraft.storagedrawers.client.gui;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerFramingTable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.inventory.ContainerFramingTable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiFraming extends GuiContainer {
private static final ResourceLocation guiTextires =
new ResourceLocation(StorageDrawers.MOD_ID.toLowerCase(), "textures/gui/framing.png");
private static final ResourceLocation guiTextires = new ResourceLocation(
StorageDrawers.MOD_ID.toLowerCase(),
"textures/gui/framing.png");
private TileEntityFramingTable tileFramingTable;
public GuiFraming(InventoryPlayer inventory, TileEntityFramingTable tileEntity) {
@@ -27,8 +32,7 @@ public class GuiFraming extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String name = tileFramingTable.hasCustomInventoryName()
? tileFramingTable.getInventoryName()
String name = tileFramingTable.hasCustomInventoryName() ? tileFramingTable.getInventoryName()
: I18n.format(tileFramingTable.getInventoryName());
fontRendererObj.drawString(name, 8, 6, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
@@ -1,18 +1,21 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockController;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
public class ControllerRenderer implements ISimpleBlockRenderingHandler {
private static final double unit = .0625f;
private ModularBoxRenderer boxRenderer = new ModularBoxRenderer();
@@ -33,8 +36,8 @@ public class ControllerRenderer implements ISimpleBlockRenderingHandler {
GL11.glRotatef(90, 0, 1, 0);
GL11.glTranslatef(-.5f, -.5f, -.5f);
RenderHelper.instance.state.setUVRotation(
RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
RenderHelper.instance.state
.setUVRotation(RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
renderExterior(block, 0, 0, 0, side, renderer);
@@ -49,22 +52,22 @@ public class ControllerRenderer implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
if (!(block instanceof BlockController)) return false;
return renderWorldBlock(world, x, y, z, (BlockController) block, modelId, renderer);
}
private boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, BlockController block, int modelId, RenderBlocks renderer) {
private boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, BlockController block, int modelId,
RenderBlocks renderer) {
TileEntityController tile = block.getTileEntity(world, x, y, z);
if (tile == null) return false;
int side = tile.getDirection();
RenderHelper.instance.state.setUVRotation(
RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
RenderHelper.instance.state
.setUVRotation(RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
boxRenderer.setUnit(unit);
boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE);
@@ -1,28 +1,24 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonDrawerRenderer;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class DrawersCustomRenderer extends DrawersRenderer {
private CommonDrawerRenderer commonRender = new CommonDrawerRenderer();
@Override
protected void renderBaseBlock(
IBlockAccess world,
TileEntityDrawers tile,
int x,
int y,
int z,
BlockDrawers block,
protected void renderBaseBlock(IBlockAccess world, TileEntityDrawers tile, int x, int y, int z, BlockDrawers block,
RenderBlocks renderer) {
BlockDrawersCustom custom = (BlockDrawersCustom) block;
@@ -1,10 +1,5 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonDrawerRenderer;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
@@ -12,9 +7,17 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonDrawerRenderer;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;
public class DrawersItemRenderer implements IItemRenderer {
// private RenderHelper renderHelper = new RenderHelper();
private CommonDrawerRenderer commonRender = new CommonDrawerRenderer();
private ModularBoxRenderer boxRenderer = new ModularBoxRenderer();
@@ -67,8 +70,8 @@ public class DrawersItemRenderer implements IItemRenderer {
private void renderBaseBlock(BlockDrawers block, ItemStack item, RenderBlocks renderer) {
int side = 4;
RenderHelper.instance.state.setUVRotation(
RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZPOS][side]);
RenderHelper.instance.state
.setUVRotation(RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZPOS][side]);
boxRenderer.setUnit(block.getTrimWidth());
boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE);
@@ -1,5 +1,11 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.LockAttribute;
@@ -8,13 +14,9 @@ import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
public class DrawersRenderer implements ISimpleBlockRenderingHandler {
private static final double unit = .0625f;
private ModularBoxRenderer boxRenderer = new ModularBoxRenderer();
@@ -24,36 +26,36 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
if (!(block instanceof BlockDrawers)) return false;
return renderWorldBlock(world, x, y, z, (BlockDrawers) block, modelId, renderer);
}
private boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, BlockDrawers block, int modelId, RenderBlocks renderer) {
private boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, BlockDrawers block, int modelId,
RenderBlocks renderer) {
TileEntityDrawers tile = block.getTileEntity(world, x, y, z);
if (tile == null) return false;
renderBaseBlock(world, tile, x, y, z, block, renderer);
if (renderer.overrideBlockTexture != null
&& renderer.overrideBlockTexture.getIconName().startsWith("destroy_stage")) return true;
&& renderer.overrideBlockTexture.getIconName().startsWith("destroy_stage"))
return true;
int side = tile.getDirection();
if (StorageDrawers.config.cache.enableIndicatorUpgrades)
renderIndicator(block, x, y, z, side, renderer, tile.getEffectiveStatusLevel());
if (StorageDrawers.config.cache.enableLockUpgrades)
renderLock(
block,
x,
y,
z,
side,
renderer,
tile.isLocked(LockAttribute.LOCK_POPULATED),
tile.getOwner() != null);
if (StorageDrawers.config.cache.enableLockUpgrades) renderLock(
block,
x,
y,
z,
side,
renderer,
tile.isLocked(LockAttribute.LOCK_POPULATED),
tile.getOwner() != null);
if (StorageDrawers.config.cache.enableVoidUpgrades) renderVoid(block, x, y, z, side, renderer, tile.isVoid());
if (StorageDrawers.config.cache.enableTape) renderTape(block, x, y, z, side, renderer, tile.isSealed());
@@ -62,19 +64,13 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
return true;
}
protected void renderBaseBlock(
IBlockAccess world,
TileEntityDrawers tile,
int x,
int y,
int z,
BlockDrawers block,
protected void renderBaseBlock(IBlockAccess world, TileEntityDrawers tile, int x, int y, int z, BlockDrawers block,
RenderBlocks renderer) {
int side = tile.getDirection();
int meta = world.getBlockMetadata(x, y, z);
RenderHelper.instance.state.setUVRotation(
RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
RenderHelper.instance.state
.setUVRotation(RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][side]);
boxRenderer.setUnit(block.getTrimWidth());
boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE);
@@ -104,8 +100,8 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
renderInterior(block, x, y, z, side, renderer);
}
private void renderLock(
BlockDrawers block, int x, int y, int z, int side, RenderBlocks renderer, boolean locked, boolean owned) {
private void renderLock(BlockDrawers block, int x, int y, int z, int side, RenderBlocks renderer, boolean locked,
boolean owned) {
if (!locked && !owned) return;
double depth = block.halfDepth ? .5 : 1;
@@ -113,8 +109,8 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
RenderHelper.instance.setRenderBounds(0.46875, 0.9375, 0, 0.53125, 1, depth + .005);
RenderHelper.instance.state.setRotateTransform(RenderHelper.ZPOS, side);
RenderHelper.instance.renderPartialFace(
RenderHelper.ZPOS, renderer.blockAccess, block, x, y, z, iconLock, 0, 0, 1, 1);
RenderHelper.instance
.renderPartialFace(RenderHelper.ZPOS, renderer.blockAccess, block, x, y, z, iconLock, 0, 0, 1, 1);
RenderHelper.instance.state.clearRotateTransform();
}
@@ -126,8 +122,8 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
RenderHelper.instance.setRenderBounds(1 - .0625, 0.9375, 0, 1, 1, depth + .005);
RenderHelper.instance.state.setRotateTransform(RenderHelper.ZPOS, side);
RenderHelper.instance.renderPartialFace(
RenderHelper.ZPOS, renderer.blockAccess, block, x, y, z, iconVoid, 0, 0, 1, 1);
RenderHelper.instance
.renderPartialFace(RenderHelper.ZPOS, renderer.blockAccess, block, x, y, z, iconVoid, 0, 0, 1, 1);
RenderHelper.instance.state.clearRotateTransform();
}
@@ -144,46 +140,34 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
}
private static final int[] cut = new int[] {
ModularBoxRenderer.CUT_YPOS
| ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_ZPOS,
ModularBoxRenderer.CUT_YPOS
| ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_ZNEG,
ModularBoxRenderer.CUT_YPOS
| ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_ZNEG
| ModularBoxRenderer.CUT_ZPOS,
ModularBoxRenderer.CUT_YPOS
| ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_ZNEG
| ModularBoxRenderer.CUT_ZPOS,
};
ModularBoxRenderer.CUT_YPOS | ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_ZPOS,
ModularBoxRenderer.CUT_YPOS | ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_ZNEG,
ModularBoxRenderer.CUT_YPOS | ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_ZNEG
| ModularBoxRenderer.CUT_ZPOS,
ModularBoxRenderer.CUT_YPOS | ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_ZNEG
| ModularBoxRenderer.CUT_ZPOS, };
private static final float[][] drawerXYWH1 = new float[][] {
{0, 0, 16, 16},
};
private static final float[][] drawerXYWH1 = new float[][] { { 0, 0, 16, 16 }, };
private static final float[][] drawerXYWH2 = new float[][] {
{0, 8, 16, 8}, {0, 0, 16, 8},
};
private static final float[][] drawerXYWH2 = new float[][] { { 0, 8, 16, 8 }, { 0, 0, 16, 8 }, };
private static final float[][] drawerXYWH4 = new float[][] {
{0, 8, 8, 8}, {0, 0, 8, 8}, {8, 8, 8, 8}, {8, 0, 8, 8},
};
private static final float[][] drawerXYWH4 = new float[][] { { 0, 8, 8, 8 }, { 0, 0, 8, 8 }, { 8, 8, 8, 8 },
{ 8, 0, 8, 8 }, };
private static final float[][] drawerXYWH3 = new float[][] {
{0, 8, 16, 8}, {0, 0, 8, 8}, {8, 0, 8, 8},
};
private static final float[][] drawerXYWH3 = new float[][] { { 0, 8, 16, 8 }, { 0, 0, 8, 8 }, { 8, 0, 8, 8 }, };
private void renderShroud(
BlockDrawers block, int x, int y, int z, int side, RenderBlocks renderer, boolean shrouded) {
private void renderShroud(BlockDrawers block, int x, int y, int z, int side, RenderBlocks renderer,
boolean shrouded) {
if (!shrouded || side < 2 || side > 5) return;
TileEntityDrawers tile = block.getTileEntity(renderer.blockAccess, x, y, z);
@@ -223,7 +207,12 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
float subY = xywh[1] + (xywh[3] - h) / 2;
RenderHelper.instance.setRenderBounds(
subX * unit, subY * unit, 0, (subX + w) * unit, (subY + h) * unit, (depth - depthAdj + .05) * unit);
subX * unit,
subY * unit,
0,
(subX + w) * unit,
(subY + h) * unit,
(depth - depthAdj + .05) * unit);
RenderHelper.instance.state.setRotateTransform(RenderHelper.ZPOS, side);
RenderHelper.instance.renderFace(RenderHelper.ZPOS, renderer.blockAccess, block, x, y, z, icon);
RenderHelper.instance.state.clearRotateTransform();
@@ -289,8 +278,7 @@ public class DrawersRenderer implements ISimpleBlockRenderingHandler {
} else if (level >= 2) {
double indXStart = xywh[0] + block.getIndStart() / unit;
double indXEnd = xywh[0] + block.getIndEnd() / unit;
double indXCur = (block.getIndSteps() == 0)
? indXEnd
double indXCur = (block.getIndSteps() == 0) ? indXEnd
: getIndEnd(block, tile, i, indXStart, (block.getIndEnd() - block.getIndStart()) / unit);
double indYStart = xywh[1];
@@ -1,17 +1,20 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockFramingTable;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonFramingRenderer;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
public class FramingTableRenderer implements ISimpleBlockRenderingHandler {
private CommonFramingRenderer framingRenderer = new CommonFramingRenderer();
@Override
@@ -45,8 +48,8 @@ public class FramingTableRenderer implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
if (!(block instanceof BlockFramingTable)) return false;
BlockFramingTable framingTable = (BlockFramingTable) block;
@@ -2,9 +2,11 @@ package com.jaquadro.minecraft.storagedrawers.client.renderer;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
public final class GLUtil {
private GLUtil() {}
public static List<int[]> makeGLState() {
@@ -14,7 +16,7 @@ public final class GLUtil {
public static List<int[]> makeGLState(int[] saveList) {
List<int[]> state = new ArrayList<int[]>(saveList.length);
for (int i = 0, n = saveList.length; i < n; i++) state.add(new int[] {0, 0});
for (int i = 0, n = saveList.length; i < n; i++) state.add(new int[] { 0, 0 });
return state;
}
@@ -1,11 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import net.minecraft.block.Block;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
public class ModularBoxRenderer {
public static final int CONNECT_YNEG = 1 << 0;
public static final int CONNECT_YPOS = 1 << 1;
public static final int CONNECT_ZNEG = 1 << 2;
@@ -63,14 +65,18 @@ public class ModularBoxRenderer {
private static final int TEST_YPOS_ZPOS_XNEG = CUT_YPOS | CUT_ZPOS | CUT_XNEG;
private static final int TEST_YPOS_ZPOS_XPOS = CUT_YPOS | CUT_ZPOS | CUT_XPOS;
private static final int PLANE_YNEG =
CONNECT_YNEG | CONNECT_YNEG_ZNEG | CONNECT_YNEG_ZPOS | CONNECT_YNEG_XNEG | CONNECT_YNEG_XPOS;
private static final int PLANE_YPOS =
CONNECT_YPOS | CONNECT_YPOS_ZNEG | CONNECT_YPOS_ZPOS | CONNECT_YPOS_XNEG | CONNECT_YPOS_XPOS;
private static final int PLANE_YNEG = CONNECT_YNEG | CONNECT_YNEG_ZNEG
| CONNECT_YNEG_ZPOS
| CONNECT_YNEG_XNEG
| CONNECT_YNEG_XPOS;
private static final int PLANE_YPOS = CONNECT_YPOS | CONNECT_YPOS_ZNEG
| CONNECT_YPOS_ZPOS
| CONNECT_YPOS_XNEG
| CONNECT_YPOS_XPOS;
public static final float[] COLOR_WHITE = new float[] {1, 1, 1};
public static final float[] COLOR_WHITE = new float[] { 1, 1, 1 };
public static final int[] sideCut = new int[] {CUT_YNEG, CUT_YPOS, CUT_ZNEG, CUT_ZPOS, CUT_XNEG, CUT_XPOS};
public static final int[] sideCut = new int[] { CUT_YNEG, CUT_YPOS, CUT_ZNEG, CUT_ZPOS, CUT_XNEG, CUT_XPOS };
private double unit = 0.0625;
@@ -190,8 +196,8 @@ public class ModularBoxRenderer {
this.unit = unit;
}
public void renderOctant(
IBlockAccess blockAccess, Block block, double x, double y, double z, int connectedFlags, int cutFlags) {
public void renderOctant(IBlockAccess blockAccess, Block block, double x, double y, double z, int connectedFlags,
int cutFlags) {
double xBase = Math.floor(x);
double yBase = Math.floor(y);
double zBase = Math.floor(z);
@@ -203,58 +209,48 @@ public class ModularBoxRenderer {
double zPos = zNeg + .5;
renderExterior(
blockAccess, block, xBase, yBase, zBase, xNeg, yNeg, zNeg, xPos, yPos, zPos, connectedFlags, cutFlags);
blockAccess,
block,
xBase,
yBase,
zBase,
xNeg,
yNeg,
zNeg,
xPos,
yPos,
zPos,
connectedFlags,
cutFlags);
renderInterior(
blockAccess, block, xBase, yBase, zBase, xNeg, yNeg, zNeg, xPos, yPos, zPos, connectedFlags, cutFlags);
blockAccess,
block,
xBase,
yBase,
zBase,
xNeg,
yNeg,
zNeg,
xPos,
yPos,
zPos,
connectedFlags,
cutFlags);
}
public void renderBox(
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos,
int connectedFlags,
int cutFlags) {
public void renderBox(IBlockAccess blockAccess, Block block, double x, double y, double z, double xNeg, double yNeg,
double zNeg, double xPos, double yPos, double zPos, int connectedFlags, int cutFlags) {
renderExterior(blockAccess, block, x, y, z, xNeg, yNeg, zNeg, xPos, yPos, zPos, connectedFlags, cutFlags);
renderInterior(blockAccess, block, x, y, z, xNeg, yNeg, zNeg, xPos, yPos, zPos, connectedFlags, cutFlags);
}
public void renderSolidBox(
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos) {
public void renderSolidBox(IBlockAccess blockAccess, Block block, double x, double y, double z, double xNeg,
double yNeg, double zNeg, double xPos, double yPos, double zPos) {
renderExterior(blockAccess, block, x, y, z, xNeg, yNeg, zNeg, xPos, yPos, zPos, 0, 0);
}
public void renderExterior(
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos,
int connectedFlags,
int cutFlags) {
public void renderExterior(IBlockAccess blockAccess, Block block, double x, double y, double z, double xNeg,
double yNeg, double zNeg, double xPos, double yPos, double zPos, int connectedFlags, int cutFlags) {
RenderHelper renderHelper = RenderHelper.instance;
if ((cutFlags & CUT_YNEG) != 0) connectedFlags |= CONNECT_YNEG;
@@ -461,20 +457,8 @@ public class ModularBoxRenderer {
}
}
public void renderInterior(
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos,
int connectedFlags,
int cutFlags) {
public void renderInterior(IBlockAccess blockAccess, Block block, double x, double y, double z, double xNeg,
double yNeg, double zNeg, double xPos, double yPos, double zPos, int connectedFlags, int cutFlags) {
RenderHelper renderHelper = RenderHelper.instance;
if ((cutFlags & CUT_YNEG) != 0) connectedFlags |= PLANE_YNEG;
@@ -590,15 +574,12 @@ public class ModularBoxRenderer {
// Render corner faces
if ((connectedFlags & TEST_YNEG_ZNEG_XNEG) != 0
&& (connectedFlags
| CONNECT_YNEG
| CONNECT_ZNEG
| CONNECT_XNEG
| CONNECT_YNEG_ZNEG
| CONNECT_YNEG_XNEG
| CONNECT_ZNEG_XNEG)
!= connectedFlags) {
if ((connectedFlags & TEST_YNEG_ZNEG_XNEG) != 0 && (connectedFlags | CONNECT_YNEG
| CONNECT_ZNEG
| CONNECT_XNEG
| CONNECT_YNEG_ZNEG
| CONNECT_YNEG_XNEG
| CONNECT_ZNEG_XNEG) != connectedFlags) {
renderHelper.setRenderBounds(xNeg, yNeg, zNeg, xNeg + unit, yNeg + unit, zNeg + unit);
if ((connectedFlags | CONNECT_YNEG | CONNECT_ZNEG) == connectedFlags)
renderInteriorFace(FACE_XPOS, blockAccess, block, x, y, z);
@@ -607,15 +588,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZNEG | CONNECT_XNEG) == connectedFlags)
renderInteriorFace(FACE_YPOS, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YNEG_ZNEG_XPOS) != 0
&& (connectedFlags
| CONNECT_YNEG
| CONNECT_ZNEG
| CONNECT_XPOS
| CONNECT_YNEG_ZNEG
| CONNECT_YNEG_XPOS
| CONNECT_ZNEG_XPOS)
!= connectedFlags) {
if ((connectedFlags & TEST_YNEG_ZNEG_XPOS) != 0 && (connectedFlags | CONNECT_YNEG
| CONNECT_ZNEG
| CONNECT_XPOS
| CONNECT_YNEG_ZNEG
| CONNECT_YNEG_XPOS
| CONNECT_ZNEG_XPOS) != connectedFlags) {
renderHelper.setRenderBounds(xPos - unit, yNeg, zNeg, xPos, yNeg + unit, zNeg + unit);
if ((connectedFlags | CONNECT_YNEG | CONNECT_ZNEG) == connectedFlags)
renderInteriorFace(FACE_XNEG, blockAccess, block, x, y, z);
@@ -624,15 +602,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZNEG | CONNECT_XPOS) == connectedFlags)
renderInteriorFace(FACE_YPOS, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YNEG_ZPOS_XNEG) != 0
&& (connectedFlags
| CONNECT_YNEG
| CONNECT_ZPOS
| CONNECT_XNEG
| CONNECT_YNEG_ZPOS
| CONNECT_YNEG_XNEG
| CONNECT_ZPOS_XNEG)
!= connectedFlags) {
if ((connectedFlags & TEST_YNEG_ZPOS_XNEG) != 0 && (connectedFlags | CONNECT_YNEG
| CONNECT_ZPOS
| CONNECT_XNEG
| CONNECT_YNEG_ZPOS
| CONNECT_YNEG_XNEG
| CONNECT_ZPOS_XNEG) != connectedFlags) {
renderHelper.setRenderBounds(xNeg, yNeg, zPos - unit, xNeg + unit, yNeg + unit, zPos);
if ((connectedFlags | CONNECT_YNEG | CONNECT_ZPOS) == connectedFlags)
renderInteriorFace(FACE_XPOS, blockAccess, block, x, y, z);
@@ -641,15 +616,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZPOS | CONNECT_XNEG) == connectedFlags)
renderInteriorFace(FACE_YPOS, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YNEG_ZPOS_XPOS) != 0
&& (connectedFlags
| CONNECT_YNEG
| CONNECT_ZPOS
| CONNECT_XPOS
| CONNECT_YNEG_ZPOS
| CONNECT_YNEG_XPOS
| CONNECT_ZPOS_XPOS)
!= connectedFlags) {
if ((connectedFlags & TEST_YNEG_ZPOS_XPOS) != 0 && (connectedFlags | CONNECT_YNEG
| CONNECT_ZPOS
| CONNECT_XPOS
| CONNECT_YNEG_ZPOS
| CONNECT_YNEG_XPOS
| CONNECT_ZPOS_XPOS) != connectedFlags) {
renderHelper.setRenderBounds(xPos - unit, yNeg, zPos - unit, xPos, yNeg + unit, zPos);
if ((connectedFlags | CONNECT_YNEG | CONNECT_ZPOS) == connectedFlags)
renderInteriorFace(FACE_XNEG, blockAccess, block, x, y, z);
@@ -658,15 +630,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZPOS | CONNECT_XPOS) == connectedFlags)
renderInteriorFace(FACE_YPOS, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YPOS_ZNEG_XNEG) != 0
&& (connectedFlags
| CONNECT_YPOS
| CONNECT_ZNEG
| CONNECT_XNEG
| CONNECT_YPOS_ZNEG
| CONNECT_YPOS_XNEG
| CONNECT_ZNEG_XNEG)
!= connectedFlags) {
if ((connectedFlags & TEST_YPOS_ZNEG_XNEG) != 0 && (connectedFlags | CONNECT_YPOS
| CONNECT_ZNEG
| CONNECT_XNEG
| CONNECT_YPOS_ZNEG
| CONNECT_YPOS_XNEG
| CONNECT_ZNEG_XNEG) != connectedFlags) {
renderHelper.setRenderBounds(xNeg, yPos - unit, zNeg, xNeg + unit, yPos, zNeg + unit);
if ((connectedFlags | CONNECT_YPOS | CONNECT_ZNEG) == connectedFlags)
renderInteriorFace(FACE_XPOS, blockAccess, block, x, y, z);
@@ -675,15 +644,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZNEG | CONNECT_XNEG) == connectedFlags)
renderInteriorFace(FACE_YNEG, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YPOS_ZNEG_XPOS) != 0
&& (connectedFlags
| CONNECT_YPOS
| CONNECT_ZNEG
| CONNECT_XPOS
| CONNECT_YPOS_ZNEG
| CONNECT_YPOS_XPOS
| CONNECT_ZNEG_XPOS)
!= connectedFlags) {
if ((connectedFlags & TEST_YPOS_ZNEG_XPOS) != 0 && (connectedFlags | CONNECT_YPOS
| CONNECT_ZNEG
| CONNECT_XPOS
| CONNECT_YPOS_ZNEG
| CONNECT_YPOS_XPOS
| CONNECT_ZNEG_XPOS) != connectedFlags) {
renderHelper.setRenderBounds(xPos - unit, yPos - unit, zNeg, xPos, yPos, zNeg + unit);
if ((connectedFlags | CONNECT_YPOS | CONNECT_ZNEG) == connectedFlags)
renderInteriorFace(FACE_XNEG, blockAccess, block, x, y, z);
@@ -692,15 +658,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZNEG | CONNECT_XPOS) == connectedFlags)
renderInteriorFace(FACE_YNEG, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YPOS_ZPOS_XNEG) != 0
&& (connectedFlags
| CONNECT_YPOS
| CONNECT_ZPOS
| CONNECT_XNEG
| CONNECT_YPOS_ZPOS
| CONNECT_YPOS_XNEG
| CONNECT_ZPOS_XNEG)
!= connectedFlags) {
if ((connectedFlags & TEST_YPOS_ZPOS_XNEG) != 0 && (connectedFlags | CONNECT_YPOS
| CONNECT_ZPOS
| CONNECT_XNEG
| CONNECT_YPOS_ZPOS
| CONNECT_YPOS_XNEG
| CONNECT_ZPOS_XNEG) != connectedFlags) {
renderHelper.setRenderBounds(xNeg, yPos - unit, zPos - unit, xNeg + unit, yPos, zPos);
if ((connectedFlags | CONNECT_YPOS | CONNECT_ZPOS) == connectedFlags)
renderInteriorFace(FACE_XPOS, blockAccess, block, x, y, z);
@@ -709,15 +672,12 @@ public class ModularBoxRenderer {
if ((connectedFlags | CONNECT_ZPOS | CONNECT_XNEG) == connectedFlags)
renderInteriorFace(FACE_YNEG, blockAccess, block, x, y, z);
}
if ((connectedFlags & TEST_YPOS_ZPOS_XPOS) != 0
&& (connectedFlags
| CONNECT_YPOS
| CONNECT_ZPOS
| CONNECT_XPOS
| CONNECT_YPOS_ZPOS
| CONNECT_YPOS_XPOS
| CONNECT_ZPOS_XPOS)
!= connectedFlags) {
if ((connectedFlags & TEST_YPOS_ZPOS_XPOS) != 0 && (connectedFlags | CONNECT_YPOS
| CONNECT_ZPOS
| CONNECT_XPOS
| CONNECT_YPOS_ZPOS
| CONNECT_YPOS_XPOS
| CONNECT_ZPOS_XPOS) != connectedFlags) {
renderHelper.setRenderBounds(xPos - unit, yPos - unit, zPos - unit, xPos, yPos, zPos);
if ((connectedFlags | CONNECT_YPOS | CONNECT_ZPOS) == connectedFlags)
renderInteriorFace(FACE_XNEG, blockAccess, block, x, y, z);
@@ -728,17 +688,8 @@ public class ModularBoxRenderer {
}
}
private void renderFace(
int face,
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
IIcon icon,
float r,
float g,
float b) {
private void renderFace(int face, IBlockAccess blockAccess, Block block, double x, double y, double z, IIcon icon,
float r, float g, float b) {
RenderHelper renderHelper = RenderHelper.instance;
switch (face) {
case FACE_YNEG:
@@ -1,11 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import net.minecraft.block.Block;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
public class PanelBoxRenderer {
public static final int FACE_YNEG = 0;
public static final int FACE_YPOS = 1;
public static final int FACE_ZNEG = 2;
@@ -13,8 +15,7 @@ public class PanelBoxRenderer {
public static final int FACE_XNEG = 4;
public static final int FACE_XPOS = 5;
private static final int TRIM_CUT = ModularBoxRenderer.CUT_XNEG
| ModularBoxRenderer.CUT_YNEG
private static final int TRIM_CUT = ModularBoxRenderer.CUT_XNEG | ModularBoxRenderer.CUT_YNEG
| ModularBoxRenderer.CUT_ZNEG
| ModularBoxRenderer.CUT_XPOS
| ModularBoxRenderer.CUT_YPOS
@@ -55,19 +56,8 @@ public class PanelBoxRenderer {
copyFrom(panelColor, color);
}
public void renderFacePanel(
int face,
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos) {
public void renderFacePanel(int face, IBlockAccess blockAccess, Block block, double x, double y, double z,
double xNeg, double yNeg, double zNeg, double xPos, double yPos, double zPos) {
RenderHelper renderer = RenderHelper.instance;
switch (face) {
@@ -139,127 +129,225 @@ public class PanelBoxRenderer {
}
}
public void renderInteriorTrim(
int face,
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos) {
public void renderInteriorTrim(int face, IBlockAccess blockAccess, Block block, double x, double y, double z,
double xNeg, double yNeg, double zNeg, double xPos, double yPos, double zPos) {
RenderHelper renderer = RenderHelper.instance;
switch (face) {
case FACE_YNEG:
renderer.setRenderBounds(
xNeg + trimWidth, yNeg, zPos - trimWidth, xPos - trimWidth, yNeg + trimDepth, zPos - trimWidth);
xNeg + trimWidth,
yNeg,
zPos - trimWidth,
xPos - trimWidth,
yNeg + trimDepth,
zPos - trimWidth);
renderCutFace(FACE_ZNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yNeg, zNeg + trimWidth, xPos - trimWidth, yNeg + trimDepth, zNeg + trimWidth);
xNeg + trimWidth,
yNeg,
zNeg + trimWidth,
xPos - trimWidth,
yNeg + trimDepth,
zNeg + trimWidth);
renderCutFace(FACE_ZPOS, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimWidth, yNeg, zNeg + trimWidth, xPos - trimWidth, yNeg + trimDepth, zPos - trimWidth);
xPos - trimWidth,
yNeg,
zNeg + trimWidth,
xPos - trimWidth,
yNeg + trimDepth,
zPos - trimWidth);
renderCutFace(FACE_XNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yNeg, zNeg + trimWidth, xNeg + trimWidth, yNeg + trimDepth, zPos - trimWidth);
xNeg + trimWidth,
yNeg,
zNeg + trimWidth,
xNeg + trimWidth,
yNeg + trimDepth,
zPos - trimWidth);
renderCutFace(FACE_XPOS, blockAccess, block, x, y, z);
break;
case FACE_YPOS:
renderer.setRenderBounds(
xNeg + trimWidth, yPos - trimDepth, zPos - trimWidth, xPos - trimWidth, yPos, zPos - trimWidth);
xNeg + trimWidth,
yPos - trimDepth,
zPos - trimWidth,
xPos - trimWidth,
yPos,
zPos - trimWidth);
renderCutFace(FACE_ZNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yPos - trimDepth, zNeg + trimWidth, xPos - trimWidth, yPos, zNeg + trimWidth);
xNeg + trimWidth,
yPos - trimDepth,
zNeg + trimWidth,
xPos - trimWidth,
yPos,
zNeg + trimWidth);
renderCutFace(FACE_ZPOS, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimWidth, yPos - trimDepth, zNeg + trimWidth, xPos - trimWidth, yPos, zPos - trimWidth);
xPos - trimWidth,
yPos - trimDepth,
zNeg + trimWidth,
xPos - trimWidth,
yPos,
zPos - trimWidth);
renderCutFace(FACE_XNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yPos - trimDepth, zNeg + trimWidth, xNeg + trimWidth, yPos, zPos - trimWidth);
xNeg + trimWidth,
yPos - trimDepth,
zNeg + trimWidth,
xNeg + trimWidth,
yPos,
zPos - trimWidth);
renderCutFace(FACE_XPOS, blockAccess, block, x, y, z);
break;
case FACE_ZNEG:
renderer.setRenderBounds(
xNeg + trimWidth, yPos - trimWidth, zNeg, xPos - trimWidth, yPos - trimWidth, zNeg + trimDepth);
xNeg + trimWidth,
yPos - trimWidth,
zNeg,
xPos - trimWidth,
yPos - trimWidth,
zNeg + trimDepth);
renderCutFace(FACE_YNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yNeg + trimWidth, zNeg, xPos - trimWidth, yNeg + trimWidth, zNeg + trimDepth);
xNeg + trimWidth,
yNeg + trimWidth,
zNeg,
xPos - trimWidth,
yNeg + trimWidth,
zNeg + trimDepth);
renderCutFace(FACE_YPOS, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimWidth, yNeg + trimWidth, zNeg, xPos - trimWidth, yPos - trimWidth, zNeg + trimDepth);
xPos - trimWidth,
yNeg + trimWidth,
zNeg,
xPos - trimWidth,
yPos - trimWidth,
zNeg + trimDepth);
renderCutFace(FACE_XNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yNeg + trimWidth, zNeg, xNeg + trimWidth, yPos - trimWidth, zNeg + trimDepth);
xNeg + trimWidth,
yNeg + trimWidth,
zNeg,
xNeg + trimWidth,
yPos - trimWidth,
zNeg + trimDepth);
renderCutFace(FACE_XPOS, blockAccess, block, x, y, z);
break;
case FACE_ZPOS:
renderer.setRenderBounds(
xNeg + trimWidth, yPos - trimWidth, zPos - trimDepth, xPos - trimWidth, yPos - trimWidth, zPos);
xNeg + trimWidth,
yPos - trimWidth,
zPos - trimDepth,
xPos - trimWidth,
yPos - trimWidth,
zPos);
renderCutFace(FACE_YNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yNeg + trimWidth, zPos - trimDepth, xPos - trimWidth, yNeg + trimWidth, zPos);
xNeg + trimWidth,
yNeg + trimWidth,
zPos - trimDepth,
xPos - trimWidth,
yNeg + trimWidth,
zPos);
renderCutFace(FACE_YPOS, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimWidth, yNeg + trimWidth, zPos - trimDepth, xPos - trimWidth, yPos - trimWidth, zPos);
xPos - trimWidth,
yNeg + trimWidth,
zPos - trimDepth,
xPos - trimWidth,
yPos - trimWidth,
zPos);
renderCutFace(FACE_XNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg + trimWidth, yNeg + trimWidth, zPos - trimDepth, xNeg + trimWidth, yPos - trimWidth, zPos);
xNeg + trimWidth,
yNeg + trimWidth,
zPos - trimDepth,
xNeg + trimWidth,
yPos - trimWidth,
zPos);
renderCutFace(FACE_XPOS, blockAccess, block, x, y, z);
break;
case FACE_XNEG:
renderer.setRenderBounds(
xNeg, yNeg + trimWidth, zPos - trimWidth, xNeg + trimDepth, yPos - trimWidth, zPos - trimWidth);
xNeg,
yNeg + trimWidth,
zPos - trimWidth,
xNeg + trimDepth,
yPos - trimWidth,
zPos - trimWidth);
renderCutFace(FACE_ZNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg, yNeg + trimWidth, zNeg + trimWidth, xNeg + trimDepth, yPos - trimWidth, zNeg + trimWidth);
xNeg,
yNeg + trimWidth,
zNeg + trimWidth,
xNeg + trimDepth,
yPos - trimWidth,
zNeg + trimWidth);
renderCutFace(FACE_ZPOS, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg, yPos - trimWidth, zNeg + trimWidth, xNeg + trimDepth, yPos - trimWidth, zPos - trimWidth);
xNeg,
yPos - trimWidth,
zNeg + trimWidth,
xNeg + trimDepth,
yPos - trimWidth,
zPos - trimWidth);
renderCutFace(FACE_YNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xNeg, yNeg + trimWidth, zNeg + trimWidth, xNeg + trimDepth, yNeg + trimWidth, zPos - trimWidth);
xNeg,
yNeg + trimWidth,
zNeg + trimWidth,
xNeg + trimDepth,
yNeg + trimWidth,
zPos - trimWidth);
renderCutFace(FACE_YPOS, blockAccess, block, x, y, z);
break;
case FACE_XPOS:
renderer.setRenderBounds(
xPos - trimDepth, yNeg + trimWidth, zPos - trimWidth, xPos, yPos - trimWidth, zPos - trimWidth);
xPos - trimDepth,
yNeg + trimWidth,
zPos - trimWidth,
xPos,
yPos - trimWidth,
zPos - trimWidth);
renderCutFace(FACE_ZNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimDepth, yNeg + trimWidth, zNeg + trimWidth, xPos, yPos - trimWidth, zNeg + trimWidth);
xPos - trimDepth,
yNeg + trimWidth,
zNeg + trimWidth,
xPos,
yPos - trimWidth,
zNeg + trimWidth);
renderCutFace(FACE_ZPOS, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimDepth, yPos - trimWidth, zNeg + trimWidth, xPos, yPos - trimWidth, zPos - trimWidth);
xPos - trimDepth,
yPos - trimWidth,
zNeg + trimWidth,
xPos,
yPos - trimWidth,
zPos - trimWidth);
renderCutFace(FACE_YNEG, blockAccess, block, x, y, z);
renderer.setRenderBounds(
xPos - trimDepth, yNeg + trimWidth, zNeg + trimWidth, xPos, yNeg + trimWidth, zPos - trimWidth);
xPos - trimDepth,
yNeg + trimWidth,
zNeg + trimWidth,
xPos,
yNeg + trimWidth,
zPos - trimWidth);
renderCutFace(FACE_YPOS, blockAccess, block, x, y, z);
break;
}
}
public void renderFaceTrim(
int face,
IBlockAccess blockAccess,
Block block,
double x,
double y,
double z,
double xNeg,
double yNeg,
double zNeg,
double xPos,
double yPos,
double zPos) {
public void renderFaceTrim(int face, IBlockAccess blockAccess, Block block, double x, double y, double z,
double xNeg, double yNeg, double zNeg, double xPos, double yPos, double zPos) {
double unit = trimWidth;
RenderHelper renderer = RenderHelper.instance;
File diff suppressed because it is too large. Load diff
@@ -5,14 +5,16 @@ 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) {
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;
@@ -1,15 +1,8 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
@@ -31,24 +24,32 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
private static final ResourceLocation RES_ITEM_GLINT =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private Vec3[] dirVectors = {
Vec3.createVectorHelper(0, -1, 0),
Vec3.createVectorHelper(0, 1, 0),
Vec3.createVectorHelper(0, 0, -1),
Vec3.createVectorHelper(0, 0, 1),
Vec3.createVectorHelper(-1, 0, 0),
Vec3.createVectorHelper(1, 0, 0)
};
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation(
"textures/misc/enchanted_item_glint.png");
private Vec3[] dirVectors = { Vec3.createVectorHelper(0, -1, 0), Vec3.createVectorHelper(0, 1, 0),
Vec3.createVectorHelper(0, 0, -1), Vec3.createVectorHelper(0, 0, 1), Vec3.createVectorHelper(-1, 0, 0),
Vec3.createVectorHelper(1, 0, 0) };
private RenderItem itemRenderer = new RenderItem() {
private RenderBlocks renderBlocksRi = new RenderBlocks();
@Override
@@ -67,19 +68,13 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
}
// The default Mojang code for item render does not handle glinted or multi-pass items gracefully in a non-UI
// setting. This modified implementation will render these items without unsightly Z-fighting.
// setting. This modified implementation will render these items without unsightly Z-fighting.
@Override
public void renderItemIntoGUI(
FontRenderer fontRenderer,
TextureManager texManager,
ItemStack itemStack,
int x,
int y,
boolean renderEffect) {
public void renderItemIntoGUI(FontRenderer fontRenderer, TextureManager texManager, ItemStack itemStack, int x,
int y, boolean renderEffect) {
if (itemStack.getItemSpriteNumber() == 0
&& RenderBlocks.renderItemIn3d(
Block.getBlockFromItem(itemStack.getItem()).getRenderType())) {
&& RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())) {
renderItemIntoGUIBlock(fontRenderer, texManager, itemStack, x, y, renderEffect);
return;
}
@@ -95,8 +90,7 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
texManager.bindTexture(loc);
IIcon icon = itemStack.getItem().requiresMultipleRenderPasses()
? item.getIcon(itemStack, i)
IIcon icon = itemStack.getItem().requiresMultipleRenderPasses() ? item.getIcon(itemStack, i)
: itemStack.getIconIndex();
if (icon == null) continue;
@@ -156,23 +150,22 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator
.addVertexWithUV(x + 0, y + h, 0, (u + (float) h * hScale) * uScale, (v + (float) h) * vScale);
tessellator.addVertexWithUV(
x + 0, y + h, 0, (u + (float) h * hScale) * uScale, (v + (float) h) * vScale);
tessellator.addVertexWithUV(
x + w, y + h, 0, (u + (float) w + (float) h * hScale) * uScale, (v + (float) h) * vScale);
x + w,
y + h,
0,
(u + (float) w + (float) h * hScale) * uScale,
(v + (float) h) * vScale);
tessellator.addVertexWithUV(x + w, y + 0, 0, (u + (float) w) * uScale, (v + 0.0F) * vScale);
tessellator.addVertexWithUV(x + 0, y + 0, 0, (u + 0.0F) * uScale, (v + 0.0F) * vScale);
tessellator.draw();
}
}
private void renderItemIntoGUIBlock(
FontRenderer fontRenderer,
TextureManager texManager,
ItemStack itemStack,
int x,
int y,
boolean renderEffect) {
private void renderItemIntoGUIBlock(FontRenderer fontRenderer, TextureManager texManager, ItemStack itemStack,
int x, int y, boolean renderEffect) {
texManager.bindTexture(TextureMap.locationBlocksTexture);
Block block = Block.getBlockFromItem(itemStack.getItem());
@@ -216,17 +209,17 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
}
};
private float itemOffset1X[] = new float[] {.5f};
private float itemOffset1Y[] = new float[] {8.25f};
private float itemOffset1X[] = new float[] { .5f };
private float itemOffset1Y[] = new float[] { 8.25f };
private float itemOffset2X[] = new float[] {.5f, .5f};
private float itemOffset2Y[] = new float[] {10.25f, 2.25f};
private float itemOffset2X[] = new float[] { .5f, .5f };
private float itemOffset2Y[] = new float[] { 10.25f, 2.25f };
private float itemOffset4X[] = new float[] {.25f, .25f, .75f, .75f};
private float itemOffset4Y[] = new float[] {10.25f, 2.25f, 10.25f, 2.25f};
private float itemOffset4X[] = new float[] { .25f, .25f, .75f, .75f };
private float itemOffset4Y[] = new float[] { 10.25f, 2.25f, 10.25f, 2.25f };
private float itemOffset3X[] = new float[] {.5f, .25f, .75f};
private float itemOffset3Y[] = new float[] {9.75f, 2.25f, 2.25f};
private float itemOffset3X[] = new float[] { .5f, .25f, .75f };
private float itemOffset3Y[] = new float[] { 9.75f, 2.25f, 2.25f };
private RenderBlocks renderBlocks = new RenderBlocks();
@@ -234,14 +227,14 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
private static final float unit = .0625f;
private static int[] glStateRender = {GL11.GL_LIGHTING, GL11.GL_BLEND};
private static int[] glStateRender = { GL11.GL_LIGHTING, GL11.GL_BLEND };
private List<int[]> savedGLStateRender = GLUtil.makeGLState(glStateRender);
private static int[] glStateItemRender = {GL11.GL_LIGHTING, GL11.GL_ALPHA_TEST, GL11.GL_BLEND};
private static int[] glStateItemRender = { GL11.GL_LIGHTING, GL11.GL_ALPHA_TEST, GL11.GL_BLEND };
private List<int[]> savedGLStateItemRender = GLUtil.makeGLState(glStateItemRender);
private static int[] glLightRender = {GL11.GL_LIGHT0, GL11.GL_LIGHT1, GL11.GL_COLOR_MATERIAL, GL12.GL_RESCALE_NORMAL
};
private static int[] glLightRender = { GL11.GL_LIGHT0, GL11.GL_LIGHT1, GL11.GL_COLOR_MATERIAL,
GL12.GL_RESCALE_NORMAL };
private List<int[]> savedGLLightRender = GLUtil.makeGLState(glLightRender);
private List<IRenderLabel> preLabelRenderHandlers = new ArrayList<IRenderLabel>();
@@ -272,16 +265,17 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
itemRenderer.setRenderManager(RenderManager.instance);
ForgeDirection side = ForgeDirection.getOrientation(tileDrawers.getDirection());
int ambLight = tile.getWorldObj()
.getLightBrightnessForSkyBlocks(
tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ, 0);
int ambLight = tile.getWorldObj().getLightBrightnessForSkyBlocks(
tile.xCoord + side.offsetX,
tile.yCoord + side.offsetY,
tile.zCoord + side.offsetZ,
0);
int lu = ambLight % 65536;
int lv = ambLight / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lu, lv);
brightness = tile.getWorldObj()
.getLightBrightness(
tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ)
.getLightBrightness(tile.xCoord + side.offsetX, tile.yCoord + side.offsetY, tile.zCoord + side.offsetZ)
* 1.25f;
if (brightness > 1) brightness = 1;
@@ -366,13 +360,8 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
}
}
private void renderFancyItem(
ItemStack itemStack,
TileEntityDrawers tile,
int slot,
ForgeDirection side,
float depth,
float partialTickTime) {
private void renderFancyItem(ItemStack itemStack, TileEntityDrawers tile, int slot, ForgeDirection side,
float depth, float partialTickTime) {
int drawerCount = tile.getDrawerCount();
boolean isBlockType = isItemBlockType(itemStack);
@@ -394,9 +383,7 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
double zDepth = 1 / relScale - itemBlock.getBlockBoundsMaxZ();
itemDepth += zDepth * zunit;
} catch (Exception e) {
}
;
} catch (Exception e) {} ;
}
switch (tile.getDirection()) {
@@ -441,18 +428,12 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
EntityItem itemEnt = new EntityItem(null, 0, 0, 0, itemStack);
itemEnt.hoverStart = 0;
itemRenderer.doRender(itemEnt, 0, 0, 0, 0, 0);
} catch (Exception e) {
}
} catch (Exception e) {}
GL11.glPopMatrix();
}
private void renderFastItem(
ItemStack itemStack,
TileEntityDrawers tile,
int slot,
ForgeDirection side,
float depth,
private void renderFastItem(ItemStack itemStack, TileEntityDrawers tile, int slot, ForgeDirection side, float depth,
float partialTickTime) {
boolean skipRenderHook = false;
Block itemBlock = Block.getBlockFromItem(itemStack.getItem());
@@ -501,21 +482,17 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
GL11.glDisable(GL11.GL_NORMALIZE);
try {
if (skipRenderHook
|| !ForgeHooksClient.renderInventoryItem(
this.renderBlocks, mc.renderEngine, itemStack, true, 0, 0, 0))
if (skipRenderHook || !ForgeHooksClient
.renderInventoryItem(this.renderBlocks, mc.renderEngine, itemStack, true, 0, 0, 0))
itemRenderer.renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, itemStack, 0, 0, true);
} catch (Exception e) {
}
} catch (Exception e) {}
GL11.glPopMatrix();
}
private boolean isItemBlockType(ItemStack itemStack) {
return itemStack.getItemSpriteNumber() == 0
&& itemStack.getItem() instanceof ItemBlock
&& RenderBlocks.renderItemIn3d(
Block.getBlockFromItem(itemStack.getItem()).getRenderType());
return itemStack.getItemSpriteNumber() == 0 && itemStack.getItem() instanceof ItemBlock
&& RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType());
}
private float getXOffset(int drawerCount, int slot) {
@@ -562,19 +539,19 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
GL11.glScalef(size, size, 1);
}
private static final float[] sideRotationY = {0, 0, 0, 2, 1, 3};
private static final float[] sideRotationY = { 0, 0, 0, 2, 1, 3 };
private float getRotationYForSide(ForgeDirection side) {
return sideRotationY[side.ordinal()] * 90;
}
private static final float[] sideRotationY2D = {0, 0, 0, 2, 3, 1};
private static final float[] sideRotationY2D = { 0, 0, 0, 2, 3, 1 };
private float getRotationYForSide2D(ForgeDirection side) {
return sideRotationY2D[side.ordinal()] * 90;
}
private static final float[] offsetX = {0, 0, 0, 0, 0, 0};
private static final float[] offsetX = { 0, 0, 0, 0, 0, 0 };
private float getOffsetXForSide(ForgeDirection side, float x) {
return Math.abs(offsetX[side.ordinal()] - x);
@@ -1,12 +1,5 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomDrawers;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomTrim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
@@ -14,11 +7,23 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomDrawers;
import com.jaquadro.minecraft.storagedrawers.item.ItemCustomTrim;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TileEntityFramingRenderer extends TileEntitySpecialRenderer {
private RenderItem itemRenderer = new RenderItem() {
@Override
public byte getMiniBlockCount(ItemStack stack, byte original) {
return 1;
@@ -57,8 +62,8 @@ public class TileEntityFramingRenderer extends TileEntitySpecialRenderer {
tileTable.getStackInSlot(3));
renderSlot(tileTable, x, y, z, result, 2f, 0f, .25f, 0f);
} else if (block instanceof BlockTrimCustom) {
ItemStack result = ItemCustomTrim.makeItemStack(
block, 1, tileTable.getStackInSlot(1), tileTable.getStackInSlot(2));
ItemStack result = ItemCustomTrim
.makeItemStack(block, 1, tileTable.getStackInSlot(1), tileTable.getStackInSlot(2));
renderSlot(tileTable, x, y, z, result, 2f, 0f, .25f, 0f);
}
}
@@ -68,16 +73,8 @@ public class TileEntityFramingRenderer extends TileEntitySpecialRenderer {
renderSlot(tileTable, x, y, z, tileTable.getStackInSlot(3), 1.15f, .225f, .15f, .65f);
}
private void renderSlot(
TileEntityFramingTable tileTable,
double x,
double y,
double z,
ItemStack item,
float scale,
float tx,
float ty,
float tz) {
private void renderSlot(TileEntityFramingTable tileTable, double x, double y, double z, ItemStack item, float scale,
float tx, float ty, float tz) {
if (item == null) return;
Block itemBlock = Block.getBlockFromItem(item.getItem());
@@ -108,8 +105,7 @@ public class TileEntityFramingRenderer extends TileEntitySpecialRenderer {
EntityItem itemEnt = new EntityItem(null, 0, 0, 0, item);
itemEnt.hoverStart = 0;
itemRenderer.doRender(itemEnt, 0, 0, 0, 0, 0);
} catch (Exception e) {
}
} catch (Exception e) {}
GL11.glPopMatrix();
}
@@ -1,32 +1,34 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityTrim;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonTrimRenderer;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityTrim;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonTrimRenderer;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class TrimCustomRenderer implements ISimpleBlockRenderingHandler {
private CommonTrimRenderer commonRender = new CommonTrimRenderer();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
RenderBlocks renderer) {
if (!(block instanceof BlockTrimCustom)) return false;
return renderWorldBlock(world, x, y, z, (BlockTrimCustom) block, modelId, renderer);
}
private boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, BlockTrimCustom block, int modelId, RenderBlocks renderer) {
private boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, BlockTrimCustom block, int modelId,
RenderBlocks renderer) {
TileEntityTrim tile = block.getTileEntity(world, x, y, z);
if (tile == null) return false;
@@ -1,16 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonTrimRenderer;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonTrimRenderer;
public class TrimItemRender implements IItemRenderer {
private CommonTrimRenderer commonRender = new CommonTrimRenderer();
@Override
@@ -1,14 +1,16 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer.common;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawersCustom;
import com.jaquadro.minecraft.storagedrawers.client.renderer.ModularBoxRenderer;
import com.jaquadro.minecraft.storagedrawers.client.renderer.PanelBoxRenderer;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class CommonDrawerRenderer {
private PanelBoxRenderer panelRenderer = new PanelBoxRenderer();
private double depth;
@@ -35,7 +37,8 @@ public class CommonDrawerRenderer {
renderHelper.state.setRotateTransform(RenderHelper.ZNEG, direction);
renderHelper.state.setUVRotation(
RenderHelper.YPOS, RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][direction]);
RenderHelper.YPOS,
RenderHelperState.ROTATION_BY_FACE_FACE[RenderHelper.ZNEG][direction]);
return renderHelper;
}
@@ -47,16 +50,8 @@ public class CommonDrawerRenderer {
renderHelper.state.clearUVRotation(RenderHelper.YPOS);
}
public void renderBasePass(
IBlockAccess world,
int x,
int y,
int z,
BlockDrawersCustom block,
int direction,
IIcon iconSide,
IIcon iconTrim,
IIcon iconFront) {
public void renderBasePass(IBlockAccess world, int x, int y, int z, BlockDrawersCustom block, int direction,
IIcon iconSide, IIcon iconTrim, IIcon iconFront) {
RenderHelper renderHelper = start(world, x, y, z, block, direction);
panelRenderer.setTrimIcon(iconTrim);
@@ -108,15 +103,8 @@ public class CommonDrawerRenderer {
end();
}
public void renderOverlayPass(
IBlockAccess world,
int x,
int y,
int z,
BlockDrawersCustom block,
int direction,
IIcon iconTrim,
IIcon iconFront) {
public void renderOverlayPass(IBlockAccess world, int x, int y, int z, BlockDrawersCustom block, int direction,
IIcon iconTrim, IIcon iconFront) {
RenderHelper renderHelper = start(world, x, y, z, block, direction);
IIcon trimShadow = block.getTrimShadowOverlay(iconTrim == iconFront);
@@ -1,62 +1,55 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer.common;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.block.BlockFramingTable;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class CommonFramingRenderer {
private static double unit = .0625;
private static double unit2 = unit * 2;
private static double unit4 = unit * 4;
private static double unit14 = unit * 14;
private static double[][] baseBoundsLeftY = new double[][] {{unit, 1 - unit2, unit, 1, 1, 1 - unit}};
private static double[][] baseBoundsLeftY = new double[][] { { unit, 1 - unit2, unit, 1, 1, 1 - unit } };
private static double[][] trimBoundsLeftY = new double[][] {
{0, 1 - unit2, unit, unit, 1, 1 - unit},
{0, 1 - unit2, 0, unit, 1, unit},
{0, 1 - unit2, 1 - unit, unit, 1, 1},
{unit, 1 - unit2, 0, 1, 1, unit},
{unit, 1 - unit2, 1 - unit, 1, 1, 1},
};
private static double[][] trimBoundsLeftY = new double[][] { { 0, 1 - unit2, unit, unit, 1, 1 - unit },
{ 0, 1 - unit2, 0, unit, 1, unit }, { 0, 1 - unit2, 1 - unit, unit, 1, 1 },
{ unit, 1 - unit2, 0, 1, 1, unit }, { unit, 1 - unit2, 1 - unit, 1, 1, 1 }, };
private static double[][] trimBoundsLeftZ = new double[][] {
{0, 1 - unit2, 0, unit, 1, 1},
{unit, 1 - unit2, 0, 1, 1, 1},
};
private static double[][] trimBoundsLeftZ = new double[][] { { 0, 1 - unit2, 0, unit, 1, 1 },
{ unit, 1 - unit2, 0, 1, 1, 1 }, };
private static double[][] trimBoundsLeftX = new double[][] {
{0, 1 - unit2, 0, 1, 1, unit},
{0, 1 - unit2, unit, 1, 1, 1 - unit},
{0, 1 - unit2, 1 - unit, 1, 1, 1},
};
private static double[][] trimBoundsLeftX = new double[][] { { 0, 1 - unit2, 0, 1, 1, unit },
{ 0, 1 - unit2, unit, 1, 1, 1 - unit }, { 0, 1 - unit2, 1 - unit, 1, 1, 1 }, };
private static double[][] baseBoundsRightY = new double[][] {{0, 1 - unit2, unit, 1 - unit, 1, 1 - unit}};
private static double[][] baseBoundsRightY = new double[][] { { 0, 1 - unit2, unit, 1 - unit, 1, 1 - unit } };
private static double[][] trimBoundsRightY = new double[][] {
{1 - unit, 1 - unit2, unit, 1, 1, 1 - unit},
{1 - unit, 1 - unit2, 0, 1, 1, unit},
{1 - unit, 1 - unit2, 1 - unit, 1, 1, 1},
{0, 1 - unit2, 0, 1 - unit, 1, unit},
{0, 1 - unit2, 1 - unit, 1 - unit, 1, 1},
};
private static double[][] trimBoundsRightY = new double[][] { { 1 - unit, 1 - unit2, unit, 1, 1, 1 - unit },
{ 1 - unit, 1 - unit2, 0, 1, 1, unit }, { 1 - unit, 1 - unit2, 1 - unit, 1, 1, 1 },
{ 0, 1 - unit2, 0, 1 - unit, 1, unit }, { 0, 1 - unit2, 1 - unit, 1 - unit, 1, 1 }, };
private static double[][] trimBoundsRightZ = new double[][] {
{1 - unit, 1 - unit2, 0, 1, 1, 1},
{0, 1 - unit2, 0, 1 - unit, 1, 1},
};
private static double[][] trimBoundsRightZ = new double[][] { { 1 - unit, 1 - unit2, 0, 1, 1, 1 },
{ 0, 1 - unit2, 0, 1 - unit, 1, 1 }, };
private static double[][] trimBoundsRightX = new double[][] {
{0, 1 - unit2, 0, 1, 1, unit},
{0, 1 - unit2, unit, 1, 1, 1 - unit},
{0, 1 - unit2, 1 - unit, 1, 1, 1},
};
private static double[][] trimBoundsRightX = new double[][] { { 0, 1 - unit2, 0, 1, 1, unit },
{ 0, 1 - unit2, unit, 1, 1, 1 - unit }, { 0, 1 - unit2, 1 - unit, 1, 1, 1 }, };
public void renderLeft(IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block) {
renderTableBox(
blockAccess, x, y, z, block, baseBoundsLeftY, trimBoundsLeftY, trimBoundsLeftZ, trimBoundsLeftX, true);
blockAccess,
x,
y,
z,
block,
baseBoundsLeftY,
trimBoundsLeftY,
trimBoundsLeftZ,
trimBoundsLeftX,
true);
renderStructure(blockAccess, x, y, z, block, true);
}
@@ -83,14 +76,8 @@ public class CommonFramingRenderer {
renderOverlay(blockAccess, x, y, z, block, baseBoundsRightY, false);
}
public void renderOverlay(
IBlockAccess blockAccess,
int x,
int y,
int z,
BlockFramingTable block,
double[][] baseBoundsY,
boolean left) {
public void renderOverlay(IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block,
double[][] baseBoundsY, boolean left) {
IIcon iconOverlay = block.getIconOverlay(left);
RenderHelper renderer = RenderHelper.instance;
@@ -109,16 +96,8 @@ public class CommonFramingRenderer {
renderBraces(blockAccess, x, y, z, block, iconSurface, left);
}
private void renderTableBox(
IBlockAccess blockAccess,
int x,
int y,
int z,
BlockFramingTable block,
double[][] baseBoundsY,
double[][] trimBoundsY,
double[][] trimBoundsZ,
double[][] trimBoundsX,
private void renderTableBox(IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block,
double[][] baseBoundsY, double[][] trimBoundsY, double[][] trimBoundsZ, double[][] trimBoundsX,
boolean left) {
RenderHelper renderer = RenderHelper.instance;
@@ -151,8 +130,8 @@ public class CommonFramingRenderer {
}
}
private void renderFoot(
IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block, IIcon icon, boolean left) {
private void renderFoot(IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block, IIcon icon,
boolean left) {
RenderHelper renderer = RenderHelper.instance;
float oldColor = renderer.state.colorMultYPos;
@@ -171,8 +150,8 @@ public class CommonFramingRenderer {
renderer.state.colorMultYPos = oldColor;
}
private void renderLegs(
IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block, IIcon icon, boolean left) {
private void renderLegs(IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block, IIcon icon,
boolean left) {
RenderHelper renderer = RenderHelper.instance;
for (int i = 2; i < 6; i++) renderer.state.setUVRotation(i, RenderHelperState.ROTATE90);
@@ -188,8 +167,8 @@ public class CommonFramingRenderer {
for (int i = 2; i < 6; i++) renderer.state.clearUVRotation(i);
}
private void renderBraces(
IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block, IIcon icon, boolean left) {
private void renderBraces(IBlockAccess blockAccess, int x, int y, int z, BlockFramingTable block, IIcon icon,
boolean left) {
RenderHelper renderer = RenderHelper.instance;
float oldColor = renderer.state.colorMultYPos;
@@ -1,13 +1,15 @@
package com.jaquadro.minecraft.storagedrawers.client.renderer.common;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.client.renderer.ModularBoxRenderer;
import com.jaquadro.minecraft.storagedrawers.client.renderer.PanelBoxRenderer;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class CommonTrimRenderer {
private PanelBoxRenderer panelRenderer = new PanelBoxRenderer();
private double trimWidth;
@@ -1,14 +1,18 @@
package com.jaquadro.minecraft.storagedrawers.config;
import cpw.mods.fml.common.Loader;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Loader;
public class CompTierRegistry {
public class Record {
public ItemStack upper;
public ItemStack lower;
public int convRate;
@@ -1,20 +1,24 @@
package com.jaquadro.minecraft.storagedrawers.config;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
import com.jaquadro.minecraft.storagedrawers.api.config.IAddonConfig;
import com.jaquadro.minecraft.storagedrawers.api.config.IBlockConfig;
import com.jaquadro.minecraft.storagedrawers.api.config.IIntegrationConfig;
import com.jaquadro.minecraft.storagedrawers.api.config.IUserConfig;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.Configuration;
public class ConfigManager {
public class ConfigSection {
public final ConfigSection parent;
public final String name;
public final String lang;
@@ -50,6 +54,7 @@ public class ConfigManager {
}
public static class ConfigCache {
public boolean enableIndicatorUpgrades;
public boolean enableStorageUpgrades;
public boolean enableLockUpgrades;
@@ -95,6 +100,7 @@ public class ConfigManager {
}
private class AddonConfig implements IAddonConfig {
@Override
public boolean showAddonItemsNEI() {
return cache.addonShowNEI;
@@ -112,6 +118,7 @@ public class ConfigManager {
}
private class BlockConfig implements IBlockConfig {
@Override
public String getBlockConfigName(BlockConfiguration blockConfig) {
switch (blockConfig) {
@@ -155,6 +162,7 @@ public class ConfigManager {
}
private class IntegrationConfig implements IIntegrationConfig {
@Override
public boolean isRefinedRelocationEnabled() {
return cache.enableRefinedRelocationIntegration;
@@ -172,6 +180,7 @@ public class ConfigManager {
}
private class UserConfig implements IUserConfig {
@Override
public IAddonConfig addonConfig() {
return addonConfig;
@@ -201,24 +210,51 @@ public class ConfigManager {
public final ConfigSection sectionAddons = new ConfigSection(sections, "addons", "addons");
public final List<ConfigSection> blockSections = new ArrayList<ConfigSection>();
public final ConfigSection sectionBlocksFullDrawers1x1 =
new ConfigSection(blockSections, sectionBlocks, "fulldrawers1", "blocks.fullDrawers1");
public final ConfigSection sectionBlocksFullDrawers1x2 =
new ConfigSection(blockSections, sectionBlocks, "fulldrawers2", "blocks.fullDrawers2");
public final ConfigSection sectionBlocksFullDrawers2x2 =
new ConfigSection(blockSections, sectionBlocks, "fulldrawers4", "blocks.fullDrawers4");
public final ConfigSection sectionBlocksHalfDrawers1x2 =
new ConfigSection(blockSections, sectionBlocks, "halfdrawers2", "blocks.halfDrawers2");
public final ConfigSection sectionBlocksHalfDrawers2x2 =
new ConfigSection(blockSections, sectionBlocks, "halfdrawers4", "blocks.halfDrawers4");
public final ConfigSection sectionBlocksCompDrawers =
new ConfigSection(blockSections, sectionBlocks, "compdrawers", "blocks.compDrawers");
public final ConfigSection sectionBlocksController =
new ConfigSection(blockSections, sectionBlocks, "controller", "blocks.controller");
public final ConfigSection sectionBlocksTrim =
new ConfigSection(blockSections, sectionBlocks, "trim", "blocks.trim");
public final ConfigSection sectionBlocksSlave =
new ConfigSection(blockSections, sectionBlocks, "controllerSlave", "blocks.controllerSlave");
public final ConfigSection sectionBlocksFullDrawers1x1 = new ConfigSection(
blockSections,
sectionBlocks,
"fulldrawers1",
"blocks.fullDrawers1");
public final ConfigSection sectionBlocksFullDrawers1x2 = new ConfigSection(
blockSections,
sectionBlocks,
"fulldrawers2",
"blocks.fullDrawers2");
public final ConfigSection sectionBlocksFullDrawers2x2 = new ConfigSection(
blockSections,
sectionBlocks,
"fulldrawers4",
"blocks.fullDrawers4");
public final ConfigSection sectionBlocksHalfDrawers1x2 = new ConfigSection(
blockSections,
sectionBlocks,
"halfdrawers2",
"blocks.halfDrawers2");
public final ConfigSection sectionBlocksHalfDrawers2x2 = new ConfigSection(
blockSections,
sectionBlocks,
"halfdrawers4",
"blocks.halfDrawers4");
public final ConfigSection sectionBlocksCompDrawers = new ConfigSection(
blockSections,
sectionBlocks,
"compdrawers",
"blocks.compDrawers");
public final ConfigSection sectionBlocksController = new ConfigSection(
blockSections,
sectionBlocks,
"controller",
"blocks.controller");
public final ConfigSection sectionBlocksTrim = new ConfigSection(
blockSections,
sectionBlocks,
"trim",
"blocks.trim");
public final ConfigSection sectionBlocksSlave = new ConfigSection(
blockSections,
sectionBlocks,
"controllerSlave",
"blocks.controllerSlave");
public Map<String, ConfigSection> blockSectionsMap = new HashMap<String, ConfigSection>();
@@ -245,258 +281,173 @@ public class ConfigManager {
public void syncConfig() {
cache.enableIndicatorUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableIndicatorUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableIndicatorUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableIndicatorUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableStorageUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableStorageUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableStorageUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableLockUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableLockUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableLockUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableLockUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableVoidUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableVoidUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableVoidUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableVoidUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableCreativeUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableCreativeUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableCreativeUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableCreativeUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableShroudUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableShroudUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableShroudUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableShroudUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enablePersonalUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enablePersonalUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enablePersonalUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enablePersonalUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableSortingUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableSortingUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableSortingUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableSortingUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableRedstoneUpgrades = config.get(Configuration.CATEGORY_GENERAL, "enableRedstoneUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.enableRedstoneUpgrades")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableRedstoneUpgrades").setRequiresMcRestart(true).getBoolean();
cache.enableTape = config.get(Configuration.CATEGORY_GENERAL, "enableTape", true)
.setLanguageKey(LANG_PREFIX + "prop.enableTape")
.setRequiresMcRestart(true)
.getBoolean();
cache.itemRenderType = config.get(
Configuration.CATEGORY_GENERAL, "itemRenderType", "fast", null, new String[] {"fancy", "fast"})
.setLanguageKey(LANG_PREFIX + "prop.itemRenderType")
.getString();
.setLanguageKey(LANG_PREFIX + "prop.enableTape").setRequiresMcRestart(true).getBoolean();
cache.itemRenderType = config
.get(Configuration.CATEGORY_GENERAL, "itemRenderType", "fast", null, new String[] { "fancy", "fast" })
.setLanguageKey(LANG_PREFIX + "prop.itemRenderType").getString();
cache.renderStorageUpgrades = config.get(Configuration.CATEGORY_GENERAL, "renderStorageUpgrades", true)
.setLanguageKey(LANG_PREFIX + "prop.renderStorageUpgrades")
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.renderStorageUpgrades").getBoolean();
cache.creativeTabVanillaWoods = config.get(Configuration.CATEGORY_GENERAL, "creativeTabVanillaWoods", true)
.setLanguageKey(LANG_PREFIX + "prop.creativeTabVanillaWoods")
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.creativeTabVanillaWoods").getBoolean();
cache.enableDrawerUI = config.get(Configuration.CATEGORY_GENERAL, "enableDrawerUI", true)
.setLanguageKey(LANG_PREFIX + "prop.enableDrawerUI")
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableDrawerUI").getBoolean();
cache.enableSidedInput = config.get(Configuration.CATEGORY_GENERAL, "enableSidedInput", true)
.setLanguageKey(LANG_PREFIX + "prop.enableSidedInput")
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableSidedInput").getBoolean();
cache.enableSidedOutput = config.get(Configuration.CATEGORY_GENERAL, "enableSidedOutput", true)
.setLanguageKey(LANG_PREFIX + "prop.enableSidedOutput")
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableSidedOutput").getBoolean();
cache.enableItemConversion = config.get(Configuration.CATEGORY_GENERAL, "enableItemConversion", true)
.setLanguageKey(LANG_PREFIX + "prop.enableItemConversion")
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableItemConversion").getBoolean();
cache.enableFallbackRecipes = config.get(Configuration.CATEGORY_GENERAL, "enableFallbackRecipes", true)
.setLanguageKey(LANG_PREFIX + "prop.enableFallbackRecipes")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "prop.enableFallbackRecipes").setRequiresMcRestart(true).getBoolean();
cache.enableFramedDrawers = config.get(Configuration.CATEGORY_GENERAL, "enableFramedDrawers", true)
.setLanguageKey(LANG_PREFIX + "prop.enableFramedDrawers")
.setRequiresMcRestart(true)
.getBoolean();
cache.stackRemainderWaila = !config.get(
Configuration.CATEGORY_GENERAL, "wailaStackRemainder", "stack + remainder", null, new String[] {
"exact", "stack + remainder"
})
.setLanguageKey(LANG_PREFIX + "prop.wailaStackRemainder")
.getString()
.equals("exact");
.setLanguageKey(LANG_PREFIX + "prop.enableFramedDrawers").setRequiresMcRestart(true).getBoolean();
cache.stackRemainderWaila = !config
.get(
Configuration.CATEGORY_GENERAL,
"wailaStackRemainder",
"stack + remainder",
null,
new String[] { "exact", "stack + remainder" })
.setLanguageKey(LANG_PREFIX + "prop.wailaStackRemainder").getString().equals("exact");
cache.invertShift = config.get(
Configuration.CATEGORY_GENERAL,
"invertShift",
false,
"Inverts how shift works with drawers. If this is true, shifting will only give one item, where regular clicks will give a full stack. Leave false for default behavior.")
.setLanguageKey(LANG_PREFIX + "prop.invertShift")
.getBoolean();
Configuration.CATEGORY_GENERAL,
"invertShift",
false,
"Inverts how shift works with drawers. If this is true, shifting will only give one item, where regular clicks will give a full stack. Leave false for default behavior.")
.setLanguageKey(LANG_PREFIX + "prop.invertShift").getBoolean();
cache.debugTrace = config.get(
Configuration.CATEGORY_GENERAL,
"enableDebugLogging",
false,
"Writes additional log messages while using the mod. Mainly for debug purposes. Should be kept disabled unless instructed otherwise.")
.setLanguageKey(LANG_PREFIX + "prop.enableDebugLogging")
.getBoolean();
cache.breakDrawerDropMode = config.get(
Configuration.CATEGORY_GENERAL,
"enableDebugLogging",
false,
"Writes additional log messages while using the mod. Mainly for debug purposes. Should be kept disabled unless instructed otherwise.")
.setLanguageKey(LANG_PREFIX + "prop.enableDebugLogging").getBoolean();
cache.breakDrawerDropMode = config
.get(
Configuration.CATEGORY_GENERAL,
"breakDrawerDropMode",
"merge",
"Select: default, merge, destroy and cluster. ",
new String[] {"default", "destroy", "merge", "cluster"})
.setLanguageKey(LANG_PREFIX + "prop.breakDrawerDropMode")
.getString();
new String[] { "default", "destroy", "merge", "cluster" })
.setLanguageKey(LANG_PREFIX + "prop.breakDrawerDropMode").getString();
cache.enableAE2Integration = config.get(sectionIntegration.getQualifiedName(), "enableAE2", true)
.setLanguageKey(LANG_PREFIX + "integration.enableAE2")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "integration.enableAE2").setRequiresMcRestart(true).getBoolean();
cache.enableWailaIntegration = config.get(sectionIntegration.getQualifiedName(), "enableWaila", true)
.setLanguageKey(LANG_PREFIX + "integration.enableWaila")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "integration.enableWaila").setRequiresMcRestart(true).getBoolean();
cache.enableThaumcraftIntegration = config.get(sectionIntegration.getQualifiedName(), "enableThaumcraft", true)
.setLanguageKey(LANG_PREFIX + "integration.enableThaumcraft")
.setRequiresMcRestart(true)
.setLanguageKey(LANG_PREFIX + "integration.enableThaumcraft").setRequiresMcRestart(true).getBoolean();
cache.enableMineTweakerIntegration = config
.get(sectionIntegration.getQualifiedName(), "enableMineTweaker", true)
.setLanguageKey(LANG_PREFIX + "integration.enableMineTweaker").setRequiresMcRestart(true).getBoolean();
cache.enableRefinedRelocationIntegration = config
.get(sectionIntegration.getQualifiedName(), "enableRefinedRelocation", true)
.setLanguageKey(LANG_PREFIX + "integration.enableRefinedRelocation").setRequiresMcRestart(true)
.getBoolean();
cache.enableMineTweakerIntegration = config.get(
sectionIntegration.getQualifiedName(), "enableMineTweaker", true)
.setLanguageKey(LANG_PREFIX + "integration.enableMineTweaker")
.setRequiresMcRestart(true)
cache.enableThermalExpansionIntegration = config
.get(sectionIntegration.getQualifiedName(), "enableThermalExpansion", true)
.setLanguageKey(LANG_PREFIX + "integration.enableThermalExpansion").setRequiresMcRestart(true)
.getBoolean();
cache.enableRefinedRelocationIntegration = config.get(
sectionIntegration.getQualifiedName(), "enableRefinedRelocation", true)
.setLanguageKey(LANG_PREFIX + "integration.enableRefinedRelocation")
.setRequiresMcRestart(true)
.getBoolean();
cache.enableThermalExpansionIntegration = config.get(
sectionIntegration.getQualifiedName(), "enableThermalExpansion", true)
.setLanguageKey(LANG_PREFIX + "integration.enableThermalExpansion")
.setRequiresMcRestart(true)
.getBoolean();
cache.enableThermalFoundationIntegration = config.get(
sectionIntegration.getQualifiedName(), "enableThermalFoundation", true)
.setLanguageKey(LANG_PREFIX + "integration.enableThermalFoundation")
.setRequiresMcRestart(true)
cache.enableThermalFoundationIntegration = config
.get(sectionIntegration.getQualifiedName(), "enableThermalFoundation", true)
.setLanguageKey(LANG_PREFIX + "integration.enableThermalFoundation").setRequiresMcRestart(true)
.getBoolean();
cache.enableChiselIntegration = config.get(sectionIntegration.getQualifiedName(), "enableChisel", true)
.setLanguageKey(LANG_PREFIX + "integration.enableChisel")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "integration.enableChisel").setRequiresMcRestart(true).getBoolean();
cache.enableGTNHIntegration = config.get(sectionIntegration.getQualifiedName(), "enableGTNH", true)
.setLanguageKey(LANG_PREFIX + "integration.enableGTNH")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "integration.enableGTNH").setRequiresMcRestart(true).getBoolean();
config.get(sectionBlocksFullDrawers1x1.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers1x1.getQualifiedName(), "baseStorage", 32)
.setLanguageKey(LANG_PREFIX + "prop.baseStorage")
.setRequiresWorldRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksFullDrawers1x1.getQualifiedName(), "recipeOutput", 1)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "baseStorage", 16)
.setLanguageKey(LANG_PREFIX + "prop.baseStorage")
.setRequiresWorldRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksFullDrawers1x2.getQualifiedName(), "recipeOutput", 2)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers2x2.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksFullDrawers2x2.getQualifiedName(), "baseStorage", 8)
.setLanguageKey(LANG_PREFIX + "prop.baseStorage")
.setRequiresWorldRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksFullDrawers2x2.getQualifiedName(), "recipeOutput", 4)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers1x2.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers1x2.getQualifiedName(), "baseStorage", 8)
.setLanguageKey(LANG_PREFIX + "prop.baseStorage")
.setRequiresWorldRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksHalfDrawers1x2.getQualifiedName(), "recipeOutput", 2)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "baseStorage", 4)
.setLanguageKey(LANG_PREFIX + "prop.baseStorage")
.setRequiresWorldRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "recipeOutput", 4)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "baseStorage", 16)
.setLanguageKey(LANG_PREFIX + "prop.baseStorage")
.setRequiresWorldRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "recipeOutput", 1)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksController.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksController.getQualifiedName(), "range", 12)
.setLanguageKey(LANG_PREFIX + "prop.controllerRange");
config.get(sectionBlocksController.getQualifiedName(), "maxDrawers", 2048)
.setLanguageKey(LANG_PREFIX + "prop.controllerMaxDrawers");
config.get(sectionBlocksTrim.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
config.get(sectionBlocksTrim.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
config.get(sectionBlocksTrim.getQualifiedName(), "recipeOutput", 4)
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput")
.setRequiresMcRestart(true);
.setLanguageKey(LANG_PREFIX + "prop.recipeOutput").setRequiresMcRestart(true);
config.get(sectionBlocksSlave.getQualifiedName(), "enabled", true)
.setLanguageKey(LANG_PREFIX + "prop.enabled")
config.get(sectionBlocksSlave.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled")
.setRequiresMcRestart(true);
cache.level2Mult = config.get(sectionUpgrades.getQualifiedName(), "level2Mult", 2)
.setLanguageKey(LANG_PREFIX + "upgrades.level2Mult")
.setRequiresWorldRestart(true)
.getInt();
.setLanguageKey(LANG_PREFIX + "upgrades.level2Mult").setRequiresWorldRestart(true).getInt();
cache.level3Mult = config.get(sectionUpgrades.getQualifiedName(), "level3Mult", 3)
.setLanguageKey(LANG_PREFIX + "upgrades.level3Mult")
.setRequiresWorldRestart(true)
.getInt();
.setLanguageKey(LANG_PREFIX + "upgrades.level3Mult").setRequiresWorldRestart(true).getInt();
cache.level4Mult = config.get(sectionUpgrades.getQualifiedName(), "level4Mult", 5)
.setLanguageKey(LANG_PREFIX + "upgrades.level4Mult")
.setRequiresWorldRestart(true)
.getInt();
.setLanguageKey(LANG_PREFIX + "upgrades.level4Mult").setRequiresWorldRestart(true).getInt();
cache.level5Mult = config.get(sectionUpgrades.getQualifiedName(), "level5Mult", 8)
.setLanguageKey(LANG_PREFIX + "upgrades.level5Mult")
.setRequiresWorldRestart(true)
.getInt();
.setLanguageKey(LANG_PREFIX + "upgrades.level5Mult").setRequiresWorldRestart(true).getInt();
cache.level6Mult = config.get(sectionUpgrades.getQualifiedName(), "level6Mult", 13)
.setLanguageKey(LANG_PREFIX + "upgrades.level6Mult")
.setRequiresWorldRestart(true)
.getInt();
.setLanguageKey(LANG_PREFIX + "upgrades.level6Mult").setRequiresWorldRestart(true).getInt();
cache.addonShowNEI = config.get(sectionAddons.getQualifiedName(), "showBlocksInNEI", true)
.setLanguageKey(LANG_PREFIX + "addons.showNEI")
.setRequiresWorldRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "addons.showNEI").setRequiresWorldRestart(true).getBoolean();
cache.addonShowVanilla = config.get(sectionAddons.getQualifiedName(), "showBlocksInCreative", true)
.setLanguageKey(LANG_PREFIX + "addons.showCreative")
.setRequiresWorldRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "addons.showCreative").setRequiresWorldRestart(true).getBoolean();
cache.addonSeparateVanilla = config.get(sectionAddons.getQualifiedName(), "useSeparateCreativeTabs", true)
.setLanguageKey(LANG_PREFIX + "addons.separateTabs")
.setRequiresMcRestart(true)
.getBoolean();
.setLanguageKey(LANG_PREFIX + "addons.separateTabs").setRequiresMcRestart(true).getBoolean();
getControllerRange();
getControllerMaxDrawers();
@@ -1,14 +1,18 @@
package com.jaquadro.minecraft.storagedrawers.config;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
public class ModConfigGui extends GuiConfig {
public ModConfigGui(GuiScreen parent) {
super(parent, getConfigElements(), StorageDrawers.MOD_ID, false, false, "Storage Drawers Configuration");
}
@@ -1,16 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.config;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
public class OreDictRegistry {
private Set<String> blacklist = new HashSet<String>();
private Set<String> whitelist = new HashSet<String>();
private List<String> blacklistPrefix = new ArrayList<String>();
@@ -53,26 +56,9 @@ public class OreDictRegistry {
addBlacklistPrefix("list");
addBlacklistPrefix("dye");
String[] oreTypes = {"ore", "block", "ingot", "nugget"};
String[] oreMaterials = {
"Iron",
"Gold",
"Diamond",
"Emerald",
"Aluminum",
"Aluminium",
"Tin",
"Copper",
"Lead",
"Silver",
"Platinum",
"Nickel",
"Osmium",
"Invar",
"Bronze",
"Electrum",
"Enderium"
};
String[] oreTypes = { "ore", "block", "ingot", "nugget" };
String[] oreMaterials = { "Iron", "Gold", "Diamond", "Emerald", "Aluminum", "Aluminium", "Tin", "Copper",
"Lead", "Silver", "Platinum", "Nickel", "Osmium", "Invar", "Bronze", "Electrum", "Enderium" };
for (String ore : oreMaterials) {
for (String type : oreTypes) addWhitelist(type + ore);
@@ -1,18 +1,21 @@
package com.jaquadro.minecraft.storagedrawers.config;
import com.jaquadro.minecraft.storagedrawers.api.registry.IIngredientHandler;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandler;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import com.jaquadro.minecraft.storagedrawers.api.registry.IIngredientHandler;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandler;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRecipeHandlerRegistry;
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry {
private Map<Class, IRecipeHandler> recipeRegistry = new HashMap<Class, IRecipeHandler>();
private Map<Class, IIngredientHandler> ingredientRegistry = new HashMap<Class, IIngredientHandler>();
@@ -60,6 +63,7 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry {
}
private static class ShapedOreRecipeHandler implements IRecipeHandler {
@Override
public Object[] getInputAsArray(IRecipe recipe) {
return ((ShapedOreRecipe) recipe).getInput();
@@ -72,6 +76,7 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry {
}
private static class ShapedRecipeHandler implements IRecipeHandler {
@Override
public Object[] getInputAsArray(IRecipe recipe) {
return ((ShapedRecipes) recipe).recipeItems;
@@ -84,6 +89,7 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry {
}
private static class ShapelessOreRecipeHandler implements IRecipeHandler {
@Override
public Object[] getInputAsArray(IRecipe recipe) {
return null;
@@ -96,6 +102,7 @@ public class RecipeHandlerRegistry implements IRecipeHandlerRegistry {
}
private static class ShapelessRecipeHandler implements IRecipeHandler {
@Override
public Object[] getInputAsArray(IRecipe recipe) {
return null;
@@ -1,11 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.config;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry;
import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel;
import java.util.ArrayList;
import java.util.List;
import com.jaquadro.minecraft.storagedrawers.api.registry.IRenderRegistry;
import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel;
public class RenderRegistry implements IRenderRegistry {
private List<IRenderLabel> registry = new ArrayList<IRenderLabel>();
@Override
@@ -1,11 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.config;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaTooltipHandler;
import java.util.ArrayList;
import java.util.List;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaRegistry;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaTooltipHandler;
public class WailaRegistry implements IWailaRegistry {
private List<IWailaTooltipHandler> registry = new ArrayList<IWailaTooltipHandler>();
@Override
@@ -13,6 +13,7 @@ import com.jaquadro.minecraft.storagedrawers.core.api.PackRecipes;
import com.jaquadro.minecraft.storagedrawers.integration.ThermalExpansion;
public class Api implements IStorageDrawersApi {
public static IStorageDrawersApi instance;
private PackFactory packFactory = new PackFactory();
@@ -1,16 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.core;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersComp;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersStandard;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityFramingTable;
import com.jaquadro.minecraft.storagedrawers.client.renderer.*;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxy extends CommonProxy {
public static int renderPass = 0;
private DrawersItemRenderer itemRenderer = new DrawersItemRenderer();
private TrimItemRender trimItemRenderer = new TrimItemRender();
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
public class CommonProxy {
public int drawersRenderID = -1;
public int controllerRenderID = -1;
public int drawersCustomRenderID = -1;
@@ -1,11 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.core;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ForgeEventHandler {
@SubscribeEvent
public void playerInteracts(PlayerInteractEvent event) {
if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK
@@ -1,17 +1,20 @@
package com.jaquadro.minecraft.storagedrawers.core;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.*;
import com.jaquadro.minecraft.storagedrawers.block.tile.*;
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
import com.jaquadro.minecraft.storagedrawers.item.*;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class ModBlocks {
public static DataResolver resolver;
public static BlockDrawers fullDrawers1;
@@ -105,13 +108,19 @@ public class ModBlocks {
getQualifiedName(halfDrawers4));
GameRegistry.registerTileEntityWithAlternatives(
TileEntityDrawersComp.class, getQualifiedName("tileDrawersComp"), getQualifiedName(compDrawers));
TileEntityDrawersComp.class,
getQualifiedName("tileDrawersComp"),
getQualifiedName(compDrawers));
GameRegistry.registerTileEntityWithAlternatives(
TileEntityController.class, getQualifiedName("tileController"), getQualifiedName(controller));
TileEntityController.class,
getQualifiedName("tileController"),
getQualifiedName(controller));
GameRegistry.registerTileEntityWithAlternatives(
TileEntitySlave.class, getQualifiedName("tileControllerSlave"), getQualifiedName(controllerSlave));
TileEntitySlave.class,
getQualifiedName("tileControllerSlave"),
getQualifiedName(controllerSlave));
GameRegistry.registerTileEntity(TileEntityFramingTable.class, getQualifiedName("framingTable"));
@@ -130,15 +139,15 @@ public class ModBlocks {
StorageDrawers.proxy.registerDrawer(halfCustom2);
StorageDrawers.proxy.registerDrawer(halfCustom4);
for (String key : new String[] {"drawerBasic"})
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(fullDrawers1, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] {"drawerBasic"})
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(fullDrawers2, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] {"drawerBasic"})
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(fullDrawers4, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] {"drawerBasic"})
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(halfDrawers2, 1, OreDictionary.WILDCARD_VALUE));
for (String key : new String[] {"drawerBasic"})
for (String key : new String[] { "drawerBasic" })
OreDictionary.registerOre(key, new ItemStack(halfDrawers4, 1, OreDictionary.WILDCARD_VALUE));
resolver.init();
@@ -1,17 +1,21 @@
package com.jaquadro.minecraft.storagedrawers.core;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public final class ModCreativeTabs {
private ModCreativeTabs() {}
public static final CreativeTabs tabStorageDrawers = new CreativeTabs("storageDrawers") {
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
@@ -1,12 +1,15 @@
package com.jaquadro.minecraft.storagedrawers.core;
import com.jaquadro.minecraft.storagedrawers.config.ModConfigGui;
import cpw.mods.fml.client.IModGuiFactory;
import java.util.Set;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import com.jaquadro.minecraft.storagedrawers.config.ModConfigGui;
import cpw.mods.fml.client.IModGuiFactory;
public class ModGuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) {}
@@ -1,11 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.core;
import net.minecraft.item.Item;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.item.*;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
public class ModItems {
public static Item upgradeTemplate;
public static ItemUpgrade upgrade;
public static ItemUpgradeStatus upgradeStatus;
@@ -19,8 +21,7 @@ public class ModItems {
public static ItemUpgradeDowngrade upgradeDowngrade;
public void init() {
upgradeTemplate = new Item()
.setUnlocalizedName(makeName("upgradeTemplate"))
upgradeTemplate = new Item().setUnlocalizedName(makeName("upgradeTemplate"))
.setTextureName(StorageDrawers.MOD_ID + ":upgrade_template")
.setCreativeTab(ModCreativeTabs.tabStorageDrawers);
upgrade = new ItemUpgrade(makeName("upgrade"));
@@ -2,11 +2,6 @@ package com.jaquadro.minecraft.storagedrawers.core;
import static com.jaquadro.minecraft.storagedrawers.StorageDrawers.config;
import com.jaquadro.minecraft.storagedrawers.core.recipe.FallbackShapedOreRecipe;
import com.jaquadro.minecraft.storagedrawers.core.recipe.TemplateRecipe;
import com.jaquadro.minecraft.storagedrawers.integration.ChiselIntegrationModule;
import com.jaquadro.minecraft.storagedrawers.integration.GTNHIntegrationModule;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.BlockWood;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -16,6 +11,12 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import com.jaquadro.minecraft.storagedrawers.core.recipe.FallbackShapedOreRecipe;
import com.jaquadro.minecraft.storagedrawers.core.recipe.TemplateRecipe;
import com.jaquadro.minecraft.storagedrawers.integration.ChiselIntegrationModule;
import com.jaquadro.minecraft.storagedrawers.integration.GTNHIntegrationModule;
import cpw.mods.fml.common.registry.GameRegistry;
public class ModRecipes {
public void init() {
@@ -29,341 +30,355 @@ public class ModRecipes {
"after:forge:shapedore");
if (!ChiselIntegrationModule.isEnabled()) {
for (int i = 0; i < BlockWood.field_150096_a.length; i++) {
if (config.isBlockEnabled("fulldrawers1"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), i),
if (config.isBlockEnabled("fulldrawers1")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), i),
"xxx",
" y ",
"xxx",
'x',
new ItemStack(Blocks.planks, 1, i),
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers2")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), i),
"xyx",
"xxx",
"xyx",
'x',
new ItemStack(Blocks.planks, 1, i),
'y',
"chestWood"));
if (config.isBlockEnabled("halfdrawers2")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), i),
"xyx",
"xxx",
"xyx",
'x',
new ItemStack(Blocks.wooden_slab, 1, i),
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers4")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), i),
"yxy",
"xxx",
"yxy",
'x',
new ItemStack(Blocks.planks, 1, i),
'y',
"chestWood"));
if (config.isBlockEnabled("halfdrawers4")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), i),
"yxy",
"xxx",
"yxy",
'x',
new ItemStack(Blocks.wooden_slab, 1, i),
'y',
"chestWood"));
if (config.isBlockEnabled("trim")) {
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), i),
"xyx",
"yyy",
"xyx",
'x',
"stickWood",
'y',
new ItemStack(Blocks.planks, 1, i)));
}
}
}
if (config.cache.enableFallbackRecipes || ChiselIntegrationModule.isEnabled()) {
if (config.isBlockEnabled("fulldrawers1")) GameRegistry.addRecipe(
new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), 0),
"xxx",
" y ",
"xxx",
'x',
new ItemStack(Blocks.planks, 1, i),
"plankWood",
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers2"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), i),
if (config.isBlockEnabled("fulldrawers2")) GameRegistry.addRecipe(
new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), 0),
"xyx",
"xxx",
"xyx",
'x',
new ItemStack(Blocks.planks, 1, i),
"plankWood",
'y',
"chestWood"));
if (config.isBlockEnabled("halfdrawers2"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), i),
if (config.isBlockEnabled("halfdrawers2")) GameRegistry.addRecipe(
new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), 0),
"xyx",
"xxx",
"xyx",
'x',
new ItemStack(Blocks.wooden_slab, 1, i),
"slabWood",
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers4"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), i),
if (config.isBlockEnabled("fulldrawers4")) GameRegistry.addRecipe(
new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), 0),
"yxy",
"xxx",
"yxy",
'x',
new ItemStack(Blocks.planks, 1, i),
"plankWood",
'y',
"chestWood"));
if (config.isBlockEnabled("halfdrawers4"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), i),
if (config.isBlockEnabled("halfdrawers4")) GameRegistry.addRecipe(
new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), 0),
"yxy",
"xxx",
"yxy",
'x',
new ItemStack(Blocks.wooden_slab, 1, i),
"slabWood",
'y',
"chestWood"));
if (config.isBlockEnabled("trim")) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), i),
if (config.isBlockEnabled("trim")) GameRegistry.addRecipe(
new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), 0),
"xyx",
"yyy",
"xyx",
'x',
"stickWood",
'y',
new ItemStack(Blocks.planks, 1, i)));
}
}
}
if (config.cache.enableFallbackRecipes || ChiselIntegrationModule.isEnabled()) {
if (config.isBlockEnabled("fulldrawers1"))
GameRegistry.addRecipe(new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers1, config.getBlockRecipeOutput("fulldrawers1"), 0),
"xxx",
" y ",
"xxx",
'x',
"plankWood",
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers2"))
GameRegistry.addRecipe(new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers2, config.getBlockRecipeOutput("fulldrawers2"), 0),
"xyx",
"xxx",
"xyx",
'x',
"plankWood",
'y',
"chestWood"));
if (config.isBlockEnabled("halfdrawers2"))
GameRegistry.addRecipe(new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers2, config.getBlockRecipeOutput("halfdrawers2"), 0),
"xyx",
"xxx",
"xyx",
'x',
"slabWood",
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers4"))
GameRegistry.addRecipe(new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.fullDrawers4, config.getBlockRecipeOutput("fulldrawers4"), 0),
"yxy",
"xxx",
"yxy",
'x',
"plankWood",
'y',
"chestWood"));
if (config.isBlockEnabled("halfdrawers4"))
GameRegistry.addRecipe(new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.halfDrawers4, config.getBlockRecipeOutput("halfdrawers4"), 0),
"yxy",
"xxx",
"yxy",
'x',
"slabWood",
'y',
"chestWood"));
if (config.isBlockEnabled("trim"))
GameRegistry.addRecipe(new FallbackShapedOreRecipe(
new ItemStack(ModBlocks.trim, config.getBlockRecipeOutput("trim"), 0),
"xyx",
"yyy",
"xyx",
'x',
"stickWood",
'y',
"plankWood"));
"plankWood"));
}
if (config.isBlockEnabled("compdrawers"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.compDrawers, config.getBlockRecipeOutput("compdrawers")),
"xxx",
"zwz",
"xyx",
'x',
new ItemStack(Blocks.stone),
'y',
"ingotIron",
'z',
new ItemStack(Blocks.piston),
'w',
"drawerBasic"));
if (config.isBlockEnabled("compdrawers")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.compDrawers, config.getBlockRecipeOutput("compdrawers")),
"xxx",
"zwz",
"xyx",
'x',
new ItemStack(Blocks.stone),
'y',
"ingotIron",
'z',
new ItemStack(Blocks.piston),
'w',
"drawerBasic"));
if (config.isBlockEnabled("controller"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.controller),
"xxx",
"yzy",
"xwx",
'x',
new ItemStack(Blocks.stone),
'y',
Items.comparator,
'z',
"drawerBasic",
'w',
"gemDiamond"));
if (config.isBlockEnabled("controller")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.controller),
"xxx",
"yzy",
"xwx",
'x',
new ItemStack(Blocks.stone),
'y',
Items.comparator,
'z',
"drawerBasic",
'w',
"gemDiamond"));
if (config.isBlockEnabled("controllerSlave"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.controllerSlave),
"xxx",
"yzy",
"xwx",
'x',
new ItemStack(Blocks.stone),
'y',
Items.comparator,
'z',
"drawerBasic",
'w',
"ingotGold"));
if (config.isBlockEnabled("controllerSlave")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.controllerSlave),
"xxx",
"yzy",
"xwx",
'x',
new ItemStack(Blocks.stone),
'y',
Items.comparator,
'z',
"drawerBasic",
'w',
"ingotGold"));
// GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgradeTemplate, 2), "xxx", "xyx", "xxx",
// 'x', "stickWood", 'y', "drawerBasic"));
// 'x', "stickWood", 'y', "drawerBasic"));
if (config.cache.enableStorageUpgrades) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 2),
"xyx",
"yzy",
"xyx",
'x',
"ingotIron",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 3),
"xyx",
"yzy",
"xyx",
'x',
"ingotGold",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 4),
"xyx",
"yzy",
"xyx",
'x',
Blocks.obsidian,
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 5),
"xyx",
"yzy",
"xyx",
'x',
"gemDiamond",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 6),
"xyx",
"yzy",
"xyx",
'x',
"gemEmerald",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 2),
"xyx",
"yzy",
"xyx",
'x',
"ingotIron",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 3),
"xyx",
"yzy",
"xyx",
'x',
"ingotGold",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 4),
"xyx",
"yzy",
"xyx",
'x',
Blocks.obsidian,
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 5),
"xyx",
"yzy",
"xyx",
'x',
"gemDiamond",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgrade, 1, 6),
"xyx",
"yzy",
"xyx",
'x',
"gemEmerald",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeDowngrade, 1, 0),
"xyx",
"yzy",
"xyx",
'x',
Items.flint,
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeDowngrade, 1, 0),
"xyx",
"yzy",
"xyx",
'x',
Items.flint,
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
}
if (config.cache.enableIndicatorUpgrades) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeStatus, 1, 1),
"wyw",
"yzy",
"xyx",
'w',
new ItemStack(Blocks.redstone_torch),
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeStatus, 1, 2),
"wyw",
"yzy",
"xyx",
'w',
Items.comparator,
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeStatus, 1, 1),
"wyw",
"yzy",
"xyx",
'w',
new ItemStack(Blocks.redstone_torch),
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeStatus, 1, 2),
"wyw",
"yzy",
"xyx",
'w',
Items.comparator,
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
}
if (config.cache.enableLockUpgrades) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeLock),
"xy ",
" y ",
" z ",
'x',
"nuggetGold",
'y',
"ingotGold",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeLock),
"xy ",
" y ",
" z ",
'x',
"nuggetGold",
'y',
"ingotGold",
'z',
ModItems.upgradeTemplate));
}
if (config.cache.enableVoidUpgrades) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeVoid),
"yyy",
"xzx",
"yyy",
'x',
Blocks.obsidian,
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeVoid),
"yyy",
"xzx",
"yyy",
'x',
Blocks.obsidian,
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
}
if (config.cache.enableRedstoneUpgrades) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeRedstone, 1, 0),
"xyx",
"yzy",
"xyx",
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeRedstone, 1, 1),
"xxx",
"yzy",
"yyy",
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.upgradeRedstone, 1, 2),
"yyy",
"yzy",
"xxx",
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeRedstone, 1, 0),
"xyx",
"yzy",
"xyx",
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeRedstone, 1, 1),
"xxx",
"yzy",
"yyy",
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.upgradeRedstone, 1, 2),
"yyy",
"yzy",
"xxx",
'x',
"dustRedstone",
'y',
"stickWood",
'z',
ModItems.upgradeTemplate));
}
if (config.cache.enableShroudUpgrades) {
@@ -375,81 +390,88 @@ public class ModRecipes {
}
if (config.cache.enableTape) {
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModItems.tape), " x ", "yyy", 'x', "slimeball", 'y', Items.paper));
GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModItems.tape),
" x ",
"yyy",
'x',
"slimeball",
'y',
Items.paper));
}
if (config.cache.enableFramedDrawers) {
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.framingTable), "xxx", "x x", 'x', ModBlocks.trim);
if (config.isBlockEnabled("fulldrawers1"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.fullCustom1, config.getBlockRecipeOutput("fulldrawers1"), 0),
"xxx",
" y ",
"xxx",
'x',
"stickWood",
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers2"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.fullCustom2, config.getBlockRecipeOutput("fulldrawers2"), 0),
"xyx",
"xzx",
"xyx",
'x',
"stickWood",
'y',
"chestWood",
'z',
"plankWood"));
if (config.isBlockEnabled("halfdrawers2"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.halfCustom2, config.getBlockRecipeOutput("halfdrawers2"), 0),
"xyx",
"xzx",
"xyx",
'x',
"stickWood",
'y',
"chestWood",
'z',
"slabWood"));
if (config.isBlockEnabled("fulldrawers4"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.fullCustom4, config.getBlockRecipeOutput("fulldrawers4"), 0),
"yxy",
"xzx",
"yxy",
'x',
"stickWood",
'y',
"chestWood",
'z',
"plankWood"));
if (config.isBlockEnabled("halfdrawers4"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.halfCustom4, config.getBlockRecipeOutput("halfdrawers4"), 0),
"yxy",
"xzx",
"yxy",
'x',
"stickWood",
'y',
"chestWood",
'z',
"slabWood"));
if (config.isBlockEnabled("trim"))
GameRegistry.addRecipe(new ShapedOreRecipe(
new ItemStack(ModBlocks.trimCustom, config.getBlockRecipeOutput("trim"), 0),
"yxy",
"xyx",
"yxy",
'x',
"stickWood",
'y',
"plankWood"));
if (config.isBlockEnabled("fulldrawers1")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.fullCustom1, config.getBlockRecipeOutput("fulldrawers1"), 0),
"xxx",
" y ",
"xxx",
'x',
"stickWood",
'y',
"chestWood"));
if (config.isBlockEnabled("fulldrawers2")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.fullCustom2, config.getBlockRecipeOutput("fulldrawers2"), 0),
"xyx",
"xzx",
"xyx",
'x',
"stickWood",
'y',
"chestWood",
'z',
"plankWood"));
if (config.isBlockEnabled("halfdrawers2")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.halfCustom2, config.getBlockRecipeOutput("halfdrawers2"), 0),
"xyx",
"xzx",
"xyx",
'x',
"stickWood",
'y',
"chestWood",
'z',
"slabWood"));
if (config.isBlockEnabled("fulldrawers4")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.fullCustom4, config.getBlockRecipeOutput("fulldrawers4"), 0),
"yxy",
"xzx",
"yxy",
'x',
"stickWood",
'y',
"chestWood",
'z',
"plankWood"));
if (config.isBlockEnabled("halfdrawers4")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.halfCustom4, config.getBlockRecipeOutput("halfdrawers4"), 0),
"yxy",
"xzx",
"yxy",
'x',
"stickWood",
'y',
"chestWood",
'z',
"slabWood"));
if (config.isBlockEnabled("trim")) GameRegistry.addRecipe(
new ShapedOreRecipe(
new ItemStack(ModBlocks.trimCustom, config.getBlockRecipeOutput("trim"), 0),
"yxy",
"xyx",
"yxy",
'x',
"stickWood",
'y',
"plankWood"));
}
RecipeSorter.register(
@@ -1,18 +1,19 @@
package com.jaquadro.minecraft.storagedrawers.core.api;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.IExtendedDataResolver;
import com.jaquadro.minecraft.storagedrawers.util.UniqueMetaIdentifier;
import com.jaquadro.minecraft.storagedrawers.util.UniqueMetaRegistry;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
public class BlockRegistry {
private Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> registry =
new HashMap<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>>();
private Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> invertRegistry =
new HashMap<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>>();
private Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> registry = new HashMap<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>>();
private Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> invertRegistry = new HashMap<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>>();
public void register(BlockConfiguration config, IExtendedDataResolver resolver) {
for (int i = 0; i < 16; i++) {
@@ -29,7 +30,8 @@ public class BlockRegistry {
}
uniq.register(
UniqueMetaIdentifier.createFor(plankBlock, plankMeta), UniqueMetaIdentifier.createFor(block, meta));
UniqueMetaIdentifier.createFor(plankBlock, plankMeta),
UniqueMetaIdentifier.createFor(block, meta));
UniqueMetaRegistry<UniqueMetaIdentifier> blockReg = invertRegistry.get(config);
if (blockReg == null) {
@@ -38,7 +40,8 @@ public class BlockRegistry {
}
blockReg.register(
UniqueMetaIdentifier.createFor(block, meta), UniqueMetaIdentifier.createFor(plankBlock, plankMeta));
UniqueMetaIdentifier.createFor(block, meta),
UniqueMetaIdentifier.createFor(plankBlock, plankMeta));
}
public Block getBlock(BlockConfiguration config, Block plankBlock, int plankMeta) {
@@ -57,11 +60,8 @@ public class BlockRegistry {
return metaLookup(invertRegistry, config, block, meta);
}
private Block blockLookup(
Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> reg,
BlockConfiguration config,
Block block,
int meta) {
private Block blockLookup(Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> reg,
BlockConfiguration config, Block block, int meta) {
UniqueMetaRegistry<UniqueMetaIdentifier> uniq = reg.get(config);
if (uniq == null) return null;
@@ -71,11 +71,8 @@ public class BlockRegistry {
return id.getBlock();
}
private int metaLookup(
Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> reg,
BlockConfiguration config,
Block block,
int meta) {
private int metaLookup(Map<BlockConfiguration, UniqueMetaRegistry<UniqueMetaIdentifier>> reg,
BlockConfiguration config, Block block, int meta) {
UniqueMetaRegistry<UniqueMetaIdentifier> uniq = reg.get(config);
if (uniq == null) return 0;
@@ -1,5 +1,9 @@
package com.jaquadro.minecraft.storagedrawers.core.api;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.IExtendedDataResolver;
@@ -18,13 +22,12 @@ import com.jaquadro.minecraft.storagedrawers.item.pack.ItemDrawersPack;
import com.jaquadro.minecraft.storagedrawers.item.pack.ItemSortingDrawersPack;
import com.jaquadro.minecraft.storagedrawers.item.pack.ItemSortingTrimPack;
import com.jaquadro.minecraft.storagedrawers.item.pack.ItemTrimPack;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class PackFactory implements IPackBlockFactory {
@Override
public Block createBlock(BlockConfiguration blockConfig, IPackDataResolver dataResolver) {
switch (blockConfig.getBlockType()) {
@@ -32,10 +35,10 @@ public class PackFactory implements IPackBlockFactory {
return new BlockDrawersPack(dataResolver, blockConfig.getDrawerCount(), blockConfig.isHalfDepth())
.setConfigName(getConfigName(blockConfig));
case DrawersSorting:
if (IntegrationRegistry.instance().isModLoaded("RefinedRelocation"))
return new BlockSortingDrawersPack(
dataResolver, blockConfig.getDrawerCount(), blockConfig.isHalfDepth())
.setConfigName(getConfigName(blockConfig));
if (IntegrationRegistry.instance().isModLoaded("RefinedRelocation")) return new BlockSortingDrawersPack(
dataResolver,
blockConfig.getDrawerCount(),
blockConfig.isHalfDepth()).setConfigName(getConfigName(blockConfig));
return null;
case Trim:
return new BlockTrimPack(dataResolver);
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff. Show more