mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 21:09:51 +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,27 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumAddressee {
|
||||
PLAYER, TRADER;
|
||||
|
||||
public static EnumAddressee fromString(String ident) {
|
||||
ident = ident.toLowerCase(Locale.ENGLISH);
|
||||
for(EnumAddressee addr : values()) {
|
||||
if(addr.toString().equals(ident))
|
||||
return addr;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
public enum EnumPostage {
|
||||
P_0(0), P_1(1), P_2(2), P_5(5), P_10(10), P_20(20), P_50(50), P_100(100), P_200(200);
|
||||
|
||||
private final int value;
|
||||
|
||||
private EnumPostage(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
|
||||
public interface ILetter extends IInventory, INBTTagable {
|
||||
|
||||
ItemStack[] getPostage();
|
||||
|
||||
void setProcessed(boolean flag);
|
||||
|
||||
boolean isProcessed();
|
||||
|
||||
boolean isMailable();
|
||||
|
||||
void setSender(IMailAddress address);
|
||||
|
||||
IMailAddress getSender();
|
||||
|
||||
boolean hasRecipient();
|
||||
|
||||
void setRecipient(IMailAddress address);
|
||||
|
||||
IMailAddress[] getRecipients();
|
||||
|
||||
String getRecipientString();
|
||||
|
||||
void setText(String text);
|
||||
|
||||
String getText();
|
||||
|
||||
void addTooltip(List<String> list);
|
||||
|
||||
boolean isPostPaid();
|
||||
|
||||
int requiredPostage();
|
||||
|
||||
void invalidatePostage();
|
||||
|
||||
ItemStack[] getAttachments();
|
||||
|
||||
void addAttachment(ItemStack itemstack);
|
||||
|
||||
void addAttachments(ItemStack[] itemstacks);
|
||||
|
||||
int countAttachments();
|
||||
|
||||
void addStamps(ItemStack stamps);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ILetterHandler {
|
||||
IPostalState handleLetter(World world, IMailAddress recipient, ItemStack letterStack, boolean doLodge);
|
||||
}
|
||||
@@ -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.mail;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
|
||||
public interface IMailAddress extends INBTTagable {
|
||||
|
||||
EnumAddressee getType();
|
||||
String getName();
|
||||
|
||||
boolean isValid();
|
||||
|
||||
boolean isPlayer();
|
||||
boolean isTrader();
|
||||
|
||||
GameProfile getPlayerProfile();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPostOffice {
|
||||
|
||||
void collectPostage(ItemStack[] stamps);
|
||||
|
||||
IPostalState lodgeLetter(World world, ItemStack itemstack, boolean doLodge);
|
||||
|
||||
ItemStack getAnyStamp(int max);
|
||||
|
||||
ItemStack getAnyStamp(EnumPostage postage, int max);
|
||||
|
||||
ItemStack getAnyStamp(EnumPostage[] postages, int max);
|
||||
|
||||
void registerTradeStation(ITradeStation trade);
|
||||
|
||||
void deregisterTradeStation(ITradeStation trade);
|
||||
|
||||
Map<IMailAddress, ITradeStation> getActiveTradeStations(World world);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public interface IPostRegistry {
|
||||
|
||||
/* POST OFFICE */
|
||||
IPostOffice getPostOffice(World world);
|
||||
|
||||
/* MAIL ADDRESSES */
|
||||
IMailAddress getMailAddress(GameProfile gameProfile);
|
||||
IMailAddress getMailAddress(String traderName);
|
||||
|
||||
/* LETTERS */
|
||||
boolean isLetter(ItemStack itemstack);
|
||||
|
||||
ILetter createLetter(IMailAddress sender, IMailAddress recipient);
|
||||
|
||||
ILetter getLetter(ItemStack itemstack);
|
||||
|
||||
ItemStack createLetterStack(ILetter letter);
|
||||
|
||||
/* CARRIERS */
|
||||
/**
|
||||
* Registers a new {@link IPostalCarrier}. See {@link IPostalCarrier} for details.
|
||||
* @param carrier {@link IPostalCarrier} to register.
|
||||
*/
|
||||
void registerCarrier(IPostalCarrier carrier);
|
||||
|
||||
IPostalCarrier getCarrier(EnumAddressee uid);
|
||||
|
||||
Map<EnumAddressee, IPostalCarrier> getRegisteredCarriers();
|
||||
|
||||
/* TRADE STATIONS */
|
||||
void deleteTradeStation(World world, IMailAddress address);
|
||||
|
||||
ITradeStation getOrCreateTradeStation(World world, GameProfile owner, IMailAddress address);
|
||||
|
||||
ITradeStation getTradeStation(World world, IMailAddress address);
|
||||
|
||||
boolean isAvailableTradeAddress(World world, IMailAddress address);
|
||||
|
||||
boolean isValidTradeAddress(World world, IMailAddress address);
|
||||
|
||||
/* PO BOXES */
|
||||
boolean isValidPOBox(World world, IMailAddress address);
|
||||
|
||||
}
|
||||
@@ -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.mail;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Postal Carriers are systems which can be hooked into Forestry's mail system to handle mail delivery.
|
||||
*
|
||||
* The two available carriers in vanilla Forestry are
|
||||
* "player" - Delivers mail to individual players.
|
||||
* "trader" - Handles mail addressed to trade stations.
|
||||
*/
|
||||
public interface IPostalCarrier {
|
||||
|
||||
/**
|
||||
* @return An EnumAddressee identifying the type of carrier
|
||||
*/
|
||||
EnumAddressee getType();
|
||||
|
||||
/**
|
||||
* @return A human-readable name for this carrier.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSprite();
|
||||
|
||||
/**
|
||||
* Handle delivery of a letter addressed to this carrier.
|
||||
* @param world The world the {@link IPostOffice} handles.
|
||||
* @param office {link @IPostOffice} which received this letter and handed it to the carrier.
|
||||
* @param recipient An identifier for the recipient as typed by the player into the address field.
|
||||
* @param letterstack ItemStack representing the letter. See {@link IPostRegistry} for helper functions to validate and extract it.
|
||||
* @param doDeliver Whether or not the letter is supposed to actually be delivered or if delivery is only to be simulated.
|
||||
* @return {link IPostalState} holding information on success or failure for delivery.
|
||||
*/
|
||||
IPostalState deliverLetter(World world, IPostOffice office, IMailAddress recipient, ItemStack letterstack, boolean doDeliver);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
public interface IPostalState {
|
||||
boolean isOk();
|
||||
|
||||
String getIdentifier();
|
||||
|
||||
int ordinal();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IStamps {
|
||||
|
||||
EnumPostage getPostage(ItemStack itemstack);
|
||||
|
||||
}
|
||||
@@ -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.mail;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public interface ITradeStation extends ILetterHandler, IInventory {
|
||||
|
||||
IMailAddress getAddress();
|
||||
|
||||
boolean isValid();
|
||||
|
||||
void invalidate();
|
||||
|
||||
void setVirtual(boolean isVirtual);
|
||||
|
||||
boolean isVirtual();
|
||||
|
||||
TradeStationInfo getTradeInfo();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
|
||||
public class PostManager {
|
||||
public static IPostRegistry postRegistry;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import java.lang.IllegalArgumentException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class TradeStationInfo {
|
||||
public final IMailAddress address;
|
||||
public final GameProfile owner;
|
||||
public final ItemStack tradegood;
|
||||
public final ItemStack[] required;
|
||||
public final IPostalState state;
|
||||
|
||||
public TradeStationInfo(IMailAddress address, GameProfile owner, ItemStack tradegood, ItemStack[] required, IPostalState state) {
|
||||
if (!address.isTrader()) {
|
||||
throw new IllegalArgumentException("TradeStation address must be a trader");
|
||||
}
|
||||
this.address = address;
|
||||
this.owner = owner;
|
||||
this.tradegood = tradegood;
|
||||
this.required = required;
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
@@ -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|mail")
|
||||
package forestry.api.mail;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
Reference in new issue
Block a user