Merge remote-tracking branch 'origin/master' into endercore

Conflicts:
	src/main/java/crazypants/enderio/conduit/ConduitRecipes.java
	src/main/java/crazypants/enderio/conduit/item/ItemConduitNetwork.java
	src/main/java/crazypants/enderio/gui/IconButtonEIO.java
	src/main/java/crazypants/enderio/machine/MachineRecipes.java
	src/main/java/crazypants/enderio/machine/crafter/TileCrafter.java
	src/main/java/crazypants/enderio/machine/enchanter/GuiEnchanter.java
	src/main/java/crazypants/enderio/machine/farm/FarmersRegistry.java
	src/main/java/crazypants/enderio/machine/spawner/GuiPoweredSpawner.java
	src/main/java/crazypants/enderio/material/MaterialRecipes.java
	src/main/java/crazypants/enderio/teleport/anchor/BlockTravelAnchor.java
	src/main/java/crazypants/enderio/teleport/telepad/TileTelePad.java
	src/main/java/crazypants/gui/GuiContainerBase.java
	src/main/java/crazypants/gui/GuiScreenBase.java
	src/main/java/crazypants/gui/IGuiScreen.java
	src/main/java/crazypants/gui/ToolTipManager.java
	src/main/java/crazypants/util/FluidUtil.java
This commit is contained in:
tterrag1098 committed 2015-06-21 12:29:39 -04:00
commit 4ad7b364f7
133 files changed
+3211 -2205

No files matched your search

