Now we have a Frank'N'Zombie

This commit is contained in:
CrazyPants committed 2014-09-05 17:46:00 +08:00
1 parent 4f90593666
commit cb2c4f9bad
20 files changed
+189 -15

No files matched your search

@@ -266,6 +266,7 @@ public final class Config {
public static int soulBinderLevelTwoPowerPerTickRF = 1000;
public static int soulBinderLevelThreePowerPerTickRF = 2000;
public static int soulBinderBrokenSpawnerRF = 2500000;
public static int soulBinderReanimationRF = 100000;
public static int powerConduitTierOneRF = 640;
public static int powerConduitTierTwoRF = 5120;
@@ -275,6 +276,8 @@ public final class Config {
public static int sliceAndSpliceLevelTwoPowerPerTickRF = 160;
public static int sliceAndSpliceLevelThreePowerPerTickRF = 320;
public static void load(FMLPreInitializationEvent event) {
FMLCommonHandler.instance().bus().register(new Config());
@@ -728,6 +731,9 @@ public final class Config {
"The number of RF/t consumed by a soul binder with an octadic capacitor upgrade.").getInt(soulBinderLevelThreePowerPerTickRF);
soulBinderBrokenSpawnerRF = config.get(sectionSoulBinder.name, "soulBinderBrokenSpawnerRF", soulBinderBrokenSpawnerRF,
"The number of RF required to change the type of a broken spawner.").getInt(soulBinderBrokenSpawnerRF);
soulBinderReanimationRF = config.get(sectionSoulBinder.name, "soulBinderReanimationRF", soulBinderReanimationRF,
"The number of RF required to to re-animated a mob head.").getInt(soulBinderReanimationRF);
sliceAndSpliceLevelOnePowerPerTickRF = config.get(sectionPower.name, "sliceAndSpliceLevelOnePowerPerTickRF", sliceAndSpliceLevelOnePowerPerTickRF,
"The number of RF/t consumed by an unupgraded Slice'N'Splice").getInt(sliceAndSpliceLevelOnePowerPerTickRF);
@@ -14,6 +14,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import crazypants.enderio.EnderIO;
import crazypants.enderio.config.Config;
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;
@@ -57,7 +58,7 @@ public class MachineRecipes {
//KillerJoe
ItemStack kj = new ItemStack(EnderIO.blockKillerJoe, 1, 0);
GameRegistry.addShapedRecipe(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 1));
GameRegistry.addShapedRecipe(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal()));
ItemStack wirelessCharger = new ItemStack(EnderIO.blockWirelessCharger);
GameRegistry.addShapedRecipe(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry);
@@ -66,6 +66,19 @@ public class BlockSliceAndSplice extends AbstractMachineBlock<TileSliceAndSplice
}
return "enderio:sliceAndSpliceFront";
}
@Override
protected String getSideIconKey(boolean active) {
return "enderio:blockSoulMachineSide";
}
protected String getTopIconKey(boolean active) {
return "enderio:blockSoulMachineTop";
}
protected String getBackIconKey(boolean active) {
return "enderio:blockSoulMachineBack";
}
@SideOnly(Side.CLIENT)
@Override
@@ -49,6 +49,7 @@ public class BlockSoulBinder extends AbstractMachineBlock<TileSoulBinder> {
protected void init() {
super.init();
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulBinder.unlocalisedName, SoulBinderSpawnerRecipe.instance);
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSoulBinder.unlocalisedName, SoulBinderReanimationRecipe.instance);
}
@Override
@@ -101,18 +102,17 @@ public class BlockSoulBinder extends AbstractMachineBlock<TileSoulBinder> {
}
@Override
protected String getMachineFrontIconKey(boolean active) {
if(active) {
return "enderio:blockSoulBinderOn";
}
return "enderio:blockSoulBinder";
protected String getMachineFrontIconKey(boolean active) {
return "enderio:blockSoulMachineBlank";
}
@Override
protected String getSideIconKey(boolean active) {
return "enderio:blockSoulBinderSide";
return "enderio:blockSoulMachineBlank";
}
protected String getTopIconKey(boolean active) {
return "enderio:blockSoulMachineTop";
}
@Override
@@ -0,0 +1,103 @@
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.item.ItemSoulVessel;
import crazypants.enderio.machine.IMachineRecipe;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
import crazypants.enderio.material.FrankenSkull;
public class SoulBinderReanimationRecipe implements IMachineRecipe {
public static SoulBinderReanimationRecipe instance = new SoulBinderReanimationRecipe();
@Override
public String getUid() {
return "SoulBinderReanimationRecipe";
}
@Override
public int getEnergyRequired(MachineRecipeInput... inputs) {
return Config.soulBinderReanimationRF;
}
@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(!isZombie(mobType)) {
return new ResultStack[0];
}
ItemStack frankenZombie = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal());
ItemStack soulVessel = new ItemStack(EnderIO.itemSoulVessel);
return new ResultStack[] {new ResultStack(soulVessel), new ResultStack(frankenZombie)};
}
@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 isZombie(EnderIO.itemSoulVessel.getMobTypeFromStack(item));
}
if(slot == 1) {
return item.getItem() == EnderIO.itemFrankenSkull && item.getItemDamage() == FrankenSkull.ZOMBIE_CONTROLLER.ordinal();
}
return false;
}
@Override
public String getMachineName() {
return ModObject.blockSoulBinder.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;
}
boolean isZombie(String mobType) {
return mobType != null && mobType.equals("Zombie");
}
}
@@ -58,7 +58,7 @@ public class SoulBinderRenderer implements ISimpleBlockRenderingHandler {
float slabWidth = 0.15f;
bb= BoundingBox.UNIT_CUBE.scale(1, slabWidth, 1);
bb = bb.translate(0, 0.5f - (slabWidth/2), 0);
setIcons(EnderIO.blockSoulFuser.getIcon(ForgeDirection.SOUTH.ordinal(), 0), ForgeDirection.UP);
setIcons(EnderIO.blockSoulFuser.getIcon(ForgeDirection.UP.ordinal(), 0), ForgeDirection.UP);
CubeRenderer.render(bb, icons, true);
bb= BoundingBox.UNIT_CUBE.scale(1, slabWidth, 1);
@@ -1,12 +1,16 @@
package crazypants.enderio.machine.soul;
import java.util.List;
import scala.xml.persistent.SetStorage;
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.IMachineRecipe;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.MachineRecipeRegistry;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.power.BasicCapacitor;
import crazypants.enderio.power.Capacitors;
@@ -38,10 +42,38 @@ public class TileSoulBinder extends AbstractPoweredTaskEntity {
public String getMachineName() {
return ModObject.blockSoulBinder.unlocalisedName;
}
@Override
public int getInventoryStackLimit() {
return 1;
}
@Override
protected boolean isMachineItemValidForSlot(int slot, ItemStack item) {
return SoulBinderSpawnerRecipe.instance.isValidInput(new MachineRecipeInput(slot, item));
if(!slotDefinition.isInputSlot(slot)) {
return false;
}
MachineRecipeInput newInput = new MachineRecipeInput(slot, item);
int otherSlot = slot == 0 ? 1 : 0;
if(inventory[otherSlot] == null) {
List<IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForInput(getMachineName(), newInput);
if(recipes.isEmpty()) {
return false;
}
for(IMachineRecipe rec : recipes) {
if(rec != null && rec.isValidInput(newInput)) {
return true;
}
}
} else {
MachineRecipeInput[] inputs = new MachineRecipeInput[] {
newInput,
new MachineRecipeInput(otherSlot, inventory[otherSlot])
};
return MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), inputs) != null;
}
return false;
//return SoulBinderSpawnerRecipe.instance.isValidInput(new MachineRecipeInput(slot, item));
}
public void setCapacitor(Capacitors capacitorType) {
@@ -2,15 +2,22 @@ package crazypants.enderio.material;
public enum FrankenSkull {
ZOMBIE_ELECTRODE("skullZombieElectrode"),
ZOMBIE_CONTROLLER("skullZombieController");
ZOMBIE_ELECTRODE("skullZombieElectrode", false),
ZOMBIE_CONTROLLER("skullZombieController", false),
FRANKEN_ZOMBIE("skullZombieFrankenstien", "enderio:skullZombieController", true);
public final String unlocalisedName;
public final String iconKey;
public final boolean isAnimated;
private FrankenSkull(String unlocalisedName) {
private FrankenSkull(String unlocalisedName, String iconKey, boolean isAnimated) {
this.unlocalisedName = unlocalisedName;
this.iconKey = "enderio:" + unlocalisedName;
this.iconKey = iconKey;
this.isAnimated = isAnimated;
}
private FrankenSkull(String unlocalisedName, boolean isAnimated) {
this(unlocalisedName, "enderio:" + unlocalisedName, isAnimated);
}
public String getUnlocalisedName() {
@@ -9,6 +9,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
@@ -61,4 +63,13 @@ public class ItemFrankenSkull extends Item {
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
int meta = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, FrankenSkull.values().length - 1);
return FrankenSkull.values()[meta].isAnimated;
}
}