mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-24 05:44:24 +00:00
Get things compiling.
Move ForestryAPI into the Forestry project instead of as a submodule Include the new RF API Remove code for mods that have not yet ported to 1.8.9 (add it back later) Bump version to 5.0.0
This commit is contained in:
1 parent
73812d8765
commit
8da0c0dc95
325 files changed
+9600
-4026
No files matched your search
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
|
||||
public abstract class BackpackEvent extends Event {
|
||||
|
||||
public final EntityPlayer player;
|
||||
public final IBackpackDefinition backpackDefinition;
|
||||
public final IInventory backpackInventory;
|
||||
|
||||
public BackpackEvent(EntityPlayer player, IBackpackDefinition backpackDefinition, IInventory backpackInventory) {
|
||||
this.player = player;
|
||||
this.backpackDefinition = backpackDefinition;
|
||||
this.backpackInventory = backpackInventory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BackpackManager {
|
||||
/**
|
||||
* 0 - Miner's Backpack 1 - Digger's Backpack 2 - Forester's Backpack 3 - Hunter's Backpack 4 - Adventurer's Backpack
|
||||
*
|
||||
* Use IMC messages to achieve the same effect!
|
||||
*/
|
||||
public static ArrayList<ItemStack>[] backpackItems;
|
||||
|
||||
public static IBackpackInterface backpackInterface;
|
||||
|
||||
/**
|
||||
* Only use this if you know what you are doing. Prefer backpackInterface.
|
||||
*/
|
||||
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<String, IBackpackDefinition>();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
/**
|
||||
* Use @SubscribeEvent on a method taking this event as an argument. Will fire whenever a backpack tries to resupply to a player inventory. Processing will stop
|
||||
* if the event is canceled.
|
||||
*/
|
||||
@Cancelable
|
||||
public class BackpackResupplyEvent extends BackpackEvent {
|
||||
|
||||
public BackpackResupplyEvent(EntityPlayer player, IBackpackDefinition backpackDefinition, IInventory backpackInventory) {
|
||||
super(player, backpackDefinition, backpackInventory);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
/**
|
||||
* Use @SubscribeEvent on a method taking this event as an argument. Will fire whenever a backpack tries to store an item. Processing will stop if the stacksize
|
||||
* of stackToStow drops to 0 or less or the event is canceled.
|
||||
*/
|
||||
@Cancelable
|
||||
public class BackpackStowEvent extends BackpackEvent {
|
||||
|
||||
public final ItemStack stackToStow;
|
||||
|
||||
public BackpackStowEvent(EntityPlayer player, IBackpackDefinition backpackDefinition, IInventory backpackInventory, ItemStack stackToStow) {
|
||||
super(player, backpackDefinition, backpackInventory);
|
||||
this.stackToStow = stackToStow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
public enum EnumBackpackType {
|
||||
APIARIST, T1, T2
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IBackpackDefinition {
|
||||
|
||||
/**
|
||||
* @return A unique string identifier
|
||||
*/
|
||||
String getKey();
|
||||
|
||||
/**
|
||||
* @return Human-readable name of the backpack.
|
||||
*/
|
||||
String getName(ItemStack backpack);
|
||||
|
||||
/**
|
||||
* @return Primary colour for the backpack icon.
|
||||
*/
|
||||
int getPrimaryColour();
|
||||
|
||||
/**
|
||||
* @return Secondary colour for backpack icon.
|
||||
*/
|
||||
int getSecondaryColour();
|
||||
|
||||
/**
|
||||
* Adds an item as valid for this backpack.
|
||||
*
|
||||
* @param validItem
|
||||
*/
|
||||
void addValidItem(ItemStack validItem);
|
||||
void addValidItems(List<ItemStack> validItems);
|
||||
|
||||
/**
|
||||
* Returns true if the itemstack is a valid item for this backpack type.
|
||||
*/
|
||||
boolean isValidItem(ItemStack itemstack);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public interface IBackpackInterface {
|
||||
|
||||
/**
|
||||
* Adds a backpack with the given definition and type, returning the item.
|
||||
*
|
||||
* @param definition
|
||||
* Definition of backpack behaviour.
|
||||
* @param type
|
||||
* Type of backpack. (T1 or T2 (= Woven)
|
||||
* @return Created backpack item.
|
||||
*/
|
||||
Item addBackpack(IBackpackDefinition definition, EnumBackpackType type);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICrateRegistry {
|
||||
|
||||
/**
|
||||
* Makes a new crate, registers it with the game registry with uid,
|
||||
* and creates crating and uncrating recipes for the Carpenter.
|
||||
* The icon is rendered automatically from the contained item.
|
||||
*
|
||||
* Can only be called during the Init stage.
|
||||
*/
|
||||
void registerCrate(Item item, String uid);
|
||||
void registerCrate(Block block, String uid);
|
||||
void registerCrate(ItemStack stack, String uid);
|
||||
|
||||
/**
|
||||
* Same as the above, but uses the ore dictionary for the Carpenter crating recipe.
|
||||
*/
|
||||
void registerCrateUsingOreDict(Item item, String uid);
|
||||
void registerCrateUsingOreDict(Block block, String uid);
|
||||
void registerCrateUsingOreDict(ItemStack stack, String uid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
public class StorageManager {
|
||||
|
||||
public static ICrateRegistry crateRegistry;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion="3.0.0", owner="ForestryAPI|core", provides="ForestryAPI|storage")
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
Reference in new issue
Block a user