Machines getting there.

This commit is contained in:
cp committed 2014-03-01 00:42:54 +08:00
1 parent fcf5fdf417
commit a1921a3944
30 files changed
+469 -528

No files matched your search

@@ -20,6 +20,7 @@ import crazypants.enderio.machine.reservoir.TileReservoir;
import crazypants.enderio.material.BlockFusedQuartz;
import crazypants.enderio.material.FusedQuartzFrameRenderer;
import crazypants.enderio.material.FusedQuartzRenderer;
import crazypants.enderio.material.MachinePartRenderer;
import crazypants.enderio.teleport.TileTravelAnchor;
import crazypants.enderio.teleport.TravelController;
import crazypants.enderio.teleport.TravelEntitySpecialRenderer;
@@ -115,7 +116,7 @@ public class ClientProxy extends CommonProxy {
//TODO:1.7
//MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCustomSlab), pir);
// MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
// MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
//
// cbr = new ConduitBundleRenderer((float) Config.conduitScale);
+50 -37
View File
@@ -1,5 +1,9 @@
package crazypants.enderio;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
@@ -13,10 +17,18 @@ import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import crazypants.enderio.enderface.BlockEnderIO;
import crazypants.enderio.enderface.ItemEnderface;
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
import crazypants.enderio.machine.alloy.BlockAlloySmelter;
import crazypants.enderio.machine.crusher.BlockCrusher;
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
import crazypants.enderio.machine.generator.BlockStirlingGenerator;
import crazypants.enderio.machine.light.BlockElectricLight;
import crazypants.enderio.machine.light.BlockLightNode;
import crazypants.enderio.machine.monitor.BlockPowerMonitor;
import crazypants.enderio.machine.monitor.ItemMJReader;
import crazypants.enderio.machine.reservoir.BlockReservoir;
import crazypants.enderio.machine.solar.BlockSolarPanel;
import crazypants.enderio.material.Alloy;
import crazypants.enderio.material.BlockFusedQuartz;
import crazypants.enderio.material.ItemAlloy;
import crazypants.enderio.material.ItemCapacitor;
@@ -81,22 +93,22 @@ public class EnderIO {
// public static ItemMeConduit itemMeConduit;
//
// // Machines
// public static BlockStirlingGenerator blockStirlingGenerator;
public static BlockStirlingGenerator blockStirlingGenerator;
public static BlockSolarPanel blockSolarPanel;
public static BlockReservoir blockReservoir;
// public static BlockAlloySmelter blockAlloySmelter;
public static BlockAlloySmelter blockAlloySmelter;
// public static BlockCapacitorBank blockCapacitorBank;
// public static BlockCrusher blockCrusher;
public static BlockCrusher blockCrusher;
// public static BlockHyperCube blockHyperCube;
// public static BlockPowerMonitor blockPowerMonitor;
//
public static BlockPowerMonitor blockPowerMonitor;
public static BlockElectricLight blockElectricLight;
public static BlockLightNode blockLightNode;
//
// public static ItemYetaWrench itemYetaWench;
// public static ItemMJReader itemMJReader;
public static ItemMJReader itemMJReader;
//
// public static ITrigger triggerNoEnergy;
// public static ITrigger triggerHasEnergy;
@@ -137,13 +149,13 @@ public class EnderIO {
// blockCustomSlab.init();
// blockCustomDoubleSlab.init();
//
// blockStirlingGenerator = BlockStirlingGenerator.create();
blockStirlingGenerator = BlockStirlingGenerator.create();
blockSolarPanel = BlockSolarPanel.create();
blockReservoir = BlockReservoir.create();
// blockAlloySmelter = BlockAlloySmelter.create();
blockAlloySmelter = BlockAlloySmelter.create();
// blockCapacitorBank = BlockCapacitorBank.create();
// blockCrusher = BlockCrusher.create();
// blockPowerMonitor = BlockPowerMonitor.create();
blockCrusher = BlockCrusher.create();
blockPowerMonitor = BlockPowerMonitor.create();
//
// blockConduitBundle = BlockConduitBundle.create();
// blockConduitFacade = BlockConduitFacade.create();
@@ -159,8 +171,8 @@ public class EnderIO {
blockLightNode = BlockLightNode.create();
//
// itemYetaWench = ItemYetaWrench.create();
// itemMJReader = ItemMJReader.create();
//
itemMJReader = ItemMJReader.create();
MaterialRecipes.registerOresInDictionary();
}
@@ -176,28 +188,28 @@ public class EnderIO {
MinecraftForge.EVENT_BUS.register(this);
//Register Custom Dungeon Loot here
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 1, 3, 60));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 1, 3, 60));
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
// .addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemYetaWench, 1, 0), 1, 1, 15));
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemMJReader, 1, 0), 1, 1, 1));
//
// ItemStack staff = new ItemStack(EnderIO.itemTravelStaff, 1, 0);
// itemTravelStaff.setFull(staff);
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 30));
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.quartz), 3, 16, 40));
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.nether_wart), 1, 4, 30));
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 2, 30));
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 5, 20, 50));
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()), 3, 14, 35));
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()), 2, 6, 20));
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()), 2, 6, 10));
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(staff, 1, 1, 5));
// ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 20));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemMJReader, 1, 0), 1, 1, 1));
ItemStack staff = new ItemStack(EnderIO.itemTravelStaff, 1, 0);
itemTravelStaff.setFull(staff);
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 30));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.quartz), 3, 16, 40));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.nether_wart), 1, 4, 30));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 2, 30));
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 5, 20, 50));
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()), 3, 14, 35));
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()), 2, 6, 20));
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()), 2, 6, 10));
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(staff, 1, 1, 5));
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 20));
//
// PacketHandler.instance.addPacketProcessor(new RedstoneModePacketProcessor());
@@ -224,12 +236,13 @@ public class EnderIO {
public void postInit(FMLPostInitializationEvent event) {
packetPipeline.postInitialise();
// CrusherRecipeManager.getInstance().loadRecipesFromConfig();
// AlloyRecipeManager.getInstance().loadRecipesFromConfig();
// MaterialRecipes.addOreDictionaryRecipes();
MaterialRecipes.registerExternalOresInDictionary();
MaterialRecipes.addOreDictionaryRecipes();
// MachineRecipes.addOreDictionaryRecipes();
// ConduitRecipes.addOreDictionaryRecipes();
CrusherRecipeManager.getInstance().loadRecipesFromConfig();
AlloyRecipeManager.getInstance().loadRecipesFromConfig();
}
@EventHandler
+16 -31
View File
@@ -10,6 +10,8 @@ public enum ModObject {
blockConduitFacade,
itemConduitFacade,
itemRedstoneConduit,
itemItemConduit,
itemMeConduit,
// Power
itemPowerConduit,
@@ -20,12 +22,24 @@ public enum ModObject {
// Materials
itemBasicCapacitor,
itemAlloy,
itemMaterial,
blockFusedQuartz,
itemFusedQuartzFrame,
itemMachinePart,
itemPowderIngot,
// Stirling Gen
// Machines
blockStirlingGenerator,
blockReservoir,
blockAlloySmelter,
blockSolarPanel,
blockCapacitorBank,
blockSagMill,
blockHyperCube,
blockPowerMonitor,
blockElectricLight,
blockLightNode,
// Painter
blockPainter,
@@ -33,48 +47,19 @@ public enum ModObject {
blockCustomFenceGate,
blockCustomWall,
blockCustomStair,
itemFusedQuartzFrame,
// Solar Panel
blockSolarPanel,
blockElectricLight,
blockLightNode,
blockCapacitorBank,
itemYetaWrench,
blockCustomSlab,
blockCustomDoubleSlab,
blockCrusher,
blockHyperCube,
itemMachinePart,
itemPowderIngot,
itemMJReader,
itemMaterial,
blockPowerMonitor,
itemItemConduit,
itemMeConduit,
itemYetaWrench,
blockTravelAnchor,
itemTravelStaff;
public final String unlocalisedName;
//public final String name;
public int actualId;
private ModObject() {
this.unlocalisedName = name();
//this.name = Lang.localize(name());
actualId = -1;
}
}
@@ -86,7 +86,7 @@ public abstract class AbstractMachineBlock<T extends AbstractMachineEntity> exte
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
public TileEntity createNewTileEntity(World var1, int var2) {
try {
return teClass.newInstance();
} catch (Exception e) {
@@ -232,7 +232,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im
@Override
public void readCustomNBT(NBTTagCompound nbtRoot) {
super.readFromNBT(nbtRoot);
super.readCustomNBT(nbtRoot);
currentTask = PoweredTask.readFromNBT(nbtRoot.getCompoundTag("currentTask"));
String uid = nbtRoot.getString("lastCompletedRecipe");
lastCompletedRecipe = MachineRecipeRegistry.instance.getRecipeForUid(uid);
@@ -240,7 +240,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im
@Override
public void writeCustomNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot);
super.writeCustomNBT(nbtRoot);
if(currentTask != null) {
NBTTagCompound currentTaskNBT = new NBTTagCompound();
currentTask.writeToNBT(currentTaskNBT);
@@ -4,10 +4,8 @@ import static crazypants.enderio.EnderIO.itemBasicCapacitor;
import java.util.ArrayList;
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 net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
@@ -76,13 +74,14 @@ public class MachineRecipes {
}
//MJ Monitor
ItemStack mJReader = new ItemStack(EnderIO.itemMJReader, 1, 0);
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, "bmb", "bMb", "bcb", 'b', Blocks.stonebrick, 'e', Items.ender_eye, 'M', machineChassi, 'm', mJReader, 'p', powerConduit,
'r', redstoneConduit, 'c', capacitor);
//TODO:1.7
// ItemStack mJReader = new ItemStack(EnderIO.itemMJReader, 1, 0);
// 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, "bmb", "bMb", "bcb", 'b', Blocks.stonebrick, 'e', Items.ender_eye, 'M', machineChassi, 'm', mJReader, 'p', powerConduit,
// 'r', redstoneConduit, 'c', capacitor);
}
@@ -118,10 +117,10 @@ public class MachineRecipes {
//painter
ItemStack painter = new ItemStack(EnderIO.blockPainter, 1, 0);
if(Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qqq", "mdm", "CMC", 'm', metal, 'M', machineChassi, 'q', Item.netherQuartz, 'd', Item.diamond,
GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qqq", "mdm", "CMC", 'm', metal, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond,
'C', capacitor, 'q', Items.quartz, 'd', Items.diamond));
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qdq", "mMm", "mCm", 'm', metal, 'M', machineChassi, 'q', Item.netherQuartz, 'd', Item.diamond,
GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qdq", "mMm", "mCm", 'm', metal, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond,
'C', capacitor, 'q', Items.quartz, 'd', Items.diamond));
}
@@ -129,10 +128,10 @@ public class MachineRecipes {
ItemStack capacitorBank = new ItemStack(EnderIO.blockCapacitorBank, 1, 0);
ItemStack activatedCapacitor = new ItemStack(itemBasicCapacitor, 1, 1);
if(Config.useHardRecipes) {
GameRegistry.addRecipe(new ShapedOreRecipe(capacitorBank, "rcr", "ccc", "rMr", 'm', metal, 'c', activatedCapacitor, 'r', Block.blockRedstone, 'M',
GameRegistry.addRecipe(new ShapedOreRecipe(capacitorBank, "rcr", "ccc", "rMr", 'm', metal, 'c', activatedCapacitor, 'r', Blocks.redstone_block, 'M',
machineChassi));
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(capacitorBank, "mcm", "crc", "mcm", 'm', metal, 'c', activatedCapacitor, 'r', Block.blockRedstone));
GameRegistry.addRecipe(new ShapedOreRecipe(capacitorBank, "mcm", "crc", "mcm", 'm', metal, 'c', activatedCapacitor, 'r', Blocks.redstone_block));
}
//light
@@ -149,18 +148,19 @@ public class MachineRecipes {
GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', silicon, 'c', capacitor));
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', Block.glass, 'd', glowstone, 's', silicon, 'c', capacitor));
GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', Blocks.glass, 'd', glowstone, 's', silicon, 'c', capacitor));
}
//MJ Reader
ItemStack mJReader = new ItemStack(EnderIO.itemMJReader, 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', silicon, 'e',
electricalSteel));
//TODO:1.7
// //MJ Reader
// ItemStack mJReader = new ItemStack(EnderIO.itemMJReader, 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', silicon, 'e',
// electricalSteel));
}
}
@@ -5,16 +5,9 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import crazypants.enderio.ModObject;
import crazypants.enderio.crafting.IEnderIoRecipe;
import crazypants.enderio.crafting.IRecipeComponent;
import crazypants.enderio.crafting.IRecipeInput;
import crazypants.enderio.crafting.IRecipeOutput;
import crazypants.enderio.crafting.impl.EnderIoRecipe;
import crazypants.enderio.crafting.impl.RecipeInput;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.recipe.AbstractMachineRecipe;
import crazypants.enderio.machine.recipe.IRecipe;
import crazypants.enderio.machine.recipe.RecipeOutput;
public class AlloyMachineRecipe extends AbstractMachineRecipe {
@@ -52,27 +45,28 @@ public class AlloyMachineRecipe extends AbstractMachineRecipe {
return AlloyRecipeManager.instance.getExperianceForOutput(output);
}
@Override
public List<IEnderIoRecipe> getAllRecipes() {
List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
List<IAlloyRecipe> recipes = AlloyRecipeManager.getInstance().getRecipes();
for (IRecipe cr : recipes) {
List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
for (crazypants.enderio.machine.recipe.RecipeInput ri : cr.getInputs()) {
if(ri.getInput() != null) {
IRecipeInput input = new RecipeInput(ri.getInput(), -1, ri.getEquivelentInputs());
components.add(input);
}
}
for (RecipeOutput co : cr.getOutputs()) {
IRecipeOutput output = new crazypants.enderio.crafting.impl.RecipeOutput(co.getOutput(), co.getChance());
components.add(output);
}
result.add(new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, cr.getEnergyRequired(), components));
}
return result;
}
//TODO:1.7
// @Override
// public List<IEnderIoRecipe> getAllRecipes() {
// List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
// List<IAlloyRecipe> recipes = AlloyRecipeManager.getInstance().getRecipes();
// for (IRecipe cr : recipes) {
// List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
// for (crazypants.enderio.machine.recipe.RecipeInput ri : cr.getInputs()) {
// if(ri.getInput() != null) {
// IRecipeInput input = new RecipeInput(ri.getInput(), -1, ri.getEquivelentInputs());
// components.add(input);
// }
// }
//
// for (RecipeOutput co : cr.getOutputs()) {
// IRecipeOutput output = new crazypants.enderio.crafting.impl.RecipeOutput(co.getOutput(), co.getChance());
// components.add(output);
// }
// result.add(new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, cr.getEnergyRequired(), components));
// }
// return result;
// }
public boolean isValidRecipeComponents(ItemStack[] resultInv) {
return AlloyRecipeManager.instance.isValidRecipeComponents(resultInv);
@@ -145,7 +145,7 @@ public class AlloyRecipeManager {
public float getExperianceForOutput(ItemStack output) {
for (IAlloyRecipe recipe : recipes) {
if(recipe.getOutput().itemID == output.itemID && recipe.getOutput().getItemDamage() == output.getItemDamage()) {
if(recipe.getOutput().getItem() == output.getItem() && recipe.getOutput().getItemDamage() == output.getItemDamage()) {
return recipe.getOutputs()[0].getExperiance();
}
}
@@ -2,14 +2,10 @@ package crazypants.enderio.machine.alloy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import crazypants.enderio.ModObject;
import crazypants.enderio.crafting.IEnderIoRecipe;
import crazypants.enderio.crafting.IRecipeComponent;
import crazypants.enderio.crafting.impl.EnderIoRecipe;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.recipe.Recipe;
import crazypants.enderio.machine.recipe.RecipeInput;
@@ -22,7 +18,7 @@ public class BasicAlloyRecipe implements IAlloyRecipe {
private float energyRequired = DEFAULT_ENERGY_USE;
private ItemStack output;
private final List<IEnderIoRecipe> recipeEIO;
//private final List<IEnderIoRecipe> recipeEIO;
private float expPerItem;
@@ -34,14 +30,15 @@ public class BasicAlloyRecipe implements IAlloyRecipe {
expPerItem = recipe.getOutputs()[0].getExperiance();
energyRequired = recipe.getEnergyRequired();
List<IRecipeComponent> reipceComps = new ArrayList<IRecipeComponent>(recipe.getInputs().length);
for (RecipeInput input : recipe.getInputs()) {
crazypants.enderio.crafting.impl.RecipeInput ri = new crazypants.enderio.crafting.impl.RecipeInput(input.getInput(), -1, input.getEquivelentInputs());
reipceComps.add(ri);
}
reipceComps.add(new crazypants.enderio.crafting.impl.RecipeOutput(output));
IEnderIoRecipe rec = new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, energyRequired, reipceComps);
this.recipeEIO = Collections.singletonList(rec);
//TODO:1.7
// List<IRecipeComponent> reipceComps = new ArrayList<IRecipeComponent>(recipe.getInputs().length);
// for (RecipeInput input : recipe.getInputs()) {
// crazypants.enderio.crafting.impl.RecipeInput ri = new crazypants.enderio.crafting.impl.RecipeInput(input.getInput(), -1, input.getEquivelentInputs());
// reipceComps.add(ri);
// }
// reipceComps.add(new crazypants.enderio.crafting.impl.RecipeOutput(output));
// IEnderIoRecipe rec = new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, energyRequired, reipceComps);
// this.recipeEIO = Collections.singletonList(rec);
}
@Override
@@ -156,9 +153,9 @@ public class BasicAlloyRecipe implements IAlloyRecipe {
return result.toArray(new MachineRecipeInput[result.size()]);
}
public List<IEnderIoRecipe> getAllRecipes() {
return recipeEIO;
}
// public List<IEnderIoRecipe> getAllRecipes() {
// return recipeEIO;
// }
static class InputKey {
@@ -7,13 +7,13 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.PacketHandler;
import crazypants.enderio.machine.AbstractMachineBlock;
public class BlockAlloySmelter extends AbstractMachineBlock<TileAlloySmelter> {
public static BlockAlloySmelter create() {
PacketHandler.instance.addPacketProcessor(new AlloySmelterPacketProcessor());
//TODO:1.7
//PacketHandler.instance.addPacketProcessor(new AlloySmelterPacketProcessor());
BlockAlloySmelter ppainter = new BlockAlloySmelter();
ppainter.init();
return ppainter;
@@ -28,11 +28,11 @@ public class BlockAlloySmelter extends AbstractMachineBlock<TileAlloySmelter> {
}
@Override
public void registerIcons(IIconRegister IIconRegister) {
super.registerIcons(IIconRegister);
vanillaSmeltingOn = IIconRegister.registerIcon("enderio:furnaceSmeltingOn");
vanillaSmeltingOff = IIconRegister.registerIcon("enderio:furnaceSmeltingOff");
vanillaSmeltingOnly = IIconRegister.registerIcon("enderio:furnaceSmeltingOnly");
public void registerBlockIcons(IIconRegister iIconRegister) {
super.registerBlockIcons(iIconRegister);
vanillaSmeltingOn = iIconRegister.registerIcon("enderio:furnaceSmeltingOn");
vanillaSmeltingOff = iIconRegister.registerIcon("enderio:furnaceSmeltingOff");
vanillaSmeltingOnly = iIconRegister.registerIcon("enderio:furnaceSmeltingOnly");
}
@Override
@@ -4,12 +4,10 @@ import java.awt.Rectangle;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.IIcon;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.network.PacketDispatcher;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.GuiMachineBase;
import crazypants.enderio.machine.alloy.TileAlloySmelter.Mode;
@@ -61,7 +59,7 @@ public class GuiAlloySmelter extends GuiMachineBase {
int x = guiLeft + xSize - 5 - BUTTON_SIZE;
int y = guiTop + 60;
vanillaFurnaceButton = new IconButton(fontRenderer, SMELT_MODE_BUTTON_ID, x, y, getIconForMode(), RenderUtil.BLOCK_TEX);
vanillaFurnaceButton = new IconButton(getFontRenderer(), SMELT_MODE_BUTTON_ID, x, y, getIconForMode(), RenderUtil.BLOCK_TEX);
vanillaFurnaceButton.setSize(BUTTON_SIZE, BUTTON_SIZE);
buttonList.add(vanillaFurnaceButton);
@@ -72,8 +70,9 @@ public class GuiAlloySmelter extends GuiMachineBase {
if(par1GuiButton.id == SMELT_MODE_BUTTON_ID) {
tileEntity.setMode(tileEntity.getMode().next());
vanillaFurnaceButton.setIcon(getIconForMode());
Packet pkt = AlloySmelterPacketProcessor.getSmeltingModePacket(tileEntity);
PacketDispatcher.sendPacketToServer(pkt);
//TODO:1.7
// Packet pkt = AlloySmelterPacketProcessor.getSmeltingModePacket(tileEntity);
// PacketDispatcher.sendPacketToServer(pkt);
} else {
super.actionPerformed(par1GuiButton);
}
@@ -36,7 +36,7 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
}
@Override
public String getInvName() {
public String getInventoryName() {
return "Alloy Smelter";
}
@@ -183,16 +183,21 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity {
}
@Override
public void readFromNBT(NBTTagCompound nbtRoot) {
super.readFromNBT(nbtRoot);
public void readCustomNBT(NBTTagCompound nbtRoot) {
super.readCustomNBT(nbtRoot);
short mb = nbtRoot.getShort("mode");
mode = Mode.values()[mb];
}
@Override
public void writeToNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot);
public void writeCustomNBT(NBTTagCompound nbtRoot) {
super.writeCustomNBT(nbtRoot);
nbtRoot.setShort("mode", (short) mode.ordinal());
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
}
@@ -1,21 +1,13 @@
package crazypants.enderio.machine.alloy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.item.Item;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace;
import crazypants.enderio.ModObject;
import crazypants.enderio.crafting.IEnderIoRecipe;
import crazypants.enderio.crafting.IRecipeInput;
import crazypants.enderio.crafting.IRecipeOutput;
import crazypants.enderio.crafting.impl.EnderIoRecipe;
import crazypants.enderio.crafting.impl.RecipeOutput;
import crazypants.enderio.machine.IMachineRecipe;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.recipe.RecipeInput;
@@ -25,7 +17,7 @@ public class VanillaSmeltingRecipe implements IMachineRecipe {
// We will use the same energy as per a standard furnace.
// To do the conversion between fuel burning and MJ, use the Stirling Gen
// which produces one MJ per tick of burn time
private static float MJ_PER_ITEM = TileEntityFurnace.getItemBurnTime(new ItemStack(Item.coal)) / 8;
private static float MJ_PER_ITEM = TileEntityFurnace.getItemBurnTime(new ItemStack(Items.coal, 1, 0)) / 8;
private boolean enabled = true;
@@ -115,7 +107,7 @@ public class VanillaSmeltingRecipe implements IMachineRecipe {
if(output == null) {
return 0;
}
float result = FurnaceRecipes.smelting().getExperience(output);
float result = FurnaceRecipes.smelting().func_151398_b(output);
return result * output.stackSize;
}
@@ -159,26 +151,27 @@ public class VanillaSmeltingRecipe implements IMachineRecipe {
return result.toArray(new MachineRecipeInput[result.size()]);
}
@Override
public List<IEnderIoRecipe> getAllRecipes() {
if(!enabled) {
return Collections.emptyList();
}
List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
Map<List<Integer>, ItemStack> metaList = FurnaceRecipes.smelting().getMetaSmeltingList();
for (Entry<List<Integer>, ItemStack> entry : metaList.entrySet()) {
List<Integer> idMeta = entry.getKey();
IRecipeInput input = new crazypants.enderio.crafting.impl.RecipeInput(new ItemStack(idMeta.get(0), 1, idMeta.get(1)), false);
IRecipeOutput output = new RecipeOutput(entry.getValue());
result.add(new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, MJ_PER_ITEM, input, output));
}
Map<Integer, ItemStack> sl = FurnaceRecipes.smelting().getSmeltingList();
for (Entry<Integer, ItemStack> entry : sl.entrySet()) {
IRecipeInput input = new crazypants.enderio.crafting.impl.RecipeInput(new ItemStack(entry.getKey(), 1, 0), false);
IRecipeOutput output = new RecipeOutput(entry.getValue());
result.add(new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, MJ_PER_ITEM, input, output));
}
return result;
}
//TODO:1.7
// @Override
// public List<IEnderIoRecipe> getAllRecipes() {
// if(!enabled) {
// return Collections.emptyList();
// }
// List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
// Map<List<Integer>, ItemStack> metaList = FurnaceRecipes.smelting().getMetaSmeltingList();
// for (Entry<List<Integer>, ItemStack> entry : metaList.entrySet()) {
// List<Integer> idMeta = entry.getKey();
// IRecipeInput input = new crazypants.enderio.crafting.impl.RecipeInput(new ItemStack(idMeta.get(0), 1, idMeta.get(1)), false);
// IRecipeOutput output = new RecipeOutput(entry.getValue());
// result.add(new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, MJ_PER_ITEM, input, output));
// }
// Map<Integer, ItemStack> sl = FurnaceRecipes.smelting().getSmeltingList();
// for (Entry<Integer, ItemStack> entry : sl.entrySet()) {
// IRecipeInput input = new crazypants.enderio.crafting.impl.RecipeInput(new ItemStack(entry.getKey(), 1, 0), false);
// IRecipeOutput output = new RecipeOutput(entry.getValue());
// result.add(new EnderIoRecipe(IEnderIoRecipe.ALLOY_SMELTER_ID, MJ_PER_ITEM, input, output));
// }
// return result;
// }
}
@@ -16,7 +16,7 @@ public class BlockCrusher extends AbstractMachineBlock {
}
private BlockCrusher() {
super(ModObject.blockCrusher, TileCrusher.class);
super(ModObject.blockSagMill, TileCrusher.class);
}
@Override
@@ -1,20 +1,9 @@
package crazypants.enderio.machine.crusher;
import java.util.ArrayList;
import java.util.List;
import crazypants.enderio.ModObject;
import crazypants.enderio.crafting.IEnderIoRecipe;
import crazypants.enderio.crafting.IRecipeComponent;
import crazypants.enderio.crafting.IRecipeInput;
import crazypants.enderio.crafting.IRecipeOutput;
import crazypants.enderio.crafting.impl.EnderIoRecipe;
import crazypants.enderio.crafting.impl.RecipeInput;
import crazypants.enderio.machine.MachineRecipeInput;
import crazypants.enderio.machine.recipe.AbstractMachineRecipe;
import crazypants.enderio.machine.recipe.IRecipe;
import crazypants.enderio.machine.recipe.Recipe;
import crazypants.enderio.machine.recipe.RecipeOutput;
public class CrusherMachineRecipe extends AbstractMachineRecipe {
@@ -38,30 +27,30 @@ public class CrusherMachineRecipe extends AbstractMachineRecipe {
@Override
public String getMachineName() {
return ModObject.blockCrusher.unlocalisedName;
return ModObject.blockSagMill.unlocalisedName;
}
@Override
public List<IEnderIoRecipe> getAllRecipes() {
List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
List<Recipe> recipes = CrusherRecipeManager.getInstance().getRecipes();
for (IRecipe cr : recipes) {
List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
for (crazypants.enderio.machine.recipe.RecipeInput ri : cr.getInputs()) {
if(ri.getInput() != null) {
IRecipeInput input = new RecipeInput(ri.getInput(), -1, ri.getEquivelentInputs());
components.add(input);
}
}
for (RecipeOutput co : cr.getOutputs()) {
IRecipeOutput output = new crazypants.enderio.crafting.impl.RecipeOutput(co.getOutput(), co.getChance());
components.add(output);
}
// IRecipeInput input = new RecipeInput(CrusherRecipeManager.getInput(cr));
// List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
// components.add(input);
result.add(new EnderIoRecipe(IEnderIoRecipe.SAG_MILL_ID, cr.getEnergyRequired(), components));
}
return result;
}
// @Override
// public List<IEnderIoRecipe> getAllRecipes() {
// List<IEnderIoRecipe> result = new ArrayList<IEnderIoRecipe>();
// List<Recipe> recipes = CrusherRecipeManager.getInstance().getRecipes();
// for (IRecipe cr : recipes) {
// List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
// for (crazypants.enderio.machine.recipe.RecipeInput ri : cr.getInputs()) {
// if(ri.getInput() != null) {
// IRecipeInput input = new RecipeInput(ri.getInput(), -1, ri.getEquivelentInputs());
// components.add(input);
// }
// }
// for (RecipeOutput co : cr.getOutputs()) {
// IRecipeOutput output = new crazypants.enderio.crafting.impl.RecipeOutput(co.getOutput(), co.getChance());
// components.add(output);
// }
// // IRecipeInput input = new RecipeInput(CrusherRecipeManager.getInput(cr));
// // List<IRecipeComponent> components = new ArrayList<IRecipeComponent>();
// // components.add(input);
// result.add(new EnderIoRecipe(IEnderIoRecipe.SAG_MILL_ID, cr.getEnergyRequired(), components));
// }
// return result;
// }
}
@@ -44,7 +44,7 @@ public class CrusherRecipeManager {
} else {
Log.error("Could not load recipes for SAG Mill.");
}
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockCrusher.unlocalisedName, new CrusherMachineRecipe());
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockSagMill.unlocalisedName, new CrusherMachineRecipe());
}
public void addCustumRecipes(String xmlDef) {
@@ -12,13 +12,13 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
}
@Override
public String getInvName() {
return ModObject.blockCrusher.name;
public String getInventoryName() {
return ModObject.blockSagMill.unlocalisedName;
}
@Override
public String getMachineName() {
return ModObject.blockCrusher.unlocalisedName;
return ModObject.blockSagMill.unlocalisedName;
}
@Override
@@ -26,4 +26,9 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
return CrusherRecipeManager.instance.getRecipeForInput(itemstack) != null;
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
}
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import net.minecraft.block.Block;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -58,7 +59,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
}
@Override
public String getInvName() {
public String getInventoryName() {
return "Stirling Generator";
}
@@ -96,21 +97,21 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
}
@Override
public void readFromNBT(NBTTagCompound nbtRoot) {
super.readFromNBT(nbtRoot);
public void readCustomNBT(NBTTagCompound nbtRoot) {
super.readCustomNBT(nbtRoot);
burnTime = nbtRoot.getInteger("burnTime");
totalBurnTime = nbtRoot.getInteger("totalBurnTime");
}
@Override
public void writeToNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot);
public void writeCustomNBT(NBTTagCompound nbtRoot) {
super.writeCustomNBT(nbtRoot);
nbtRoot.setInteger("burnTime", burnTime);
nbtRoot.setInteger("totalBurnTime", totalBurnTime);
}
@Override
public void onNeighborBlockChange(int blockId) {
public void onNeighborBlockChange(Block blockId) {
super.onNeighborBlockChange(blockId);
receptorsDirty = true;
}
@@ -134,7 +135,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
burnTime = TileEntityFurnace.getItemBurnTime(inventory[0]);
if(burnTime > 0) {
totalBurnTime = burnTime;
ItemStack containedItem = inventory[0].getItem().getContainerItemStack(inventory[0]);
ItemStack containedItem = inventory[0].getItem().getContainerItem(inventory[0]);
if(containedItem != null) {
inventory[0] = containedItem;
} else {
@@ -155,12 +156,12 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
powerHandler.update();
return false;
}
float canTransmit = Math.min(powerHandler.getEnergyStored(), capacitorType.capacitor.getMaxEnergyExtracted());
double canTransmit = Math.min(powerHandler.getEnergyStored(), capacitorType.capacitor.getMaxEnergyExtracted());
float transmitted = 0;
float stored = powerHandler.getEnergyStored();
double stored = powerHandler.getEnergyStored();
powerHandler.update();
float storedAfter = powerHandler.getEnergyStored();
double storedAfter = powerHandler.getEnergyStored();
checkReceptors();
@@ -174,7 +175,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
Receptor receptor = receptorIterator.next();
IPowerInterface pp = receptor.receptor;
if(pp != null && pp.getMinEnergyReceived(receptor.fromDir.getOpposite()) <= canTransmit) {
float used = pp.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
double used = pp.recieveEnergy(receptor.fromDir.getOpposite(), (float) canTransmit);
transmitted += used;
canTransmit -= used;
}
@@ -224,4 +225,9 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
}
}
@Override
public boolean hasCustomInventoryName() {
return false;
}
}
@@ -184,11 +184,17 @@ public class BlockElectricLight extends BlockEio {
@Override
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
TileElectricLight te = (TileElectricLight) world.getTileEntity(x, y, z);
if(te != null) {
te.onBlockRemoved();
TileEntity t = world.getTileEntity(x, y, z);
TileElectricLight te = null;
if(t instanceof TileElectricLight) {
te = (TileElectricLight) t;
}
world.removeTileEntity(x, y, z);
if(t != null) {
te.onBlockRemoved();
world.removeTileEntity(x, y, z);
}
}
}
@@ -28,7 +28,6 @@ public class TileLightNode extends TileEntityEio {
}
if(worldObj.getWorldTime() % 42 == 0) {
if(worldObj.getBlock(parentX, parentY, parentZ) != EnderIO.blockElectricLight) {
System.out.println("TileLightNode.updateEntity: ");
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
}
@@ -6,17 +6,16 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.RedNetConnectionType;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.PacketHandler;
import crazypants.enderio.machine.AbstractMachineBlock;
import crazypants.util.DyeColor;
public class BlockPowerMonitor extends AbstractMachineBlock<TilePowerMonitor> implements ITileEntityProvider {
public static BlockPowerMonitor create() {
PacketHandler.instance.addPacketProcessor(new PowerMonitorPacketHandler());
//TODO:1.7
//PacketHandler.instance.addPacketProcessor(new PowerMonitorPacketHandler());
BlockPowerMonitor result = new BlockPowerMonitor();
result.init();
@@ -68,35 +67,4 @@ public class BlockPowerMonitor extends AbstractMachineBlock<TilePowerMonitor> im
return 0;
}
@Override
public int[] getOutputValues(World world, int x, int y, int z, ForgeDirection side) {
// TileEntity te = world.getTileEntity(x, y, z);
// if(te instanceof TilePowerMonitor) {
// return ((TilePowerMonitor) te).getRednetOutputValues(side);
// }
return new int[16];
}
@Override
public int getOutputValue(World world, int x, int y, int z, ForgeDirection side, int subnet) {
// TileEntity te = world.getTileEntity(x, y, z);
// if(te instanceof TilePowerMonitor) {
// return ((TilePowerMonitor) te).getRednetOutputValue(side, subnet);
// }
return 0;
}
@Override
public void onInputsChanged(World world, int x, int y, int z, ForgeDirection side, int[] inputValues) {
}
@Override
public void onInputChanged(World world, int x, int y, int z, ForgeDirection side, int inputValue) {
}
@Override
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side) {
return RedNetConnectionType.PlateSingle;
}
}
@@ -8,12 +8,11 @@ import java.awt.Rectangle;
import java.text.NumberFormat;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.network.packet.Packet;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.network.PacketDispatcher;
import crazypants.enderio.gui.CheckBoxEIO;
import crazypants.enderio.machine.power.PowerDisplayUtil;
import crazypants.gui.GuiScreenBase;
@@ -96,8 +95,7 @@ public class GuiPowerMonitor extends GuiScreenBase {
});
fontRenderer = Minecraft.getMinecraft().fontRenderer;
int x = MARGIN + fontRenderer.getStringWidth(titleStr) + SPACING;
int x = MARGIN + Minecraft.getMinecraft().fontRenderer.getStringWidth(titleStr) + SPACING;
enabledB = new CheckBoxEIO(this, 21267, x, 8);
enabledB.setSelectedToolTip(Lang.localize("enderio.gui.enabled"));
@@ -113,17 +111,17 @@ public class GuiPowerMonitor extends GuiScreenBase {
buttonList.clear();
enabledB.onGuiInit();
int x = guiLeft + MARGIN + fontRenderer.getStringWidth(engineTxt2) + 4;
int y = guiTop + MARGIN + ICON_SIZE + ICON_SIZE + fontRenderer.FONT_HEIGHT;
startTF = new GuiTextField(fontRenderer, x, y, 28, 14);
int x = guiLeft + MARGIN + getFontRenderer().getStringWidth(engineTxt2) + 4;
int y = guiTop + MARGIN + ICON_SIZE + ICON_SIZE + getFontRenderer().FONT_HEIGHT;
startTF = new GuiTextField(getFontRenderer(), x, y, 28, 14);
startTF.setCanLoseFocus(true);
startTF.setMaxStringLength(3);
startTF.setFocused(true);
startTF.setText(INT_NF.format(te.asPercentInt(te.startLevel)));
y = y + fontRenderer.FONT_HEIGHT + ICON_SIZE + ICON_SIZE + 4;
x = guiLeft + MARGIN + fontRenderer.getStringWidth(engineTxt5);
endTF = new GuiTextField(fontRenderer, x, y, 28, 14);
y = y + getFontRenderer().FONT_HEIGHT + ICON_SIZE + ICON_SIZE + 4;
x = guiLeft + MARGIN + getFontRenderer().getStringWidth(engineTxt5);
endTF = new GuiTextField(getFontRenderer(), x, y, 28, 14);
endTF.setCanLoseFocus(true);
endTF.setMaxStringLength(3);
endTF.setFocused(false);
@@ -205,8 +203,9 @@ public class GuiPowerMonitor extends GuiScreenBase {
if(i >= 0) {
te.stopLevel = te.asPercentFloat(i);
}
Packet pkt = PowerMonitorPacketHandler.createPowerMonitotPacket(te);
PacketDispatcher.sendPacketToServer(pkt);
//TODO:1.7
// Packet pkt = PowerMonitorPacketHandler.createPowerMonitotPacket(te);
// PacketDispatcher.sendPacketToServer(pkt);
}
}
@@ -238,6 +237,7 @@ public class GuiPowerMonitor extends GuiScreenBase {
} else {
rgb = ColorUtil.getRGB(Color.black);
}
FontRenderer fontRenderer = getFontRenderer();
fontRenderer.drawString(titleStr, x, y, rgb, false);
x = left + fontRenderer.getStringWidth(titleStr) + SPACING + ICON_SIZE + SPACING;
@@ -302,6 +302,7 @@ public class GuiPowerMonitor extends GuiScreenBase {
int sectionGap = SPACING;
FontRenderer fontRenderer = getFontRenderer();
rgb = headingCol;
StringBuilder sb = new StringBuilder();
sb.append(monHeading1);
@@ -1,27 +1,17 @@
package crazypants.enderio.machine.monitor;
import java.text.NumberFormat;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.network.PacketDispatcher;
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.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.PacketHandler;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IConduitBundle;
public class ItemMJReader extends Item {
@@ -29,7 +19,8 @@ public class ItemMJReader extends Item {
public static ItemMJReader create() {
PacketHandler.instance.addPacketProcessor(MJReaderPacketHandler.getInstance());
//TODO:1.7
// PacketHandler.instance.addPacketProcessor(MJReaderPacketHandler.getInstance());
ItemMJReader result = new ItemMJReader();
result.init();
@@ -37,7 +28,6 @@ public class ItemMJReader extends Item {
}
protected ItemMJReader() {
super(ModObject.itemMJReader.id);
setCreativeTab(EnderIOTab.tabEnderIO);
setUnlocalizedName("enderio." + ModObject.itemMJReader.name());
setMaxStackSize(64);
@@ -48,34 +38,36 @@ public class ItemMJReader extends Item {
float par9, float par10) {
if(player.isSneaking()) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof IConduitBundle) {
IConduitBundle cb = (IConduitBundle) te;
Set<ForgeDirection> cons = new HashSet<ForgeDirection>();
for (IConduit con : cb.getConduits()) {
cons.addAll(con.getExternalConnections());
}
if(cons.isEmpty()) {
return false;
}
if(cons.size() == 1) {
player.openGui(EnderIO.instance, GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + cons.iterator().next().ordinal(), world, x, y, z);
return true;
}
player.openGui(EnderIO.instance, GuiHandler.GUI_ID_EXTERNAL_CONNECTION_SELECTOR, world, x, y, z);
}
return false;
}
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof IConduitBundle) && MJReaderPacketHandler.canCreatePacket(world, x, y, z)) {
if(world.isRemote) {
PacketDispatcher.sendPacketToServer(MJReaderPacketHandler.createInfoRequestPacket(x, y, z, side));
}
return true;
//TODO:1.7
}
// TileEntity te = world.getTileEntity(x, y, z);
// if(te instanceof IConduitBundle) {
// IConduitBundle cb = (IConduitBundle) te;
// Set<ForgeDirection> cons = new HashSet<ForgeDirection>();
// for (IConduit con : cb.getConduits()) {
// cons.addAll(con.getExternalConnections());
// }
//
// if(cons.isEmpty()) {
// return false;
// }
// if(cons.size() == 1) {
// player.openGui(EnderIO.instance, GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + cons.iterator().next().ordinal(), world, x, y, z);
// return true;
// }
// player.openGui(EnderIO.instance, GuiHandler.GUI_ID_EXTERNAL_CONNECTION_SELECTOR, world, x, y, z);
//
// }
// return false;
// }
//
// TileEntity te = world.getTileEntity(x, y, z);
// if(!(te instanceof IConduitBundle) && MJReaderPacketHandler.canCreatePacket(world, x, y, z)) {
// if(world.isRemote) {
// PacketDispatcher.sendPacketToServer(MJReaderPacketHandler.createInfoRequestPacket(x, y, z, side));
// }
// return true;
// }
return false;
}
@@ -1,24 +1,14 @@
package crazypants.enderio.machine.monitor;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import powercrystals.minefactoryreloaded.api.rednet.IRedNetNetworkContainer;
import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.power.NetworkPowerManager;
import crazypants.enderio.conduit.power.PowerConduitNetwork;
import crazypants.enderio.conduit.power.PowerTracker;
import crazypants.enderio.conduit.redstone.Signal;
import crazypants.enderio.machine.AbstractMachineEntity;
import crazypants.enderio.machine.SlotDefinition;
import crazypants.enderio.power.IInternalPowerReceptor;
import crazypants.util.BlockCoord;
import crazypants.util.DyeColor;
import crazypants.util.Util;
public class TilePowerMonitor extends AbstractMachineEntity implements IInternalPowerReceptor {
@@ -38,27 +28,27 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
float stopLevel = 0.99f;
DyeColor signalColor = DyeColor.RED;
Signal currentlyEmmittedSignal;
//Signal currentlyEmmittedSignal;
public TilePowerMonitor() {
super(new SlotDefinition(0, 0));
}
public int[] getRednetOutputValues(ForgeDirection side) {
if(currentlyEmmittedSignal == null) {
return new int[16];
}
// if(currentlyEmmittedSignal == null) {
// return new int[16];
// }
int[] res = new int[DyeColor.values().length];
for (DyeColor col : DyeColor.values()) {
res[col.ordinal()] = currentlyEmmittedSignal.color == col ? 15 : 0;
}
// for (DyeColor col : DyeColor.values()) {
// res[col.ordinal()] = currentlyEmmittedSignal.color == col ? 15 : 0;
// }
return res;
}
public int getRednetOutputValue(ForgeDirection side, int subnet) {
if(currentlyEmmittedSignal != null) {
return 15;
}
// if(currentlyEmmittedSignal != null) {
// return 15;
// }
return 0;
}
@@ -71,8 +61,8 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
}
@Override
public String getInvName() {
return ModObject.blockPowerMonitor.name;
public String getInventoryName() {
return EnderIO.blockPowerMonitor.getUnlocalizedName();
}
@Override
@@ -136,46 +126,38 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
powerHandler.setEnergy(powerHandler.getEnergyStored() - energyPerTick);
boolean update = worldObj.getWorldInfo().getWorldTotalTime() % 20 == 0;
NetworkPowerManager pm = getPowerManager();
if(pm != null) {
update(pm);
}
// NetworkPowerManager pm = getPowerManager();
// if(pm != null) {
// update(pm);
// }
Signal sig = null;
if(!engineControlEnabled) {
sig = null;
} else {
float percentFull = getPercentFull();
if(currentlyEmmittedSignal == null) {
if(percentFull <= startLevel) {
sig = new Signal(xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN, 15, signalColor);
}
} else {
if(percentFull >= stopLevel) {
sig = null;
} else {
sig = currentlyEmmittedSignal;
}
}
}
if(currentlyEmmittedSignal != sig) {
currentlyEmmittedSignal = sig;
broadcastSignal();
}
// Signal sig = null;
// if(!engineControlEnabled) {
// sig = null;
// } else {
// float percentFull = getPercentFull();
// if(currentlyEmmittedSignal == null) {
// if(percentFull <= startLevel) {
// sig = new Signal(xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN, 15, signalColor);
// }
// } else {
// if(percentFull >= stopLevel) {
// sig = null;
// } else {
// sig = currentlyEmmittedSignal;
// }
// }
// }
// if(currentlyEmmittedSignal != sig) {
// currentlyEmmittedSignal = sig;
// broadcastSignal();
// }
return update;
}
private void broadcastSignal() {
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
BlockCoord to = getLocation().getLocation(dir);
Block b = Util.getBlock(worldObj.getBlockId(to.x, to.y, to.z));
if(b instanceof IRedNetNetworkContainer) {
((IRedNetNetworkContainer) b).updateNetwork(worldObj, to.x, to.y, to.z);
}
}
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, ModObject.blockPowerMonitor.actualId);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, EnderIO.blockPowerMonitor);
}
@@ -183,38 +165,39 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
return (powerInConduits + powerInCapBanks) / (maxPowerInCoduits + maxPowerInCapBanks);
}
private void update(NetworkPowerManager pm) {
powerInConduits = pm.getPowerInConduits();
maxPowerInCoduits = pm.getMaxPowerInConduits();
powerInCapBanks = pm.getPowerInCapacitorBanks();
maxPowerInCapBanks = pm.getMaxPowerInCapacitorBanks();
powerInMachines = pm.getPowerInReceptors();
maxPowerInMachines = pm.getMaxPowerInReceptors();
PowerTracker tracker = pm.getNetworkPowerTracker();
aveMjSent = tracker.getAverageMjTickSent();
aveMjRecieved = tracker.getAverageMjTickRecieved();
}
private NetworkPowerManager getPowerManager() {
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
IPowerConduit con = ConduitUtil.getConduit(worldObj, this, dir, IPowerConduit.class);
if(con != null) {
AbstractConduitNetwork<?, ?> n = con.getNetwork();
if(n instanceof PowerConduitNetwork) {
NetworkPowerManager pm = ((PowerConduitNetwork) n).getPowerManager();
if(pm != null) {
return pm;
}
}
}
}
return null;
}
//TODO:1.7
// private void update(NetworkPowerManager pm) {
// powerInConduits = pm.getPowerInConduits();
// maxPowerInCoduits = pm.getMaxPowerInConduits();
// powerInCapBanks = pm.getPowerInCapacitorBanks();
// maxPowerInCapBanks = pm.getMaxPowerInCapacitorBanks();
// powerInMachines = pm.getPowerInReceptors();
// maxPowerInMachines = pm.getMaxPowerInReceptors();
// PowerTracker tracker = pm.getNetworkPowerTracker();
// aveMjSent = tracker.getAverageMjTickSent();
// aveMjRecieved = tracker.getAverageMjTickRecieved();
//
// }
//
// private NetworkPowerManager getPowerManager() {
// for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
// IPowerConduit con = ConduitUtil.getConduit(worldObj, this, dir, IPowerConduit.class);
// if(con != null) {
// AbstractConduitNetwork<?, ?> n = con.getNetwork();
// if(n instanceof PowerConduitNetwork) {
// NetworkPowerManager pm = ((PowerConduitNetwork) n).getPowerManager();
// if(pm != null) {
// return pm;
// }
// }
// }
// }
// return null;
// }
@Override
public void readFromNBT(NBTTagCompound nbtRoot) {
super.readFromNBT(nbtRoot);
public void readCustomNBT(NBTTagCompound nbtRoot) {
super.readCustomNBT(nbtRoot);
powerInConduits = nbtRoot.getFloat("powerInConduits");
maxPowerInCoduits = nbtRoot.getFloat("maxPowerInCoduits");
@@ -232,8 +215,8 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
}
@Override
public void writeToNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot);
public void writeCustomNBT(NBTTagCompound nbtRoot) {
super.writeCustomNBT(nbtRoot);
nbtRoot.setFloat("powerInConduits", powerInConduits);
nbtRoot.setFloat("maxPowerInCoduits", maxPowerInCoduits);
@@ -248,9 +231,11 @@ public class TilePowerMonitor extends AbstractMachineEntity implements IInternal
nbtRoot.setFloat("startLevel", startLevel);
nbtRoot.setFloat("stopLevel", stopLevel);
nbtRoot.setShort("signalColor", (short) signalColor.ordinal());
}
;
@Override
public boolean hasCustomInventoryName() {
return false;
}
}
@@ -357,11 +357,11 @@ public class RecipeConfigParser extends DefaultHandler {
Item i = GameRegistry.findItem(modId, name);
if(i != null) {
res = new ItemStack(i, 1, useMeta ? itemMeta : 0);
res = new ItemStack(i, stackSize, useMeta ? itemMeta : 0);
} else {
Block b = GameRegistry.findBlock(modId, name);
if(b != null) {
res = new ItemStack(b, 1, useMeta ? itemMeta : 0);
res = new ItemStack(b, stackSize, useMeta ? itemMeta : 0);
}
}
}
@@ -194,12 +194,14 @@ public class BlockReservoir extends BlockContainer {
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block blockId) {
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
if(world.isRemote) {
return;
}
TileReservoir te = (TileReservoir) world.getTileEntity(x, y, z);
te.onNeighborBlockChange(blockId);
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileReservoir) {
((TileReservoir) te).onNeighborBlockChange(block);
}
}
@Override
@@ -24,8 +24,8 @@ public class MaterialRecipes {
OreDictionary.registerOre("dustCopper", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal()));
OreDictionary.registerOre("dustTin", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal()));
OreDictionary.registerOre("dustEnderPearl", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal()));
OreDictionary.registerOre("itemSilicon", new ItemStack(EnderIO.itemPowderIngot, 1, Material.SILICON.ordinal()));
OreDictionary.registerOre("gearStone", new ItemStack(EnderIO.itemPowderIngot, 1, MachinePart.BASIC_GEAR.ordinal()));
OreDictionary.registerOre("itemSilicon", new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal()));
OreDictionary.registerOre("gearStone", new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()));
int oreId = OreDictionary.getOreID("glass");
ArrayList<ItemStack> ingots = OreDictionary.getOres(oreId);