Commit 543ae5f9 authored by Dennis Bonke's avatar Dennis Bonke

Fixed some stuff, maven broke on me again, and we now have a ProjectE compat.

Also don't load Nether Star block stuff if Forbidden Magic is found, let them do it.
Signed-off-by: Dennis Bonke's avatarDennis Bonke <dennisb@kabelfoon.net>
parent f6243a38
......@@ -46,7 +46,7 @@ else
println "!! No build number set !!"
}
project.buildnumber = "3"
project.buildnumber = "5"
version = "1.7.10-0.2.2-B1" + "-" + project.buildnumber
group= "com.advancedmods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
......@@ -114,13 +114,14 @@ dependencies {
//compile "some.group:artifact:version"
compile files(
'deps/Baubles-1.7.10-1.0.1.10-deobf.jar'
'deps/Baubles-1.7.10-1.0.1.10-deobf.jar',
'deps/AMCore-1.7.10-0.2.1-B4-579-dev.jar'
)
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
compile 'com.advancedmods:AMCore:1.7.10-0.2.2-B1-4:dev'
//compile 'com.advancedmods:AMCore:1.7.10-0.2.2-B1-4:dev'
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
......
......@@ -3,6 +3,7 @@ package com.advancedmods.advancedtools;
import com.advancedmods.advancedtools.common.generic.creativetabs.CreativeTabATCombat;
import com.advancedmods.advancedtools.common.generic.creativetabs.CreativeTabATMaterials;
import com.advancedmods.advancedtools.common.generic.creativetabs.CreativeTabATTools;
import com.advancedmods.advancedtools.core.ATCompat;
import com.advancedmods.advancedtools.core.ATProps;
import com.advancedmods.advancedtools.core.ATRegistry;
import com.advancedmods.amcore.core.environment.IMCHandler;
......@@ -106,6 +107,17 @@ public class AdvancedTools extends BaseMod {
log.error("=============================ERROR!=============================");
e.printStackTrace();
}
// Compat stuff
try {
log.info("Initializing compat...");
ATCompat.compatInit();
log.info("Compat initialized");
} catch (Exception e) {
log.error("=============================ERROR!=============================");
log.error("Failed to initialize the compatibility module, printing stacktrace...");
log.error("Please report this as a bug report with the stacktrace, the minecraft log and a mod list + version to: " + issueURL);
log.error("=============================ERROR!=============================");
}
log.info("Init Finished");
log.info("Mod loaded");
}
......
package com.advancedmods.advancedtools.common.compat;
import com.advancedmods.advancedtools.core.ATRegistry;
import cpw.mods.fml.common.Loader;
import moze_intel.projecte.api.ProjectEAPI;
import net.minecraft.init.Blocks;
public class ProjectECompat {
public static void initOP() {
ProjectEAPI.getEMCProxy().registerCustomEMC(Blocks.bedrock, 387420489);
if(!Loader.isModLoaded("ForbiddenMagic")) {
ProjectEAPI.getEMCProxy().registerCustomEMC(ATRegistry.blockNetherStar, 1253376);
}
}
}
package com.advancedmods.advancedtools.core;
import com.advancedmods.advancedtools.common.compat.ProjectECompat;
import cpw.mods.fml.common.Loader;
public class ATCompat {
public static void compatInit() {
if(Loader.isModLoaded("ProjectE")) {
ProjectECompat.initOP();
}
}
}
......@@ -13,7 +13,8 @@ public class ATProps {
public static final String FORGE_BASE = "10.13.4.";
public static final String FORGE_BUILD = "1614";
public static final String FORGE_VERSION = "[" + FORGE_BASE + FORGE_BUILD + "]";
public static final String AMCORE_VERSION = "[" + AMCoreProps.version + "]";
//public static final String AMCORE_VERSION = "[" + AMCoreProps.version + "]";
public static final String AMCORE_VERSION = "[1.7.10R0.2.2B1]";
public static final String BAUBLES_VERSION = "1.0.1.10";
// General Mod stuff
......
......@@ -10,6 +10,7 @@ import com.advancedmods.advancedtools.common.items.tools.ingot.FlintIngot;
import com.advancedmods.advancedtools.common.items.tools.ingot.LapisIngot;
import com.advancedmods.advancedtools.common.items.tools.ingot.NetherionIngot;
import com.advancedmods.advancedtools.common.items.tools.ingot.RedstoneIngot;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
......@@ -195,7 +196,9 @@ public class ATRegistry {
// Blocks
// Nether star
GameRegistry.registerBlock(blockNetherStar, "netherstarblock");
if(!Loader.isModLoaded("ForbiddenMagic")) {
GameRegistry.registerBlock(blockNetherStar, "netherstarblock");
}
// Items
// Ingots
......@@ -363,7 +366,9 @@ public class ATRegistry {
//OreDictionary.registerOre("ingotNetherion", new ItemStack(netherionIngot));
// Blocks
OreDictionary.registerOre("blockNetherStar", new ItemStack(blockNetherStar));
if(!Loader.isModLoaded("ForbiddenMagic")) {
OreDictionary.registerOre("blockNetherStar", new ItemStack(blockNetherStar));
}
// Nuggets
//OreDictionary.registerOre("nuggetEnderion", new ItemStack(ModItems.enderionNugget));
......@@ -384,9 +389,11 @@ public class ATRegistry {
// Blocks
// Nether star
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockNetherStar), "sss", "sss", "sss", 's', "materialNetherStar"));
if(!Loader.isModLoaded("ForbiddenMagic")) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockNetherStar), "sss", "sss", "sss", 's', "materialNetherStar"));
GameRegistry.addShapelessRecipe(new ItemStack(Items.nether_star, 9), new Object[]{ATRegistry.blockNetherStar});
}
//GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.nether_star), "s", 's', ATRegistry.blockNetherStar));
GameRegistry.addShapelessRecipe(new ItemStack(Items.nether_star, 9), new Object[]{ATRegistry.blockNetherStar});
// Armor
// Emerald
......
package moze_intel.projecte.api;
import cpw.mods.fml.common.FMLLog;
import moze_intel.projecte.api.proxy.IEMCProxy;
import moze_intel.projecte.api.proxy.IBlacklistProxy;
import moze_intel.projecte.api.proxy.IConversionProxy;
import moze_intel.projecte.api.proxy.ITransmutationProxy;
public final class ProjectEAPI
{
private static IEMCProxy emcProxy;
private static ITransmutationProxy transProxy;
private static IBlacklistProxy blacklistProxy;
private static IConversionProxy recipeProxy;
private ProjectEAPI() {}
/**
* Retrieves the proxy for EMC-based API queries.
* @return The proxy for EMC-based API queries
*/
public static IEMCProxy getEMCProxy()
{
if (emcProxy == null)
{
try
{
Class<?> clazz = Class.forName("moze_intel.moze_intel.projecte.impl.EMCProxyImpl");
emcProxy = (IEMCProxy) clazz.getField("instance").get(null);
} catch (ReflectiveOperationException ex)
{
FMLLog.warning("[ProjectEAPI] Error retrieving EMCProxyImpl, ProjectE may be absent, damaged, or outdated.");
}
}
return emcProxy;
}
/**
* Retrieves the proxy for EMC-Recipe-Calculation-based API queries.
* @return The proxy for EMC-Recipe-Calculation-based API queries
*/
public static IConversionProxy getConversionProxy()
{
if (recipeProxy == null)
{
try
{
Class<?> clazz = Class.forName("moze_intel.moze_intel.projecte.impl.ConversionProxyImpl");
recipeProxy = (IConversionProxy) clazz.getField("instance").get(null);
} catch (ReflectiveOperationException ex)
{
FMLLog.warning("[ProjectEAPI] Error retrieving ConversionProxyImpl, ProjectE may be absent, damaged, or outdated.");
}
}
return recipeProxy;
}
/**
* Retrieves the proxy for Transmutation-based API queries.
* @return The proxy for Transmutation-based API queries
*/
public static ITransmutationProxy getTransmutationProxy()
{
if (transProxy == null)
{
try
{
Class<?> clazz = Class.forName("moze_intel.moze_intel.projecte.impl.TransmutationProxyImpl");
transProxy = (ITransmutationProxy) clazz.getField("instance").get(null);
} catch (ReflectiveOperationException ex)
{
FMLLog.warning("[ProjectEAPI] Error retrieving TransmutationProxyImpl, ProjectE may be absent, damaged, or outdated.");
}
}
return transProxy;
}
/**
* Retrieves the proxy for black/whitelist-based API queries.
* @return The proxy for black/whitelist-based API queries
*/
public static IBlacklistProxy getBlacklistProxy()
{
if (blacklistProxy == null)
{
try
{
Class<?> clazz = Class.forName("moze_intel.moze_intel.projecte.impl.BlacklistProxyImpl");
blacklistProxy = (IBlacklistProxy) clazz.getField("instance").get(null);
} catch (ReflectiveOperationException ex)
{
FMLLog.warning("[ProjectEAPI] Error retrieving BlacklistProxyImpl, ProjectE may be absent, damaged, or outdated.");
}
}
return blacklistProxy;
}
}
\ No newline at end of file
package moze_intel.projecte.api.event;
import cpw.mods.fml.common.eventhandler.Event;
/**
* This event is fired after all EMC values are recalculated
* This event is not cancelable, and has no result
* This event is fired on MinecraftForge#EVENT_BUS
*/
public class EMCRemapEvent extends Event {}
package moze_intel.projecte.api.event;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.eventhandler.Event;
/**
* This event is fired after a players transmutation knowledge is changed
* This event is not cancelable, and has no result
* This event is fired on MinecraftForge#EVENT_BUS
*/
public class PlayerKnowledgeChangeEvent extends Event
{
public final UUID playerUUID;
public PlayerKnowledgeChangeEvent(EntityPlayer entityPlayer)
{
playerUUID = entityPlayer.getUniqueID();
}
}
package moze_intel.projecte.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* This interfaces specifies items that perform a specific function every tick when inside an Alchemical Bag, on a player
*
* @author williewillus
*/
public interface IAlchBagItem
{
/**
* Called on both client and server every time the alchemical bag ticks this item
*
* @param inv The inventory of the bag
* @param player The player whose bag is being ticked
* @param stack The ItemStack being ticked
* @return Whether the inventory was changed by this item ticking
*/
boolean updateInAlchBag(ItemStack[] inv, EntityPlayer player, ItemStack stack);
}
package moze_intel.projecte.api.item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* This interface specifies items that perform a specific function every tick when inside an Alchemical Chest
*
* @author williewillus
*/
public interface IAlchChestItem
{
/**
* Called on both client and server every time the alchemical chest ticks this item
* Implementers that modify the chest inventory (serverside) MUST call markDirty() on the tile entity.
* If you do not, your changes may not be saved when the world/chunk unloads!
*
* @param world The World
* @param stack The ItemStack being ticked
*/
void updateInAlchChest(World world, int x, int y, int z, ItemStack stack);
}
package moze_intel.projecte.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* This interface specifies items that perform a specific function when the Extra Function key is activated (default C)
*/
public interface IExtraFunction
{
/**
* Called serverside when the server receives a Extra Function key packet
* @param stack The ItemStack performing this function
* @param player The player performing this function
*/
void doExtraFunction(ItemStack stack, EntityPlayer player);
}
package moze_intel.projecte.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* This interface specifies items that have a charge that changes when the respective keybinding is activated (default V)
*/
public interface IItemCharge
{
/**
* Returns the current charge on the given ItemStack
* @param stack Stack whose charge we want
* @return The charge on the stack
*/
byte getCharge(ItemStack stack);
/**
* Called serverside when the player presses the charge keybinding; reading sneaking state is up to you
* @param player The player
* @param stack The item being charged
*/
void changeCharge(EntityPlayer player, ItemStack stack);
}
package moze_intel.projecte.api.item;
import net.minecraft.item.ItemStack;
/**
* This interface defines the contract for items that wish to expose their internal EMC storage for external manipulation
*
* @author williewillus
*/
public interface IItemEmc
{
/**
* Adds EMC to the itemstack
* @param stack The itemstack to add to
* @param toAdd The maximum amount to add
* @return The amount that was actually added
*/
double addEmc(ItemStack stack, double toAdd);
/**
* Extracts EMC from the itemstack
* @param stack The itemstack to remove from
* @param toRemove The maximum amount to remove
* @return The amount that was actually extracted
*/
double extractEmc(ItemStack stack, double toRemove);
/**
* Gets the current EMC this stack is showing to the public
* @param stack The stack to query
* @return The current publicly-accessible EMC stored in this stack
*/
double getStoredEmc(ItemStack stack);
/**
* Gets the maximum EMC that is allowed to be stored in this stack
* @param stack The stack to query
* @return The maximum amount of publicly-accessible EMC that can be stored in this stack
*/
double getMaximumEmc(ItemStack stack);
}
package moze_intel.projecte.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* This interface specifies items that switch between modes when the mode switch keybind is activated (default G)
*/
public interface IModeChanger
{
/**
* Gets the mode from this ItemStack
* @param stack The stack we want the mode of
* @return The mode of this ItemStack
*/
byte getMode(ItemStack stack);
/**
* Called serverside when the player presses change mode
* @param player The player pressing the change mode key
* @param stack The stack whose mode we are changing
*/
void changeMode(EntityPlayer player, ItemStack stack);
}
package moze_intel.projecte.api.item;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
/**
* This interface specifies items that perform a specific function every tick when inside an activated Dark Matter Pedestal
*
* @author williewillus
*/
public interface IPedestalItem {
String TOOLTIPDISABLED = EnumChatFormatting.RED + StatCollector.translateToLocal("pe.pedestal.item_disabled");
/***
* Called on both client and server each time an active DMPedestalTile ticks with this item inside
*/
void updateInPedestal(World world, int x, int y, int z);
/***
* Called clientside when inside the pedestal gui to add special function descriptions
* @return Brief strings describing the item's function in an activated pedestal
*/
List<String> getPedestalDescription();
}
package moze_intel.projecte.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* This interface specifies items that fire a projectile when the Shoot Projectile keybind is activated (default R)
*/
public interface IProjectileShooter
{
/**
* Called serverside when the player presses the Fire Projectile Button
* @param player The player pressing the key
* @param stack The stack we are using to shoot
* @return If the projectile was actually fired
*/
boolean shootProjectile(EntityPlayer player, ItemStack stack);
}
/**
* Increment apiVersion every time the API changes.
* (Adding methods, removing methods, changing method signatures, etc.)
*/
@API(owner = "ProjectE", apiVersion = "7", provides = "ProjectEAPI")
package moze_intel.projecte.api;
import cpw.mods.fml.common.API;
package moze_intel.projecte.api.proxy;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public interface IBlacklistProxy
{
/**
* Blacklist an Entity class from being repelled by the Interdiction Torch
* Call this during the postinit phase
* @param clazz The entity class to blacklist
*/
void blacklistInterdiction(Class<? extends Entity> clazz);
/**
* Blacklist an Entity class from being repelled by the SWRG's repel mode
* Call this during the postinit phase
* @param clazz The entity class to blacklist
*/
void blacklistSwiftwolf(Class<? extends Entity> clazz);
/**
* Prevent the Watch of Flowing Time from speeding up this TileEntity
* Modders: Use this only to prevent things from breaking badly - leave balance to the modpacker and player
* Call this during the postinit phase
* @param clazz The TileEntity to blacklist
*/
void blacklistTimeWatch(Class<? extends TileEntity> clazz);
/**
* Whitelist an ItemStack, allowing stacks of its kind to dupe NBT during Transmutation and Condensation
* Call this during the postinit phase
* @param stack The stack to whitelist
*/
void whitelistNBT(ItemStack stack);
}
package moze_intel.projecte.api.proxy;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import java.util.Map;
public interface IConversionProxy
{
/**
* Add a Conversion to the EMC Calculation.
*
* Adding a Conversion allows ProjectE to calculate the EMC value for the output based on the specified ingredients.
* These do not need to be actually Conversions. You can use it to make the EMC value of an item relative to the EMC value of other items.
* ProjectE will automatically select the Conversion with the lowest EMC value.
*
* Has to be called after {@code FMLInitializationEvent} and before {@code FMLServerStartingEvent}.
*
* You can use the following things for the {@code output}-Parameter and the keys in the {@code ingredients} Map:
* <ul>
* <li>{@link ItemStack} - The ItemId and Metadata will be used to identify this ItemStack (May contain a {@code Block} or {@code Item}). You can use {@link net.minecraftforge.oredict.OreDictionary#WILDCARD_VALUE} as metadata.</li>
* <li>{@link Block} - Same as calling it with {@code new ItemStack(block)}. Uses the Id and metadata = 0</li>
* <li>{@link Item} - Same as calling it with {@code new ItemStack(item)}. Uses the Id and metadata = 0</li>
* <li>{@link FluidStack} - {@link FluidStack#getFluid()} and {@link Fluid#getName()} will be used to identify this Fluid.</li>
* <li>{@link String} - will be interpreted as an OreDictionary name.</li>
* <li>{@link Object} - (No subclasses of {@code Object} - only {@code Object}!) can be used as a intermediate fake object for complex conversion.</li>
* </ul>
* All {@code Object}s will be assumed to be a single instance. No stacksize will be used.
*
* Use the {@code amount} parameter to specify how many {@code output}s are created.
* Use the value in the {@code ingredients}-Map to specify how much of an ingredient is required.
* (Use Millibuckets for Fluids)
*
* Examples:
*
* <pre>{@code
* //Furnace Crafting Recipe:
* addConversion(1, Blocks.furnace, ImmutableMap.of((Object)Blocks.cobblestone, 8));
* //alternatively:
* addConversion(1, Blocks.furnace, ImmutableMap.<Object, Integer>of(Blocks.cobblestone, 8));
*
* //Bed Crafting Recipe with OreDictionary Names:
* //3 "plankWood" and 3 "blockWool" turn into 1 Blocks.bed
* addConversion(1, Blocks.bed, ImmutableMap.<Object, Integer>of("plankWood", 3, "blockWool", 3));
*
* //For Recipes that have multiple possible Ingredients, that don't belong to a known OreDict entry you can use a fake-item Object:
* Object blackOrWhite = new Object();
* //1 White Wool can be turned into 1 'blackOrWhite'
* addConversion(1, blackOrWhite, ImmutableMap.of((Object)new ItemStack(Blocks.wool, 1, 0), 1));
* //1 Black Wool can be turned into 1 'blackOrWhite'
* addConversion(1, blackOrWhite, ImmutableMap.of((Object)new ItemStack(Blocks.wool, 1, 15), 1));
* //Bed created with black or white wool only
* addConversion(1, Blocks.bed, ImmutableMap.of(blackOrWhite, 3, "plankWood", 3));
* }
* </pre>
*
* @param amount
* @param output
* @param ingredients
*/
void addConversion(int amount, Object output, Map<Object, Integer> ingredients);
}
\ No newline at end of file
package moze_intel.projecte.api.proxy;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.Map;
public interface IEMCProxy
{
/**
* Registers a custom EMC value for this ItemStack
* Call this during any of the main loading phases (Preinit, Init, Postinit)
* @param stack The stack we want to define EMC for
* @param value The value to define. Values below 0 are changed to 0
*/
void registerCustomEMC(ItemStack stack, int value);
/**
* Register a custom EMC value for emc calculation that is used in Recipes.
* You can use the following things for the {@code o}-Parameter:
* <ul>
* <li>{@link ItemStack} - The Modname:unlocalizedName and Metadata will be used to identify this ItemStack (May contain a {@code Block} or {@code Item})</li>
* <li>{@link String} - will be interpreted as an OreDictionary name.</li>
* <li>{@link Object} - (No subclasses of {@code Object} - only {@code Object}!) can be used as a intermediate fake object for complex recipes.</li>
* </ul>
* @param o
* @param value
* @see IConversionProxy#addConversion(int, Object, Map)
*/
void registerCustomEMC(Object o, int value);
/**
* Queries the EMC value registry if the given block has an EMC value
* Can be called at any time, but will only return valid results if a world is loaded
* Can be called on both sides
* @param block The block we want to query
* @return Whether the block has an emc value
*/
boolean hasValue(Block block);
/**
* Queries the EMC value registry if the given item with a damage value of 0 has an EMC value
* Can be called at any time, but will only return valid results if a world is loaded
* Can be called on both sides
* @param item The item we want to query
* @return Whether the item has an emc value
*/
boolean hasValue(Item item);
/**
* Queries the EMC value registry if the given ItemStack has an EMC value
* This will also use the damage value to check if the Item has an EMC value
* Can be called at any time, but will only return valid results if a world is loaded
* Can be called on both sides
* @param stack The stack we want to query
* @return Whether the ItemStack has an emc value
*/
boolean hasValue(ItemStack stack);
/**
* Queries the EMC value for the provided block
* Can be called at any time, but will only return valid results if a world is loaded