mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-10-25 20:22:26 +00:00
Baubles Expanded 2.0.0 beta 1
This commit is contained in:
1 parent
a962fb8a95
commit
32600f753a
24 files changed
+460
-277
No files matched your search
@@ -1,11 +1,11 @@
|
||||
Baubles
|
||||
=======
|
||||
|
||||
A mod api that adds 8 bauble slots to the players inventory.
|
||||
A mod api that adds up to twenty bauble slots to the players inventory.
|
||||
|
||||
The mod has no real content - the idea is that other mods will use this one and its API to add their own baubles.
|
||||
|
||||
The 8 slots added are an amulet, belt, head, body, charm, gauntlet and 2 ring slots.
|
||||
The slots added by default are an amulet, belt, and two ring slots.
|
||||
|
||||
Baubles is distributed under the Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license.
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ repositories {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.7.10-1.0.1.10"
|
||||
version = "2.0.0-beta1"
|
||||
group= "com.azanor.baubles"
|
||||
archivesBaseName = "Baubles"
|
||||
archivesBaseName = "Baubles-Expanded-1.7.10"
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
@@ -2,9 +2,9 @@ package baubles.api;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
/**
|
||||
* @author Azanor
|
||||
|
||||
@@ -7,92 +7,131 @@ import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderState;
|
||||
|
||||
public class BaubleExpandedSlots {
|
||||
|
||||
//The total number of slots that can be added.
|
||||
//Please keep in mind that increases to this limit are possible with minimal changes.
|
||||
public static final int slotLimit = 20;
|
||||
|
||||
//Fallback for if a slot type cannot be found
|
||||
//The type used in place of null.
|
||||
public static final String unknownType = "unknown";
|
||||
//All "default" types will be registered automatically.
|
||||
|
||||
//Ppre-registered types.
|
||||
public static final String ringType = "ring";
|
||||
public static final String amuletType = "amulet";
|
||||
public static final String beltType = "belt";
|
||||
public static final String headType = "head";
|
||||
public static final String bodyType = "body";
|
||||
public static final String charmType = "charm";
|
||||
public static final String shieldType = "shield";
|
||||
public static final String gauntletType = "gauntlet";
|
||||
public static final String capeType = "cape";
|
||||
public static final String shieldType = "shield";
|
||||
public static final String quiverType = "quiver";
|
||||
public static final String gauntletType = "gauntlet";
|
||||
|
||||
private static String[] slots = new String[slotLimit];
|
||||
private static ArrayList<String> registeredTypes = new ArrayList<String>();
|
||||
static {
|
||||
registeredTypes.add(unknownType);
|
||||
registeredTypes.add(ringType);
|
||||
registeredTypes.add(amuletType);
|
||||
registeredTypes.add(beltType);
|
||||
registeredTypes.add(headType);
|
||||
registeredTypes.add(bodyType);
|
||||
registeredTypes.add(charmType);
|
||||
registeredTypes.add(shieldType);
|
||||
registeredTypes.add(gauntletType);
|
||||
registeredTypes.add(capeType);
|
||||
}
|
||||
private static int newSlotsRemaining = slotLimit;
|
||||
|
||||
//TODO: Sort slots, locked after post init
|
||||
//TODO: Prevent items in the wrong slot from applying effects
|
||||
//TODO: Lock removing slots added during pre init
|
||||
//TODO: Option to show all slots
|
||||
|
||||
/**
|
||||
* Tries to add a new slot type if the loader state is currently
|
||||
* in Pre Initialization and the slot type has not already been registered.
|
||||
* Registers a type and returns true if the type could be or has been registered.
|
||||
* Types can only be registered while the loader state is pre-initialization.
|
||||
*
|
||||
* @return If adding a type was successful
|
||||
* @param type The type to register.
|
||||
* @return If a type was registered or had been registered previously.
|
||||
*/
|
||||
public static boolean tryRegisterType(String type) {
|
||||
if(type != null && type.length() > 0 && Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION && !registeredTypes.contains(type)) {
|
||||
registeredTypes.add(type);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if(type != null && type.length() > 0) {
|
||||
if(isTypeRegistered(type)) {
|
||||
return true;
|
||||
} else {
|
||||
if(Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION) {
|
||||
registeredTypes.add(type);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int indexOfTypeInRegisteredTypes(String type) {
|
||||
return registeredTypes.indexOf(type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns if the type is registered or not.
|
||||
* Returns false if the type is unregistered or unknown, the minimum number of
|
||||
* assigned slots cannot be met, or the loader state is not pre-initialization.
|
||||
*
|
||||
* @return If the type is registered or not
|
||||
*/
|
||||
public static boolean isTypeRegistered(String type) {
|
||||
return registeredTypes.contains(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered bauble types.
|
||||
* If Pre Initialization is done this list is effectively final.
|
||||
* @param type The type of the slot to evaluate and possibly assign.
|
||||
* @param minumumOfType The minimum slots of type to be assigned.
|
||||
*
|
||||
* @return The currently registered bauble types
|
||||
* @return If the total assigned slots of the specified type equals or is more than the minimum.
|
||||
*/
|
||||
public static ArrayList<String> getCurrentlyRegisteredTypes() {
|
||||
return registeredTypes;
|
||||
public static boolean tryAssignSlotsUpToMinimum(String type, int minumumOfType) {
|
||||
if(minumumOfType >= 1 && isTypeRegistered(type) && !type.equals(unknownType) && Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION) {
|
||||
int total = 0;
|
||||
for(int slotToCheck = 0; slotToCheck < slotLimit; slotToCheck++) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
if(total < minumumOfType) {
|
||||
total = minumumOfType - total;
|
||||
for(int i = 0; i < total; i++) {
|
||||
if(newSlotsRemaining >= 1) {
|
||||
assignedSlots[slotLimit - newSlotsRemaining] = type;
|
||||
newSlotsRemaining--;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns if a new slot was added successfully.
|
||||
* Does not add a slot type if the type is unregistered or no slots are free.
|
||||
*
|
||||
* @param type The type of the slot to be added
|
||||
* @return If adding a slot was successful or not
|
||||
*/
|
||||
public static boolean tryAddSlot(String type) {
|
||||
if(newSlotsRemaining >= 1 && registeredTypes.contains(type)) {
|
||||
slots[slotLimit - newSlotsRemaining] = type;
|
||||
* Returns false if the type is unregistered or unknown, or the
|
||||
* loader state is not pre-initialization.
|
||||
*
|
||||
* @param type The type of the slot to evaluate and possibly unassign.
|
||||
* @param minumumOfType The minimum slots of type to be assigned.
|
||||
*
|
||||
* @return If the total assigned slots of the specified type equals or is less then the maximum.
|
||||
*/
|
||||
public static boolean tryUnassignSlotsDownToMaximum(String type, int maximumOfType) {
|
||||
if(maximumOfType < 0) maximumOfType = 0;
|
||||
if(isTypeRegistered(type) && !type.equals(unknownType) && Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION) {
|
||||
int total = 0;
|
||||
for(int slotToCheck = 0; slotToCheck < slotLimit; slotToCheck++) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
if(total > maximumOfType) {
|
||||
total -= maximumOfType;
|
||||
for(int i = 0; i < total; i++) {
|
||||
for(int slotToCheck = slotsCurrentlyUsed(); slotToCheck > 0; slotToCheck--) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
for(int slotToMove = slotToCheck + 1; slotToMove < slotLimit; slotToMove++) {
|
||||
assignedSlots[slotToMove - 1] = assignedSlots[slotToMove];
|
||||
}
|
||||
assignedSlots[slotLimit - 1] = unknownType;
|
||||
newSlotsRemaining++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if a slot was assigned successfully.
|
||||
* Does not assign a slot type if the type is unregistered, no slots
|
||||
* are free, or the loader state is not pre-initialization.
|
||||
*
|
||||
* @param type The type of the slot to be assigned.
|
||||
*
|
||||
* @return If assigning a slot was successful or not.
|
||||
*/
|
||||
public static boolean tryAssignSlotOfType(String type) {
|
||||
if(newSlotsRemaining >= 1 && isTypeRegistered(type) && !type.equals(unknownType) && Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION) {
|
||||
assignedSlots[slotLimit - newSlotsRemaining] = type;
|
||||
newSlotsRemaining--;
|
||||
return true;
|
||||
} else {
|
||||
@@ -100,82 +139,130 @@ public class BaubleExpandedSlots {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a slot of the specified type if one can be found.
|
||||
/**
|
||||
* Unassigns the last slot of the specified type if one can be found
|
||||
* and the loader state is not pre-initialization.
|
||||
*
|
||||
* @param type The type of the slot to be removed
|
||||
* @return If removing a slot was successful or not
|
||||
* @param type The type of the slot to be removed.
|
||||
*
|
||||
* @return If unassigning a slot was successful or not.
|
||||
*/
|
||||
public static boolean tryRemoveSlot(String type) {
|
||||
if(Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION && newSlotsRemaining < slotLimit)
|
||||
for(int slotToCheck = 0; slotToCheck < slotsCurrentlyUsed(); slotToCheck++) {
|
||||
if(slots[slotToCheck].equals(type)) {
|
||||
for(int slotToMove = slotToCheck + 1; slotToMove < slotLimit; slotToMove++) {
|
||||
slots[slotToMove - 1] = slots[slotToMove];
|
||||
public static boolean tryUnassignSlotOfType(String type) {
|
||||
if(newSlotsRemaining < slotLimit && type != null && !type.equals(unknownType) && Loader.instance().getLoaderState() == LoaderState.PREINITIALIZATION) {
|
||||
for(int slotToCheck = slotsCurrentlyUsed(); slotToCheck > 0; slotToCheck--) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
for(int slotToMove = slotToCheck + 1; slotToMove < slotLimit; slotToMove++) {
|
||||
assignedSlots[slotToMove - 1] = assignedSlots[slotToMove];
|
||||
}
|
||||
assignedSlots[slotLimit - 1] = unknownType;
|
||||
newSlotsRemaining++;
|
||||
return true;
|
||||
}
|
||||
slots[slotLimit - 1] = null;
|
||||
newSlotsRemaining++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current number of slots with a matching type.
|
||||
*
|
||||
* @param type The type of slot being counted
|
||||
* @return The current total number of matching slots found
|
||||
*/
|
||||
public static int totalCurrentSlotsOfType(String type) {
|
||||
* Returns the current number of slots with a matching type.
|
||||
*
|
||||
* @param type The type of slot being counted.
|
||||
*
|
||||
* @return The current total number of matching slots found.
|
||||
*/
|
||||
public static int totalCurrentlyAssignedSlotsOfType(String type) {
|
||||
int total = 0;
|
||||
for(int slotToCheck = 0; slotToCheck < slotLimit; slotToCheck++) {
|
||||
if(slots[slotToCheck].equals(type)) {
|
||||
total++;
|
||||
if(isTypeRegistered(type)) {
|
||||
for(int slotToCheck = 0; slotToCheck < slotLimit; slotToCheck++) {
|
||||
if(assignedSlots[slotToCheck].equals(type)) {
|
||||
total++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bauble slots that are currently used.
|
||||
*
|
||||
* @return The number of bauble slots currently used
|
||||
*/
|
||||
* Returns if the type is registered or not.
|
||||
*
|
||||
* @param type The type to check the registration of.
|
||||
*
|
||||
* @return If the type is registered or not.
|
||||
*/
|
||||
public static boolean isTypeRegistered(String type) {
|
||||
return registeredTypes.contains(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bauble slots that are currently used.
|
||||
*
|
||||
* @return The number of bauble slots currently used.
|
||||
*/
|
||||
public static int slotsCurrentlyUsed() {
|
||||
return slotLimit - newSlotsRemaining;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of bauble slots that are currently unused.
|
||||
*
|
||||
* @return The number of bauble slots currently unused
|
||||
*/
|
||||
* Returns the number of bauble slots that are currently unused.
|
||||
*
|
||||
* @return The number of bauble slots currently unused.
|
||||
*/
|
||||
public static int slotsCurrentlyUnused() {
|
||||
return newSlotsRemaining;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the specified slot or null if none or out of range.
|
||||
*
|
||||
* @param slot The slot to check
|
||||
* @return The type of the specified slot or "unknown"
|
||||
*/
|
||||
* Returns the type of the specified slot, "unknown" if out of range.
|
||||
*
|
||||
* @param slot The slot to check
|
||||
* @return The type of the specified slot or unknown.
|
||||
*/
|
||||
public static String getSlotType(int slot) {
|
||||
if (slot >= 0 & slot < slotLimit) {
|
||||
return slots[slot];
|
||||
return assignedSlots[slot];
|
||||
} else {
|
||||
return unknownType;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type based on the specified BaubleType.
|
||||
*
|
||||
* @param type The BaubleType to get a matching type from
|
||||
* @return The type matching the BaubleType or "unknown"
|
||||
*/
|
||||
* Returns the index of a certain type in the registeredType array
|
||||
* or -1 if it cannot be found.
|
||||
*
|
||||
* @param type The type to get the index of
|
||||
* @return Index of a type or negative one
|
||||
*/
|
||||
public static int getIndexOfTypeInRegisteredTypes(String type) {
|
||||
return registeredTypes.indexOf(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered bauble types.
|
||||
* If pre-initialization is done this list is effectively final.
|
||||
*
|
||||
* @return The currently registered bauble types.
|
||||
*/
|
||||
public static ArrayList<String> getCurrentlyRegisteredTypes() {
|
||||
return registeredTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current slot assignments as a string array.
|
||||
* If initialization is done this list is effectively final.
|
||||
*
|
||||
* @return The current contents of the slots array.
|
||||
*/
|
||||
public static String[] getCurrentSlotAssignments() {
|
||||
return assignedSlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a type based on the specified BaubleType.
|
||||
*
|
||||
* @param type The BaubleType to get a matching type from.
|
||||
*
|
||||
* @return The type matching the BaubleType or unknown.
|
||||
*/
|
||||
public static String getTypeFromBaubleType(BaubleType type) {
|
||||
switch(type) {
|
||||
case RING:
|
||||
@@ -189,4 +276,53 @@ public class BaubleExpandedSlots {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only intended to be used by the Baubles manualSlotSelection config option, if it is enabled.
|
||||
* Overrides assigned slots with the contents of a string array.
|
||||
* Any entry that would go over slotLimit is ignored.
|
||||
* If an array is shorter than slotLimit all remaining slots are set to unknown.
|
||||
* Invalid slot types are set to unknown.
|
||||
*
|
||||
* @param overrideSlots The array to override assigned slots with.
|
||||
*/
|
||||
public static void overrideSlots(String[] overrideSlots) {
|
||||
if(Loader.instance().getLoaderState() == LoaderState.INITIALIZATION) {
|
||||
newSlotsRemaining = 0;
|
||||
for(int slot = 0; slot < slotLimit; slot++) {
|
||||
if(slot < overrideSlots.length && isTypeRegistered(overrideSlots[slot])) {
|
||||
assignedSlots[slot] = overrideSlots[slot];
|
||||
newSlotsRemaining++;
|
||||
} else {
|
||||
assignedSlots[slot] = unknownType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int newSlotsRemaining;
|
||||
private static String[] assignedSlots = new String[slotLimit];
|
||||
private static ArrayList<String> registeredTypes = new ArrayList<String>();
|
||||
static {
|
||||
registeredTypes.add(unknownType);
|
||||
registeredTypes.add(ringType);
|
||||
registeredTypes.add(amuletType);
|
||||
registeredTypes.add(beltType);
|
||||
registeredTypes.add(headType);
|
||||
registeredTypes.add(bodyType);
|
||||
registeredTypes.add(charmType);
|
||||
registeredTypes.add(capeType);
|
||||
registeredTypes.add(shieldType);
|
||||
registeredTypes.add(quiverType);
|
||||
registeredTypes.add(gauntletType);
|
||||
|
||||
assignedSlots[0] = amuletType;
|
||||
assignedSlots[1] = ringType;
|
||||
assignedSlots[2] = ringType;
|
||||
assignedSlots[3] = beltType;
|
||||
newSlotsRemaining = slotLimit - 4;
|
||||
for(int slot = 4; slot < slotLimit; slot++) {
|
||||
assignedSlots[slot] = unknownType;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,8 +13,8 @@ public interface IBaubleExpanded extends IBauble {
|
||||
|
||||
/**
|
||||
* This method returns the types of bauble slots this item can go into.
|
||||
* getBaubleType is ignored when using IBaubleExpanded.
|
||||
* Original slots can be used by putting "AMULET" "RING" or BELT" in the array.
|
||||
* getBaubleType is generally ignored when using IBaubleExpanded, so it can return null unless you want backwards compatibility with official bauble builds.
|
||||
* Pre-registered slot types can be found in BaubleExpandedSlots, but it is possible to add more during pre-initialization.
|
||||
*/
|
||||
public String[] getBaubleTypes (ItemStack itemstack);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@API(owner = "Baubles", apiVersion = "1.0.1.10", provides = "Baubles|API")
|
||||
@API(owner = "Baubles", apiVersion = "2.0.0", provides = "Baubles|API")
|
||||
package baubles.api;
|
||||
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
|
||||
package baubles.client;
|
||||
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import baubles.client.gui.GuiEvents;
|
||||
import baubles.client.gui.GuiPlayerExpanded;
|
||||
import baubles.common.Baubles;
|
||||
@@ -12,6 +8,10 @@ import baubles.common.CommonProxy;
|
||||
import baubles.common.event.KeyHandler;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@ package baubles.client.gui;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import baubles.common.network.PacketHandler;
|
||||
import baubles.common.network.PacketOpenBaublesInventory;
|
||||
import baubles.common.network.PacketOpenNormalInventory;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
public class GuiEvents {
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package baubles.client.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.BaublesConfig;
|
||||
import baubles.common.container.ContainerPlayerExpanded;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.achievement.GuiAchievements;
|
||||
import net.minecraft.client.gui.achievement.GuiStats;
|
||||
@@ -7,19 +14,11 @@ import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.container.ContainerPlayerExpanded;
|
||||
|
||||
public class GuiPlayerExpanded extends InventoryEffectRenderer {
|
||||
|
||||
public static final ResourceLocation background = new ResourceLocation("baubles","textures/gui/bauble_inventory.png");
|
||||
@@ -73,8 +72,8 @@ public class GuiPlayerExpanded extends InventoryEffectRenderer {
|
||||
mc.getTextureManager().bindTexture(background);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
for (int i1 = 4; i1 < BaubleExpandedSlots.slotsCurrentlyUsed() + 4; ++i1) {
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1);
|
||||
for (int slotIndex = 4; slotIndex < (BaublesConfig.showUnusedSlots ? BaubleExpandedSlots.slotLimit : BaubleExpandedSlots.slotsCurrentlyUsed()) + 4; slotIndex++) {
|
||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(slotIndex);
|
||||
drawTexturedModalRect(guiLeft + slot.xDisplayPosition - 1, guiTop + slot.yDisplayPosition - 1, 200, 0, 18, 18);
|
||||
}
|
||||
drawPlayerModel(guiLeft + 51, guiTop + 75, 30, (float)(guiLeft + 51) - this.xSizeFloat, (float)(guiTop + 75 - 50) - this.ySizeFloat, this.mc.thePlayer);
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.File;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.common.event.EventHandlerEntity;
|
||||
import baubles.common.event.EventHandlerNetwork;
|
||||
import baubles.common.network.PacketHandler;
|
||||
@@ -19,56 +18,54 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
@Mod(modid = Baubles.MODID, name = Baubles.MODNAME, version = Baubles.VERSION)
|
||||
|
||||
public class Baubles {
|
||||
|
||||
public static final String MODID = "Baubles";
|
||||
public static final String MODNAME = "Baubles";
|
||||
public static final String VERSION = "1.0.1.10";
|
||||
public static final String MODID = "Baubles";
|
||||
public static final String MODNAME = "Baubles";
|
||||
public static final String VERSION = "2.0.0";
|
||||
|
||||
@SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
@SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@Instance(value=Baubles.MODID)
|
||||
public static Baubles instance;
|
||||
@Instance(value=Baubles.MODID)
|
||||
public static Baubles instance;
|
||||
|
||||
public EventHandlerEntity entityEventHandler;
|
||||
public EventHandlerNetwork entityEventNetwork;
|
||||
public File modDir;
|
||||
public EventHandlerEntity entityEventHandler;
|
||||
public EventHandlerNetwork entityEventNetwork;
|
||||
|
||||
public static final Logger log = LogManager.getLogger("Baubles");
|
||||
public static final int GUI = 0;
|
||||
public static final Logger log = LogManager.getLogger("Baubles");
|
||||
public static final int GUI = 0;
|
||||
|
||||
public static final Item itemDebugger = new ItemDebugger().setUnlocalizedName("baubleSlotDebugTool");
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
event.getModMetadata().version = Baubles.VERSION;
|
||||
modDir = event.getModConfigurationDirectory();
|
||||
public static final Item itemDebugger = new ItemDebugger().setUnlocalizedName("baubleSlotDebugTool");
|
||||
|
||||
PacketHandler.init();
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
event.getModMetadata().version = Baubles.VERSION;
|
||||
|
||||
entityEventHandler = new EventHandlerEntity();
|
||||
entityEventNetwork = new EventHandlerNetwork();
|
||||
PacketHandler.init();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(entityEventHandler);
|
||||
FMLCommonHandler.instance().bus().register(entityEventNetwork);
|
||||
proxy.registerHandlers();
|
||||
entityEventHandler = new EventHandlerEntity();
|
||||
entityEventNetwork = new EventHandlerNetwork();
|
||||
|
||||
BaubleExpandedSlots.tryAddSlot(BaubleExpandedSlots.amuletType);
|
||||
BaubleExpandedSlots.tryAddSlot(BaubleExpandedSlots.ringType);
|
||||
BaubleExpandedSlots.tryAddSlot(BaubleExpandedSlots.ringType);
|
||||
BaubleExpandedSlots.tryAddSlot(BaubleExpandedSlots.beltType);
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.register(entityEventHandler);
|
||||
FMLCommonHandler.instance().bus().register(entityEventNetwork);
|
||||
proxy.registerHandlers();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
//This config is intentionally loaded later than normal.
|
||||
BaublesConfig.loadConfig(new Configuration(new File(Launch.minecraftHome, "config" + File.separator + "baubles.cfg")));
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||
proxy.registerKeyBindings();
|
||||
GameRegistry.registerItem(itemDebugger, "bauble_slot_debug_tool", Baubles.MODID);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||
proxy.registerKeyBindings();
|
||||
GameRegistry.registerItem(itemDebugger, "bauble_slot_debug_tool", Baubles.MODID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package baubles.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class BaublesConfig {
|
||||
|
||||
public static boolean hideDebugItem = true;
|
||||
|
||||
public static boolean showUnusedSlots = false;
|
||||
public static boolean manualSlotSelection = false;
|
||||
|
||||
public static String[] overrideSlotTypes = new String[] {
|
||||
BaubleExpandedSlots.amuletType,
|
||||
BaubleExpandedSlots.ringType,
|
||||
BaubleExpandedSlots.ringType,
|
||||
BaubleExpandedSlots.beltType
|
||||
};
|
||||
|
||||
static final String categoryDebug = "debug";
|
||||
static final String categoryMenu = "menu";
|
||||
static final String categoryOverride = "override";
|
||||
|
||||
public static void loadConfig(Configuration config) {
|
||||
|
||||
ArrayList<String> currentlyRegisteredTypes = BaubleExpandedSlots.getCurrentlyRegisteredTypes();
|
||||
String[] currentSlotAssignments = BaubleExpandedSlots.getCurrentSlotAssignments();
|
||||
|
||||
//categoryDebug
|
||||
hideDebugItem = config.getBoolean("hideDebugItem", categoryDebug, hideDebugItem, "Hide the Bauble debug item from creative tabs and NEI.\n");
|
||||
|
||||
//categoryMenu
|
||||
showUnusedSlots = config.getBoolean("showUnusedSlots", categoryMenu, showUnusedSlots, "Display unused Bauble slots.\n");
|
||||
manualSlotSelection = config.getBoolean("manualSlotSelection", categoryMenu, manualSlotSelection, "Manually override slot assignments.\n!Bauble slot types must be configured manually with this option enabled!\n");
|
||||
|
||||
//categoryOverride
|
||||
config.getStringList("defualtSlotTypes", categoryOverride, new String[] {}, "Baubles and its addons assigned the folowing types to the bauble slots.\n!This config option automatically changes to reflect what Baubles and its addons assigned each time the game is launched!");
|
||||
config.getCategory(categoryOverride).get("defualtSlotTypes").set(currentSlotAssignments);
|
||||
|
||||
overrideSlotTypes = config.getStringList("slotTypeOverrides", categoryOverride, overrideSlotTypes,
|
||||
"Slot assignments to use if manualSlotSelection is enabled.\nAny assignents after the first " +
|
||||
BaubleExpandedSlots.slotLimit + " will be ignored.\n!Adding, moving, or removing slots of the "
|
||||
+ BaubleExpandedSlots.amuletType + ", " + BaubleExpandedSlots.ringType + ", or " + BaubleExpandedSlots.beltType +
|
||||
" types will reduce compatibility with mods made with official Baubles versions!\n",
|
||||
currentlyRegisteredTypes.toArray(new String[currentlyRegisteredTypes.size()])
|
||||
);
|
||||
|
||||
if(manualSlotSelection) {
|
||||
BaubleExpandedSlots.overrideSlots(overrideSlotTypes);
|
||||
}
|
||||
|
||||
if(config.hasChanged()) {
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
package baubles.common;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import baubles.common.container.ContainerPlayerExpanded;
|
||||
import baubles.common.event.KeyHandler;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,59 +2,54 @@ package baubles.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
|
||||
public ItemDebugger() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
public ItemDebugger() {
|
||||
super();
|
||||
this.setMaxStackSize(1);
|
||||
this.setHasSubtypes(true);
|
||||
setCreativeTab(BaublesConfig.hideDebugItem ? null : CreativeTabs.tabTools);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] icons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
icons = new IIcon[BaubleExpandedSlots.getCurrentlyRegisteredTypes().size()];
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
icons[i] = ir.registerIcon("baubles:empty_bauble_slot_" + BaubleExpandedSlots.getCurrentlyRegisteredTypes().get(i));
|
||||
}
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
icons = new IIcon[BaubleExpandedSlots.getCurrentlyRegisteredTypes().size()];
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
icons[i] = ir.registerIcon("baubles:empty_bauble_slot_" + BaubleExpandedSlots.getCurrentlyRegisteredTypes().get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta >= icons.length ? 0 : meta];
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta >= icons.length ? 0 : meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
if(!BaublesConfig.hideDebugItem) {
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +70,7 @@ public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add("Valid bauble slot types:");
|
||||
list.add("Usable bauble slot types:");
|
||||
for(String type : getBaubleTypes(itemStack)) {
|
||||
list.add(type);
|
||||
}
|
||||
@@ -116,11 +111,10 @@ public class ItemDebugger extends Item implements IBaubleExpanded {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getBackgroundIconForSlotType(String type) {
|
||||
if(type != null && BaubleExpandedSlots.isTypeRegistered(type)) {
|
||||
return icons[BaubleExpandedSlots.indexOfTypeInRegisteredTypes(type)];
|
||||
return icons[BaubleExpandedSlots.getIndexOfTypeInRegisteredTypes(type)];
|
||||
} else {
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +1,20 @@
|
||||
package baubles.common.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.util.IIcon;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import baubles.common.BaublesConfig;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ContainerPlayerExpanded extends Container {
|
||||
public InventoryBaubles baubles;
|
||||
@@ -61,11 +56,14 @@ public class ContainerPlayerExpanded extends Container {
|
||||
final int slotOffset = 18;
|
||||
final int slotStartX = 80;
|
||||
final int slotStartY = 8;
|
||||
final int totalBaubleSlots = BaubleExpandedSlots.slotsCurrentlyUsed();
|
||||
|
||||
//bauble slots
|
||||
for(i = 0; i < totalBaubleSlots; i++) {
|
||||
addSlotToContainer(new SlotBauble(baubles, BaubleExpandedSlots.getSlotType(i), i, slotStartX + (slotOffset * (i / 4)), slotStartY + (slotOffset * (i % 4))));
|
||||
for(i = 0; i < BaubleExpandedSlots.slotLimit; i++) {
|
||||
String slotType = BaubleExpandedSlots.getSlotType(i);
|
||||
if(!BaublesConfig.showUnusedSlots && slotType.equals(BaubleExpandedSlots.unknownType)) {
|
||||
continue;
|
||||
}
|
||||
addSlotToContainer(new SlotBauble(baubles, slotType, i, slotStartX + (slotOffset * (i / 4)), slotStartY + (slotOffset * (i % 4))));
|
||||
}
|
||||
|
||||
//inventory slots
|
||||
@@ -94,7 +92,7 @@ public class ContainerPlayerExpanded extends Container {
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot)inventorySlots.get(slotIndex);
|
||||
final int totalBaubleSlots = BaubleExpandedSlots.slotsCurrentlyUsed();
|
||||
final int visibleBaubleSlots = BaublesConfig.showUnusedSlots ? BaubleExpandedSlots.slotLimit : BaubleExpandedSlots.slotsCurrentlyUsed();
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
@@ -106,8 +104,8 @@ public class ContainerPlayerExpanded extends Container {
|
||||
if (!mergeItemStack(itemstack1, j, j + 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (slotIndex >= 4 + totalBaubleSlots && item instanceof IBauble && ((IBauble)item).canEquip(itemstack, thePlayer)) {
|
||||
for(int baubleSlot = 4; baubleSlot < 4 + totalBaubleSlots; baubleSlot++) {
|
||||
} else if (slotIndex >= 4 + visibleBaubleSlots && item instanceof IBauble && ((IBauble)item).canEquip(itemstack, thePlayer)) {
|
||||
for(int baubleSlot = 4; baubleSlot < 4 + visibleBaubleSlots; baubleSlot++) {
|
||||
if(!((Slot)inventorySlots.get(baubleSlot)).getHasStack()) {
|
||||
String[] types;
|
||||
if(item instanceof IBaubleExpanded) {
|
||||
@@ -122,15 +120,15 @@ public class ContainerPlayerExpanded extends Container {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (slotIndex >= 4 + totalBaubleSlots && slotIndex < 31 + totalBaubleSlots) {
|
||||
if (!mergeItemStack(itemstack1, 31 + totalBaubleSlots, 40 + totalBaubleSlots, false)) {
|
||||
} else if (slotIndex >= 4 + visibleBaubleSlots && slotIndex < 31 + visibleBaubleSlots) {
|
||||
if (!mergeItemStack(itemstack1, 31 + visibleBaubleSlots, 40 + visibleBaubleSlots, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (slotIndex >= 31 + totalBaubleSlots && slotIndex < 40 + totalBaubleSlots) {
|
||||
if (!mergeItemStack(itemstack1, 4 + totalBaubleSlots, 31 + totalBaubleSlots, false)) {
|
||||
} else if (slotIndex >= 31 + visibleBaubleSlots && slotIndex < 40 + visibleBaubleSlots) {
|
||||
if (!mergeItemStack(itemstack1, 4 + visibleBaubleSlots, 31 + visibleBaubleSlots, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!mergeItemStack(itemstack1, 4 + totalBaubleSlots, 40 + totalBaubleSlots, false, slot)) {
|
||||
} else if (!mergeItemStack(itemstack1, 4 + visibleBaubleSlots, 40 + visibleBaubleSlots, false, slot)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@ package baubles.common.container;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.network.PacketHandler;
|
||||
import baubles.common.network.PacketSyncBauble;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,13 +20,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.network.PacketHandler;
|
||||
import baubles.common.network.PacketSyncBauble;
|
||||
|
||||
public class InventoryBaubles implements IInventory {
|
||||
public ItemStack[] stackList;
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
package baubles.common.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
@@ -15,6 +8,12 @@ import baubles.common.Baubles;
|
||||
import baubles.common.ItemDebugger;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class SlotBauble extends Slot {
|
||||
|
||||
@@ -29,7 +28,11 @@ public class SlotBauble extends Slot {
|
||||
|
||||
public SlotBauble(IInventory inventory, String type, int slot, int x, int y) {
|
||||
super(inventory, slot, x, y);
|
||||
slotType = type;
|
||||
if(type == null) {
|
||||
slotType = BaubleExpandedSlots.unknownType;
|
||||
} else {
|
||||
slotType = type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +40,7 @@ public class SlotBauble extends Slot {
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
if (stack == null || slotType == null) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,17 +3,16 @@ package baubles.common.event;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import baubles.api.IBauble;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
public class EventHandlerEntity {
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package baubles.common.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class EventHandlerNetwork {
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package baubles.common.event;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import baubles.common.network.PacketHandler;
|
||||
@@ -14,6 +11,8 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class KeyHandler {
|
||||
|
||||
|
||||
@@ -5,13 +5,13 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.container.InventoryBaubles;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
public class PlayerHandler {
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package baubles.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import baubles.common.Baubles;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class PacketOpenBaublesInventory implements IMessage, IMessageHandler<PacketOpenBaublesInventory, IMessage> {
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package baubles.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class PacketOpenNormalInventory implements IMessage, IMessageHandler<PacketOpenNormalInventory, IMessage> {
|
||||
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
package baubles.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.world.World;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PacketSyncBauble implements IMessage, IMessageHandler<PacketSyncBauble, IMessage> {
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 137 B |
Reference in new issue
Block a user