pahimar 2013-12-31 00:25:47 -05:00
parent bf7eeb97ed
commit 98188ba872
9 changed files with 20 additions and 79 deletions

View file

@ -1,4 +1,4 @@
package com.pahimar.ee3.handler; package com.pahimar.ee3.client.handler;
import com.pahimar.ee3.configuration.ConfigurationSettings; import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.helper.TransmutationHelper; import com.pahimar.ee3.helper.TransmutationHelper;

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.handler; package com.pahimar.ee3.client.handler;
import com.pahimar.ee3.helper.KeyBindingHelper; import com.pahimar.ee3.client.helper.KeyBindingHelper;
import com.pahimar.ee3.item.IKeyBound; import com.pahimar.ee3.item.IKeyBound;
import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.network.PacketTypeHandler; import com.pahimar.ee3.network.PacketTypeHandler;
@ -9,6 +9,8 @@ import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.KeyBindingRegistry; import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -22,6 +24,7 @@ import java.util.EnumSet;
* *
* @author pahimar * @author pahimar
*/ */
@SideOnly(Side.CLIENT)
public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler
{ {
public KeyBindingHandler() public KeyBindingHandler()
@ -53,7 +56,7 @@ public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler
{ {
if (currentItem.getItem() instanceof IKeyBound) if (currentItem.getItem() instanceof IKeyBound)
{ {
if (!KeyBindingHelper.isClientSided(kb.keyDescription)) if (player.worldObj.isRemote)
{ {
PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketKeyPressed(kb.keyDescription))); PacketDispatcher.sendPacketToServer(PacketTypeHandler.populatePacket(new PacketKeyPressed(kb.keyDescription)));
} }

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.handler; package com.pahimar.ee3.client.handler;
import com.pahimar.ee3.client.renderer.RenderUtils; import com.pahimar.ee3.client.helper.RenderUtils;
import com.pahimar.ee3.configuration.ConfigurationSettings; import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.helper.TransmutationHelper; import com.pahimar.ee3.helper.TransmutationHelper;
import com.pahimar.ee3.item.ITransmutationStone; import com.pahimar.ee3.item.ITransmutationStone;

View file

@ -1,6 +1,7 @@
package com.pahimar.ee3.helper; package com.pahimar.ee3.client.helper;
import com.pahimar.ee3.configuration.ConfigurationSettings; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import java.util.ArrayList; import java.util.ArrayList;
@ -12,15 +13,14 @@ import java.util.ArrayList;
* *
* @author pahimar * @author pahimar
*/ */
@SideOnly(Side.CLIENT)
public class KeyBindingHelper public class KeyBindingHelper
{ {
private static ArrayList<KeyBinding> keyBindingsList;
public static ArrayList<KeyBinding> keyBindingsList; private static ArrayList<Boolean> isRepeatingList;
public static ArrayList<Boolean> isRepeatingList;
public static void addKeyBinding(String name, int value) public static void addKeyBinding(String name, int value)
{ {
if (keyBindingsList == null) if (keyBindingsList == null)
{ {
keyBindingsList = new ArrayList<KeyBinding>(); keyBindingsList = new ArrayList<KeyBinding>();
@ -31,7 +31,6 @@ public class KeyBindingHelper
public static void addIsRepeating(boolean value) public static void addIsRepeating(boolean value)
{ {
if (isRepeatingList == null) if (isRepeatingList == null)
{ {
isRepeatingList = new ArrayList<Boolean>(); isRepeatingList = new ArrayList<Boolean>();
@ -42,13 +41,11 @@ public class KeyBindingHelper
public static KeyBinding[] gatherKeyBindings() public static KeyBinding[] gatherKeyBindings()
{ {
return keyBindingsList.toArray(new KeyBinding[keyBindingsList.size()]); return keyBindingsList.toArray(new KeyBinding[keyBindingsList.size()]);
} }
public static boolean[] gatherIsRepeating() public static boolean[] gatherIsRepeating()
{ {
boolean[] isRepeating = new boolean[isRepeatingList.size()]; boolean[] isRepeating = new boolean[isRepeatingList.size()];
for (int x = 0; x < isRepeating.length; x++) for (int x = 0; x < isRepeating.length; x++)
@ -58,11 +55,4 @@ public class KeyBindingHelper
return isRepeating; return isRepeating;
} }
// TODO Still not ideal, won't work for every case. Specifically, make it context sensitive
public static boolean isClientSided(String keybinding)
{
return keybinding.equalsIgnoreCase(ConfigurationSettings.KEYBINDING_TOGGLE);
}
} }

View file

@ -1,4 +1,4 @@
package com.pahimar.ee3.client.renderer; package com.pahimar.ee3.client.helper;
import com.pahimar.ee3.lib.Textures; import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;

View file

@ -19,7 +19,6 @@ import java.util.Comparator;
*/ */
public class ItemHelper public class ItemHelper
{ {
private static double rand; private static double rand;
/** /**
@ -68,7 +67,6 @@ public class ItemHelper
} }
else else
{ {
NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY); NBTTagCompound displayTagCompound = nbtTagCompound.getCompoundTag(Strings.NBT_ITEM_DISPLAY);
return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16); return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16);
} }
@ -78,12 +76,10 @@ public class ItemHelper
{ {
if (itemStack != null) if (itemStack != null)
{ {
NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
if (nbtTagCompound == null) if (nbtTagCompound == null)
{ {
nbtTagCompound = new NBTTagCompound(); nbtTagCompound = new NBTTagCompound();
itemStack.setTagCompound(nbtTagCompound); itemStack.setTagCompound(nbtTagCompound);
} }
@ -114,7 +110,6 @@ public class ItemHelper
public static Comparator<ItemStack> comparator = new Comparator<ItemStack>() public static Comparator<ItemStack> comparator = new Comparator<ItemStack>()
{ {
public int compare(ItemStack itemStack1, ItemStack itemStack2) public int compare(ItemStack itemStack1, ItemStack itemStack2)
{ {

View file

@ -1,44 +0,0 @@
package com.pahimar.ee3.helper;
import net.minecraft.item.ItemStack;
/**
* Equivalent-Exchange-3
* <p/>
* QualityHelper
*
* @author pahimar
*/
public class QualityHelper
{
private static int[][] dustTable = {{0, 0, 0, 1, 1, 1}, {0, 1, 1, 1, 2, 2}, {0, 1, 2, 2, 2, 2}, {1, 1, 2, 3, 3, 3}, {1, 2, 2, 3, 4, 4}, {1, 2, 2, 3, 4, 5},};
public static int getItemTierQuality(ItemStack item)
{
// TODO Return the 'Tier' level of the given ItemStack
return -1;
}
public static int getFuelTierQuality(ItemStack fuel)
{
// TODO Return the 'Tier' level of the given ItemStack
return -1;
}
public static int getDustTierQuality(ItemStack item, ItemStack fuel)
{
if (getItemTierQuality(item) >= 0 && getItemTierQuality(item) <= 5)
{
if (getFuelTierQuality(fuel) >= 0 && getFuelTierQuality(fuel) <= 5)
{
return dustTable[getItemTierQuality(item)][getFuelTierQuality(fuel)];
}
}
return -1;
}
}

View file

@ -5,16 +5,13 @@ import net.minecraft.util.ResourceLocation;
public class ResourceLocationHelper public class ResourceLocationHelper
{ {
public static ResourceLocation getResourceLocation(String modId, String path) public static ResourceLocation getResourceLocation(String modId, String path)
{ {
return new ResourceLocation(modId, path); return new ResourceLocation(modId, path);
} }
public static ResourceLocation getResourceLocation(String path) public static ResourceLocation getResourceLocation(String path)
{ {
return getResourceLocation(Reference.MOD_ID.toLowerCase(), path); return getResourceLocation(Reference.MOD_ID.toLowerCase(), path);
} }
} }

View file

@ -2,7 +2,11 @@ package com.pahimar.ee3.proxy;
import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.client.audio.SoundHandler; import com.pahimar.ee3.client.audio.SoundHandler;
import com.pahimar.ee3.client.handler.DrawBlockHighlightHandler;
import com.pahimar.ee3.client.handler.ItemTooltipEventHandler; import com.pahimar.ee3.client.handler.ItemTooltipEventHandler;
import com.pahimar.ee3.client.handler.KeyBindingHandler;
import com.pahimar.ee3.client.handler.TransmutationTargetOverlayHandler;
import com.pahimar.ee3.client.helper.KeyBindingHelper;
import com.pahimar.ee3.client.renderer.item.ItemAlchemicalChestRenderer; import com.pahimar.ee3.client.renderer.item.ItemAlchemicalChestRenderer;
import com.pahimar.ee3.client.renderer.item.ItemAludelRenderer; import com.pahimar.ee3.client.renderer.item.ItemAludelRenderer;
import com.pahimar.ee3.client.renderer.item.ItemCalcinatorRenderer; import com.pahimar.ee3.client.renderer.item.ItemCalcinatorRenderer;
@ -11,11 +15,7 @@ import com.pahimar.ee3.client.renderer.tileentity.TileEntityAlchemicalChestRende
import com.pahimar.ee3.client.renderer.tileentity.TileEntityAludelRenderer; import com.pahimar.ee3.client.renderer.tileentity.TileEntityAludelRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityCalcinatorRenderer; import com.pahimar.ee3.client.renderer.tileentity.TileEntityCalcinatorRenderer;
import com.pahimar.ee3.client.renderer.tileentity.TileEntityGlassBellRenderer; import com.pahimar.ee3.client.renderer.tileentity.TileEntityGlassBellRenderer;
import com.pahimar.ee3.handler.DrawBlockHighlightHandler;
import com.pahimar.ee3.handler.KeyBindingHandler;
import com.pahimar.ee3.handler.TransmutationTargetOverlayHandler;
import com.pahimar.ee3.helper.ItemHelper; import com.pahimar.ee3.helper.ItemHelper;
import com.pahimar.ee3.helper.KeyBindingHelper;
import com.pahimar.ee3.helper.TransmutationHelper; import com.pahimar.ee3.helper.TransmutationHelper;
import com.pahimar.ee3.item.IChargeable; import com.pahimar.ee3.item.IChargeable;
import com.pahimar.ee3.lib.ActionTypes; import com.pahimar.ee3.lib.ActionTypes;