mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 20:52:42 +00:00
Added first cut of 'Soul Fuser' (needs a name!)
This commit is contained in:
1 parent
76a71821c2
commit
96864a8991
13 files changed
+385
-23
No files matched your search
@@ -92,6 +92,7 @@ import crazypants.enderio.machine.painter.BlockPainter;
|
||||
import crazypants.enderio.machine.power.BlockCapacitorBank;
|
||||
import crazypants.enderio.machine.reservoir.BlockReservoir;
|
||||
import crazypants.enderio.machine.solar.BlockSolarPanel;
|
||||
import crazypants.enderio.machine.soul.BlockSoulFuser;
|
||||
import crazypants.enderio.machine.spawner.BlockPoweredSpawner;
|
||||
import crazypants.enderio.machine.spawner.ItemBrokenSpawner;
|
||||
import crazypants.enderio.machine.still.BlockVat;
|
||||
@@ -195,6 +196,7 @@ public class EnderIO {
|
||||
public static BlockCrafter blockCrafter;
|
||||
public static BlockPoweredSpawner blockPoweredSpawner;
|
||||
public static ItemBrokenSpawner itemBrokenSpawner;
|
||||
public static BlockSoulFuser blockSoulFuser;
|
||||
|
||||
public static BlockKillerJoe blockKillerJoe;
|
||||
|
||||
@@ -241,13 +243,7 @@ public class EnderIO {
|
||||
public static ItemDarkSteelAxe itemDarkSteelAxe;
|
||||
public static BlockVacuumChest blockVacuumChest;
|
||||
public static ItemGliderWing itemGliderWing;
|
||||
|
||||
// public static ITrigger triggerNoEnergy;
|
||||
// public static ITrigger triggerHasEnergy;
|
||||
// public static ITrigger triggerFullEnergy;
|
||||
// public static ITrigger triggerIsCharging;
|
||||
// public static ITrigger triggerFinishedCharging;
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
@@ -308,6 +304,8 @@ public class EnderIO {
|
||||
|
||||
blockPoweredSpawner = BlockPoweredSpawner.create();
|
||||
itemBrokenSpawner = ItemBrokenSpawner.create();
|
||||
|
||||
blockSoulFuser = BlockSoulFuser.create();
|
||||
|
||||
itemRedstoneConduit = ItemRedstoneConduit.create();
|
||||
itemPowerConduit = ItemPowerConduit.create();
|
||||
|
||||
@@ -43,6 +43,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
public static final int GUI_ID_WIRELESS_CHARGER = 90;
|
||||
public static final int GUI_ID_ENCHANTER = 91;
|
||||
public static final int GUI_ID_KILLER_JOE = 92;
|
||||
public static final int GUI_ID_SOUL_FUSER = 93;
|
||||
|
||||
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public enum ModObject {
|
||||
blockVacuumChest,
|
||||
blockWirelessCharger,
|
||||
blockEnchanter,
|
||||
blockSoulFuser,
|
||||
|
||||
blockPoweredSpawner,
|
||||
itemBrokenSpawner,
|
||||
|
||||
@@ -257,6 +257,11 @@ public final class Config {
|
||||
public static String[] soulVesselBlackList = new String[0];
|
||||
public static boolean soulVesselCapturesBosses = false;
|
||||
|
||||
public static double soulFuserLevelOnePowerPerTick = 50;
|
||||
public static double soulFuserLevelTwoPowerPerTick = 100;
|
||||
public static double soulFuserLevelThreePowerPerTick = 200;
|
||||
public static int soulFuserMjForBrokenSpawner = 250000;
|
||||
|
||||
public static void load(FMLPreInitializationEvent event) {
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new Config());
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.ConduitDisplayMode;
|
||||
@@ -186,6 +187,26 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean containsSoul(ItemStack item) {
|
||||
if(item == null) {
|
||||
return false;
|
||||
}
|
||||
if(item.getItem() != this) {
|
||||
return false;
|
||||
}
|
||||
return item.stackTagCompound != null && item.stackTagCompound.hasKey("id");
|
||||
}
|
||||
|
||||
public String getMobTypeFromStack(ItemStack item) {
|
||||
if(!containsSoul(item)) {
|
||||
return null;
|
||||
}
|
||||
if(item == null || item.stackTagCompound == null || !item.stackTagCompound.hasKey("id")) {
|
||||
return null;
|
||||
}
|
||||
return item.stackTagCompound.getString("id");
|
||||
}
|
||||
|
||||
private boolean isBlackListed(String entityId) {
|
||||
for(String str : Config.soulVesselBlackList) {
|
||||
@@ -196,16 +217,6 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean containsSoul(ItemStack item) {
|
||||
if(item == null) {
|
||||
return false;
|
||||
}
|
||||
if(item.getItem() != this) {
|
||||
return false;
|
||||
}
|
||||
return item.stackTagCompound != null && item.stackTagCompound.hasKey("id");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedNameForTooltip(ItemStack itemStack) {
|
||||
return getUnlocalizedName(itemStack);
|
||||
@@ -224,11 +235,6 @@ public class ItemSoulVessel extends Item implements IResourceTooltipProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private String getMobTypeFromStack(ItemStack item) {
|
||||
if(item == null || item.stackTagCompound == null || !item.stackTagCompound.hasKey("id")) {
|
||||
return null;
|
||||
}
|
||||
return item.stackTagCompound.getString("id");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.machine.farm.BlockFarmStation;
|
||||
import crazypants.enderio.machine.farm.PacketFarmAction;
|
||||
import crazypants.enderio.machine.farm.PacketUpdateNotification;
|
||||
import crazypants.enderio.machine.farm.TileFarmStation;
|
||||
import crazypants.enderio.machine.painter.GuiPainter;
|
||||
import crazypants.enderio.machine.painter.PainterContainer;
|
||||
import crazypants.enderio.machine.painter.TileEntityPainter;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
public class BlockSoulFuser extends AbstractMachineBlock<TileSoulFuser> {
|
||||
|
||||
|
||||
public static BlockSoulFuser create() {
|
||||
BlockSoulFuser result = new BlockSoulFuser();
|
||||
result.init();
|
||||
return result;
|
||||
}
|
||||
|
||||
protected BlockSoulFuser() {
|
||||
super(ModObject.blockSoulFuser, TileSoulFuser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulFuser.unlocalisedName, SoulFuserSpawnerRecipe.instance);
|
||||
}
|
||||
|
||||
@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 TileSoulFuser) {
|
||||
return new ContainerSoulFuser(player.inventory, (AbstractMachineEntity) te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@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 TileSoulFuser) {
|
||||
return new GuiSoulFuser(player.inventory, (AbstractMachineEntity) te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getGuiId() {
|
||||
return GuiHandler.GUI_ID_SOUL_FUSER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMachineFrontIconKey(boolean active) {
|
||||
if(active) {
|
||||
return "enderio:blockSoulFuserOn";
|
||||
}
|
||||
return "enderio:blockSoulFuser";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import crazypants.enderio.machine.AbstractMachineContainer;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
|
||||
public class ContainerSoulFuser extends AbstractMachineContainer {
|
||||
|
||||
public ContainerSoulFuser(InventoryPlayer playerInv, AbstractMachineEntity te) {
|
||||
super(playerInv, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addMachineSlots(InventoryPlayer playerInv) {
|
||||
addSlotToContainer(new Slot(tileEntity, 0, 38, 34) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(0, itemStack);
|
||||
}
|
||||
});
|
||||
addSlotToContainer(new Slot(tileEntity, 1, 59, 34) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
return tileEntity.isItemValidForSlot(1, itemStack);
|
||||
}
|
||||
});
|
||||
addSlotToContainer(new Slot(tileEntity, 2, 112, 34) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
addSlotToContainer(new Slot(tileEntity, 3, 134, 34) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.GuiMachineBase;
|
||||
import crazypants.enderio.machine.painter.PainterContainer;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public class GuiSoulFuser extends GuiMachineBase {
|
||||
|
||||
private AbstractMachineEntity tileEntity;
|
||||
|
||||
public GuiSoulFuser(InventoryPlayer par1InventoryPlayer, AbstractMachineEntity te) {
|
||||
super(te, new ContainerSoulFuser(par1InventoryPlayer, te));
|
||||
tileEntity = te;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the
|
||||
* items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderUtil.bindTexture("enderio:textures/gui/soulFuser.png");
|
||||
int k = (width - xSize) / 2;
|
||||
int l = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
int i1;
|
||||
|
||||
i1 = tileEntity.getProgressScaled(24);
|
||||
drawTexturedModalRect(k + 80, l + 34, 176, 14, i1 + 1, 16);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showRecipeButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected void renderSlotHighlight(int slot, Vector4f col) {
|
||||
// if(tileEntity.getSlotDefinition().isOutputSlot(slot)) {
|
||||
// renderSlotHighlight(col, 117,31,24,24);
|
||||
// } else if(slot != 1) {
|
||||
// super.renderSlotHighlight(slot, col);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.IMachineRecipe;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
|
||||
public class SoulFuserSpawnerRecipe implements IMachineRecipe {
|
||||
|
||||
public static SoulFuserSpawnerRecipe instance = new SoulFuserSpawnerRecipe();
|
||||
|
||||
@Override
|
||||
public String getUid() {
|
||||
return "SoulFuserSpawnerRecipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnergyRequired(MachineRecipeInput... inputs) {
|
||||
return Config.soulFuserMjForBrokenSpawner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecipe(MachineRecipeInput... inputs) {
|
||||
int validCount = 0;
|
||||
for(MachineRecipeInput input : inputs) {
|
||||
if(isValidInput(input)) {
|
||||
validCount++;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return validCount == 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultStack[] getCompletedResult(float randomChance, MachineRecipeInput... inputs) {
|
||||
String mobType = null;
|
||||
for(MachineRecipeInput input : inputs) {
|
||||
if(input != null && EnderIO.itemSoulVessel.containsSoul(input.item)) {
|
||||
mobType = EnderIO.itemSoulVessel.getMobTypeFromStack(input.item);
|
||||
}
|
||||
}
|
||||
if(mobType == null) {
|
||||
return new ResultStack[0];
|
||||
}
|
||||
ItemStack spawner = EnderIO.itemBrokenSpawner.createStackForMobType(mobType);
|
||||
if(spawner == null) {
|
||||
return new ResultStack[0];
|
||||
}
|
||||
ItemStack soulVessel = new ItemStack(EnderIO.itemSoulVessel);
|
||||
return new ResultStack[] {new ResultStack(soulVessel), new ResultStack(spawner)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExperianceForOutput(ItemStack output) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidInput(MachineRecipeInput input) {
|
||||
if(input == null || input.item == null) {
|
||||
return false;
|
||||
}
|
||||
int slot = input.slotNumber;
|
||||
ItemStack item = input.item;
|
||||
if(slot == 0) {
|
||||
return EnderIO.itemSoulVessel.containsSoul(item);
|
||||
}
|
||||
if(slot == 1) {
|
||||
return item.getItem() == EnderIO.itemBrokenSpawner;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSoulFuser.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MachineRecipeInput> getQuantitiesConsumed(MachineRecipeInput[] inputs) {
|
||||
List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>(inputs.length);
|
||||
for(MachineRecipeInput input : inputs) {
|
||||
if(input != null && input.item != null) {
|
||||
ItemStack resStack = input.item.copy();
|
||||
resStack.stackSize = 1;
|
||||
MachineRecipeInput mri = new MachineRecipeInput(input.slotNumber, resStack);
|
||||
result.add(mri);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractPoweredTaskEntity;
|
||||
import crazypants.enderio.machine.MachineRecipeInput;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.power.BasicCapacitor;
|
||||
import crazypants.enderio.power.Capacitors;
|
||||
import crazypants.enderio.power.PowerHandlerUtil;
|
||||
|
||||
public class TileSoulFuser extends AbstractPoweredTaskEntity {
|
||||
|
||||
public static final float POWER_PER_TICK_ONE = (float)Config.soulFuserLevelOnePowerPerTick;
|
||||
private static final BasicCapacitor CAP_ONE = new BasicCapacitor((int) (POWER_PER_TICK_ONE * 1.25),
|
||||
Capacitors.BASIC_CAPACITOR.capacitor.getMaxEnergyStored());
|
||||
|
||||
public static final float POWER_PER_TICK_TWO = (float)Config.soulFuserLevelTwoPowerPerTick;
|
||||
private static final BasicCapacitor CAP_TWO = new BasicCapacitor((int) (POWER_PER_TICK_TWO * 1.25),
|
||||
Capacitors.ACTIVATED_CAPACITOR.capacitor.getMaxEnergyStored());
|
||||
|
||||
public static final float POWER_PER_TICK_THREE = (float)Config.soulFuserLevelThreePowerPerTick;
|
||||
private static final BasicCapacitor CAP_THREE = new BasicCapacitor((int) (POWER_PER_TICK_THREE * 1.25),
|
||||
Capacitors.ENDER_CAPACITOR.capacitor.getMaxEnergyStored());
|
||||
|
||||
public TileSoulFuser() {
|
||||
super(new SlotDefinition(2, 2, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockSoulFuser.unlocalisedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isMachineItemValidForSlot(int slot, ItemStack item) {
|
||||
return SoulFuserSpawnerRecipe.instance.isValidInput(new MachineRecipeInput(slot, item));
|
||||
}
|
||||
|
||||
public void setCapacitor(Capacitors capacitorType) {
|
||||
this.capacitorType = capacitorType;
|
||||
switch (capacitorType) {
|
||||
case BASIC_CAPACITOR:
|
||||
PowerHandlerUtil.configure(powerHandler, CAP_ONE);
|
||||
break;
|
||||
case ACTIVATED_CAPACITOR:
|
||||
PowerHandlerUtil.configure(powerHandler, CAP_TWO);
|
||||
break;
|
||||
case ENDER_CAPACITOR:
|
||||
PowerHandlerUtil.configure(powerHandler, CAP_THREE);
|
||||
break;
|
||||
default:
|
||||
PowerHandlerUtil.configure(powerHandler, CAP_ONE);
|
||||
break;
|
||||
}
|
||||
forceClientUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPowerUsePerTick() {
|
||||
if(capacitorType.ordinal() == 0) {
|
||||
return POWER_PER_TICK_ONE;
|
||||
} else if(capacitorType.ordinal() == 1) {
|
||||
return POWER_PER_TICK_TWO;
|
||||
}
|
||||
return POWER_PER_TICK_THREE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgressScaled(int scale) {
|
||||
int res = super.getProgressScaled(scale);
|
||||
if(currentTask != null) {
|
||||
res = Math.max(1, res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user