+1 -1
View File
@@ -6,6 +6,6 @@ public class CoFHAPIProps {
}
public static final String VERSION = "1.7.10R1.0.3";
public static final String VERSION = "1.7.10R1.0.12";
}
@@ -0,0 +1,51 @@
package cofh.api.block;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on blocks that can mimic the appearance of other blocks. Note that this is meant to be available server-side, so ensure the code is
* server-safe and doesn't use client-side code.
*
*/
public interface IBlockAppearance {
/**
* This function returns the block that is being shown on a given side.
*
* @param world
* Reference to the world.
* @param x
* X coordinate of the block.
* @param y
* Y coordinate of the block.
* @param z
* Z coordinate of the block.
* @param side
* The side of the block.
*/
public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side);
/**
* This function returns metadata of the block that is being shown on a given side.
*
* @param world
* Reference to the world.
* @param x
* X coordinate of the block.
* @param y
* Y coordinate of the block.
* @param z
* Z coordinate of the block.
* @param side
* The side of the block.
*/
public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side);
/**
* This function returns whether the block's renderer will visually connect to other blocks implementing IBlockAppearance.
*/
public boolean supportsVisualConnections();
}
@@ -0,0 +1,31 @@
package cofh.api.block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on blocks which have a GUI that needs a tool (e.g., multimeter) to open.
*
*/
public interface IBlockConfigGui {
/**
* This function will open a GUI if the player has permission.
*
* @param world
* Reference to the world.
* @param x
* X coordinate of the block.
* @param y
* Y coordinate of the block.
* @param z
* Z coordinate of the block.
* @param side
* The side of the block.
* @param player
* Player doing the configuring.
* @return True if the GUI was opened.
*/
public boolean openConfigGui(IBlockAccess world, int x, int y, int z, ForgeDirection side, EntityPlayer player);
}
@@ -6,15 +6,15 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on blocks which have some debug method which can be activated via a tool or other means.
*
*
* @author King Lemming
*
*
*/
public interface IBlockDebug {
/**
* This function debugs a block.
*
*
* @param world
* Reference to the world.
* @param x
+3 -3
View File
@@ -12,15 +12,15 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on blocks which can provide information about themselves. If the block contains Tile Entities, then it is recommended that this
* function serve as a passthrough for {@link ITileInfo}.
*
*
* @author King Lemming
*
*
*/
public interface IBlockInfo {
/**
* This function appends information to a list provided to it.
*
*
* @param world
* Reference to the world.
* @param x
@@ -8,9 +8,9 @@ import net.minecraft.world.World;
/**
* Implemented on Blocks which have some method of being instantly dismantled.
*
*
* @author King Lemming
*
*
*/
public interface IDismantleable {
@@ -4,9 +4,9 @@ import net.minecraft.nbt.NBTTagCompound;
/**
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
*
*
* @author King Lemming
*
*
*/
public class EnergyStorage implements IEnergyStorage {
@@ -89,7 +89,7 @@ public class EnergyStorage implements IEnergyStorage {
/**
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
* are guaranteed to have it.
*
*
* @param energy
*/
public void setEnergyStored(int energy) {
@@ -106,7 +106,7 @@ public class EnergyStorage implements IEnergyStorage {
/**
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
* externally, as not all IEnergyHandlers are guaranteed to have it.
*
*
* @param energy
*/
public void modifyEnergyStored(int energy) {
@@ -7,9 +7,9 @@ import net.minecraftforge.common.util.ForgeDirection;
* accept it; otherwise just use IEnergyHandler.
* <p>
* Note that {@link IEnergyHandler} is an extension of this.
*
*
* @author King Lemming
*
*
*/
public interface IEnergyConnection {
@@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack;
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
* <p>
* A reference implementation is provided {@link ItemEnergyContainer}.
*
*
* @author King Lemming
*
*
*/
public interface IEnergyContainerItem {
/**
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
*
*
* @param container
* ItemStack to be charged.
* @param maxReceive
@@ -28,7 +28,7 @@ public interface IEnergyContainerItem {
/**
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
* discharged.
*
*
* @param container
* ItemStack to be discharged.
* @param maxExtract
@@ -42,7 +42,6 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
@Override
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
@@ -5,15 +5,15 @@ package cofh.api.energy;
* This is not to be implemented on TileEntities. This is for internal use only.
* <p>
* A reference implementation can be found at {@link EnergyStorage}.
*
*
* @author King Lemming
*
*
*/
public interface IEnergyStorage {
/**
* Adds energy to the storage. Returns quantity of energy that was accepted.
*
*
* @param maxReceive
* Maximum amount of energy to be inserted.
* @param simulate
@@ -24,7 +24,7 @@ public interface IEnergyStorage {
/**
* Removes energy from the storage. Returns quantity of energy that was removed.
*
*
* @param maxExtract
* Maximum amount of energy to be extracted.
* @param simulate
@@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
/**
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
*
*
* @author King Lemming
*
*
*/
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
@@ -7,18 +7,18 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on TileEntities which should handle items.
*
*
* A reference implementation is provided {@link TileInventoryHandler}.
*
*
* @author King Lemming
*
*
*/
public interface IInventoryHandler extends IInventoryConnection {
/**
* Insert an ItemStack into the IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns what is remaining of the
* original stack - a null return means that the entire stack was accepted!
*
*
* @param from
* Orientation the item is inserted from.
* @param item
@@ -32,7 +32,7 @@ public interface IInventoryHandler extends IInventoryConnection {
/**
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
* null return means that nothing was extracted!
*
*
* @param from
* Orientation the item is extracted from.
* @param item
@@ -47,7 +47,7 @@ public interface IInventoryHandler extends IInventoryConnection {
/**
* Extract an ItemStack from an IInventoryHandler, internal distribution is left entirely to the IInventoryHandler. This returns the resulting stack - a
* null return means that nothing was extracted!
*
*
* @param from
* Orientation the item is extracted from.
* @param maxExtract
@@ -2,9 +2,9 @@ package cofh.api.inventory;
/**
* Marks a block which will retain its inventory when broken.
*
*
* @author King Lemming
*
*
*/
public interface IInventoryRetainer {
@@ -8,7 +8,7 @@ public interface IAugmentItem {
/**
* Get the augmentation level for a given Augment and Augment Type.
*
*
* @param stack
* ItemStack representing the Augment.
* @param type
@@ -19,7 +19,7 @@ public interface IAugmentItem {
/**
* Get the Augment Types for a given Augment. Set ensure that there are no duplicates.
*
*
* @param stack
* ItemStack representing the Augment.
* @return Set of the Augmentation Types. Should return an empty set if there are none (but this would be really stupid to make). DO NOT RETURN NULL.
@@ -6,9 +6,9 @@ import net.minecraft.item.ItemStack;
/**
* Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with
* them.
*
*
* @author King Lemming
*
*
*/
public interface IEmpowerableItem {
@@ -19,7 +19,7 @@ public interface IEmpowerableItem {
/**
* Attempt to set the empowered state of the item.
*
*
* @param stack
* ItemStack to be empowered/disempowered.
* @param state
@@ -30,7 +30,7 @@ public interface IEmpowerableItem {
/**
* Callback method for reacting to a state change. Useful in KeyBinding handlers.
*
*
* @param player
* Player holding the item, if applicable.
* @param stack
@@ -4,11 +4,11 @@ import net.minecraft.item.ItemStack;
/**
* Implement this interface on Item classes that are themselves inventories.
*
*
* A reference implementation is provided {@link ItemInventoryContainer}.
*
*
* @author King Lemming
*
*
*/
public interface IInventoryContainerItem {
@@ -0,0 +1,56 @@
package cofh.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* Implement this interface on Item classes which may be "Empowered" - what that means is completely up to you. This just provides a uniform way of dealing with
* them.
*
* @author King Lemming
*
*/
public interface IMultiModeItem {
/**
* Get the current mode of an item.
*/
int getMode(ItemStack stack);
/**
* Attempt to set the empowered state of the item.
*
* @param stack
* ItemStack to set the mode on.
* @param mode
* Desired mode.
* @return TRUE if the operation was successful, FALSE if it was not.
*/
boolean setMode(ItemStack stack, int mode);
/**
* Increment the current mode of an item.
*/
boolean incrMode(ItemStack stack);
/**
* Decrement the current mode of an item.
*/
boolean decrMode(ItemStack stack);
/**
* Returns the number of possible modes.
*/
int getNumModes(ItemStack stack);
/**
* Callback method for reacting to a state change. Useful in KeyBinding handlers.
*
* @param player
* Player holding the item, if applicable.
* @param stack
* The item being held.
*/
void onModeChange(EntityPlayer player, ItemStack stack);
}
+2 -2
View File
@@ -10,7 +10,7 @@ public interface IToolHammer {
/**
* Called to ensure that the wrench can be used.
*
*
* @param item
* The itemstack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools)
* @param user
@@ -27,7 +27,7 @@ public interface IToolHammer {
/**
* Callback for when the tool has been used reactively.
*
*
* @param item
* The ItemStack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools)
* @param user
@@ -4,9 +4,9 @@ import net.minecraft.item.ItemStack;
/**
* Implemented on objects which support Augments.
*
*
* @author King Lemming
*
*
*/
public interface IAugmentable {
@@ -2,11 +2,11 @@ package cofh.api.tileentity;
/**
* Implement this interface on objects which can report information about their energy usage.
*
*
* This is used for reporting purposes - Energy transactions are handled through IEnergyHandler!
*
*
* @author King Lemming
*
*
*/
public interface IEnergyInfo {
@@ -1,13 +0,0 @@
package cofh.api.tileentity;
/**
* Implement this interface on Tile Entities which need to know when they are placed into the world.
*
* @author Zeldo
*
*/
public interface IPlacedTile {
public void tilePlaced();
}
@@ -5,18 +5,18 @@ import net.minecraft.nbt.NBTTagCompound;
/**
* Implement this interface on Tile Entities which can write a limited amount of data about themselves.
*
*
* This is typically for the purposes of being transferred to a similar tile entity.
*
*
* @author King Lemming
*
*
*/
public interface IPortableData {
/**
* Data identifier of the Tile Entity/Block. Used for display as well as verification purposes. Tiles with completely interchangeable data should return the
* same type.
*
*
* @return
*/
String getDataType();
@@ -2,11 +2,11 @@ package cofh.api.tileentity;
/**
* Implement this interface on Tile Entities which allow for reconfiguration of their facing.
*
*
* Coordination with the containing block is required.
*
*
* @author King Lemming
*
*
*/
public interface IReconfigurableFacing {
@@ -22,14 +22,14 @@ public interface IReconfigurableFacing {
/**
* Attempt to rotate the block. Arbitrary based on implementation.
*
*
* @return True if rotation was successful, false otherwise.
*/
boolean rotateBlock();
/**
* Set the facing of the block.
*
*
* @param side
* The side to set the facing to.
* @return True if the facing was set, false otherwise.
@@ -2,17 +2,17 @@ package cofh.api.tileentity;
/**
* Implement this interface on Tile Entities which allow for reconfiguration of their sides.
*
*
* Coordination with the containing block is required.
*
*
* @author King Lemming
*
*
*/
public interface IReconfigurableSides {
/**
* Decrement the config for a given side.
*
*
* @param side
* The side to decrement.
* @return True if config was changed, false otherwise.
@@ -21,7 +21,7 @@ public interface IReconfigurableSides {
/**
* Increment the config for a given side.
*
*
* @param side
* The side to decrement.
* @return True if config was changed, false otherwise.
@@ -30,7 +30,7 @@ public interface IReconfigurableSides {
/**
* Set the config for a given side.
*
*
* @param side
* The side to set.
* @param config
@@ -41,7 +41,7 @@ public interface IReconfigurableSides {
/**
* Reset configs on all sides to their base values.
*
*
* @return True if reset was successful, false otherwise.
*/
boolean resetSides();
@@ -2,11 +2,11 @@ package cofh.api.tileentity;
/**
* Implement this interface on Tile Entities which cache their redstone status.
*
*
* Note that {@link IRedstoneControl} is an extension of this.
*
*
* @author King Lemming
*
*
*/
public interface IRedstoneCache {
@@ -3,9 +3,9 @@ package cofh.api.tileentity;
/**
* Implement this interface on Tile Entities which have Redstone Control functionality. This means that a tile can be set to ignore redstone entirely, or
* respond to a low or high redstone state.
*
*
* @author King Lemming
*
*
*/
public interface IRedstoneControl extends IRedstoneCache {
@@ -1,18 +1,22 @@
package cofh.api.tileentity;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.EntityPlayer;
/**
* Implement this interface on Tile Entities which can have access restrictions.
*
*
* @author King Lemming
*
*
*/
public interface ISecurable {
/**
* Enum for Access Modes - Restricted is Friends Only, Private is Owner only.
*
*
* @author King Lemming
*
*
*/
public static enum AccessMode {
PUBLIC, RESTRICTED, PRIVATE;
@@ -47,10 +51,14 @@ public interface ISecurable {
boolean setOwnerName(String name);
boolean setOwner(GameProfile name);
AccessMode getAccess();
String getOwnerName();
boolean canPlayerAccess(String name);
GameProfile getOwner();
boolean canPlayerAccess(EntityPlayer player);
}
@@ -5,15 +5,15 @@ import net.minecraft.util.IIcon;
/**
* Implement this interface on Tile Entities which can change their block's texture based on the current render pass. The block must defer the call to its Tile
* Entity.
*
*
* @author Zeldo Kavira
*
*
*/
public interface ISidedTexture {
/**
* Returns the icon to use for a given side and render pass.
*
*
* @param side
* Block side to get the texture for.
* @param pass
@@ -8,15 +8,15 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on Tile Entities which can provide information about themselves.
*
*
* @author King Lemming
*
*
*/
public interface ITileInfo {
/**
* This function appends information to a list provided to it.
*
*
* @param info
* The list that the information should be appended to.
* @param side
@@ -0,0 +1,17 @@
package cofh.api.transport;
public interface IEnderDestination extends IEnderAttuned {
public boolean isNotValid();
public int x();
public int y();
public int z();
public int dimension();
public int getDestination();
public boolean setDestination(int frequency);
public boolean clearDestination();
}
@@ -2,9 +2,9 @@ package cofh.api.transport;
/**
* This interface is implemented on Ender Attuned objects which can receive Energy (Redstone Flux).
*
*
* @author King Lemming
*
*
*/
public interface IEnderEnergyHandler extends IEnderAttuned {
@@ -15,7 +15,7 @@ public interface IEnderEnergyHandler extends IEnderAttuned {
/**
* This should be checked to see if the Ender Attuned object can currently receive energy (Redstone Flux).
*
*
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
*/
boolean canReceiveEnergy();
@@ -23,7 +23,7 @@ public interface IEnderEnergyHandler extends IEnderAttuned {
/**
* This tells the Ender Attuned object to receive energy. This returns the amount remaining, *not* the amount received - a return of 0 means that all energy
* was received!
*
*
* @param energy
* Amount of energy to be received.
* @param simulate
@@ -4,9 +4,9 @@ import net.minecraftforge.fluids.FluidStack;
/**
* This interface is implemented on Ender Attuned objects which can receive Fluid.
*
*
* @author King Lemming
*
*
*/
public interface IEnderFluidHandler extends IEnderAttuned {
@@ -17,7 +17,7 @@ public interface IEnderFluidHandler extends IEnderAttuned {
/**
* This should be checked to see if the Ender Attuned object can currently receive a FluidStack.
*
*
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
*/
boolean canReceiveFluid();
@@ -25,7 +25,7 @@ public interface IEnderFluidHandler extends IEnderAttuned {
/**
* This tells the Ender Attuned object to receive a FluidStack. This returns what remains of the original stack, *not* the amount received - a null return
* means that the entire stack was received!
*
*
* @param fluid
* FluidStack to be received.
* @param simulate
@@ -4,9 +4,9 @@ import net.minecraft.item.ItemStack;
/**
* This interface is implemented on Ender Attuned objects which can receive Items.
*
*
* @author King Lemming
*
*
*/
public interface IEnderItemHandler extends IEnderAttuned {
@@ -17,7 +17,7 @@ public interface IEnderItemHandler extends IEnderAttuned {
/**
* This should be checked to see if the Ender Attuned object can currently receive an ItemStack.
*
*
* Note: In practice, this can (and should) be used to ensure that something does not send to itself.
*/
boolean canReceiveItems();
@@ -25,10 +25,10 @@ public interface IEnderItemHandler extends IEnderAttuned {
/**
* This tells the Ender Attuned object to receive an ItemStack. This returns what remains of the original stack, *not* the amount received - a null return
* means that the entire stack was received!
*
*
* This function does not support simulation because Inventory manipulation in Minecraft is an absolute mess and it would be a computational liability to do
* so.
*
*
* @param item
* ItemStack to be received.
* @return An ItemStack representing how much is remaining.
@@ -5,16 +5,16 @@ import net.minecraftforge.common.util.ForgeDirection;
/**
* This interface is implemented on ItemDucts. Use it to attempt to eject items into an entry point.
*
*
* @author Zeldo Kavira, King Lemming
*
*
*/
public interface IItemDuct {
/**
* Insert an ItemStack into the IItemDuct. Will only accept items if there is a valid destination. This returns what is remaining of the original stack - a
* null return means that the entire stack was accepted/routed!
*
*
* @param from
* Orientation the item is inserted from.
* @param item
@@ -1,7 +1,5 @@
package cofh.api.transport;
import gnu.trove.map.hash.THashMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -10,23 +8,69 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.config.Configuration;
public final class RegistryEnderAttuned {
public static Map<String, Map<Integer, List<IEnderItemHandler>>> inputItem = new THashMap<String, Map<Integer, List<IEnderItemHandler>>>();
public static Map<String, Map<Integer, List<IEnderFluidHandler>>> inputFluid = new THashMap<String, Map<Integer, List<IEnderFluidHandler>>>();
public static Map<String, Map<Integer, List<IEnderEnergyHandler>>> inputEnergy = new THashMap<String, Map<Integer, List<IEnderEnergyHandler>>>();
public static Map<String, Map<Integer, List<IEnderItemHandler>>> inputItem = new HashMap<String, Map<Integer, List<IEnderItemHandler>>>();
public static Map<String, Map<Integer, List<IEnderFluidHandler>>> inputFluid = new HashMap<String, Map<Integer, List<IEnderFluidHandler>>>();
public static Map<String, Map<Integer, List<IEnderEnergyHandler>>> inputEnergy = new HashMap<String, Map<Integer, List<IEnderEnergyHandler>>>();
public static Map<String, Map<Integer, List<IEnderItemHandler>>> outputItem = new THashMap<String, Map<Integer, List<IEnderItemHandler>>>();
public static Map<String, Map<Integer, List<IEnderFluidHandler>>> outputFluid = new THashMap<String, Map<Integer, List<IEnderFluidHandler>>>();
public static Map<String, Map<Integer, List<IEnderEnergyHandler>>> outputEnergy = new THashMap<String, Map<Integer, List<IEnderEnergyHandler>>>();
public static Map<String, Map<Integer, List<IEnderItemHandler>>> outputItem = new HashMap<String, Map<Integer, List<IEnderItemHandler>>>();
public static Map<String, Map<Integer, List<IEnderFluidHandler>>> outputFluid = new HashMap<String, Map<Integer, List<IEnderFluidHandler>>>();
public static Map<String, Map<Integer, List<IEnderEnergyHandler>>> outputEnergy = new HashMap<String, Map<Integer, List<IEnderEnergyHandler>>>();
public static Map<String, Map<Integer, EnderDestination>> outputTeleport = new HashMap<String, Map<Integer, EnderDestination>>();
public static Configuration linkConf;
public static Map<String, String> clientFrequencyNames = new LinkedHashMap<String, String>();
public static Map<String, String> clientFrequencyNamesReversed = new LinkedHashMap<String, String>();
private static class EnderDestination {
private final int dimension;
private final int x, y, z;
private IEnderDestination output;
public EnderDestination(IEnderDestination output) {
x = output.x();
y = output.y();
z = output.z();
dimension = output.dimension();
this.output = output;
}
public boolean hasOutput() {
return DimensionManager.isDimensionRegistered(dimension);
}
public IEnderDestination getOutput() {
if (output == null || output.isNotValid()) {
output = null;
if (!DimensionManager.isDimensionRegistered(dimension)) {
return null;
}
WorldServer world = DimensionManager.getWorld(dimension);
if (world == null) {
DimensionManager.initDimension(dimension);
world = DimensionManager.getWorld(dimension);
}
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof IEnderDestination) {
output = (IEnderDestination) te;
}
}
return output;
}
}
public static void clear() {
inputItem.clear();
@@ -85,6 +129,31 @@ public final class RegistryEnderAttuned {
return outputEnergy.get(theAttuned.getChannelString()).get(theAttuned.getFrequency());
}
public static boolean hasDestination(IEnderDestination theAttuned) {
return hasDestination(theAttuned, true);
}
public static boolean hasDestination(IEnderDestination theAttuned, boolean to) {
Map<Integer, EnderDestination> map = outputTeleport.get(theAttuned.getChannelString());
if (map == null) {
return false;
}
EnderDestination dest = map.get(to ? theAttuned.getDestination() : theAttuned.getFrequency());
return dest == null ? false : dest.hasOutput();
}
public static IEnderDestination getDestination(IEnderDestination theAttuned) {
Map<Integer, EnderDestination> map = outputTeleport.get(theAttuned.getChannelString());
if (map == null) {
return null;
}
EnderDestination dest = map.get(theAttuned.getDestination());
return dest == null ? null : dest.getOutput();
}
/* HELPER FUNCTIONS */
public static void addItemHandler(IEnderItemHandler theAttuned) {
@@ -164,6 +233,16 @@ public final class RegistryEnderAttuned {
}
}
public static void addDestination(IEnderDestination theAttuned) {
if (!hasDestination(theAttuned, false)) {
if (outputTeleport.get(theAttuned.getChannelString()) == null) {
outputTeleport.put(theAttuned.getChannelString(), new HashMap<Integer, EnderDestination>());
}
outputTeleport.get(theAttuned.getChannelString()).put(theAttuned.getFrequency(), new EnderDestination(theAttuned));
}
}
public static void removeItemHandler(IEnderItemHandler theAttuned) {
if (inputItem.get(theAttuned.getChannelString()) != null) {
@@ -224,6 +303,23 @@ public final class RegistryEnderAttuned {
}
}
public static void removeDestination(IEnderDestination theAttuned) {
Map<Integer, EnderDestination> map = outputTeleport.get(theAttuned.getChannelString());
if (map == null) {
return;
}
EnderDestination dest = map.get(theAttuned.getFrequency());
if (dest == null) {
return;
}
if (dest.dimension == theAttuned.dimension()) {
if (dest.x == theAttuned.x() && dest.y == theAttuned.x() && dest.z == theAttuned.x()) {
map.remove(theAttuned.getFrequency());
}
}
}
public static void add(IEnderAttuned theAttuned) {
if (theAttuned instanceof IEnderItemHandler) {
@@ -235,6 +331,9 @@ public final class RegistryEnderAttuned {
if (theAttuned instanceof IEnderEnergyHandler) {
addEnergyHandler((IEnderEnergyHandler) theAttuned);
}
if (theAttuned instanceof IEnderDestination) {
addDestination((IEnderDestination) theAttuned);
}
}
public static void remove(IEnderAttuned theAttuned) {
@@ -248,6 +347,9 @@ public final class RegistryEnderAttuned {
if (theAttuned instanceof IEnderEnergyHandler) {
removeEnergyHandler((IEnderEnergyHandler) theAttuned);
}
if (theAttuned instanceof IEnderDestination) {
removeDestination((IEnderDestination) theAttuned);
}
}
public static void sortClientNames() {
@@ -570,13 +570,15 @@ public class EnderIO {
SkeletonHandler.registerSkeleton(this);
}
MaterialRecipes.registerDependantOresInDictionary();
EnderfaceRecipes.addRecipes();
MaterialRecipes.addRecipes();
ConduitRecipes.addRecipes();
MachineRecipes.addRecipes();
ItemRecipes.addRecipes();
TeleportRecipes.addRecipes();
proxy.load();
}
@@ -587,16 +589,10 @@ public class EnderIO {
//Regsiter the enchants
Enchantments.getInstance();
MaterialRecipes.registerDependantOresInDictionary();
//This must be loaded before parsing the recipes so we get the preferred outputs
OreDictionaryPreferences.loadConfig();
MaterialRecipes.addOreDictionaryRecipes();
MachineRecipes.addOreDictionaryRecipes();
ItemRecipes.addOreDictionaryRecipes();
CrusherRecipeManager.getInstance().loadRecipesFromConfig();
AlloyRecipeManager.getInstance().loadRecipesFromConfig();
SliceAndSpliceRecipeManager.getInstance().loadRecipesFromConfig();
@@ -5,6 +5,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -15,6 +16,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.ItemUtil;
import com.enderio.core.common.util.Util;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -104,6 +106,31 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
}
}
return true;
} else {
// There's not really any good way to compare conduits...
IConduit existingConduit = bundle.getConduit(getBaseConduitType());
ItemStack existingConduitAsItemStack = existingConduit.createItem();
if (!ItemUtil.areStacksEqual(existingConduitAsItemStack, stack)) {
if (!world.isRemote) {
IConduit newConduit = createConduit(stack, player);
if (newConduit == null) {
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
return false;
}
bundle.removeConduit(existingConduit);
bundle.addConduit(newConduit);
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
for (ItemStack drop : existingConduit.getDrops()) {
EntityItem entityitem = new EntityItem(world, x + hitX, y + hitY, z + hitZ, drop);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}
}
return true;
}
}
}
}
@@ -964,6 +964,21 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler, IFacade
return res;
}
@Override
public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacade(world, x, y, z, side.ordinal());
}
@Override
public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacadeMetadata(world, x, y, z, side.ordinal());
}
@Override
public boolean supportsVisualConnections() {
return true;
}
@Override
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues) {
IRedstoneConduit conduit = getRedstoneConduit(world, x, y, z);
@@ -16,12 +16,14 @@ import crazypants.enderio.conduit.item.filter.CopyFilterRecipe;
import crazypants.enderio.conduit.me.MEUtil;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.material.Alloy;
import crazypants.enderio.material.BlockFusedQuartz;
import crazypants.enderio.material.FrankenSkull;
import crazypants.enderio.material.Material;
import static crazypants.enderio.ModObject.blockPainter;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.util.RecipeUtil.addShaped;
public class ConduitRecipes {
@@ -29,62 +31,61 @@ public class ConduitRecipes {
//Crafting Components
ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 0);
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal());
ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0);
ItemStack fusedGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.GLASS.ordinal());
ItemStack conductiveIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal());
ItemStack energeticGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal());
ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal());
ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal());
ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal());
ItemStack redstoneAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal());
ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal());
String electricalSteel = ELECTRICAL_STEEL.oreIngot;
String phasedGold = PHASED_GOLD.oreIngot;
String conductiveIron = CONDUCTIVE_IRON.oreIngot;
String energeticGold = ENERGETIC_ALLOY.oreIngot;
String phasedIronNugget = PHASED_IRON_NUGGET.oreDict;
String redstoneAlloy = REDSTONE_ALLOY.oreIngot;
String binder = CONDUIT_BINDER.oreDict;
ItemStack zombieController = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal());
//Recipes
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.BASIC.ordinal()), "bbb", "b b", "bbb", 'b', conduitBinder);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()), " o ", "oFo", " o ", 'F', EnderIO.itemConduitFacade, 'o', "dustObsidian"));
addShaped(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.BASIC.ordinal()), "bbb", "b b", "bbb", 'b', binder);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()), " o ", "oFo", " o ", 'F',
EnderIO.itemConduitFacade, 'o', "dustObsidian"));
int numConduits = Config.numConduitsPerRecipe;
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 0), "bbb", "###", "bbb", 'b', conduitBinder, '#', fusedGlass);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 1), "bbb", "###", "bbb", 'b', conduitBinder, '#', fusedQuartz);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 2), "bbb", "#p#", "bbb", 'b', conduitBinder, '#', fusedQuartz, 'p', phasedGold);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 0), "bbb", "###", "bbb", 'b', conduitBinder, '#', conductiveIron);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 1), "bbb", "###", "bbb", 'b', conduitBinder, '#', energeticGold);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedGold);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 0), "###", '#', redstoneAlloy);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, 1, 1), "lbl", "bcb", "lbl", 'b', conduitBinder, 'c', redstoneConduit, 'l',
Blocks.lever);
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#',
redstoneAlloy);
addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 0), "bbb", "###", "bbb", 'b', binder, '#', fusedGlass);
addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 1), "bbb", "###", "bbb", 'b', binder, '#', fusedQuartz);
addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 2), "bbb", "#p#", "bbb", 'b', binder, '#', fusedQuartz, 'p', phasedGold);
addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 0), "bbb", "###", "bbb", 'b', binder, '#', conductiveIron);
addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 1), "bbb", "###", "bbb", 'b', binder, '#', energeticGold);
addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 2), "bbb", "###", "bbb", 'b', binder, '#', phasedGold);
addShaped(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 0), "###", '#', redstoneAlloy);
addShaped(new ItemStack(EnderIO.itemRedstoneConduit, 1, 1), "lbl", "bcb", "lbl", 'b', binder, 'c', redstoneConduit, 'l', Blocks.lever);
addShaped(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', binder, '#', redstoneAlloy);
if (GasUtil.isGasConduitEnabled()) {
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', conduitBinder, '#', electricalSteel, 'g',
fusedGlass);
addShaped(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', binder, '#', electricalSteel, 'g', fusedGlass);
}
ItemStack itemConduit = new ItemStack(EnderIO.itemItemConduit, numConduits, 0);
GameRegistry.addShapedRecipe(itemConduit, "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedIronNugget);
addShaped(itemConduit, "bbb", "###", "bbb", 'b', binder, '#', phasedIronNugget);
MachineRecipeRegistry.instance.registerRecipe(blockPainter.unlocalisedName, EnderIO.itemConduitFacade.new FacadePainterRecipe());
//Filter Recipes
ItemStack basicFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 0);
GameRegistry.addShapedRecipe(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper);
addShaped(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper);
ItemStack advFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 1);
GameRegistry.addRecipe(new ShapedOreRecipe(advFilter, "rpr", "pzp", "rpr", 'p', Items.paper, 'z', zombieController, 'r', Items.redstone));
addShaped(advFilter, "rpr", "pzp", "rpr", 'p', Items.paper, 'z', zombieController, 'r', "dustRedstone");
ItemStack modFilter = new ItemStack(EnderIO.itemModItemFilter, 1, 0);
GameRegistry.addShapedRecipe(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench);
addShaped(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench);
ItemStack exFilt = new ItemStack(EnderIO.itemExistingItemFilter);
GameRegistry.addShapedRecipe(exFilt, " r ", "rfr", " c ", 'c', new ItemStack(Items.comparator, 1, 0), 'r', Items.redstone, 'f', advFilter);
addShaped(exFilt, " r ", "rfr", " c ", 'c', new ItemStack(Items.comparator, 1, 0), 'r', "dustRedstone", 'f', advFilter);
ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter);
GameRegistry.addShapedRecipe(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
ClearFilterRecipe clearRec = new ClearFilterRecipe();
MinecraftForge.EVENT_BUS.register(clearRec);
@@ -94,11 +95,11 @@ public class ConduitRecipes {
GameRegistry.addRecipe(copyRec);
ItemStack speedUpgrade = new ItemStack(EnderIO.itemExtractSpeedUpgrade, 1, 0);
GameRegistry.addShapedRecipe(speedUpgrade, "iii","epe","ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', Items.iron_ingot);
addShaped(speedUpgrade, "iii", "epe", "ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', "ingotIron");
ItemStack speedDowngrade = new ItemStack(EnderIO.itemExtractSpeedUpgrade, 1, 1);
GameRegistry.addRecipe(new ShapedOreRecipe(speedDowngrade, "iii","ese","ete", 's', "slimeball", 'e', electricalSteel, 't', "stickWood", 'i', Items.iron_ingot));
GameRegistry.addRecipe(new ShapedOreRecipe(speedDowngrade, "iii","ese","ete", 's', "slimeball", 'e', electricalSteel, 't', "woodStick", 'i', Items.iron_ingot));
addShaped(speedDowngrade, "iii", "ese", "ete", 's', "slimeball", 'e', electricalSteel, 't', "stickWood", 'i', "ingotIron");
addShaped(speedDowngrade, "iii", "ese", "ete", 's', "slimeball", 'e', electricalSteel, 't', "woodStick", 'i', "ingotIron");
if (MEUtil.isMEEnabled()) {
addAeRecipes();
@@ -109,15 +110,15 @@ public class ConduitRecipes {
private static void addAeRecipes() {
String fluix = "crystalFluix";
String pureFluix = "crystalPureFluix";
ItemStack quartzFiber = AEApi.instance().parts().partQuartzFiber.stack(1).copy();
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal());
ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2);
GameRegistry.addRecipe(new ShapedOreRecipe(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', fluix, 'q', quartzFiber));
GameRegistry.addRecipe(new ShapedOreRecipe(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber));
addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', fluix, 'q', quartzFiber);
addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber);
res.stackSize = 1;
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res));
addShaped(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
}
}
@@ -115,7 +115,6 @@ public class ExternalConnectionContainer extends Container {
}
protected void filterChanged() {
System.out.println("filterChanged " + filterListeners.size());
for (FilterChangeListener list : filterListeners) {
list.onFilterChanged();
}
@@ -53,7 +53,6 @@ public class BasicItemFilterGui implements IItemFilterGui {
this.yOffset = yOffset;
this.buttonIdOffset = buttonIdOffset;
filter = filterContainer.getItemFilter();
isAdvanced = filter.isAdvanced();
@@ -12,7 +12,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.item.NetworkedInventory.Target;
import crazypants.enderio.conduit.item.filter.IItemFilter;
@@ -182,7 +181,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
for (Target t : source.sendPriority) {
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
if(input == null || f == null || f.doesItemPassFilter(t.inv, input)) {
String s = EnderIO.lang.localizeExact(t.inv.getInventory().getInventoryName()) + " " + t.inv.location.chatString() + " Distance [" + t.distance + "] ";
String s = t.inv.getLocalizedInventoryName() + " " + t.inv.location.chatString() + " Distance [" + t.distance + "] ";
result.add(s);
}
}
@@ -199,7 +198,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
if(inv.hasTarget(con, dir)) {
IItemFilter f = inv.con.getInputFilter(inv.conDir);
if(input == null || f == null || f.doesItemPassFilter(inv, input)) {
result.add(EnderIO.lang.localizeExact(inv.getInventory().getInventoryName()) + " " + inv.location.chatString());
result.add(inv.getLocalizedInventoryName() + " " + inv.location.chatString());
}
}
}
@@ -11,6 +11,7 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -393,6 +394,17 @@ public class NetworkedInventory {
this.inventorySide = inventorySide;
}
public String getLocalizedInventoryName() {
String inventoryName = getInventory().getInventoryName();
if(inventoryName == null) {
return "null";
} else {
// don't use Lang.localize as that passes the localized string to
// String.format which might crash when it contains formatting specifiers
return StatCollector.translateToLocal(inventoryName);
}
}
static class Target implements Comparable<Target> {
NetworkedInventory inv;
int distance;
@@ -421,4 +433,4 @@ public class NetworkedInventory {
}
}
}
}
@@ -19,30 +19,30 @@ public class CopyFilterRecipe implements IRecipe{
@Override
public boolean matches(InventoryCrafting inv, World world) {
ItemStack blankInput = null;
int blankCount = 0;
ItemStack filterInput = null;
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack checkStack = inv.getStackInSlot(i);
if (checkStack != null && checkStack.getItem() instanceof IItemFilterUpgrade) {
if(FilterRegister.isFilterSet(checkStack)) {
if(filterInput != null || !isSameTypeOrNull(blankInput, checkStack)) {
return false;
}
filterInput = checkStack;
} else {
if(blankInput != null || !isSameTypeOrNull(filterInput, checkStack)) {
if(filterInput != null) {
return false;
}
blankInput = checkStack;
filterInput = checkStack;
} else {
if(!isSameTypeOrNull(filterInput, checkStack)) {
return false;
}
blankCount++;
}
}
}
if(blankInput == null || filterInput == null) {
if(blankCount == 0 || filterInput == null) {
return false;
}
output = filterInput.copy();
output.stackSize = 2;
output.stackSize = blankCount + 1;
return true;
}
@@ -298,6 +298,38 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
}
return network.getTankInfo(this, from);
}
@Override
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
super.readTypeSettings(dir, dataRoot);
if (dataRoot.hasKey("outputFilters")) {
FluidFilter out = new FluidFilter();
out.readFromNBT(dataRoot.getCompoundTag("outputFilters"));
outputFilters.put(dir, out);
}
if (dataRoot.hasKey("inputFilters")) {
FluidFilter in = new FluidFilter();
in.readFromNBT(dataRoot.getCompoundTag("inputFilters"));
inputFilters.put(dir, in);
}
}
@Override
protected void writeTypeSettingsToNbt(ForgeDirection dir, NBTTagCompound dataRoot) {
super.writeTypeSettingsToNbt(dir, dataRoot);
FluidFilter out = outputFilters.get(dir);
if (out != null) {
NBTTagCompound outTag = new NBTTagCompound();
out.writeToNBT(outTag);
dataRoot.setTag("outputFilters", outTag);
}
FluidFilter in = inputFilters.get(dir);
if (in != null) {
NBTTagCompound inTag = new NBTTagCompound();
in.writeToNBT(inTag);
dataRoot.setTag("inputFilters", inTag);
}
}
@Override
public void writeToNBT(NBTTagCompound nbtRoot) {
@@ -322,7 +354,6 @@ public class EnderLiquidConduit extends AbstractLiquidConduit {
}
}
}
}
@Override
@@ -106,6 +106,7 @@ public final class Config {
public static File configDirectory;
public static boolean useHardRecipes = false;
public static boolean addPeacefulRecipes = false;
public static boolean allowExternalTickSpeedup = true;
public static boolean useSteelInChassi = false;
@@ -345,6 +346,10 @@ public final class Config {
public static int poweredSpawnerLevelThreePowerPerTickRF = 1500;
public static int poweredSpawnerMaxPlayerDistance = 0;
public static int poweredSpawnerDespawnTimeSeconds = 120;
public static int poweredSpawnerSpawnCount = 4;
public static int poweredSpawnerSpawnRange = 4;
public static int poweredSpawnerMaxNearbyEntities = 6;
public static int poweredSpawnerMaxSpawnTries = 3;
public static boolean poweredSpawnerUseVanillaSpawChecks = false;
public static double brokenSpawnerDropChance = 1;
public static String[] brokenSpawnerToolBlacklist = new String[] {
@@ -584,6 +589,8 @@ public final class Config {
useHardRecipes = config.get(sectionRecipe.name, "useHardRecipes", useHardRecipes, "When enabled machines cost significantly more.")
.getBoolean(useHardRecipes);
addPeacefulRecipes = config.get(sectionRecipe.name, "addPeacefulRecipes", addPeacefulRecipes, "When enabled peaceful recipes are added for soulbinder based crafting components.")
.getBoolean(addPeacefulRecipes);
soulBinderRequiresEndermanSkull = config.getBoolean("soulBinderRequiresEndermanSkull", sectionRecipe.name, soulBinderRequiresEndermanSkull,
"When true the Soul Binder requires an Enderman Skull to craft");
allowTileEntitiesAsPaintSource = config.get(sectionRecipe.name, "allowTileEntitiesAsPaintSource", allowTileEntitiesAsPaintSource,
@@ -1097,6 +1104,14 @@ public final class Config {
"Max distance of the closest player for the spawner to be active. A zero value will remove the player check").getInt(poweredSpawnerMaxPlayerDistance);
poweredSpawnerDespawnTimeSeconds = config.get(sectionSpawner.name, "poweredSpawnerDespawnTimeSeconds" , poweredSpawnerDespawnTimeSeconds,
"Number of seconds in which spawned entities are protected from despawning").getInt(poweredSpawnerDespawnTimeSeconds);
poweredSpawnerSpawnCount = config.get(sectionSpawner.name, "poweredSpawnerSpawnCount" , poweredSpawnerSpawnCount,
"Number of entities to spawn each time").getInt(poweredSpawnerSpawnCount);
poweredSpawnerSpawnRange = config.get(sectionSpawner.name, "poweredSpawnerSpawnRange" , poweredSpawnerSpawnRange,
"Spawning range in X/Z").getInt(poweredSpawnerSpawnRange);
poweredSpawnerMaxNearbyEntities = config.get(sectionSpawner.name, "poweredSpawnerMaxNearbyEntities" , poweredSpawnerMaxNearbyEntities,
"Max number of entities in the nearby area until no more are spawned. A zero value will remove this check").getInt(poweredSpawnerMaxNearbyEntities);
poweredSpawnerMaxSpawnTries = config.get(sectionSpawner.name, "poweredSpawnerMaxSpawnTries" , poweredSpawnerMaxSpawnTries,
"Number of tries to find a suitable spawning location").getInt(poweredSpawnerMaxSpawnTries);
poweredSpawnerUseVanillaSpawChecks = config.get(sectionSpawner.name, "poweredSpawnerUseVanillaSpawChecks", poweredSpawnerUseVanillaSpawChecks,
"If true, regular spawn checks such as lighting level and dimension will be made before spawning mobs").getBoolean(poweredSpawnerUseVanillaSpawChecks);
brokenSpawnerDropChance = (float) config.get(sectionSpawner.name, "brokenSpawnerDropChance", brokenSpawnerDropChance,
@@ -2,19 +2,17 @@ package crazypants.enderio.enderface;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.EnderIO;
import crazypants.enderio.material.Alloy;
import crazypants.util.RecipeUtil;
public class EnderfaceRecipes {
public static void addRecipes() {
ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal());
ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0);
ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal());
GameRegistry.addRecipe(new ItemStack(EnderIO.blockEnderIo), "sqs", "qeq", "sqs", 's', electricalSteel, 'q', fusedQuartz, 'e', new ItemStack(
Items.ender_eye));
String electricalSteel = Alloy.ELECTRICAL_STEEL.oreIngot;
RecipeUtil.addShaped(new ItemStack(EnderIO.blockEnderIo), "sqs", "qeq", "sqs", 's', electricalSteel, 'q', fusedQuartz, 'e', new ItemStack(Items.ender_eye));
}
}
@@ -7,64 +7,63 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.EnderIO;
import crazypants.enderio.item.darksteel.DarkSteelItems;
import crazypants.enderio.material.Alloy;
import crazypants.enderio.material.MachinePart;
import crazypants.enderio.material.Material;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.VIBRANT_CYSTAL;
import static crazypants.util.RecipeUtil.addShaped;
public class ItemRecipes {
public static void addRecipes() {
ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal());
ItemStack conductiveIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal());
ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal());
ItemStack vibAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal());
ItemStack enAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal());
ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal());
ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal());
String electricalSteel = ELECTRICAL_STEEL.oreIngot;
String conductiveIron = CONDUCTIVE_IRON.oreIngot;
String vibCry = VIBRANT_CYSTAL.oreDict;
String enAlloy = ENERGETIC_ALLOY.oreIngot;
String darkSteel = DARK_STEEL.oreIngot;
String soularium = SOULARIUM.oreIngot;
// Wrench
ItemStack wrench = new ItemStack(EnderIO.itemYetaWench, 1, 0);
GameRegistry.addShapedRecipe(wrench, "s s", " b ", " s ", 's', electricalSteel, 'b', basicGear);
addShaped(wrench, "s s", " b ", " s ", 's', electricalSteel, 'b', basicGear);
//Magnet
ItemStack magnet = new ItemStack(EnderIO.itemMagnet, 1, 0);
EnderIO.itemMagnet.setEnergy(magnet, 0);
GameRegistry.addShapedRecipe(magnet, "scc", " v", "scc", 's', electricalSteel, 'c', conductiveIron, 'v', vibCry);
addShaped(magnet, "scc", " v", "scc", 's', electricalSteel, 'c', conductiveIron, 'v', vibCry);
//Dark Steel
GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelHelmet.createItemStack(), "sss", "s s", 's', darkSteel);
GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel);
GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel);
GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelBoots.createItemStack(), "s s", "s s", 's', darkSteel);
addShaped(DarkSteelItems.itemDarkSteelHelmet.createItemStack(), "sss", "s s", 's', darkSteel);
addShaped(DarkSteelItems.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel);
addShaped(DarkSteelItems.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel);
addShaped(DarkSteelItems.itemDarkSteelBoots.createItemStack(), "s s", "s s", 's', darkSteel);
ItemStack wing = new ItemStack(DarkSteelItems.itemGliderWing,1,0);
GameRegistry.addShapedRecipe(wing, " s", " sl", "sll", 's', darkSteel, 'l', Items.leather);
GameRegistry.addShapedRecipe(new ItemStack(DarkSteelItems.itemGliderWing,1,1), " s ", "wsw", " ", 's', darkSteel, 'w', wing);
ItemStack wing = new ItemStack(DarkSteelItems.itemGliderWing, 1, 0);
addShaped(wing, " s", " sl", "sll", 's', darkSteel, 'l', Items.leather);
addShaped(new ItemStack(DarkSteelItems.itemGliderWing, 1, 1), " s ", "wsw", " ", 's', darkSteel, 'w', wing);
GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelShears.createItemStack(), " s", "s ", 's', darkSteel);
addShaped(DarkSteelItems.itemDarkSteelShears.createItemStack(), " s", "s ", 's', darkSteel);
ItemStack dspp = new ItemStack(EnderIO.blockDarkSteelPressurePlate);
GameRegistry.addShapedRecipe(dspp, "ss", 's', darkSteel);
addShaped(dspp, "ss", 's', darkSteel);
ItemStack dsppSilent = new ItemStack(EnderIO.blockDarkSteelPressurePlate, 1, 1);
GameRegistry.addShapedRecipe(dsppSilent, "p", "w", 'p', dspp, 'w', Blocks.wool);
//Soul Vessel
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack(EnderIO.blockFusedQuartz,1,0));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack(
EnderIO.blockFusedQuartz, 1, 0)));
//XP Rod
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemXpTransfer), " s", " v ", "s ", 's', soularium, 'v', enAlloy);
addShaped(new ItemStack(EnderIO.itemXpTransfer), " s", " v ", "s ", 's', soularium, 'v', enAlloy);
}
public static void addOreDictionaryRecipes() {
ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal());
GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "stickWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "woodStick"));
GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "stickWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "woodStick"));
GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "woodStick"));
GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "stickWood"));
// DS Tools
addShaped(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "stickWood");
addShaped(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "woodStick");
addShaped(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "stickWood");
addShaped(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "woodStick");
addShaped(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "woodStick");
addShaped(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "stickWood");
}
}
@@ -0,0 +1,40 @@
package crazypants.enderio.machine;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import com.enderio.core.common.util.BlockCoord;
import com.mojang.authlib.GameProfile;
public class FakePlayerEIO extends FakePlayer {
ItemStack prevWeapon;
public FakePlayerEIO(World world, BlockCoord pos, GameProfile profile) {
super(MinecraftServer.getServer().worldServerForDimension(world.provider.dimensionId), profile);
posX = pos.x + 0.5;
posY = pos.y + 0.5;
posZ = pos.z + 0.5;
}
// These do things with packets...which crash since the net handler is null. Potion effects are not needed anyways.
@Override
protected void onNewPotionEffect(PotionEffect p_70670_1_) {
}
@Override
protected void onChangedPotionEffect(PotionEffect p_70695_1_, boolean p_70695_2_) {
}
@Override
protected void onFinishedPotionEffect(PotionEffect p_70688_1_) {
}
@Override
public void addChatMessage(IChatComponent p_145747_1_) {
}
}
@@ -4,8 +4,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.item.FunctionUpgrade;
@@ -16,134 +14,136 @@ import crazypants.enderio.machine.capbank.BlockItemCapBank;
import crazypants.enderio.machine.capbank.CapBankType;
import crazypants.enderio.machine.capbank.ConvertOldRecipe;
import crazypants.enderio.machine.light.BlockItemElectricLight;
import crazypants.enderio.material.Alloy;
import crazypants.enderio.material.FrankenSkull;
import crazypants.enderio.material.MachinePart;
import crazypants.enderio.material.Material;
import crazypants.enderio.power.Capacitors;
import static crazypants.enderio.EnderIO.itemBasicCapacitor;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.util.RecipeUtil.*;
public class MachineRecipes {
public static void addRecipes() {
//Common ingredients
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 4, Material.CONDUIT_BINDER.ordinal());
ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0);
ItemStack capacitor2 = new ItemStack(itemBasicCapacitor, 1, 1);
ItemStack capacitor3 = new ItemStack(itemBasicCapacitor, 1, 2);
ItemStack enderCapacitor = new ItemStack(itemBasicCapacitor, 1, Capacitors.ENDER_CAPACITOR.ordinal());
ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
ItemStack machineChassi = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal());
ItemStack silicon = new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal());
ItemStack pulCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal());
ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal());
ItemStack endCry = new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal());
ItemStack electricSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal());
ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal());
ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal());
ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal());
ItemStack energeticAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal());
String basicGear = MachinePart.BASIC_GEAR.oreDict;
String machineChassi = MachinePart.MACHINE_CHASSI.oreDict;
ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0);
ItemStack clearGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, 1);
ItemStack enlightedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 2);
ItemStack fusedGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, 1);
ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal());
ItemStack zombieController = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal());
ItemStack frankenZombie = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal());
ItemStack enderRes = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ENDER_RESONATOR.ordinal());
ItemStack sentientEnder = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.SENTIENT_ENDER.ordinal());
ItemStack obsidian = new ItemStack(Blocks.obsidian);
String electricalSteel = ELECTRICAL_STEEL.oreIngot;
String darkSteel = DARK_STEEL.oreIngot;
String energeticAlloy = ENERGETIC_ALLOY.oreIngot;
String phasedGold = PHASED_GOLD.oreIngot;
String phasedIron = PHASED_IRON.oreIngot;
String soularium = SOULARIUM.oreIngot;
String vibCry = VIBRANT_CYSTAL.oreDict;
String pulCry = PULSATING_CYSTAL.oreDict;
String endCry = ENDER_CRYSTAL.oreDict;
String binder = CONDUIT_BINDER.oreDict;
String silicon = SILICON.oreDict;
if (Config.addPeacefulRecipes) {
addShaped(frankenZombie, "gdg", "dzd", "gdg", 'g', Items.gold_ingot, 'd', Items.diamond, 'z', zombieController);
addShaped(sentientEnder, "ddd", "ded", "dgd", 'g', Blocks.gold_block, 'd', Items.diamond, 'e', enderRes);
}
//stirling gen
ItemStack stirlingGen = new ItemStack(EnderIO.blockStirlingGenerator, 1, 0);
GameRegistry.addShapedRecipe(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear);
addShaped(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear);
//Combustion Gen
ItemStack res = new ItemStack(EnderIO.blockTank, 1, 0);
ItemStack comGen = new ItemStack(EnderIO.blockCombustionGenerator, 1, 0);
GameRegistry.addShapedRecipe(comGen, "eee", "rmr", "gpg", 'e', electricSteel, 'r', res, 'm', machineChassi, 'g', basicGear, 'p', Blocks.piston);
addShaped(comGen, "eee", "rmr", "gpg", 'e', electricalSteel, 'r', res, 'm', machineChassi, 'g', basicGear, 'p', Blocks.piston);
//ZombieGen
ItemStack zg = new ItemStack(EnderIO.blockZombieGenerator, 1, 0);
GameRegistry.addShapedRecipe(zg, "eee", "qzq", "qqq", 'e', electricSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 0));
addShaped(zg, "eee", "qzq", "qqq", 'e', electricalSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 0));
//KillerJoe
ItemStack kj = new ItemStack(EnderIO.blockKillerJoe, 1, 0);
GameRegistry.addShapedRecipe(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie);
addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie);
//Wireless charger
ItemStack wirelessCharger = new ItemStack(EnderIO.blockWirelessCharger);
//GameRegistry.addShapedRecipe(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry);
GameRegistry.addShapedRecipe(wirelessCharger, "sss", "ses", "scs", 's', electricSteel, 'c', capacitor3, 'e', enderRes);
//addShaped(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry);
addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes);
//Crafter
ItemStack crafter = new ItemStack(EnderIO.blockCrafter, 1, 0);
GameRegistry.addShapedRecipe(crafter, "iti", "imi", "izi", 'i', Items.iron_ingot, 't', Blocks.crafting_table, 'm', machineChassi, 'z', zombieController);
addShaped(crafter, "iti", "imi", "izi", 'i', Items.iron_ingot, 't', Blocks.crafting_table, 'm', machineChassi, 'z', zombieController);
//Powered Spawner
ItemStack poweredSpawner = new ItemStack(EnderIO.blockPoweredSpawner);
ItemStack zombieBit;
if(Config.useHardRecipes) {
if (Config.useHardRecipes) {
zombieBit = frankenZombie;
} else {
zombieBit = zombieController;
}
GameRegistry.addRecipe(new ShapedOreRecipe(poweredSpawner, "ese", "eme", "vzv", 'e', electricSteel, 's', "itemSkull", 'v', vibCry, 'm', machineChassi, 'z',
zombieBit));
addShaped(poweredSpawner, "ese", "eme", "vzv", 'e', electricalSteel, 's', "itemSkull", 'v', vibCry, 'm', machineChassi, 'z', zombieBit);
if(Config.reservoirEnabled) {
if (Config.reservoirEnabled) {
//reservoir
ItemStack reservoir = new ItemStack(EnderIO.blockReservoir, 2, 0);
Object glassSides;
if(Config.useHardRecipes) {
if (Config.useHardRecipes) {
glassSides = "blockGlassHardened";
} else {
glassSides = "glass";
}
GameRegistry.addRecipe(new ShapedOreRecipe(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz));
addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz);
}
//Tanks
ItemStack basicTank = new ItemStack(EnderIO.blockTank, 1, 0);
GameRegistry.addRecipe(new ShapedOreRecipe(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', Items.iron_ingot, 'b', Blocks.iron_bars));
addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', Items.iron_ingot, 'b', Blocks.iron_bars);
ItemStack advTank = new ItemStack(EnderIO.blockTank, 1, 1);
GameRegistry.addRecipe(new ShapedOreRecipe(advTank, "ibi", "bgb", "ibi", 'g', "blockGlassHardened", 'i', darkSteel, 'b', EnderIO.blockDarkIronBars));
addShaped(advTank, "ibi", "bgb", "ibi", 'g', "blockGlassHardened", 'i', darkSteel, 'b', EnderIO.blockDarkIronBars);
//mill
ItemStack crusher = new ItemStack(EnderIO.blockCrusher, 1, 0);
if(Config.useHardRecipes) {
GameRegistry.addShapedRecipe(crusher, "ooo", "fmf", "pip", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p',
Blocks.piston,
'o', Blocks.obsidian);
if (Config.useHardRecipes) {
addShaped(crusher, "ooo", "fmf", "pip", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston, 'o', Blocks.obsidian);
} else {
GameRegistry.addShapedRecipe(crusher, "fff", "imi", "ipi", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston);
addShaped(crusher, "fff", "imi", "ipi", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston);
}
//alloy smelter
ItemStack alloySmelter = new ItemStack(EnderIO.blockAlloySmelter, 1, 0);
if(Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Blocks.iron_block, 'f',
Blocks.furnace));
if (Config.useHardRecipes) {
addShaped(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Blocks.iron_block, 'f', Blocks.furnace);
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Items.iron_ingot, 'f',
Blocks.furnace));
addShaped(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Items.iron_ingot, 'f', Blocks.furnace);
}
//Vat
ItemStack still = new ItemStack(EnderIO.blockVat, 1, 0);
GameRegistry.addShapedRecipe(still, "eve", "tmt", "efe", 'v', Items.cauldron, 'm', machineChassi, 'e', electricSteel, 'f', Blocks.furnace, 't', basicTank);
addShaped(still, "eve", "tmt", "efe", 'v', Items.cauldron, 'm', machineChassi, 'e', electricalSteel, 'f', Blocks.furnace, 't', basicTank);
//capacitor bank
ItemStack capBank1 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.SIMPLE), 0);
GameRegistry.addShapedRecipe(capBank1, "bcb", "cmc", "bcb", 'b', Items.iron_ingot, 'c', capacitor, 'm', Blocks.redstone_block);
addShaped(capBank1, "bcb", "cmc", "bcb", 'b', Items.iron_ingot, 'c', capacitor, 'm', Blocks.redstone_block);
ItemStack capBank2 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.ACTIVATED), 0);
GameRegistry.addShapedRecipe(capBank2, "bcb", "cmc", "bcb", 'b', electricSteel, 'c', capacitor2, 'm', Blocks.redstone_block);
addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', Blocks.redstone_block);
ItemStack capBank3 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.VIBRANT), 0);
GameRegistry.addShapedRecipe(capBank3, "bcb", "cmc", "bcb", 'b', electricSteel, 'c', capacitor3, 'm', vibCry);
addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry);
ConvertOldRecipe convertRecipe = new ConvertOldRecipe();
GameRegistry.addRecipe(convertRecipe);
@@ -153,54 +153,46 @@ public class MachineRecipes {
//painter
ItemStack painter = new ItemStack(EnderIO.blockPainter, 1, 0);
if(Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qqq", "mdm", "mMm", 'm', electricSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond,
'd', Items.diamond));
if (Config.useHardRecipes) {
addShaped(painter, "qqq", "mdm", "mMm", 'm', electricalSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, 'd', Items.diamond);
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qdq", "mMm", "mmm", 'm', electricSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond,
'd', Items.diamond));
addShaped(painter, "qdq", "mMm", "mmm", 'm', electricalSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, 'd', Items.diamond);
}
//Farm
ItemStack farm = new ItemStack(EnderIO.blockFarmStation, 1, 0);
if(Config.useHardRecipes) {
if (Config.useHardRecipes) {
zombieBit = frankenZombie;
} else {
zombieBit = zombieController;
}
GameRegistry.addShapedRecipe(farm, "ehe", "eme", "pzp", 'h', Items.diamond_hoe, 'm', machineChassi, 'e', electricSteel, 'z', zombieController, 'p', pulCry);
addShaped(farm, "ehe", "eme", "pzp", 'h', Items.diamond_hoe, 'm', machineChassi, 'e', electricalSteel, 'z', zombieController, 'p', pulCry);
if(Config.transceiverEnabled) {
if (Config.transceiverEnabled) {
//transceiver
ItemStack transceiver = new ItemStack(EnderIO.blockTransceiver, 1, 0);
if(Config.transceiverUseEasyRecipe) {
GameRegistry
.addShapedRecipe(transceiver, "oeo", "pdp", "oco", 'o', obsidian, 'e', Items.ender_eye, 'c', enderCapacitor, 'p', phasedGold, 'd', Items.diamond);
if (Config.transceiverUseEasyRecipe) {
addShaped(transceiver, "oeo", "pdp", "oco", 'o', obsidian, 'e', Items.ender_eye, 'c', enderCapacitor, 'p', phasedGold, 'd',
Items.diamond);
} else {
GameRegistry
.addShapedRecipe(transceiver, "oeo", "pdp", "oco", 'o', electricSteel, 'e', enderRes, 'c', enderCapacitor, 'p', fusedQuartz, 'd', endCry);
GameRegistry.addShapelessRecipe(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0));
addShaped(transceiver, "oeo", "pdp", "oco", 'o', electricalSteel, 'e', enderRes, 'c', enderCapacitor, 'p', fusedQuartz, 'd', endCry);
addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0));
}
}
//solar panel
if(Config.photovoltaicCellEnabled) {
if (Config.photovoltaicCellEnabled) {
ItemStack solarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 0);
ItemStack advSolarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 1);
if(Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'c', capacitor,
'e',
energeticAlloy, 'p', phasedGold));
GameRegistry.addRecipe(new ShapedOreRecipe(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'c', capacitor2,
'e',
phasedIron, 'p', phasedGold));
if (Config.useHardRecipes) {
addShaped(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'c', capacitor, 'e', energeticAlloy, 'p',
phasedGold);
addShaped(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'c', capacitor2, 'e', phasedIron, 'p', phasedGold);
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'p', silicon,
'e',
energeticAlloy, 'c', electricSteel));
GameRegistry.addRecipe(new ShapedOreRecipe(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'p', vibCry, 'e',
phasedGold, 'c', phasedIron));
addShaped(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'p', silicon, 'e', energeticAlloy, 'c',
electricalSteel);
addShaped(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'p', vibCry, 'e', phasedGold, 'c', phasedIron);
}
}
@@ -209,20 +201,19 @@ public class MachineRecipes {
ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0);
ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2);
ItemStack mJMonitor = new ItemStack(EnderIO.blockPowerMonitor, 1, 0);
GameRegistry.addShapedRecipe(mJMonitor, "sms", "sMs", "sps", 's', electricSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit,
'r', redstoneConduit);
addShaped(mJMonitor, "sms", "sMs", "sps", 's', electricalSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit, 'r', redstoneConduit);
//Enchanter
ItemStack enchanter = new ItemStack(EnderIO.blockEnchanter);
GameRegistry.addShapedRecipe(enchanter, "dbd", "sss", " s ", 'd', Items.diamond, 'b', Items.book, 's', darkSteel);
addShaped(enchanter, "dbd", "sss", " s ", 'd', Items.diamond, 'b', Items.book, 's', darkSteel);
//Vacuum Chest
ItemStack vacuumChest = new ItemStack(EnderIO.blockVacuumChest);
GameRegistry.addShapedRecipe(vacuumChest, "iii", "ici", "ipi", 'i', Items.iron_ingot, 'c', Blocks.chest, 'p', pulCry);
addShaped(vacuumChest, "iii", "ici", "ipi", 'i', Items.iron_ingot, 'c', Blocks.chest, 'p', pulCry);
//Soul Binder
ItemStack enderBit;
if(Config.soulBinderRequiresEndermanSkull) {
Object enderBit;
if (Config.soulBinderRequiresEndermanSkull) {
enderBit = new ItemStack(EnderIO.blockEndermanSkull);
} else {
enderBit = pulCry;
@@ -231,29 +222,28 @@ public class MachineRecipes {
ItemStack zombieSkull = new ItemStack(Items.skull, 1, 4);
ItemStack skeletonSkull = new ItemStack(Items.skull, 1, 0);
ItemStack soulBinder = new ItemStack(EnderIO.blockSoulFuser);
GameRegistry.addShapedRecipe(soulBinder, "ses", "zmc", "sks", 's', soularium, 'm', machineChassi, 'e', enderBit, 'z', zombieSkull, 'c', creeperSkull, 'k',
skeletonSkull);
addShaped(soulBinder, "ses", "zmc", "sks", 's', soularium, 'm', machineChassi, 'e', enderBit, 'z', zombieSkull, 'c', creeperSkull, 'k', skeletonSkull);
//Attractor
ItemStack attractor = new ItemStack(EnderIO.blockAttractor);
ItemStack attractorCrystal = new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal());
GameRegistry.addShapedRecipe(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy);
addShaped(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy);
//Aversion
ItemStack aversion = new ItemStack(EnderIO.blockSpawnGuard);
ItemStack tormentedEnderman = new ItemStack(EnderIO.blockEndermanSkull, 1, BlockEndermanSkull.SkullType.TORMENTED.ordinal());
GameRegistry.addShapedRecipe(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy);
addShaped(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy);
//Experience
ItemStack xp = new ItemStack(EnderIO.blockExperianceOblisk);
ItemStack xpItem = new ItemStack(EnderIO.itemXpTransfer);
GameRegistry.addShapedRecipe(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem);
//Weather
ItemStack weather = new ItemStack(EnderIO.blockWeatherObelisk);
ItemStack weatherItem = new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal());
GameRegistry.addShapedRecipe(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b', new ItemStack(EnderIO.blockCapBank,
1, CapBankType.getMetaFromType(CapBankType.SIMPLE)));
addShaped(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b',
new ItemStack(EnderIO.blockCapBank, 1, CapBankType.getMetaFromType(CapBankType.SIMPLE)));
ClearConfigRecipe inst = new ClearConfigRecipe();
MinecraftForge.EVENT_BUS.register(inst);
@@ -264,65 +254,52 @@ public class MachineRecipes {
ItemStack poweredLampInv = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.ELECTRIC_INV.ordinal());
ItemStack wirelessLamp = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.WIRELESS.ordinal());
ItemStack wirelessLampInv = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.WIRELESS_INV.ordinal());
GameRegistry.addShapelessRecipe(wirelessLamp, poweredLamp, enderRes);
GameRegistry.addShapelessRecipe(wirelessLamp, wirelessLampInv, Blocks.redstone_torch);
GameRegistry.addShapelessRecipe(wirelessLampInv, poweredLampInv, enderRes);
GameRegistry.addShapelessRecipe(wirelessLampInv, wirelessLamp, Blocks.redstone_torch);
addShapeless(wirelessLamp, poweredLamp, enderRes);
addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch);
addShapeless(wirelessLampInv, poweredLampInv, enderRes);
addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch);
//inventory panel
ItemStack awareness = new ItemStack(EnderIO.itemFunctionUpgrade, 1, FunctionUpgrade.INVENTORY_PANEL.ordinal());
GameRegistry.addRecipe(new ShapedOreRecipe(awareness, "bsb", "ses", "bib", 'b', conduitBinder, 's', silicon, 'e', Items.ender_eye, 'i', electricSteel));
addShaped(awareness, "bsb", "ses", "bib", 'b', binder, 's', silicon, 'e', Items.ender_eye, 'i', electricalSteel);
ItemStack invPanel = new ItemStack(EnderIO.blockInventoryPanel);
GameRegistry.addShapedRecipe(invPanel, "dad", "psp", "dtd", 'd', darkSteel, 'a', awareness, 'p', pulCry, 's', sentientEnder, 't', basicTank);
}
addShaped(invPanel, "dad", "psp", "dtd", 'd', darkSteel, 'a', awareness, 'p', pulCry, 's', sentientEnder, 't', basicTank);
public static void addOreDictionaryRecipes() {
ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0);
ItemStack machineChassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal());
ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0);
//powered light
ItemStack poweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 0);
ItemStack glowstone = new ItemStack(Items.glowstone_dust);
if(Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', "itemSilicon", 'c', capacitor));
if (Config.useHardRecipes) {
addShaped(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', "itemSilicon", 'c', capacitor);
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', "glass", 'd', glowstone, 's', "itemSilicon", 'c', capacitor));
addShaped(poweredLamp, "ggg", "sds", "scs", 'g', "glass", 'd', glowstone, 's', "itemSilicon", 'c', capacitor);
}
ItemStack invPoweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 1);
GameRegistry.addShapelessRecipe(invPoweredLamp, poweredLamp, Blocks.redstone_torch);
GameRegistry.addShapelessRecipe(poweredLamp, invPoweredLamp, Blocks.redstone_torch);
addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch);
addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch);
//light
ItemStack lamp = new ItemStack(EnderIO.blockElectricLight, 1, 2);
GameRegistry.addRecipe(new ShapedOreRecipe(lamp, " ", "ggg", "isi", 'g', "glass", 's', Blocks.glowstone, 'i', Items.iron_ingot));
addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', Blocks.glowstone, 'i', Items.iron_ingot);
ItemStack invLamp = new ItemStack(EnderIO.blockElectricLight, 1, 3);
GameRegistry.addShapelessRecipe(invLamp, lamp, Blocks.redstone_torch);
GameRegistry.addShapelessRecipe(lamp, invLamp, Blocks.redstone_torch);
addShapeless(invLamp, lamp, Blocks.redstone_torch);
addShapeless(lamp, invLamp, Blocks.redstone_torch);
//MJ Reader
ItemStack mJReader = new ItemStack(EnderIO.itemConduitProbe, 1, 0);
ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal());
ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0);
ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2);
GameRegistry.addRecipe(new ShapedOreRecipe(mJReader, "epe", "gcg", "srs", 'p', powerConduit, 'r', redstoneConduit, 'c', Items.comparator, 'g',
Blocks.glass_pane, 's', "itemSilicon", 'e',
electricalSteel));
addShaped(mJReader, "epe", "gcg", "srs", 'p', powerConduit, 'r', redstoneConduit, 'c', Items.comparator, 'g', Blocks.glass_pane, 's', "itemSilicon", 'e',
electricalSteel);
//Slice'N'Splice
ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal());
ItemStack sns = new ItemStack(EnderIO.blockSliceAndSplice);
GameRegistry.addRecipe(new ShapedOreRecipe(sns, "iki", "ams", "iii", 'i', soularium, 'm', machineChassis, 'k', "itemSkull", 'a', Items.iron_axe, 's',
Items.shears));
//Buffer
ItemStack itemBuffer = Type.getStack(Type.ITEM);
ItemStack powerBuffer = Type.getStack(Type.POWER);
ItemStack omniBuffer = Type.getStack(Type.OMNI);
GameRegistry.addRecipe(new ShapedOreRecipe(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', Blocks.chest));
GameRegistry.addRecipe(new ShapedOreRecipe(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis));
GameRegistry.addRecipe(new ShapelessOreRecipe(omniBuffer, itemBuffer, powerBuffer));
addShaped(sns, "iki", "ams", "iii", 'i', soularium, 'm', machineChassis, 'k', "itemSkull", 'a', Items.iron_axe, 's', Items.shears);
//Buffer
ItemStack itemBuffer = Type.getStack(Type.ITEM);
ItemStack powerBuffer = Type.getStack(Type.POWER);
ItemStack omniBuffer = Type.getStack(Type.OMNI);
addShaped(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', Blocks.chest);
addShaped(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis);
addShapeless(omniBuffer, itemBuffer, powerBuffer);
}
}
}
@@ -11,6 +11,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -184,4 +185,18 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
return this;
}
@Override
public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacade(world, x, y, z, side.ordinal());
}
@Override
public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacadeMetadata(world, x, y, z, side.ordinal());
}
@Override
public boolean supportsVisualConnections() {
return true;
}
}
@@ -84,7 +84,7 @@ public class ContainerCrafter extends AbstractMachineContainer {
if(refStack == null || itemStack == null) {
return false;
}
return refStack.isItemEqual(itemStack);
return TileCrafter.compareDamageable(itemStack, refStack);
}
}
@@ -1,7 +1,5 @@
package crazypants.enderio.machine.crafter;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -20,17 +18,6 @@ public class DummyCraftingGrid implements IInventory {
return inv[9];
}
public void copyRequiredInputs(List<ItemStack> required) {
for (int i = 0; i < 9; i++) {
ItemStack is = inv[i];
if(is != null) {
ItemStack copy = is.copy();
copy.stackSize = 1;
required.add(copy);
}
}
}
@Override
public int getSizeInventory() {
return inv.length;
@@ -3,6 +3,7 @@ package crazypants.enderio.machine.crafter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@@ -10,12 +11,17 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.FakePlayer;
import com.enderio.core.common.util.ItemUtil;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.AbstractPowerConsumerEntity;
import crazypants.enderio.machine.FakePlayerEIO;
import crazypants.enderio.machine.IItemBuffer;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.power.BasicCapacitor;
@@ -26,11 +32,13 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
DummyCraftingGrid craftingGrid = new DummyCraftingGrid();
private List<ItemStack> containerItems;
private final List<ItemStack> containerItems;
private boolean bufferStacks = true;
private long ticksSinceLastCraft = 0;
private FakePlayer playerInst;
public TileCrafter() {
super(new SlotDefinition(9, 1));
@@ -55,7 +63,7 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
if(!slotDefinition.isInputSlot(slot)) {
return false;
}
return craftingGrid.inv[slot] != null && craftingGrid.inv[slot].isItemEqual(itemstack);
return craftingGrid.inv[slot] != null && compareDamageable(itemstack, craftingGrid.inv[slot]);
}
@Override
@@ -91,10 +99,7 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
return false;
}
List<ItemStack> required = new ArrayList<ItemStack>();
craftingGrid.copyRequiredInputs(required);
if(hasRequiredInput(required)) {
craftRecipe();
if(craftRecipe()) {
int used = Math.min(getEnergyStored(), Config.crafterRfPerCraft);
setEnergyStored(getEnergyStored() - used);
}
@@ -125,7 +130,20 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
}
}
private void craftRecipe() {
static boolean compareDamageable(ItemStack stack, ItemStack req) {
if(stack.isItemEqual(req)) {
return true;
}
if(stack.isItemStackDamageable() && stack.getItem() == req.getItem()) {
return stack.getItemDamage() < stack.getMaxDamage();
}
return false;
}
private static final UUID uuid = UUID.fromString("9b381cae-3c95-4a64-b958-1e25b0a4c790");
private static final GameProfile DUMMY_PROFILE = new GameProfile(uuid, "[EioCrafter]");
private boolean craftRecipe() {
// (1) Find the items to craft with and put a copy into a temp crafting grid;
// also record what was used to destroy it later
@@ -136,33 +154,40 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
}
}, 3, 3);
ItemStack[] shadowInventory = new ItemStack[9];
for (int i = 0; i < 9; i++) {
shadowInventory[i] = inventory[i] == null ? null : inventory[i].copy();
}
int[] usedItems = new int[9];
for (int j = 0; j < 9; j++) {
ItemStack req = craftingGrid.getStackInSlot(j);
for (int i = 0; i < 9 && req != null; i++) {
if (shadowInventory[i] != null && shadowInventory[i].stackSize > 0 && shadowInventory[i].isItemEqual(req)) {
req = null;
shadowInventory[i].stackSize--;
ItemStack craftingItem = shadowInventory[i].copy();
craftingItem.stackSize = 1;
inv.setInventorySlotContents(j, craftingItem);
if (req != null) {
for (int i = 0; i < 9; i++) {
if (inventory[i] != null && inventory[i].stackSize > usedItems[i] && compareDamageable(inventory[i], req)) {
req = null;
usedItems[i]++;
ItemStack craftingItem = inventory[i].copy();
craftingItem.stackSize = 1;
inv.setInventorySlotContents(j, craftingItem);
break;
}
}
if (req != null) {
return false;
}
}
}
// (2) Try to craft with the temp grid
ItemStack output = CraftingManager.getInstance().findMatchingRecipe(inv, worldObj);
// (3) If we got a result, ...
if (output != null) {
if (playerInst == null) {
playerInst = new FakePlayerEIO(worldObj, getLocation(), DUMMY_PROFILE);
}
MinecraftForge.EVENT_BUS.post(new ItemCraftedEvent(playerInst, output, inv));
// (3a) ... remove the used up items and ...
for (int i = 0; i < 9; i++) {
while (shadowInventory[i] != null && inventory[i] != null && shadowInventory[i].stackSize < inventory[i].stackSize) {
for (int j = 0; j < usedItems[i] && inventory[i] != null; j++) {
setInventorySlotContents(i, eatOneItemForCrafting(inventory[i].copy()));
}
}
@@ -190,14 +215,20 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
// Crafting failed. This is not supposed to happen, but if a recipe is nbt-sensitive, it can.
// To avoid being stuck in a dead loop, we flush the non-working input items.
for (int j = 0; j < 9; j++) {
if (shadowInventory[j] != null) {
setInventorySlotContents(j, shadowInventory[j].stackSize > 0 ? shadowInventory[j] : null);
}
if (craftingGrid.getStackInSlot(j) != null) {
containerItems.add(craftingGrid.getStackInSlot(j));
if (usedItems[j] > 0 && inventory[j] != null) {
ItemStack rejected = inventory[j].copy();
rejected.stackSize = Math.min(inventory[j].stackSize, usedItems[j]);
containerItems.add(rejected);
if (inventory[j].stackSize <= usedItems[j]) {
inventory[j] = null;
} else {
inventory[j].stackSize -= usedItems[j];
}
}
}
}
return true;
}
private ItemStack eatOneItemForCrafting(ItemStack avail) {
@@ -254,30 +285,6 @@ public class TileCrafter extends AbstractPowerConsumerEntity implements IItemBuf
return output.getMaxStackSize() >= (inventory[9].stackSize + output.stackSize);
}
private boolean hasRequiredInput(List<ItemStack> required) {
List<ItemStack> available = new ArrayList<ItemStack>();
for (int i = 0; i < 9; i++) {
ItemStack is = inventory[i];
if(is != null) {
available.add(is.copy());
}
}
for (ItemStack req : required) {
boolean foundReq = false;
for (ItemStack avail : available) {
if(req.isItemEqual(avail) && avail.stackSize > 0) {
avail.stackSize--;
foundReq = true;
break;
}
}
if(!foundReq) {
return false;
}
}
return true;
}
@Override
public int getInventoryStackLimit() {
return bufferStacks ? 64 : 1;
@@ -66,7 +66,7 @@ public class CrusherRecipeManager {
int id = OreDictionary.getOreID(input.item);
if(id >= 0) {
String name = OreDictionary.getOreName(id);
if(name.startsWith("ingot") || name.startsWith("block")) {
if(name.startsWith("ingot") || name.startsWith("block") || name.startsWith("nugget")) {
addExcludedStack(input.item);
return true;
}
@@ -1,27 +1,40 @@
package crazypants.enderio.machine.enchanter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.opengl.GL11;
import com.enderio.core.client.gui.GuiContainerBase;
import com.enderio.core.client.gui.button.IconButton;
import com.enderio.core.client.render.RenderUtil;
import crazypants.enderio.EnderIO;
import crazypants.enderio.gui.IconEIO;
public class GuiEnchanter extends GuiContainer {
public class GuiEnchanter extends GuiContainerBase {
private TileEnchanter te;
private ContainerEnchanter container;
private IconButton recipeButton;
public GuiEnchanter(EntityPlayer player, InventoryPlayer inventory, TileEnchanter te) {
super(new ContainerEnchanter(player, inventory, te));
container = (ContainerEnchanter)inventorySlots;
this.te = te;
recipeButton = new IconButton(this, 100, 154, 8, IconEIO.RECIPE);
recipeButton.visible = false;
recipeButton.setIconMargin(3, 3);
}
@Override
public void initGui() {
super.initGui();
recipeButton.onGuiInit();
recipeButton.visible = EnderIO.proxy.isNeiInstalled();
}
@Override
@@ -52,5 +65,4 @@ public class GuiEnchanter extends GuiContainer {
drawCenteredString(Minecraft.getMinecraft().fontRenderer, s, sx + xSize/2, sy + 57, col);
}
}
}
@@ -1,10 +1,14 @@
package crazypants.enderio.machine.farm;
import java.util.Iterator;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.farm.farmers.CocoaFarmer;
@@ -35,6 +39,7 @@ public final class FarmersRegistry {
addMFR();
addThaumcraft();
addFlowers();
addGrowableOres();
FarmersCommune.joinCommune(new StemFarmer(Blocks.reeds, new ItemStack(Items.reeds)));
FarmersCommune.joinCommune(new StemFarmer(Blocks.cactus, new ItemStack(Blocks.cactus)));
@@ -213,6 +218,28 @@ public final class FarmersRegistry {
GameRegistry.findBlock("Botany", "flower"),
GameRegistry.findBlock("Botania", "flower") ) );
}
@SuppressWarnings("unchecked")
private static void addGrowableOres() {
String mod = "B0bGrowsOre";
if (!Loader.isModLoaded(mod)) {
return;
}
Pattern[] growableOres = { Pattern.compile("(.+)Reed"), Pattern.compile("oreGrowable(.+)") };
Iterator<Block> blockIter = Block.blockRegistry.iterator();
while (blockIter.hasNext()) {
Block block = blockIter.next();
String name = Block.blockRegistry.getNameForObject(block);
if (name != null && name.startsWith(mod)) {
for (Pattern blockPattern : growableOres) {
if (blockPattern.matcher(name).find()) {
FarmersCommune.joinCommune(new StemFarmer(block, new ItemStack(block)));
}
}
}
}
}
private FarmersRegistry() {
}
@@ -24,6 +24,7 @@ public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
public GuiFarmStation(InventoryPlayer par1InventoryPlayer, TileFarmStation machine) {
super(machine, new FarmStationContainer(par1InventoryPlayer, machine));
setYSize(ySize + 3);
}
@SuppressWarnings("unchecked")
@@ -103,5 +104,4 @@ public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
protected int getPowerHeight() {
return super.getPowerHeight() + 3;
}
}
@@ -52,18 +52,23 @@ public class StemFarmer extends CustomSeedFarmer {
boolean done = false;
do{
harvestCoord = harvestCoord.getLocation(ForgeDirection.UP);
if(plantedBlock == farm.getBlock(harvestCoord) && farm.hasHoe()) {
boolean hasHoe = farm.hasHoe();
if(plantedBlock == farm.getBlock(harvestCoord) && hasHoe) {
res.harvestedBlocks.add(harvestCoord);
ArrayList<ItemStack> drops = plantedBlock.getDrops(farm.getWorldObj(), harvestCoord.x, harvestCoord.y, harvestCoord.z, meta, farm.getMaxLootingValue());
if(drops != null) {
for(ItemStack drop : drops) {
res.drops.add(new EntityItem(farm.getWorldObj(), bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, drop.copy()));
}
}
farm.damageHoe(1, harvestCoord);
farm.actionPerformed(false);
} else {
if (!hasHoe) {
farm.setNotification(TileFarmStation.NOTIFICATION_NO_HOE);
} else {
farm.clearNotification();
}
done = true;
}
} while(!done);
@@ -421,11 +421,13 @@ public class TileCombustionGenerator extends AbstractGeneratorEntity implements
@Override
public FluidTank getInputTank(FluidStack forFluidType) {
if (FluidFuelRegister.instance.getCoolant(forFluidType.getFluid()) != null) {
return coolantTank;
}
if (FluidFuelRegister.instance.getFuel(forFluidType.getFluid()) != null) {
return fuelTank;
if (forFluidType != null) {
if (FluidFuelRegister.instance.getCoolant(forFluidType.getFluid()) != null) {
return coolantTank;
}
if (FluidFuelRegister.instance.getFuel(forFluidType.getFluid()) != null) {
return fuelTank;
}
}
return null;
}
@@ -3,68 +3,80 @@ package crazypants.enderio.machine.invpanel.server;
import net.minecraft.item.ItemStack;
abstract class AbstractInventory {
static final ItemEntry[] NO_SLOTS = new ItemEntry[0];
ItemEntry[] slotItems = NO_SLOTS;
int[] itemCounts;
static final SlotKey[] NO_SLOTS = new SlotKey[0];
SlotKey[] slotKeys = NO_SLOTS;
protected void setEmpty(InventoryDatabaseServer db, int aiIndex) {
if (slotItems.length != 0) {
reset(db, 0, aiIndex);
protected void setEmpty(InventoryDatabaseServer db) {
if (slotKeys.length != 0) {
reset(db, 0);
}
}
protected void reset(InventoryDatabaseServer db, int count, int aiIndex) {
for (int slot = 0; slot < slotItems.length; slot++) {
ItemEntry key = slotItems[slot];
if (key != null) {
key.removeSlot(aiIndex, slot);
db.entryChanged(key);
protected void reset(InventoryDatabaseServer db, int count) {
for (SlotKey slotKey : slotKeys) {
if(slotKey != null) {
slotKey.remove(db);
}
}
slotItems = new ItemEntry[count];
itemCounts = new int[count];
slotKeys = new SlotKey[count];
}
protected void updateSlot(InventoryDatabaseServer db, int slot, int aiIndex, ItemStack stack) {
ItemEntry current = slotItems[slot];
if (stack == null || stack.stackSize <= 0) {
if (current != null) {
slotItems[slot] = null;
itemCounts[slot] = 0;
current.removeSlot(aiIndex, slot);
db.entryChanged(current);
}
protected void updateSlot(InventoryDatabaseServer db, int slot, ItemStack stack) {
if (stack == null) {
emptySlot(db, slot);
} else {
ItemEntry key = db.lookupItem(stack, current, true);
if (key != current) {
slotItems[slot] = key;
itemCounts[slot] = stack.stackSize;
key.addSlot(aiIndex, slot);
db.entryChanged(key);
if (current != null) {
current.removeSlot(aiIndex, slot);
db.entryChanged(current);
}
} else if (itemCounts[slot] != stack.stackSize) {
itemCounts[slot] = stack.stackSize;
db.entryChanged(current);
}
updateSlot(db, slot, stack, stack.stackSize);
}
}
protected void updateCount(InventoryDatabaseServer db, int slot, int aiIndex, ItemEntry entry, int count) {
if (itemCounts[slot] != count) {
itemCounts[slot] = count;
protected void updateSlot(InventoryDatabaseServer db, int slot, ItemStack stack, int count) {
SlotKey slotKey = slotKeys[slot];
ItemEntry current = slotKey != null ? slotKey.item : null;
ItemEntry key = db.lookupItem(stack, current, true);
if (key != current) {
updateSlotKey(db, slot, slotKey, key, count);
} else if (slotKey != null && slotKey.count != count) {
slotKey.count = count;
db.entryChanged(current);
}
}
protected void emptySlot(InventoryDatabaseServer db, int slot) {
SlotKey slotKey = slotKeys[slot];
if (slotKey != null) {
slotKey.remove(db);
slotKeys[slot] = null;
}
}
private void updateSlotKey(InventoryDatabaseServer db, int slot, SlotKey slotKey, ItemEntry key, int count) {
if (slotKey != null) {
slotKey.remove(db);
slotKey = null;
}
if (key != null) {
slotKey = new SlotKey(this, slot, key, count);
key.addSlot(slotKey);
db.entryChanged(key);
}
slotKeys[slot] = slotKey;
}
protected void updateCount(InventoryDatabaseServer db, int slot, ItemEntry entry, int count) {
SlotKey slotKey = slotKeys[slot];
if (slotKey != null && slotKey.count != count && slotKey.item == entry) {
if (count == 0) {
slotItems[slot] = null;
entry.removeSlot(aiIndex, slot);
slotKey.remove(db);
slotKeys[slot] = null;
} else {
slotKey.count = count;
db.entryChanged(slotKey.item);
}
db.entryChanged(entry);
}
}
abstract int scanInventory(InventoryDatabaseServer db, int aiIndex);
abstract int scanInventory(InventoryDatabaseServer db);
abstract int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int aiIndex, int count);
abstract int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count);
}
@@ -8,23 +8,18 @@ class DSUInventory extends AbstractInventory {
DSUInventory(IDeepStorageUnit dsu) {
this.dsu = dsu;
this.slotKeys = new SlotKey[1];
}
@Override
public int scanInventory(InventoryDatabaseServer db, int aiIndex) {
if (slotItems.length != 1) {
reset(db, 1, aiIndex);
}
public int scanInventory(InventoryDatabaseServer db) {
ItemStack stack = dsu.getStoredItemType();
updateSlot(db, 0, aiIndex, stack);
updateSlot(db, 0, stack);
return 1;
}
@Override
public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int aiIndex, int count) {
if (slotItems.length != 1) {
return 0;
}
public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) {
ItemStack stack = dsu.getStoredItemType();
if (db.lookupItem(stack, entry, false) != entry) {
return 0;
@@ -35,7 +30,7 @@ class DSUInventory extends AbstractInventory {
}
remaining -= count;
dsu.setStoredItemCount(remaining);
updateCount(db, slot, aiIndex, entry, remaining);
updateCount(db, 0, entry, remaining);
return count;
}
@@ -0,0 +1,66 @@
package crazypants.enderio.machine.invpanel.server;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import net.minecraft.item.ItemStack;
public class DrawerGroupInventory extends AbstractInventory {
final IDrawerGroup dg;
public DrawerGroupInventory(IDrawerGroup dg) {
this.dg = dg;
}
@Override
int scanInventory(InventoryDatabaseServer db) {
int count = dg.getDrawerCount();
if (count == 0) {
setEmpty(db);
return 0;
}
if (count != slotKeys.length) {
reset(db, count);
}
for (int i = 0; i < count; i++) {
IDrawer drawer = dg.getDrawer(i);
ItemStack stack;
int quantity;
if (drawer != null &&
(quantity = drawer.getStoredItemCount()) > 0 &&
(stack = drawer.getStoredItemPrototype()) != null &&
drawer.canItemBeExtracted(stack)) {
updateSlot(db, i, stack, quantity);
} else {
emptySlot(db, i);
}
}
return count;
}
@Override
int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) {
if (slot >= dg.getDrawerCount()) {
return 0;
}
IDrawer drawer = dg.getDrawer(slot);
if (drawer == null) {
return 0;
}
int remaining = drawer.getStoredItemCount();
if (remaining <= 0) {
return 0;
}
ItemStack stack = drawer.getStoredItemPrototype();
if (db.lookupItem(stack, entry, false) != entry) {
return 0;
}
if (count > remaining) {
count = remaining;
}
remaining -= count;
drawer.setStoredItemCount(remaining);
updateCount(db, slot, entry, remaining);
return count;
}
}
@@ -21,7 +21,6 @@ import com.enderio.core.common.network.CompressedDataOutput;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
public class InventoryDatabaseServer extends InventoryDatabase<ItemEntry> {
@@ -182,11 +181,7 @@ public class InventoryDatabaseServer extends InventoryDatabase<ItemEntry> {
this.inventories = new AbstractInventory[sources.size()];
for(int i=0; i<sources.size(); i++) {
NetworkedInventory ni = sources.get(i);
if(ni.getInventory() instanceof IDeepStorageUnit) {
inventories[i] = new DSUInventory((IDeepStorageUnit) ni.getInventory());
} else {
inventories[i] = new NormalInventory(ni);
}
inventories[i] = InventoryFactory.createInventory(ni);
}
}
@@ -237,7 +232,7 @@ public class InventoryDatabaseServer extends InventoryDatabase<ItemEntry> {
}
AbstractInventory inv = inventories[currentInventory];
int slots = inv.scanInventory(this, currentInventory);
int slots = inv.scanInventory(this);
currentInventory = (currentInventory+1) % inventories.length;
tickPause += 1 + (slots + 8) / 9;
@@ -0,0 +1,55 @@
package crazypants.enderio.machine.invpanel.server;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;
import cpw.mods.fml.common.Loader;
import crazypants.enderio.conduit.item.NetworkedInventory;
import java.util.ArrayList;
import net.minecraft.inventory.ISidedInventory;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
public abstract class InventoryFactory {
private static final ArrayList<InventoryFactory> factories;
static {
factories = new ArrayList<InventoryFactory>();
factories.add(new DSUFactory());
if (Loader.isModLoaded("StorageDrawers")) {
factories.add(new DrawerFactory());
}
}
static AbstractInventory createInventory(NetworkedInventory ni) {
for(InventoryFactory f : factories) {
AbstractInventory ai = f.create(ni);
if (ai != null) {
return ai;
}
}
return new NormalInventory(ni);
}
abstract AbstractInventory create(NetworkedInventory ni);
static class DSUFactory extends InventoryFactory {
@Override
AbstractInventory create(NetworkedInventory ni) {
ISidedInventory inv = ni.getInventory();
if (inv instanceof IDeepStorageUnit) {
return new DSUInventory((IDeepStorageUnit) inv);
}
return null;
}
}
static class DrawerFactory extends InventoryFactory {
@Override
AbstractInventory create(NetworkedInventory ni) {
ISidedInventory inv = ni.getInventory();
if (inv instanceof IDrawerGroup) {
return new DrawerGroupInventory((IDrawerGroup) inv);
}
return null;
}
}
}
@@ -1,47 +1,42 @@
package crazypants.enderio.machine.invpanel.server;
import crazypants.enderio.machine.invpanel.ItemEntryBase;
import java.util.HashSet;
import java.util.IdentityHashMap;
import net.minecraft.nbt.NBTTagCompound;
public class ItemEntry extends ItemEntryBase {
private final HashSet<Integer> slots = new HashSet<Integer>();
private final IdentityHashMap<SlotKey, SlotKey> slots = new IdentityHashMap<SlotKey, SlotKey>();
public ItemEntry(int dbID, int hash, int itemID, int meta, NBTTagCompound nbt) {
super(dbID, hash, itemID, meta, nbt);
}
static int encodeAISlot(int aiIndex, int slot) {
return (aiIndex << 12) | slot;
void addSlot(SlotKey slotKey) {
slots.put(slotKey, slotKey);
}
void addSlot(int aiIndex, int slot) {
slots.add(encodeAISlot(aiIndex, slot));
}
void removeSlot(int aiIndex, int slot) {
slots.remove(encodeAISlot(aiIndex, slot));
void removeSlot(SlotKey slotKey) {
slots.remove(slotKey);
}
int countItems(InventoryDatabaseServer db) {
int count = 0;
for (Integer idx : slots) {
AbstractInventory key = db.getInventory(idx >> 12);
count += key.itemCounts[idx & 4095];
for (SlotKey slotKey : slots.values()) {
count += slotKey.count;
}
return count;
}
int extractItems(InventoryDatabaseServer db, int count) {
int extracted = 0;
Integer[] copy = slots.toArray(new Integer[slots.size()]);
for (Integer idx : copy) {
int aiIndex = idx >> 12;
int slotIndex = idx & 4095;
AbstractInventory key = db.getInventory(aiIndex);
int amount = key.extractItem(db, this, slotIndex, aiIndex, count);
SlotKey[] copy = slots.values().toArray(new SlotKey[slots.size()]);
for (SlotKey slotKey : copy) {
int amount = slotKey.inv.extractItem(db, this, slotKey.slot, count);
count -= amount;
extracted += amount;
if (count <= 0) {
break;
}
}
return extracted;
}
@@ -12,17 +12,17 @@ class NormalInventory extends AbstractInventory {
}
@Override
int scanInventory(InventoryDatabaseServer db, int aiIndex) {
int scanInventory(InventoryDatabaseServer db) {
ISidedInventory inv = ni.getInventoryRecheck();
int side = ni.getInventorySide();
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
if (slotIndices == null || slotIndices.length == 0) {
setEmpty(db, aiIndex);
setEmpty(db);
return 0;
}
int count = slotIndices.length;
if (count != slotItems.length) {
reset(db, count, aiIndex);
if (count != slotKeys.length) {
reset(db, count);
}
for (int slot = 0; slot < count; slot++) {
int invSlot = slotIndices[slot];
@@ -30,13 +30,13 @@ class NormalInventory extends AbstractInventory {
if (stack != null && !inv.canExtractItem(invSlot, stack, side)) {
stack = null;
}
updateSlot(db, slot, aiIndex, stack);
updateSlot(db, slot, stack);
}
return count;
}
@Override
public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int aiIndex, int count) {
public int extractItem(InventoryDatabaseServer db, ItemEntry entry, int slot, int count) {
ISidedInventory inv = ni.getInventoryRecheck();
int side = ni.getInventorySide();
int[] slotIndices = inv.getAccessibleSlotsFromSide(side);
@@ -57,7 +57,7 @@ class NormalInventory extends AbstractInventory {
}
ni.itemExtracted(invSlot, count);
remaining -= count;
updateCount(db, slot, aiIndex, entry, remaining);
updateCount(db, slot, entry, remaining);
return count;
}
@@ -0,0 +1,20 @@
package crazypants.enderio.machine.invpanel.server;
public final class SlotKey {
final AbstractInventory inv;
final int slot;
final ItemEntry item;
int count;
SlotKey(AbstractInventory inv, int slot, ItemEntry item, int count) {
this.inv = inv;
this.slot = slot;
this.item = item;
this.count = count;
}
void remove(InventoryDatabaseServer db) {
item.removeSlot(this);
db.entryChanged(item);
}
}
@@ -38,6 +38,7 @@ import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.FakePlayerEIO;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.machine.generator.zombie.IHasNutrientTank;
import crazypants.enderio.machine.generator.zombie.PacketNutrientTank;
@@ -496,15 +497,12 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle
private static final UUID uuid = UUID.fromString("3baa66fa-a69a-11e4-89d3-123b93f75cba");
private static final GameProfile DUMMY_PROFILE = new GameProfile(uuid, "[EioKillera]");
private class Attackera extends FakePlayer {
private class Attackera extends FakePlayerEIO {
ItemStack prevWeapon;
public Attackera() {
super(MinecraftServer.getServer().worldServerForDimension(getWorldObj().provider.dimensionId), DUMMY_PROFILE);
posX = xCoord + 0.5;
posY = yCoord + 0.5;
posZ = zCoord + 0.5;
super(getWorldObj(), getLocation(), DUMMY_PROFILE);
}
@Override
@@ -527,23 +525,6 @@ public class TileKillerJoe extends AbstractMachineEntity implements IFluidHandle
getChargedLocation().chargeItems(inventory.mainInventory);
}
// These do things with packets...which crash since the net handler is null. Potion effects are not needed anyways.
@Override
protected void onNewPotionEffect(PotionEffect p_70670_1_) {
}
@Override
protected void onChangedPotionEffect(PotionEffect p_70695_1_, boolean p_70695_2_) {
}
@Override
protected void onFinishedPotionEffect(PotionEffect p_70688_1_) {
}
@Override
public void addChatMessage(IChatComponent p_145747_1_) {
}
}
@Override
@@ -110,7 +110,6 @@ public class GuiPowerMonitor extends GuiContainerBase {
startTF = new TextFieldEnder(getFontRenderer(), x, y, 28, 14);
startTF.setCanLoseFocus(true);
startTF.setMaxStringLength(3);
startTF.setFocused(true);
startTF.setVisible(false);
startTF.setText(INT_NF.format(te.asPercentInt(te.startLevel)));
@@ -119,7 +118,6 @@ public class GuiPowerMonitor extends GuiContainerBase {
endTF = new TextFieldEnder(getFontRenderer(), x, y, 28, 14);
endTF.setCanLoseFocus(true);
endTF.setMaxStringLength(3);
endTF.setFocused(false);
endTF.setVisible(false);
endTF.setText(INT_NF.format(te.asPercentInt(te.stopLevel)));
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.GuiHandler;
@@ -15,6 +16,7 @@ public class BlockAttractor extends BlockObeliskAbstract<TileAttractor> {
public static BlockAttractor create() {
BlockAttractor res = new BlockAttractor();
res.init();
MinecraftForge.EVENT_BUS.register(new EndermanFixer());
return res;
}
@@ -0,0 +1,15 @@
package crazypants.enderio.machine.obelisk.attractor;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class EndermanFixer {
@SubscribeEvent
public void onEndermanTeleport(EnderTeleportEvent event) {
if (event.entityLiving instanceof EntityEnderman && event.entityLiving.getEntityData().getBoolean("EIO:tracked")) {
event.setCanceled(true);
}
}
}
@@ -9,6 +9,7 @@ import java.util.Set;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;
@@ -25,6 +26,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.common.util.FakePlayer;
import com.enderio.core.client.render.BoundingBox;
@@ -38,6 +40,7 @@ import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.AbstractPowerConsumerEntity;
import crazypants.enderio.machine.FakePlayerEIO;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.machine.ranged.IRanged;
import crazypants.enderio.machine.ranged.RangeEntity;
@@ -166,13 +169,40 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
onEntityTick(ent);
} else if(tracking.size() < maxMobsAttracted && trackMob(ent)) {
trackingThisTick.add(ent);
onTracked(ent);
}
}
}
for (EntityLiving e : tracking) {
if (!trackingThisTick.contains(e)) {
onUntracked(e);
}
}
tracking.clear();
tracking = trackingThisTick;
return false;
}
private void onUntracked(EntityLiving e) {
if (e instanceof EntityEnderman) {
e.getEntityData().setBoolean("EIO:tracked", false);
}
}
private void onTracked(EntityLiving e) {
if (e instanceof EntityEnderman) {
e.getEntityData().setBoolean("EIO:tracked", true);
}
}
@Override
public void invalidate() {
super.invalidate();
for (EntityLiving e : tracking) {
onUntracked(e);
}
tracking.clear();
}
protected double usePower() {
return usePower(getPowerUsePerTick());
@@ -281,10 +311,6 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
}
private boolean applySpecialCase(EntityLiving ent) {
return ent instanceof EntitySlime || ent instanceof EntitySilverfish || ent instanceof EntityBlaze;
}
private boolean useSpecialCase(EntityLiving ent) {
if(ent instanceof EntitySlime) {
ent.faceEntity(getTarget(), 10.0F, 20.0F);
return true;
@@ -298,6 +324,10 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
return false;
}
private boolean useSpecialCase(EntityLiving ent) {
return ent instanceof EntitySlime || ent instanceof EntitySilverfish || ent instanceof EntityBlaze;
}
private void onEntityTick(EntityLiving ent) {
if(ent instanceof EntitySlime) {
ent.faceEntity(getTarget(), 10.0F, 20.0F);
@@ -325,7 +355,9 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
}
} else if(ent instanceof EntityPigZombie || ent instanceof EntitySpider) {
forceMove(ent);
}
} else if(ent instanceof EntityEnderman) {
((EntityEnderman) ent).setTarget(getTarget());
}
}
private void forceMove(EntityLiving ent) {
@@ -346,19 +378,14 @@ public class TileAttractor extends AbstractPowerConsumerEntity implements IRange
}
private boolean useSetTarget(EntityLiving ent) {
return ent instanceof EntityEnderman || ent instanceof EntityPigZombie || ent instanceof EntitySpider || ent instanceof EntitySilverfish;
return ent instanceof EntityPigZombie || ent instanceof EntitySpider || ent instanceof EntitySilverfish;
}
private class Target extends FakePlayer {
ItemStack prevWeapon;
private class Target extends FakePlayerEIO {
public Target() {
super(MinecraftServer.getServer().worldServerForDimension(getWorldObj().provider.dimensionId), new GameProfile(null,
ModObject.blockAttractor.unlocalisedName + ":" + getLocation()));
posX = xCoord + 0.5;
posY = yCoord + 1.5;
posZ = zCoord + 0.5;
super(getWorldObj(), getLocation(), new GameProfile(null, ModObject.blockAttractor.unlocalisedName + ":" + getLocation()));
posY += 1;
}
}
@@ -294,4 +294,19 @@ public class BlockPaintedGlowstone extends BlockEio implements ITileEntityProvid
}
return this;
}
@Override
public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacade(world, x, y, z, side.ordinal());
}
@Override
public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacadeMetadata(world, x, y, z, side.ordinal());
}
@Override
public boolean supportsVisualConnections() {
return true;
}
}
@@ -20,7 +20,7 @@ public class PainterContainer extends AbstractMachineContainer {
return tileEntity.isItemValidForSlot(0, itemStack);
}
});
addSlotToContainer(new Slot(tileEntity, 1, 37, 34) {
addSlotToContainer(new Slot(tileEntity, 1, 38, 34) {
@Override
public boolean isItemValid(ItemStack itemStack) {
return tileEntity.isItemValidForSlot(1, itemStack);
@@ -8,19 +8,22 @@ import crazypants.enderio.machine.gui.AbstractMachineContainer;
public class ContainerPoweredSpawner extends AbstractMachineContainer {
private Slot slotInput;
private Slot slotOutput;
public ContainerPoweredSpawner(InventoryPlayer playerInv, AbstractMachineEntity te) {
super(playerInv, te);
}
@Override
protected void addMachineSlots(InventoryPlayer playerInv) {
addSlotToContainer(new Slot(tileEntity, 0, 54, 42) {
slotInput = addSlotToContainer(new Slot(tileEntity, 0, 54, 42) {
@Override
public boolean isItemValid(ItemStack itemStack) {
return tileEntity.isItemValidForSlot(0, itemStack);
}
});
addSlotToContainer(new Slot(tileEntity, 1, 105, 42) {
slotOutput = addSlotToContainer(new Slot(tileEntity, 1, 105, 42) {
@Override
public boolean isItemValid(ItemStack itemStack) {
return false;
@@ -28,5 +31,9 @@ public class ContainerPoweredSpawner extends AbstractMachineContainer {
});
}
public void setSlotVisibility(boolean visible) {
slotInput.yDisplayPosition = visible ? 42 : -3000;
slotOutput.yDisplayPosition = visible ? 42 : -3000;
}
}
@@ -1,6 +1,7 @@
package crazypants.enderio.machine.spawner;
import java.awt.Color;
import java.awt.Rectangle;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
@@ -11,6 +12,7 @@ import org.lwjgl.opengl.GL11;
import com.enderio.core.client.gui.button.MultiIconButton;
import com.enderio.core.client.render.ColorUtil;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.Lang;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
@@ -19,12 +21,20 @@ import crazypants.enderio.network.PacketHandler;
public class GuiPoweredSpawner extends GuiPoweredMachineBase<TilePoweredSpawner> {
private final MultiIconButton modeB;
private final Rectangle progressTooltipRect;
private boolean wasSpawnMode;
private String header;
public GuiPoweredSpawner(InventoryPlayer par1InventoryPlayer, TilePoweredSpawner te) {
super(te, new ContainerPoweredSpawner(par1InventoryPlayer, te));
modeB = MultiIconButton.createRightArrowButton(this, 8888, 115, 10);
modeB.setSize(10, 16);
addProgressTooltip(80, 34, 14, 14);
progressTooltipRect = progressTooltips.get(0).getBounds();
updateSpawnMode(te.isSpawnMode());
}
@Override
@@ -43,6 +53,25 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase<TilePoweredSpawner>
}
}
private void updateSpawnMode(boolean spawnMode) {
wasSpawnMode = spawnMode;
((ContainerPoweredSpawner) inventorySlots).setSlotVisibility(!spawnMode);
if(spawnMode) {
header = EnderIO.lang.localize("gui.machine.poweredspawner.spawn");
progressTooltipRect.x = 80;
progressTooltipRect.y = 34;
progressTooltipRect.width = 14;
progressTooltipRect.height = 14;
} else {
header = EnderIO.lang.localize("gui.machine.poweredspawner.capture");
progressTooltipRect.x = 52;
progressTooltipRect.y = 40;
progressTooltipRect.width = 72;
progressTooltipRect.height = 21;
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -55,36 +84,32 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase<TilePoweredSpawner>
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
TilePoweredSpawner spawner = getTileEntity();
int left = getGuiLeft();
int top = getGuiTop();
boolean spawnMode = spawner.isSpawnMode();
String txt = EnderIO.lang.localize("gui.machine.poweredspawner.spawn");
if(!spawner.isSpawnMode()) {
txt = EnderIO.lang.localize("gui.machine.poweredspawner.capture");
if(spawnMode != wasSpawnMode) {
updateSpawnMode(spawnMode);
}
FontRenderer fr = getFontRenderer();
int x = left + xSize / 2 - fr.getStringWidth(txt) / 2;
int y = top + fr.FONT_HEIGHT + 6;
fr.drawStringWithShadow(txt, x, y, ColorUtil.getRGB(Color.WHITE));
int x = sx + xSize / 2 - fr.getStringWidth(header) / 2;
int y = sy + fr.FONT_HEIGHT + 6;
fr.drawStringWithShadow(header, x, y, ColorUtil.getRGB(Color.WHITE));
RenderUtil.bindTexture("enderio:textures/gui/poweredSpawner.png");
if(spawner.isSpawnMode()) {
int yOff = 34;
drawTexturedModalRect(left + 80, top + yOff, 207, 0, 17, 15);
if(spawner.getProgress() < 1 && spawner.getProgress() > 0) {
if(spawnMode) {
drawTexturedModalRect(sx + 80, sy + 34, 207, 0, 17, 15);
if(shouldRenderProgress()) {
int scaled = getProgressScaled(14) + 1;
drawTexturedModalRect(left + 81, top + yOff + 14 - scaled, 176, 14 - scaled, 14, scaled);
drawTexturedModalRect(sx + 81, sy + 34 + 14 - scaled, 176, 14 - scaled, 14, scaled);
}
} else {
drawTexturedModalRect(left + 52, top + 40, 52, 170, 72, 21);
if(spawner.getProgress() < 1 && spawner.getProgress() > 0) {
drawTexturedModalRect(sx + 52, sy + 40, 52, 170, 72, 21);
if(shouldRenderProgress()) {
int scaled = getProgressScaled(24);
drawTexturedModalRect(left + 76, top + 43, 176, 14, scaled + 1, 16);
drawTexturedModalRect(sx + 76, sy + 43, 176, 14, scaled + 1, 16);
}
}
}
@Override
@@ -6,9 +6,7 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.config.Config;
@@ -40,15 +38,16 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
public static final int MIN_PLAYER_DISTANCE = Config.poweredSpawnerMaxPlayerDistance;
public static final boolean USE_VANILLA_SPAWN_CHECKS = Config.poweredSpawnerUseVanillaSpawChecks;
private final SpawnerLogic logic = new SpawnerLogic();
private static final String NULL_ENTITY_NAME = "None";
private String entityTypeName;
private boolean isSpawnMode = true;
private int powerUsePerTick;
private int remainingSpawnTries;
public TilePoweredSpawner() {
super(new SlotDefinition(1, 1, 1));
logic.setEntityName(NULL_ENTITY_NAME);
entityTypeName = NULL_ENTITY_NAME;
}
public boolean isSpawnMode() {
@@ -66,16 +65,17 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
protected void taskComplete() {
super.taskComplete();
if(isSpawnMode) {
logic.spawnDelay = 0;
remainingSpawnTries = Config.poweredSpawnerSpawnCount + Config.poweredSpawnerMaxSpawnTries;
for (int i = 0; i < Config.poweredSpawnerSpawnCount && remainingSpawnTries > 0; ++i) {
if(!trySpawnEntity()) {
break;
}
}
} else {
if(getStackInSlot(0) == null || getStackInSlot(1) != null) {
if(getStackInSlot(0) == null || getStackInSlot(1) != null || !hasEntityName()) {
return;
}
String name = logic.getEntityNameToSpawn();
if(NULL_ENTITY_NAME.equals(name)) {
return;
}
ItemStack res = EnderIO.itemSoulVessel.createVesselWithEntityStub(logic.getEntityNameToSpawn());
ItemStack res = EnderIO.itemSoulVessel.createVesselWithEntityStub(getEntityName());
decrStackSize(0, 1);
setInventorySlotContents(1, res);
}
@@ -83,20 +83,26 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
@Override
public void onCapacitorTypeChange() {
ICapacitor refCap = null;
ICapacitor refCap;
int basePowerUse;
switch (getCapacitorType()) {
default:
case BASIC_CAPACITOR:
refCap = CAP_ONE;
basePowerUse = POWER_PER_TICK_ONE;
break;
case ACTIVATED_CAPACITOR:
refCap = CAP_TWO;
basePowerUse = POWER_PER_TICK_TWO;
break;
case ENDER_CAPACITOR:
refCap = CAP_THREE;
basePowerUse = POWER_PER_TICK_THREE;
break;
}
double multuplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(logic.getEntityNameToSpawn());
setCapacitor(new BasicCapacitor((int) (refCap.getMaxEnergyExtracted() * multuplier), refCap.getMaxEnergyStored()));
double multiplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(getEntityName());
setCapacitor(new BasicCapacitor((int) (refCap.getMaxEnergyExtracted() * multiplier), refCap.getMaxEnergyStored()));
powerUsePerTick = (int) Math.ceil(basePowerUse * multiplier);
forceClientUpdate = true;
}
@@ -118,9 +124,14 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
@Override
protected IMachineRecipe canStartNextTask(float chance) {
if(!hasEntityName()) {
return null;
}
if(isSpawnMode) {
if(logic.getEntityNameToSpawn() == null || logic.getEntityNameToSpawn().equals(NULL_ENTITY_NAME)) {
return null;
if(MIN_PLAYER_DISTANCE > 0) {
if(worldObj.getClosestPlayer(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, MIN_PLAYER_DISTANCE) == null) {
return null;
}
}
} else {
if(getStackInSlot(0) == null || getStackInSlot(1) != null) {
@@ -137,13 +148,7 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
@Override
public int getPowerUsePerTick() {
double multuplier = PoweredSpawnerConfig.getInstance().getCostMultiplierFor(logic.getEntityNameToSpawn());
if(getCapacitorType().ordinal() == 0) {
return (int) Math.round(POWER_PER_TICK_ONE * multuplier);
} else if(getCapacitorType().ordinal() == 1) {
return (int) Math.round(POWER_PER_TICK_TWO * multuplier);
}
return (int) Math.round(POWER_PER_TICK_THREE * multuplier);
return powerUsePerTick;
}
@Override
@@ -156,29 +161,14 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
return true;
}
@Override
public void readCustomNBT(NBTTagCompound nbtRoot) {
logic.readFromNBT(nbtRoot);
super.readCustomNBT(nbtRoot);
}
@Override
public void writeCustomNBT(NBTTagCompound nbtRoot) {
logic.writeToNBT(nbtRoot);
super.writeCustomNBT(nbtRoot);
}
@Override
public void readCommon(NBTTagCompound nbtRoot) {
//Must read the mob type first so we no the multiplier to be used when calculating input/output power
//Must read the mob type first so we know the multiplier to be used when calculating input/output power
String mobType = BlockPoweredSpawner.readMobTypeFromNBT(nbtRoot);
if(mobType == null) {
mobType = NULL_ENTITY_NAME;
}
logic.setEntityName(mobType);
logic.resetTimer();
entityTypeName = mobType;
if(!nbtRoot.hasKey("isSpawnMode")) {
isSpawnMode = true;
} else {
@@ -189,29 +179,25 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
@Override
public void writeCommon(NBTTagCompound nbtRoot) {
String mobType = logic.getEntityNameToSpawn();
if(mobType == null || mobType.equals(NULL_ENTITY_NAME)) {
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, null);
if(hasEntityName()) {
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, getEntityName());
} else {
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, mobType);
BlockPoweredSpawner.writeMobTypeToNBT(nbtRoot, null);
}
nbtRoot.setBoolean("isSpawnMode", isSpawnMode);
super.writeCommon(nbtRoot);
}
@Override
public void doUpdate() {
logic.updateSpawner();
super.doUpdate();
}
/**
* Called when a client event is received with the event number and argument,
* see World.sendClientEvent
*/
@Override
public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) {
return logic.setDelayToMin(p_145842_1_) ? true : super.receiveClientEvent(p_145842_1_, p_145842_2_);
protected void updateEntityClient() {
if(isActive()) {
double x = xCoord + worldObj.rand.nextFloat();
double y = yCoord + worldObj.rand.nextFloat();
double z = zCoord + worldObj.rand.nextFloat();
worldObj.spawnParticle("smoke", x, y, z, 0.0D, 0.0D, 0.0D);
worldObj.spawnParticle("flame", x, y, z, 0.0D, 0.0D, 0.0D);
}
super.updateEntityClient();
}
@Override
@@ -246,138 +232,58 @@ public class TilePoweredSpawner extends AbstractPoweredTaskEntity {
return spaceClear;
}
Entity createEntity(boolean forceAlive) {
Entity ent = EntityList.createEntityByName(getEntityName(), worldObj);
if(forceAlive && MIN_PLAYER_DISTANCE <= 0 && Config.poweredSpawnerDespawnTimeSeconds > 0 && ent instanceof EntityLiving) {
ent.getEntityData().setLong(BlockPoweredSpawner.KEY_SPAWNED_BY_POWERED_SPAWNER, worldObj.getTotalWorldTime());
((EntityLiving) ent).func_110163_bv();
}
return ent;
}
protected boolean trySpawnEntity() {
Entity entity = createEntity(true);
if(!(entity instanceof EntityLiving)) {
return false;
}
EntityLiving entityliving = (EntityLiving) entity;
int spawnRange = Config.poweredSpawnerSpawnRange;
if(Config.poweredSpawnerMaxNearbyEntities > 0) {
int nearbyEntities = worldObj.getEntitiesWithinAABB(
entity.getClass(),
AxisAlignedBB.getBoundingBox(
xCoord - spawnRange*2, yCoord - 4, zCoord - spawnRange*2,
xCoord + spawnRange*2, yCoord + 4, zCoord + spawnRange*2)).size();
if(nearbyEntities >= Config.poweredSpawnerMaxNearbyEntities) {
return false;
}
}
while(remainingSpawnTries-- > 0) {
double x = xCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * spawnRange;
double y = yCoord + worldObj.rand.nextInt(3) - 1;
double z = zCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * spawnRange;
entity.setLocationAndAngles(x, y, z, worldObj.rand.nextFloat() * 360.0F, 0.0F);
if(canSpawnEntity(entityliving)) {
entityliving.onSpawnWithEgg(null);
worldObj.spawnEntityInWorld(entityliving);
worldObj.playAuxSFX(2004, xCoord, yCoord, zCoord, 0);
entityliving.spawnExplosionParticle();
return true;
}
}
return false;
}
public String getEntityName() {
return logic.getEntityNameToSpawn();
return entityTypeName;
}
class SpawnerLogic extends MobSpawnerBaseLogic {
private int spawnCount = 4;
private int maxNearbyEntities = 6;
private int spawnRange = 4;
@Override
public void func_98267_a(int par1) {
worldObj.addBlockEvent(xCoord, yCoord, zCoord, EnderIO.blockPoweredSpawner, par1, 0);
}
@Override
public World getSpawnerWorld() {
return worldObj;
}
@Override
public int getSpawnerX() {
return xCoord;
}
@Override
public int getSpawnerY() {
return yCoord;
}
@Override
public int getSpawnerZ() {
return zCoord;
}
@Override
public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart par1WeightedRandomMinecart) {
super.setRandomEntity(par1WeightedRandomMinecart);
if(getSpawnerWorld() != null) {
getSpawnerWorld().markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
/**
* Returns true if there's a player close enough to this mob spawner to
* activate it.
*/
@Override
public boolean isActivated() {
if(MIN_PLAYER_DISTANCE > 0) {
//TODO: Add this to main 'hasPower' like check so turn of the machine if the player is out of range?
boolean playerInRange = worldObj.getClosestPlayer(getSpawnerX() + 0.5D, getSpawnerY() + 0.5D, getSpawnerZ() + 0.5D,
MIN_PLAYER_DISTANCE) != null;
if(!playerInRange) {
return false;
}
}
return isActive();
}
@Override
public void updateSpawner() {
if(isActivated()) {
double d2;
if(getSpawnerWorld().isRemote) {
double d0 = getSpawnerX() + getSpawnerWorld().rand.nextFloat();
double d1 = getSpawnerY() + getSpawnerWorld().rand.nextFloat();
d2 = getSpawnerZ() + getSpawnerWorld().rand.nextFloat();
getSpawnerWorld().spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
getSpawnerWorld().spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
field_98284_d = field_98287_c;
field_98287_c = (field_98287_c + 1000.0F / (spawnDelay + 200.0F)) % 360.0D;
} else {
if(spawnDelay > 0) {
return;
}
resetTimer();
for (int i = 0; i < spawnCount; ++i) {
Entity entity = createEntity(true);
if(entity == null) {
return;
}
int j = getSpawnerWorld().getEntitiesWithinAABB(
entity.getClass(),
AxisAlignedBB.getBoundingBox(getSpawnerX(), getSpawnerY(), getSpawnerZ(), getSpawnerX() + 1,
getSpawnerY() + 1, getSpawnerZ() + 1).expand(spawnRange * 2, 4.0D, spawnRange * 2)).size();
if(j >= maxNearbyEntities) {
resetTimer();
return;
}
d2 = getSpawnerX() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange;
double d3 = getSpawnerY() + getSpawnerWorld().rand.nextInt(3) - 1;
double d4 = getSpawnerZ() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange;
EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
entity.setLocationAndAngles(d2, d3, d4, getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F);
if(entityliving != null && canSpawnEntity(entityliving)) {
func_98265_a(entity);
getSpawnerWorld().playAuxSFX(2004, getSpawnerX(), getSpawnerY(), getSpawnerZ(), 0);
if(entityliving != null)
{
entityliving.spawnExplosionParticle();
}
}
}
}
}
}
Entity createEntity(boolean forceAlive) {
Entity ent = EntityList.createEntityByName(getEntityNameToSpawn(), getSpawnerWorld());
if(forceAlive && MIN_PLAYER_DISTANCE <= 0 && Config.poweredSpawnerDespawnTimeSeconds > 0 && ent instanceof EntityLiving) {
ent.getEntityData().setLong(BlockPoweredSpawner.KEY_SPAWNED_BY_POWERED_SPAWNER, getSpawnerWorld().getTotalWorldTime());
((EntityLiving) ent).func_110163_bv();
}
return ent;
}
void resetTimer() {
spawnDelay = Integer.MAX_VALUE;
}
public boolean hasEntityName() {
return !NULL_ENTITY_NAME.equals(entityTypeName);
}
}
@@ -1,7 +1,11 @@
package crazypants.enderio.material;
import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.StringUtils;
import crazypants.enderio.EnderIO;
public enum Alloy {
ELECTRICAL_STEEL("electricalSteel", 6.0f),
@@ -15,19 +19,35 @@ public enum Alloy {
public final String unlocalisedName;
public final String iconKey;
public final String oredictIngotName;
public final String oredictBlockName;
public final String oreIngot;
public final String oreBlock;
private final float hardness;
private Alloy(String baseName, float hardness) {
this.unlocalisedName = "enderio." + baseName;
this.iconKey = "enderio:" + baseName;
this.oredictIngotName = "ingot" + StringUtils.capitalize(baseName);
this.oredictBlockName = "block" + StringUtils.capitalize(baseName);
this.oreIngot = "ingot" + StringUtils.capitalize(baseName);
this.oreBlock = "block" + StringUtils.capitalize(baseName);
this.hardness = hardness;
}
public float getHardness() {
return hardness;
}
public ItemStack getStackIngot() {
return getStackIngot(1);
}
public ItemStack getStackIngot(int size) {
return new ItemStack(EnderIO.itemAlloy, size, ordinal());
}
public ItemStack getStackBlock() {
return getStackBlock(1);
}
public ItemStack getStackBlock(int size) {
return new ItemStack(EnderIO.blockIngotStorage, size, ordinal());
}
}
@@ -1,5 +1,11 @@
package crazypants.enderio.material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.StringUtils;
public enum MachinePart {
MACHINE_CHASSI("machineChassi"),
@@ -7,10 +13,17 @@ public enum MachinePart {
public final String unlocalisedName;
public final String iconKey;
public final String oreDict;
private MachinePart(String unlocalisedName) {
this.unlocalisedName = "enderio." + unlocalisedName;
this.iconKey = "enderio:" + unlocalisedName;
this.oreDict = "item" + StringUtils.capitalize(unlocalisedName);
}
public static void registerOres(Item item) {
for (MachinePart m : values()) {
OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal()));
}
}
}
@@ -6,6 +6,8 @@ import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.StringUtils;
import crazypants.enderio.EnderIO;
public enum Material {
SILICON("silicon"),
@@ -41,4 +43,12 @@ public enum Material {
OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal()));
}
}
public ItemStack getStack() {
return getStack(1);
}
public ItemStack getStack(int size) {
return new ItemStack(EnderIO.itemMaterial, size, ordinal());
}
}
@@ -4,10 +4,8 @@ import java.util.ArrayList;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import com.enderio.core.common.util.OreDictionaryHelper;
@@ -19,6 +17,9 @@ import crazypants.enderio.machine.obelisk.weather.TileWeatherObelisk.WeatherTask
import static com.enderio.core.common.util.OreDictionaryHelper.*;
import static crazypants.enderio.EnderIO.itemBasicCapacitor;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.util.RecipeUtil.*;
public class MaterialRecipes {
@@ -44,13 +45,10 @@ public class MaterialRecipes {
OreDictionary.registerOre("dustIron", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal()));
OreDictionary.registerOre("dustGold", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal()));
OreDictionary.registerOre("dustObsidian", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_OBSIDIAN.ordinal()));
OreDictionary.registerOre("gearStone", new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()));
OreDictionary.registerOre("itemSilicon", new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal()));
for (Alloy alloy : Alloy.values()) {
OreDictionary.registerOre(alloy.oredictIngotName, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal()));
OreDictionary.registerOre(alloy.oredictBlockName, new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()));
OreDictionary.registerOre(alloy.oreIngot, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal()));
OreDictionary.registerOre(alloy.oreBlock, new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()));
}
OreDictionary.registerOre("nuggetPulsatingIron", new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal()));
@@ -74,63 +72,60 @@ public class MaterialRecipes {
OreDictionary.registerOre("itemSkull", new ItemStack(EnderIO.blockEndermanSkull));
//Glass stuff for compatability
GameRegistry.addShapedRecipe(new ItemStack(Blocks.glass_pane, 16, 0), " ", "eee", "eee", 'e', pureGlass);
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.glass), pureGlass);
GameRegistry.addShapedRecipe(new ItemStack(Items.glass_bottle, 3, 0), " ", "g g", " g ", 'g', pureGlass);
addShaped(new ItemStack(Blocks.glass_pane, 16, 0), " ", "eee", "eee", 'e', pureGlass);
addShapeless(new ItemStack(Blocks.glass), pureGlass);
addShaped(new ItemStack(Items.glass_bottle, 3, 0), " ", "g g", " g ", 'g', pureGlass);
Material.registerOres(EnderIO.itemMaterial);
MachinePart.registerOres(EnderIO.itemMachinePart);
}
public static void addRecipes() {
//Common Ingredients
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 4, Material.CONDUIT_BINDER.ordinal());
ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
ItemStack binderComposite = new ItemStack(EnderIO.itemMaterial, 1, Material.BINDER_COMPOSITE.ordinal());
String conduitBinder = CONDUIT_BINDER.oreDict;
ItemStack fusedQuartzFrame = new ItemStack(EnderIO.itemFusedQuartzFrame, 1, 0);
ItemStack machineChassi = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal());
ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal());
ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal());
ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal());
ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal());
String energeticAlloy = ENERGETIC_ALLOY.oreIngot;
String phasedGold = PHASED_GOLD.oreIngot;
String phasedIron = PHASED_IRON.oreIngot;
String darkSteel = DARK_STEEL.oreIngot;
ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0);
//Conduit Binder
ItemStack cbc = binderComposite.copy();
cbc.stackSize = 8;
ItemStack cbc = BINDER_COMPOSITE.getStack(8);
if (Config.useAlternateBinderRecipe) {
GameRegistry.addShapedRecipe(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball);
addShaped(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball);
} else {
GameRegistry.addShapedRecipe(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball);
addShaped(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball);
}
GameRegistry.addSmelting(binderComposite, conduitBinder, 0);
GameRegistry.addSmelting(BINDER_COMPOSITE.getStack(), CONDUIT_BINDER.getStack(4), 0);
//Nuggets
ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.PHASED_IRON_NUGGET.ordinal());
GameRegistry.addShapelessRecipe(phasedIronNugget, phasedIron);
addShapeless(phasedIronNugget, phasedIron);
phasedIronNugget = phasedIronNugget.copy();
phasedIronNugget.stackSize = 1;
GameRegistry.addShapedRecipe(phasedIron, "eee", "eee", "eee", 'e', phasedIronNugget);
addShaped(PHASED_IRON.getStackIngot(), "eee", "eee", "eee", 'e', phasedIronNugget);
ItemStack vibrantNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.VIBRANT_NUGGET.ordinal());
GameRegistry.addShapelessRecipe(vibrantNugget, phasedGold);
addShapeless(vibrantNugget, phasedGold);
vibrantNugget = vibrantNugget.copy();
vibrantNugget.stackSize = 1;
GameRegistry.addShapedRecipe(phasedGold, "eee", "eee", "eee", 'e', vibrantNugget);
addShaped(PHASED_GOLD.getStackIngot(), "eee", "eee", "eee", 'e', vibrantNugget);
//Crystals
ItemStack pulsCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal());
GameRegistry.addShapedRecipe(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', Items.diamond);
addShaped(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', Items.diamond);
ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal());
GameRegistry.addShapedRecipe(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', Items.emerald);
addShaped(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', Items.emerald);
//Balls
ItemStack darkBall = new ItemStack(EnderIO.itemMaterial, 5, Material.DARK_GRINDING_BALL.ordinal());
GameRegistry.addShapedRecipe(darkBall, " s ", "sss", " s ", 's', darkSteel);
addShaped(darkBall, " s ", "sss", " s ", 's', darkSteel);
//Smelting
ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal());
@@ -143,37 +138,36 @@ public class MaterialRecipes {
//Ender Dusts
ItemStack enderDust = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal());
GameRegistry.addShapedRecipe(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust);
addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust);
//Dark Iron Bars
ItemStack diBars = new ItemStack(EnderIO.blockDarkIronBars, 16, 0);
GameRegistry.addShapedRecipe(diBars, "ddd", "ddd", 'd', darkSteel);
addShaped(diBars, "ddd", "ddd", 'd', darkSteel);
// Fused Quartz Frame
GameRegistry.addRecipe(new ShapedOreRecipe(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick"));
addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood");
addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick");
// Machine Chassi
ArrayList<ItemStack> steelIngots = OreDictionary.getOres("ingotSteel");
if (Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty()) {
GameRegistry.addRecipe(new ShapedOreRecipe(machineChassi, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', "ingotSteel", 'c', capacitor));
} else {
GameRegistry.addShapedRecipe(machineChassi, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', Items.iron_ingot, 'c', capacitor);
}
ItemStack chassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal());
String mat = Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty() ? "ingotSteel" : "ingotIron";
addShaped(chassis, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', mat, 'c', capacitor);
// Basic Gear
GameRegistry.addRecipe(new ShapedOreRecipe(basicGear, "scs", "c c", "scs", 's', "stickWood", 'c', Blocks.cobblestone));
GameRegistry.addRecipe(new ShapedOreRecipe(basicGear, "scs", "c c", "scs", 's', "woodStick", 'c', Blocks.cobblestone));
ItemStack gear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal());
addShaped(gear, "scs", "c c", "scs", 's', "stickWood", 'c', "cobblestone");
addShaped(gear, "scs", "c c", "scs", 's', "woodStick", 'c', "cobblestone");
//Ender Capacitor
ItemStack enderCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 2);
ItemStack activatedCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 1);
if (Config.useHardRecipes) {
GameRegistry.addShapedRecipe(enderCapacitor, "eee", "cgc", "eee", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone);
addShaped(enderCapacitor, "eee", "cgc", "eee", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone);
} else {
GameRegistry.addShapedRecipe(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone);
addShaped(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone);
}
// Weather Crystal
@@ -183,23 +177,20 @@ public class MaterialRecipes {
if (Config.reinforcedObsidianEnabled) {
ItemStack reinfObs = new ItemStack(EnderIO.blockReinforcedObsidian);
ItemStack corners = darkSteel;
String corners = darkSteel;
if (Config.reinforcedObsidianUseDarkSteelBlocks) {
corners = new ItemStack(EnderIO.blockIngotStorage, 1, Alloy.DARK_STEEL.ordinal());
corners = Alloy.DARK_STEEL.oreBlock;
}
GameRegistry.addShapedRecipe(reinfObs, "dbd", "bob", "dbd", 'd', corners, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian);
addShaped(reinfObs, "dbd", "bob", "dbd", 'd', corners, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian);
}
GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.blockDarkSteelAnvil, "bbb", " i ", "iii",
addShaped(EnderIO.blockDarkSteelAnvil, "bbb", " i ", "iii", 'b', DARK_STEEL.oreBlock, 'i', darkSteel);
'b', "blockDarkSteel", 'i', "ingotDarkSteel"));
GameRegistry.addRecipe(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars);
addShaped(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars);
for (Alloy alloy : Alloy.values()) {
GameRegistry
.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()), "iii", "iii", "iii", 'i', alloy.oredictIngotName));
GameRegistry.addShapelessRecipe(new ItemStack(EnderIO.itemAlloy, 9, alloy.ordinal()), new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()));
addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.oreIngot);
addShapeless(alloy.getStackIngot(9), alloy.oreBlock);
}
//Food
@@ -208,10 +199,7 @@ public class MaterialRecipes {
GameRegistry.addSmelting(flour, bread, 0.35f);
}
public static void addOreDictionaryRecipes() {
if (OreDictionaryHelper.hasCopper()) {
if (hasCopper()) {
ItemStack dustCopper = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal());
ItemStack ingotCopper = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_COPPER);
GameRegistry.addSmelting(dustCopper, ingotCopper, 0);
@@ -222,27 +210,23 @@ public class MaterialRecipes {
GameRegistry.addSmelting(dustTin, ingotTin, 0);
}
ItemStack capacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 0);
ArrayList<ItemStack> copperIngots = OreDictionary.getOres("ingotCopper");
Item gold;
String gold;
if (Config.useHardRecipes) {
gold = Items.gold_ingot;
gold = "ingotGold";
} else {
gold = Items.gold_nugget;
gold = "nuggetGold";
}
if (copperIngots != null && !copperIngots.isEmpty() && Config.useModMetals) {
GameRegistry.addRecipe(new ShapedOreRecipe(capacitor, " gr", "gcg", "rg ", 'r', Items.redstone, 'g', gold, 'c', "ingotCopper"));
addShaped(capacitor, " gr", "gcg", "rg ", 'r', Items.redstone, 'g', gold, 'c', "ingotCopper");
} else {
GameRegistry.addShapedRecipe(capacitor, " gr", "gig", "rg ", 'r', Items.redstone, 'g', gold, 'i', Items.iron_ingot);
addShaped(capacitor, " gr", "gig", "rg ", 'r', "dustRedstone", 'g', gold, 'i', "ingotIron");
}
int dustCoal = OreDictionary.getOreID("dustCoal");
ItemStack activatedCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 1);
ItemStack energeticAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal());
if (Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(activatedCapacitor, "eee", "cCc", "eee", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal"));
addShaped(activatedCapacitor, "eee", "cCc", "eee", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal");
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(activatedCapacitor, " e ", "cCc", " e ", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal"));
addShaped(activatedCapacitor, " e ", "cCc", " e ", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal");
}
}
}
}
@@ -16,6 +16,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.UsernameCache;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
import com.enderio.core.common.TileEntityEnder;
@@ -73,7 +74,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
private BlockTravelAnchor() {
super(ModObject.blockTravelAnchor.unlocalisedName, TileTravelAnchor.class);
if(!Config.travelAnchorEnabled) {
if (!Config.travelAnchorEnabled) {
setCreativeTab(null);
}
}
@@ -94,9 +95,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int blockSide) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileTravelAnchor) {
if (te instanceof TileTravelAnchor) {
TileTravelAnchor tef = (TileTravelAnchor) te;
if(tef.getSourceBlock() != null) {
if (tef.getSourceBlock() != null) {
return tef.getSourceBlock().getIcon(blockSide, tef.getSourceBlockMetadata());
}
}
@@ -110,9 +111,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack par6ItemStack) {
if(entity instanceof EntityPlayer) {
if (entity instanceof EntityPlayer) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileTravelAnchor) {
if (te instanceof TileTravelAnchor) {
TileTravelAnchor ta = (TileTravelAnchor) te;
ta.setPlacedBy((EntityPlayer) entity);
Block b = PainterUtil.getSourceBlock(par6ItemStack);
@@ -126,9 +127,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@Override
public boolean openGui(World world, int x, int y, int z, EntityPlayer entityPlayer, int side) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof ITravelAccessable) {
if (te instanceof ITravelAccessable) {
ITravelAccessable ta = (ITravelAccessable) te;
if(ta.canUiBeAccessed(entityPlayer)) {
if (ta.canUiBeAccessed(entityPlayer)) {
entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, world, x, y, z);
} else {
sendPrivateChatMessage(entityPlayer, ta.getPlacedBy());
@@ -136,7 +137,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
}
return true;
}
public static void sendPrivateChatMessage(EntityPlayer player, UUID owner) {
if(player.worldObj.isRemote && !player.isSneaking()) {
player.addChatComponentMessage(new ChatComponentText(EnderIO.lang.localize("gui.travelAccessable.privateBlock1") + " "
@@ -144,12 +145,12 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
+ EnderIO.lang.localize("gui.travelAccessable.privateBlock2")));
}
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof ITravelAccessable) {
if(ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) {
if (te instanceof ITravelAccessable) {
if (ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) {
return new ContainerTravelAccessable(player.inventory, (ITravelAccessable) te, world);
} else {
return new ContainerTravelAuth(player.inventory);
@@ -161,8 +162,8 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof ITravelAccessable) {
if(ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) {
if (te instanceof ITravelAccessable) {
if (ID == GuiHandler.GUI_ID_TRAVEL_ACCESSABLE) {
return new GuiTravelAccessable(player.inventory, (ITravelAccessable) te, world);
} else {
return new GuiTravelAuth(player, (ITravelAccessable) te, world);
@@ -175,13 +176,13 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
protected void processDrop(World world, int x, int y, int z, TileEntityEnder te, ItemStack drop) {
TileTravelAnchor anchor = (TileTravelAnchor) te;
if(anchor == null) {
if (anchor == null) {
return;
}
ItemStack itemStack = new ItemStack(this);
Block srcBlk = anchor.getSourceBlock();
if(srcBlk != null) {
if (srcBlk != null) {
itemStack = createItemStackForSourceBlock(anchor.getSourceBlock(), anchor.getSourceBlockMetadata());
drop.stackTagCompound = (NBTTagCompound) itemStack.stackTagCompound.copy();
}
@@ -196,9 +197,9 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileTravelAnchor) {
if (te instanceof TileTravelAnchor) {
TileTravelAnchor tef = (TileTravelAnchor) te;
if(tef.getSourceBlock() != null) {
if (tef.getSourceBlock() != null) {
return tef.getSourceBlock().colorMultiplier(world, x, y, z);
}
}
@@ -216,7 +217,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
}
public ItemStack createItemStackForSourceBlock(Block block, int damage) {
if(block == this) {
if (block == this) {
return new ItemStack(this);
}
ItemStack result = new ItemStack(this, 1, damage);
@@ -238,7 +239,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@Override
public ResultStack[] getCompletedResult(float chance, MachineRecipeInput... inputs) {
ItemStack paintSource = MachineRecipeInput.getInputForSlot(1, inputs);
if(paintSource == null) {
if (paintSource == null) {
return new ResultStack[0];
}
return new ResultStack[] { new ResultStack(createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage())) };
@@ -248,7 +249,7 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@Override
public int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileTravelAnchor) {
if (te instanceof TileTravelAnchor) {
return ((TileTravelAnchor) te).getSourceBlockMetadata();
}
return 0;
@@ -257,9 +258,24 @@ public class BlockTravelAnchor extends BlockEio implements IGuiHandler, ITileEnt
@Override
public Block getFacade(IBlockAccess world, int x, int y, int z, int side) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileTravelAnchor) {
if (te instanceof TileTravelAnchor) {
return ((TileTravelAnchor) te).getSourceBlock();
}
return this;
}
@Override
public Block getVisualBlock(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacade(world, x, y, z, side.ordinal());
}
@Override
public int getVisualMeta(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return getFacadeMetadata(world, x, y, z, side.ordinal());
}
@Override
public boolean supportsVisualConnections() {
return true;
}
}
@@ -346,7 +346,9 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei
int distance = new BlockCoord(this).getDist(target);
double base = Math.log((0.005 * distance) + 1);
this.maxPower = (int) (base * Config.telepadPowerCoefficient);
if (this.maxPower <= 0) {
this.maxPower = 1;
}
} else {
this.maxPower = Config.telepadPowerInterdimensional;
}
@@ -524,7 +526,7 @@ public class TileTelePad extends TileTravelAnchor implements IInternalPowerRecei
this.target = coords;
this.coordsChanged = true;
} else {
this.master.setCoords(coords);
this.master.setCoords_internal(coords);
}
}
}
@@ -36,38 +36,38 @@ public class ThaumcraftCompat {
ThaumcraftApi.registerObjectTag("dustCoal", new AspectList().add(getAspects(Items.coal)));
ThaumcraftApi.registerObjectTag("itemSilicon", new AspectList().add(Aspect.FIRE, 1).add(Aspect.ORDER, 1).add(Aspect.SENSES, 1));
ThaumcraftApi.registerObjectTag(Alloy.ELECTRICAL_STEEL.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.ELECTRICAL_STEEL.oreIngot, new AspectList()
.add(getAspects("dustCoal"))
.add(getAspects(Items.iron_ingot))
.add(getAspects("itemSilicon")));
ThaumcraftApi.registerObjectTag(Alloy.ENERGETIC_ALLOY.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.ENERGETIC_ALLOY.oreIngot, new AspectList()
.add(getAspects(Items.glowstone_dust))
.add(getAspects(Items.redstone))
.add(getAspects(Items.gold_ingot)));
ThaumcraftApi.registerObjectTag(Alloy.PHASED_GOLD.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.PHASED_GOLD.oreIngot, new AspectList()
.add(getAspects(Items.ender_pearl))
.add(getAspects("ingotEnergeticAlloy")));
ThaumcraftApi.registerObjectTag(Alloy.REDSTONE_ALLOY.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.REDSTONE_ALLOY.oreIngot, new AspectList()
.add(getAspects(Items.redstone))
.add(getAspects("itemSilicon")));
ThaumcraftApi.registerObjectTag(Alloy.CONDUCTIVE_IRON.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.CONDUCTIVE_IRON.oreIngot, new AspectList()
.add(getAspects(Items.redstone))
.add(getAspects(Items.iron_ingot)));
ThaumcraftApi.registerObjectTag(Alloy.PHASED_IRON.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.PHASED_IRON.oreIngot, new AspectList()
.add(getAspects(Items.ender_pearl))
.add(getAspects(Items.iron_ingot)));
ThaumcraftApi.registerObjectTag(Alloy.DARK_STEEL.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.DARK_STEEL.oreIngot, new AspectList()
.add(getAspects(Items.iron_ingot))
.add(getAspects("dustCoal"))
.add(getAspects(Blocks.obsidian)));
ThaumcraftApi.registerObjectTag(Alloy.SOULARIUM.oredictIngotName, new AspectList()
ThaumcraftApi.registerObjectTag(Alloy.SOULARIUM.oreIngot, new AspectList()
.add(getAspects(Blocks.soul_sand))
.add(getAspects(Items.gold_ingot)));
@@ -80,19 +80,19 @@ public class ThaumcraftCompat {
.add(getAspects(EnderIO.blockEndermanSkull))
.add(getAspects(Items.potionitem)).add(getAspects(Items.potionitem))
.add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal())))
.add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName)));
.add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot)));
ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_ELECTRODE.ordinal()), new AspectList()
.add(getAspects(new ItemStack(Items.skull, 1, 2)))
.add(getAspects("itemSilicon")).add(getAspects("itemSilicon"))
.add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal())))
.add(getAspects(Alloy.ENERGETIC_ALLOY.oredictIngotName)).add(getAspects(Alloy.ENERGETIC_ALLOY.oredictIngotName)));
.add(getAspects(Alloy.ENERGETIC_ALLOY.oreIngot)).add(getAspects(Alloy.ENERGETIC_ALLOY.oreIngot)));
ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()), new AspectList()
.add(getAspects(new ItemStack(Items.skull, 1, 2)))
.add(getAspects("itemSilicon")).add(getAspects("itemSilicon"))
.add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal())))
.add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName)));
.add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot)));
ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal()), new AspectList()
.add(Aspect.UNDEAD, 2)
@@ -103,8 +103,8 @@ public class ThaumcraftCompat {
ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ENDER_RESONATOR.ordinal()), new AspectList()
.add(getAspects(EnderIO.blockEndermanSkull))
.add(getAspects("itemSilicon")).add(getAspects("itemSilicon"))
.add(getAspects(Alloy.PHASED_GOLD.oredictIngotName))
.add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName)));
.add(getAspects(Alloy.PHASED_GOLD.oreIngot))
.add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot)));
ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal()), new AspectList()
.add(Aspect.AIR, 2)
+3 -1
View File
@@ -1,5 +1,7 @@
package crazypants.util;
public interface IFacade extends info.jbcs.minecraft.chisel.api.IFacade, com.cricketcraft.chisel.api.IFacade {
import cofh.api.block.IBlockAppearance;
public interface IFacade extends info.jbcs.minecraft.chisel.api.IFacade, com.cricketcraft.chisel.api.IFacade, IBlockAppearance {
// :(
}
@@ -0,0 +1,35 @@
package crazypants.util;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
public class RecipeUtil {
public static void addShaped(Item res, Object... recipe) {
addShaped(new ItemStack(res), recipe);
}
public static void addShaped(Block res, Object... recipe) {
addShaped(new ItemStack(res), recipe);
}
public static void addShaped(ItemStack res, Object... recipe) {
GameRegistry.addRecipe(new ShapedOreRecipe(res, recipe));
}
public static void addShapeless(Item res, Object... recipe) {
addShaped(new ItemStack(res), recipe);
}
public static void addShapeless(Block res, Object... recipe) {
addShaped(new ItemStack(res), recipe);
}
public static void addShapeless(ItemStack res, Object... recipe) {
GameRegistry.addRecipe(new ShapelessOreRecipe(res, recipe));
}
}