mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-18 19:39:14 +00:00
Added Gas Conduits
This commit is contained in:
1 parent
18d4245c83
commit
e8531024fa
90 files changed
+7058
-165
No files matched your search
@@ -19,6 +19,8 @@ import crazypants.enderio.conduit.BlockConduitBundle;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.facade.FacadeRenderer;
|
||||
import crazypants.enderio.conduit.gas.GasConduit;
|
||||
import crazypants.enderio.conduit.gas.GasConduitRenderer;
|
||||
import crazypants.enderio.conduit.item.ItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitRenderer;
|
||||
@@ -71,7 +73,6 @@ import crazypants.enderio.machine.light.ElectricLightRenderer;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedFenceGateRenderer;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
|
||||
import crazypants.enderio.machine.painter.BlockPaintedGlowstoneRenderer;
|
||||
import crazypants.enderio.machine.painter.PaintedBlockRenderer;
|
||||
import crazypants.enderio.machine.painter.PaintedItemRenderer;
|
||||
import crazypants.enderio.machine.power.BlockCapacitorBank;
|
||||
@@ -118,6 +119,7 @@ public class ClientProxy extends CommonProxy {
|
||||
AdvancedLiquidConduit.initIcons();
|
||||
EnderLiquidConduit.initIcons();
|
||||
ItemConduit.initIcons();
|
||||
GasConduit.initIcons();
|
||||
}
|
||||
|
||||
private List<ConduitRenderer> conduitRenderers = new ArrayList<ConduitRenderer>();
|
||||
@@ -125,7 +127,7 @@ public class ClientProxy extends CommonProxy {
|
||||
private DefaultConduitRenderer dcr = new DefaultConduitRenderer();
|
||||
|
||||
private ConduitBundleRenderer cbr;
|
||||
|
||||
|
||||
private boolean checkedNei = false;
|
||||
private boolean neiInstalled = false;
|
||||
|
||||
@@ -133,16 +135,16 @@ public class ClientProxy extends CommonProxy {
|
||||
public World getClientWorld() {
|
||||
return FMLClientHandler.instance().getClient().theWorld;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isNeiInstalled() {
|
||||
public boolean isNeiInstalled() {
|
||||
if(checkedNei) {
|
||||
return neiInstalled;
|
||||
}
|
||||
try{
|
||||
try {
|
||||
Class.forName("crazypants.enderio.nei.EnchanterRecipeHandler");
|
||||
neiInstalled = true;
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
neiInstalled = false;
|
||||
}
|
||||
checkedNei = true;
|
||||
@@ -176,44 +178,43 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockStirlingGenerator), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrusher), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockAlloySmelter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockAlloySmelter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPowerMonitor), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), machRen);
|
||||
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemBrokenSpawner, new BrokenSpawnerRenderer());
|
||||
|
||||
|
||||
EnchanterModelRenderer emr = new EnchanterModelRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnchanter.class, emr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEnchanter), emr);
|
||||
|
||||
|
||||
BlockFusedQuartz.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new FusedQuartzRenderer());
|
||||
|
||||
BlockFarmStation.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new FarmingStationRenderer());
|
||||
|
||||
// BlockWirelessCharger.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
// RenderingRegistry.registerBlockHandler(new WirelessChargerRenderer());
|
||||
|
||||
// BlockWirelessCharger.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
// RenderingRegistry.registerBlockHandler(new WirelessChargerRenderer());
|
||||
|
||||
if(Config.useCombustionGenModel) {
|
||||
CombustionGeneratorModelRenderer cgmr = new CombustionGeneratorModelRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCombustionGenerator.class, cgmr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCombustionGenerator), cgmr);
|
||||
} else {
|
||||
} else {
|
||||
BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
CombustionGeneratorRenderer cr = new CombustionGeneratorRenderer();
|
||||
RenderingRegistry.registerBlockHandler(cr);
|
||||
if(!Config.combustionGeneratorUseOpaqueModel) {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCombustionGenerator.class, cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ZombieGeneratorRenderer zgr = new ZombieGeneratorRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileZombieGenerator.class, zgr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockZombieGenerator), zgr);
|
||||
|
||||
|
||||
KillerJoeRenderer kjr = new KillerJoeRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileKillerJoe.class, kjr);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockKillerJoe), kjr);
|
||||
@@ -246,6 +247,7 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemPowerConduit, itemConRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemRedstoneConduit, itemConRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemItemConduit, itemConRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemGasConduit, itemConRenderer);
|
||||
|
||||
BlockPaintedFenceGateRenderer bcfgr = new BlockPaintedFenceGateRenderer();
|
||||
BlockPaintedFenceGate.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -261,14 +263,13 @@ public class ClientProxy extends CommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPaintedCarpet), pir);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockDarkSteelPressurePlate), pir);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTravelPlatform), pir);
|
||||
|
||||
|
||||
BlockPaintedGlowstone.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new PaintedBlockRenderer(BlockPaintedGlowstone.renderId, Blocks.glowstone));
|
||||
|
||||
|
||||
BlockTravelAnchor.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new PaintedBlockRenderer(BlockTravelAnchor.renderId, EnderIO.blockTravelPlatform));
|
||||
|
||||
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
|
||||
|
||||
@@ -278,9 +279,9 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileConduitBundle.class, cbr);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileTravelAnchor.class, new TravelEntitySpecialRenderer());
|
||||
|
||||
|
||||
BlockEndermanSkull.renderId = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new EndermanSkullRenderer());
|
||||
RenderingRegistry.registerBlockHandler(new EndermanSkullRenderer());
|
||||
|
||||
conduitRenderers.add(RedstoneSwitchRenderer.getInstance());
|
||||
conduitRenderers.add(new AdvancedLiquidConduitRenderer());
|
||||
@@ -289,6 +290,7 @@ public class ClientProxy extends CommonProxy {
|
||||
conduitRenderers.add(new InsulatedRedstoneConduitRenderer());
|
||||
conduitRenderers.add(new EnderLiquidConduitRenderer());
|
||||
conduitRenderers.add(new crazypants.enderio.conduit.item.ItemConduitRenderer());
|
||||
conduitRenderers.add(new GasConduitRenderer());
|
||||
|
||||
EnderIoRenderer eior = new EnderIoRenderer();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEnderIO.class, eior);
|
||||
@@ -322,14 +324,12 @@ public class ClientProxy extends CommonProxy {
|
||||
//Ensure it is loaded and registered
|
||||
KeyTracker.instance.isGlideActive();
|
||||
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(SoundEntity.class, new SoundRenderer());
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(SoundDetector.instance);
|
||||
FMLCommonHandler.instance().bus().register(SoundDetector.instance);
|
||||
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(SoundDetector.instance);
|
||||
FMLCommonHandler.instance().bus().register(SoundDetector.instance);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConduitRenderer getRendererForConduit(IConduit conduit) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import static crazypants.enderio.EnderIO.*;
|
||||
import static crazypants.enderio.EnderIO.MODID;
|
||||
import static crazypants.enderio.EnderIO.MOD_NAME;
|
||||
import static crazypants.enderio.EnderIO.VERSION;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -30,6 +32,7 @@ import crazypants.enderio.conduit.BlockConduitBundle;
|
||||
import crazypants.enderio.conduit.ConduitRecipes;
|
||||
import crazypants.enderio.conduit.facade.BlockConduitFacade;
|
||||
import crazypants.enderio.conduit.facade.ItemConduitFacade;
|
||||
import crazypants.enderio.conduit.gas.ItemGasConduit;
|
||||
import crazypants.enderio.conduit.geom.ConduitGeometryUtil;
|
||||
import crazypants.enderio.conduit.item.ItemExtractSpeedUpgrade;
|
||||
import crazypants.enderio.conduit.item.ItemItemConduit;
|
||||
@@ -165,6 +168,7 @@ public class EnderIO {
|
||||
public static ItemPowerConduit itemPowerConduit;
|
||||
public static ItemLiquidConduit itemLiquidConduit;
|
||||
public static ItemItemConduit itemItemConduit;
|
||||
public static ItemGasConduit itemGasConduit;
|
||||
public static ItemBasicItemFilter itemBasicFilterUpgrade;
|
||||
public static ItemExistingItemFilter itemExistingItemFilter;
|
||||
public static ItemModItemFilter itemModItemFilter;
|
||||
@@ -188,11 +192,11 @@ public class EnderIO {
|
||||
public static BlockCrafter blockCrafter;
|
||||
public static BlockPoweredSpawner blockPoweredSpawner;
|
||||
public static ItemBrokenSpawner itemBrokenSpawner;
|
||||
|
||||
|
||||
public static BlockKillerJoe blockKillerJoe;
|
||||
|
||||
public static BlockEnchanter blockEnchanter;
|
||||
|
||||
|
||||
public static BlockElectricLight blockElectricLight;
|
||||
public static BlockLightNode blockLightNode;
|
||||
|
||||
@@ -282,9 +286,9 @@ public class EnderIO {
|
||||
blockTank = BlockTank.create();
|
||||
blockReservoir = BlockReservoir.create();
|
||||
blockVacuumChest = BlockVacuumChest.create();
|
||||
|
||||
|
||||
blockEnchanter = BlockEnchanter.create();
|
||||
|
||||
|
||||
blockKillerJoe = BlockKillerJoe.create();
|
||||
|
||||
blockDarkSteelPressurePlate = BlockDarkSteelPressurePlate.create();
|
||||
@@ -304,6 +308,7 @@ public class EnderIO {
|
||||
itemPowerConduit = ItemPowerConduit.create();
|
||||
itemLiquidConduit = ItemLiquidConduit.create();
|
||||
itemItemConduit = ItemItemConduit.create();
|
||||
itemGasConduit = ItemGasConduit.create();
|
||||
|
||||
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
|
||||
itemExistingItemFilter = ItemExistingItemFilter.create();
|
||||
@@ -363,7 +368,7 @@ public class EnderIO {
|
||||
blockDarkIronBars = BlockDarkIronBars.create();
|
||||
|
||||
itemGliderWing = ItemGliderWing.create();
|
||||
|
||||
|
||||
itemDarkSteelHelmet = ItemDarkSteelArmor.create(0);
|
||||
itemDarkSteelChestplate = ItemDarkSteelArmor.create(1);
|
||||
itemDarkSteelLeggings = ItemDarkSteelArmor.create(2);
|
||||
@@ -374,14 +379,13 @@ public class EnderIO {
|
||||
itemDarkSteelAxe = ItemDarkSteelAxe.create();
|
||||
|
||||
blockEndermanSkull = BlockEndermanSkull.create();
|
||||
|
||||
|
||||
MaterialRecipes.registerOresInDictionary();
|
||||
|
||||
|
||||
int entityID = EntityRegistry.findGlobalUniqueEntityId();
|
||||
|
||||
int entityID = EntityRegistry.findGlobalUniqueEntityId();
|
||||
EntityRegistry.registerGlobalEntityID(SoundEntity.class, "soundEntity", entityID);
|
||||
EntityRegistry.registerModEntity(SoundEntity.class, "soundEntity", entityID, this, 0, 0, false);
|
||||
|
||||
EntityRegistry.registerModEntity(SoundEntity.class, "soundEntity", entityID, this, 0, 0, false);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -397,7 +401,7 @@ public class EnderIO {
|
||||
|
||||
//Register Custom Dungeon Loot here
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()), 1, 3, 15));
|
||||
new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()), 1, 3, 15));
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemConduitProbe, 1, 0), 1, 1, 10));
|
||||
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.quartz), 3, 16, 20));
|
||||
|
||||
@@ -11,7 +11,7 @@ public enum ModObject {
|
||||
itemConduitFacade,
|
||||
itemRedstoneConduit,
|
||||
itemItemConduit,
|
||||
itemMeConduit,
|
||||
itemGasConduit,
|
||||
itemBasicFilterUpgrade,
|
||||
itemExistingItemFilter,
|
||||
itemModItemFilter,
|
||||
@@ -48,19 +48,19 @@ public enum ModObject {
|
||||
blockFarmStation,
|
||||
blockTank,
|
||||
blockCrafter,
|
||||
blockVacuumChest,
|
||||
blockVacuumChest,
|
||||
blockWirelessCharger,
|
||||
blockEnchanter,
|
||||
|
||||
|
||||
blockPoweredSpawner,
|
||||
itemBrokenSpawner,
|
||||
|
||||
|
||||
blockKillerJoe,
|
||||
|
||||
blockElectricLight,
|
||||
blockLightNode,
|
||||
blockLight,
|
||||
|
||||
|
||||
//Blocks
|
||||
blockDarkSteelPressurePlate,
|
||||
blockReinforcedObsidian,
|
||||
@@ -80,9 +80,9 @@ public enum ModObject {
|
||||
itemYetaWrench,
|
||||
|
||||
blockTravelAnchor,
|
||||
itemTravelStaff,
|
||||
itemMagnet,
|
||||
itemGliderWing,
|
||||
itemTravelStaff,
|
||||
itemMagnet,
|
||||
itemGliderWing,
|
||||
blockEndermanSkull;
|
||||
|
||||
public final String unlocalisedName;
|
||||
|
||||
@@ -8,8 +8,9 @@ public enum ConduitDisplayMode {
|
||||
ALL,
|
||||
POWER,
|
||||
REDSTONE,
|
||||
FLUID,
|
||||
ITEM,
|
||||
FLUID;
|
||||
GAS;
|
||||
|
||||
public static ConduitDisplayMode next(ConduitDisplayMode mode) {
|
||||
int index = mode.ordinal() + 1;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package crazypants.enderio.conduit;
|
||||
|
||||
import static crazypants.enderio.ModObject.*;
|
||||
import static crazypants.enderio.ModObject.blockPainter;
|
||||
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 cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadePainterRecipe;
|
||||
import crazypants.enderio.conduit.item.filter.ClearFilterRecipe;
|
||||
import crazypants.enderio.conduit.item.filter.CopyFilterRecipe;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.ClearConfigRecipe;
|
||||
import crazypants.enderio.machine.MachineRecipeRegistry;
|
||||
import crazypants.enderio.material.Alloy;
|
||||
import crazypants.enderio.material.BlockFusedQuartz;
|
||||
@@ -43,7 +43,8 @@ public class ConduitRecipes {
|
||||
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.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);
|
||||
@@ -53,33 +54,39 @@ public class ConduitRecipes {
|
||||
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#',
|
||||
redstoneAlloy);
|
||||
|
||||
if(Loader.isModLoaded("Mekanism")) {
|
||||
GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', conduitBinder, '#',
|
||||
electricalSteel, 'g', fusedGlass);
|
||||
}
|
||||
|
||||
ItemStack itemConduit = new ItemStack(EnderIO.itemItemConduit, numConduits, 0);
|
||||
GameRegistry.addShapedRecipe(itemConduit, "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedIronNugget);
|
||||
|
||||
MachineRecipeRegistry.instance.registerRecipe(blockPainter.unlocalisedName, new FacadePainterRecipe());
|
||||
|
||||
|
||||
//Filter Recipes
|
||||
ItemStack basicFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 0);
|
||||
GameRegistry.addShapedRecipe(basicFilter, " p ","php"," p ", 'p', Items.paper, 'h', Blocks.hopper);
|
||||
|
||||
GameRegistry.addShapedRecipe(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper);
|
||||
|
||||
ItemStack advFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 1);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(advFilter, "rpr","php","rpr", 'p', Items.paper, 'h', "itemSkull", 'r', Items.redstone));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(advFilter, "rpr", "php", "rpr", 'p', Items.paper, 'h', "itemSkull", 'r', Items.redstone));
|
||||
|
||||
ItemStack modFilter = new ItemStack(EnderIO.itemModItemFilter, 1, 0);
|
||||
GameRegistry.addShapedRecipe(modFilter, " p ","pwp"," p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench);
|
||||
|
||||
GameRegistry.addShapedRecipe(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench);
|
||||
|
||||
ItemStack exFilt = new ItemStack(EnderIO.itemExistingItemFilter);
|
||||
GameRegistry.addShapedRecipe(exFilt, "rpr","pcp","rpr", 'p', Items.paper, 'c', new ItemStack(Items.comparator, 1, 0), 'r', Items.redstone);
|
||||
|
||||
GameRegistry.addShapedRecipe(exFilt, "rpr", "pcp", "rpr", 'p', Items.paper, 'c', new ItemStack(Items.comparator, 1, 0), 'r', Items.redstone);
|
||||
|
||||
ClearFilterRecipe clearRec = new ClearFilterRecipe();
|
||||
MinecraftForge.EVENT_BUS.register(clearRec);
|
||||
GameRegistry.addRecipe(clearRec);
|
||||
|
||||
|
||||
CopyFilterRecipe copyRec = new CopyFilterRecipe();
|
||||
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);
|
||||
GameRegistry
|
||||
.addShapedRecipe(speedUpgrade, "iii", "epe", "ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', Items.iron_ingot);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.conduit.IConduitBundle.FacadeRenderState;
|
||||
import crazypants.enderio.conduit.gas.GasConduitNetwork;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.item.ItemConduitNetwork;
|
||||
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
|
||||
@@ -59,6 +61,8 @@ public class ConduitUtil {
|
||||
return new LiquidConduitNetwork();
|
||||
} else if(IItemConduit.class.isAssignableFrom(type)) {
|
||||
return new ItemConduitNetwork();
|
||||
} else if(IGasConduit.class.isAssignableFrom(type)) {
|
||||
return new GasConduitNetwork();
|
||||
}
|
||||
FMLCommonHandler.instance().raiseException(new Exception("Could not determine network type for class " + type), "ConduitUtil.createNetworkForType", false);
|
||||
return null;
|
||||
@@ -206,14 +210,16 @@ public class ConduitUtil {
|
||||
switch (mode) {
|
||||
case ALL:
|
||||
return true;
|
||||
case FLUID:
|
||||
return conduitType == ILiquidConduit.class;
|
||||
case ITEM:
|
||||
return conduitType == IItemConduit.class;
|
||||
case POWER:
|
||||
return conduitType == IPowerConduit.class;
|
||||
case REDSTONE:
|
||||
return conduitType == IRedstoneConduit.class || conduitType == IInsulatedRedstoneConduit.class;
|
||||
case FLUID:
|
||||
return conduitType == ILiquidConduit.class;
|
||||
case ITEM:
|
||||
return conduitType == IItemConduit.class;
|
||||
case GAS:
|
||||
return conduitType == IGasConduit.class;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cofh.api.transport.IItemDuct;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
@@ -16,7 +18,8 @@ import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.power.IInternalPowerReceptor;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, IItemDuct {
|
||||
@Optional.Interface(iface = "mekanism.api.gas.IGasHandler", modid = "Mekanism")
|
||||
public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, IItemDuct, IGasHandler {
|
||||
|
||||
TileEntity getEntity();
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -17,10 +19,12 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConduitConnectorType;
|
||||
@@ -757,4 +761,46 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
return item;
|
||||
}
|
||||
|
||||
// ---- Mekanism Gas Tubes
|
||||
|
||||
@Optional.Method(modid = "Mekanism")
|
||||
@Override
|
||||
public int receiveGas(ForgeDirection side, GasStack stack) {
|
||||
IGasConduit gc = getConduit(IGasConduit.class);
|
||||
if(gc != null) {
|
||||
return gc.receiveGas(side, stack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Mekanism")
|
||||
@Override
|
||||
public GasStack drawGas(ForgeDirection side, int amount) {
|
||||
IGasConduit gc = getConduit(IGasConduit.class);
|
||||
if(gc != null) {
|
||||
return gc.drawGas(side, amount);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Mekanism")
|
||||
@Override
|
||||
public boolean canReceiveGas(ForgeDirection side, Gas type) {
|
||||
IGasConduit gc = getConduit(IGasConduit.class);
|
||||
if(gc != null) {
|
||||
return gc.canReceiveGas(side, type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Mekanism")
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection side, Gas type) {
|
||||
IGasConduit gc = getConduit(IGasConduit.class);
|
||||
if(gc != null) {
|
||||
return gc.canDrawGas(side, type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.AbstractConduit;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.machine.reservoir.TileReservoir;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.util.DyeColor;
|
||||
|
||||
public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit {
|
||||
|
||||
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(ForgeDirection.class);
|
||||
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(ForgeDirection.class);
|
||||
|
||||
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
|
||||
protected boolean redstoneStateDirty = true;
|
||||
|
||||
public IGasHandler getExternalHandler(ForgeDirection direction) {
|
||||
IGasHandler con = GasUtil.getExternalGasHandler(getBundle().getWorld(), getLocation().getLocation(direction));
|
||||
return (con != null && !(con instanceof IConduitBundle)) ? con : null;
|
||||
}
|
||||
|
||||
public IGasHandler getTankContainer(BlockCoord bc) {
|
||||
return GasUtil.getGasHandler(getBundle().getWorld(), bc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreDisabled) {
|
||||
IGasHandler h = getExternalHandler(direction);
|
||||
if(h == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IGasConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNeighborBlockChange(Block blockId) {
|
||||
redstoneStateDirty = true;
|
||||
return super.onNeighborBlockChange(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionRedstoneMode(RedstoneControlMode mode, ForgeDirection dir) {
|
||||
extractionModes.put(dir, mode);
|
||||
redstoneStateDirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControlMode getExtractionRedstoneMode(ForgeDirection dir) {
|
||||
RedstoneControlMode res = extractionModes.get(dir);
|
||||
if(res == null) {
|
||||
res = RedstoneControlMode.ON;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtractionSignalColor(ForgeDirection dir, DyeColor col) {
|
||||
extractionColors.put(dir, col);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DyeColor getExtractionSignalColor(ForgeDirection dir) {
|
||||
DyeColor result = extractionColors.get(dir);
|
||||
if(result == null) {
|
||||
return DyeColor.RED;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputToDir(ForgeDirection dir) {
|
||||
if(isExtractingFromDir(dir) || getConectionMode(dir) == ConnectionMode.DISABLED) {
|
||||
return false;
|
||||
}
|
||||
if(conduitConnections.contains(dir)) {
|
||||
return true;
|
||||
}
|
||||
if(!externalConnections.contains(dir)) {
|
||||
return false;
|
||||
}
|
||||
IGasHandler ext = getExternalHandler(dir);
|
||||
if(ext instanceof TileReservoir) { // dont push to an auto ejecting
|
||||
// resevoir or we loop
|
||||
TileReservoir tr = (TileReservoir) ext;
|
||||
return !tr.isMultiblock() || !tr.isAutoEject();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean autoExtractForDir(ForgeDirection dir) {
|
||||
if(!isExtractingFromDir(dir)) {
|
||||
return false;
|
||||
}
|
||||
RedstoneControlMode mode = getExtractionRedstoneMode(dir);
|
||||
if(mode == RedstoneControlMode.IGNORE) {
|
||||
return true;
|
||||
}
|
||||
if(mode == RedstoneControlMode.NEVER) {
|
||||
return false;
|
||||
}
|
||||
if(redstoneStateDirty) {
|
||||
externalRedstoneSignals.clear();
|
||||
redstoneStateDirty = false;
|
||||
}
|
||||
|
||||
DyeColor col = getExtractionSignalColor(dir);
|
||||
int signal = ConduitUtil.getInternalSignalForColor(getBundle(), col);
|
||||
if(mode.isConditionMet(mode, signal) && mode != RedstoneControlMode.OFF) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return isConditionMetByExternalSignal(dir, mode, col);
|
||||
}
|
||||
|
||||
private boolean isConditionMetByExternalSignal(ForgeDirection dir, RedstoneControlMode mode, DyeColor col) {
|
||||
int externalSignal = 0;
|
||||
if(col == DyeColor.RED) {
|
||||
Integer val = externalRedstoneSignals.get(dir);
|
||||
if(val == null) {
|
||||
TileEntity te = getBundle().getEntity();
|
||||
externalSignal = te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord);
|
||||
externalRedstoneSignals.put(dir, externalSignal);
|
||||
} else {
|
||||
externalSignal = val;
|
||||
}
|
||||
}
|
||||
|
||||
return mode.isConditionMet(mode, externalSignal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtractingFromDir(ForgeDirection dir) {
|
||||
return getConectionMode(dir) == ConnectionMode.INPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
|
||||
for (Entry<ForgeDirection, RedstoneControlMode> entry : extractionModes.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("extRM." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<ForgeDirection, DyeColor> entry : extractionColors.entrySet()) {
|
||||
if(entry.getValue() != null) {
|
||||
short ord = (short) entry.getValue().ordinal();
|
||||
nbtRoot.setShort("extSC." + entry.getKey().name(), ord);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtRoot, short nbtVersion) {
|
||||
super.readFromNBT(nbtRoot, nbtVersion);
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
String key = "extRM." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < RedstoneControlMode.values().length) {
|
||||
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
|
||||
}
|
||||
}
|
||||
key = "extSC." + dir.name();
|
||||
if(nbtRoot.hasKey(key)) {
|
||||
short ord = nbtRoot.getShort(key);
|
||||
if(ord >= 0 && ord < DyeColor.values().length) {
|
||||
extractionColors.put(dir, DyeColor.values()[ord]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConduitUtil;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.RaytraceResult;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public abstract class AbstractGasTankConduit extends AbstractGasConduit {
|
||||
|
||||
protected ConduitGasTank tank = new ConduitGasTank(0);
|
||||
protected boolean stateDirty = false;
|
||||
protected long lastEmptyTick = 0;
|
||||
protected int numEmptyEvents = 0;
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {
|
||||
if(player.getCurrentEquippedItem() == null) {
|
||||
return false;
|
||||
}
|
||||
AbstractGasTankConduitNetwork<? extends AbstractGasTankConduit> network = getTankNetwork();
|
||||
if(ConduitUtil.isToolEquipped(player)) {
|
||||
|
||||
if(!getBundle().getEntity().getWorldObj().isRemote) {
|
||||
|
||||
if(res != null && res.component != null) {
|
||||
|
||||
ForgeDirection connDir = res.component.dir;
|
||||
ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);
|
||||
|
||||
if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {
|
||||
|
||||
if(getConectionMode(faceHit) == ConnectionMode.DISABLED) {
|
||||
setConnectionMode(faceHit, getNextConnectionMode(faceHit));
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockCoord loc = getLocation().getLocation(faceHit);
|
||||
IGasConduit n = ConduitUtil.getConduit(getBundle().getEntity().getWorldObj(), loc.x, loc.y, loc.z, IGasConduit.class);
|
||||
if(n == null) {
|
||||
return false;
|
||||
}
|
||||
if(!canJoinNeighbour(n)) {
|
||||
return false;
|
||||
}
|
||||
if(!(n instanceof AbstractGasTankConduit)) {
|
||||
return false;
|
||||
}
|
||||
AbstractGasTankConduit neighbour = (AbstractGasTankConduit) n;
|
||||
if(neighbour.getGasType() == null || getGasType() == null) {
|
||||
GasStack type = getGasType();
|
||||
type = type != null ? type : neighbour.getGasType();
|
||||
neighbour.setGasTypeOnNetwork(neighbour, type);
|
||||
setGasTypeOnNetwork(this, type);
|
||||
}
|
||||
return ConduitUtil.joinConduits(this, faceHit);
|
||||
} else if(containsExternalConnection(connDir)) {
|
||||
// Toggle extraction mode
|
||||
setConnectionMode(connDir, getNextConnectionMode(connDir));
|
||||
} else if(containsConduitConnection(connDir)) {
|
||||
GasStack curGasType = null;
|
||||
if(getTankNetwork() != null) {
|
||||
curGasType = getTankNetwork().getGasType();
|
||||
}
|
||||
ConduitUtil.disconectConduits(this, connDir);
|
||||
setGasType(curGasType);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setGasTypeOnNetwork(AbstractGasTankConduit con, GasStack type) {
|
||||
AbstractConduitNetwork<?, ?> n = con.getNetwork();
|
||||
if(n != null) {
|
||||
AbstractGasTankConduitNetwork<?> network = (AbstractGasTankConduitNetwork<?>) n;
|
||||
network.setGasType(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected abstract boolean canJoinNeighbour(IGasConduit n);
|
||||
|
||||
public abstract AbstractGasTankConduitNetwork<? extends AbstractGasTankConduit> getTankNetwork();
|
||||
|
||||
public void setGasType(GasStack gasType) {
|
||||
if(tank.getGas() != null && tank.getGas().isGasEqual(gasType)) {
|
||||
return;
|
||||
}
|
||||
if(gasType != null) {
|
||||
gasType = gasType.copy();
|
||||
} else if(tank.getGas() == null) {
|
||||
return;
|
||||
}
|
||||
tank.setGas(gasType);
|
||||
stateDirty = true;
|
||||
}
|
||||
|
||||
public ConduitGasTank getTank() {
|
||||
return tank;
|
||||
}
|
||||
|
||||
public GasStack getGasType() {
|
||||
GasStack result = null;
|
||||
if(getTankNetwork() != null) {
|
||||
result = getTankNetwork().getGasType();
|
||||
}
|
||||
if(result == null) {
|
||||
result = tank.getGas();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected abstract void updateTank();
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbtRoot, short nbtVersion) {
|
||||
super.readFromNBT(nbtRoot, nbtVersion);
|
||||
updateTank();
|
||||
if(nbtRoot.hasKey("tank")) {
|
||||
GasStack gas = GasStack.readFromNBT(nbtRoot.getCompoundTag("tank"));
|
||||
tank.setGas(gas);
|
||||
} else {
|
||||
tank.setGas(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeToNBT(nbtRoot);
|
||||
GasStack gt = getGasType();
|
||||
if(GasUtil.isGasValid(gt)) {
|
||||
updateTank();
|
||||
gt = gt.copy();
|
||||
gt.amount = tank.getStored();
|
||||
nbtRoot.setTag("tank", gt.write(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
|
||||
public class AbstractGasTankConduitNetwork<T extends AbstractGasTankConduit> extends AbstractConduitNetwork<IGasConduit, T> {
|
||||
|
||||
protected GasStack gasType;
|
||||
|
||||
protected AbstractGasTankConduitNetwork(Class<T> cl) {
|
||||
super(cl);
|
||||
}
|
||||
|
||||
public GasStack getGasType() {
|
||||
return gasType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IGasConduit> getBaseConduitType() {
|
||||
return IGasConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(T con) {
|
||||
super.addConduit(con);
|
||||
con.setGasType(gasType);
|
||||
}
|
||||
|
||||
public boolean setGasType(GasStack newType) {
|
||||
if(gasType != null && gasType.isGasEqual(newType)) {
|
||||
return false;
|
||||
}
|
||||
if(newType != null) {
|
||||
gasType = newType.copy();
|
||||
gasType.amount = 0;
|
||||
} else {
|
||||
gasType = null;
|
||||
}
|
||||
for (AbstractGasTankConduit conduit : conduits) {
|
||||
conduit.setGasType(gasType);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canAcceptGas(GasStack acceptable) {
|
||||
return areGassCompatable(gasType, acceptable);
|
||||
}
|
||||
|
||||
public static boolean areGassCompatable(GasStack a, GasStack b) {
|
||||
if(a == null || b == null) {
|
||||
return true;
|
||||
}
|
||||
return a.isGasEqual(b);
|
||||
}
|
||||
|
||||
public int getTotalVolume() {
|
||||
int totalVolume = 0;
|
||||
for (T con : conduits) {
|
||||
totalVolume += con.getTank().getStored();
|
||||
}
|
||||
return totalVolume;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ConduitGasTank extends GasTank {
|
||||
|
||||
private int capacity;
|
||||
|
||||
ConduitGasTank(int capacity) {
|
||||
super(capacity);
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public float getFilledRatio() {
|
||||
if(getStored() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
if(getMaxGas() <= 0) {
|
||||
return -1;
|
||||
}
|
||||
float res = (float) getStored() / getMaxGas();
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return getStored() >= getMaxGas();
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
if(stored != null) {
|
||||
stored.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public int getAvailableSpace() {
|
||||
return getMaxGas() - getStored();
|
||||
}
|
||||
|
||||
public void addAmount(int amount) {
|
||||
setAmount(getStored() + amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxGas() {
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
this.capacity = capacity;
|
||||
if(getStored() > capacity) {
|
||||
setAmount(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receive(GasStack resource, boolean doReceive) {
|
||||
if(resource == null || resource.getGas().getID() <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(stored == null || stored.getGas().getID() <= 0) {
|
||||
if(resource.amount <= capacity) {
|
||||
if(doReceive) {
|
||||
setGas(resource.copy());
|
||||
}
|
||||
return resource.amount;
|
||||
} else {
|
||||
if(doReceive) {
|
||||
stored = resource.copy();
|
||||
stored.amount = capacity;
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
if(!stored.isGasEqual(resource)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int space = capacity - stored.amount;
|
||||
if(resource.amount <= space) {
|
||||
if(doReceive) {
|
||||
addAmount(resource.amount);
|
||||
}
|
||||
return resource.amount;
|
||||
} else {
|
||||
if(doReceive) {
|
||||
stored.amount = capacity;
|
||||
}
|
||||
return space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasStack draw(int maxDrain, boolean doDraw) {
|
||||
if(stored == null || stored.getGas().getID() <= 0) {
|
||||
return null;
|
||||
}
|
||||
if(stored.amount <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int used = maxDrain;
|
||||
if(stored.amount < used) {
|
||||
used = stored.amount;
|
||||
}
|
||||
|
||||
if(doDraw) {
|
||||
addAmount(-used);
|
||||
}
|
||||
|
||||
GasStack drained = new GasStack(stored.getGas().getID(), used);
|
||||
|
||||
if(stored.amount < 0) {
|
||||
stored.amount = 0;
|
||||
}
|
||||
return drained;
|
||||
}
|
||||
|
||||
public String getGasName() {
|
||||
return stored != null ? stored.getGas().getLocalizedName() : null;
|
||||
}
|
||||
|
||||
public boolean containsValidGas() {
|
||||
return GasUtil.isGasValid(stored);
|
||||
}
|
||||
|
||||
public NBTTagCompound write(NBTTagCompound nbt) {
|
||||
if(containsValidGas()) {
|
||||
stored.write(nbt);
|
||||
} else {
|
||||
nbt.setBoolean("emptyGasTank", true);
|
||||
}
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void read(NBTTagCompound nbt) {
|
||||
if(!nbt.hasKey("emptyGasTank")) {
|
||||
GasStack gas = GasStack.readFromNBT(nbt);
|
||||
if(gas != null) {
|
||||
setGas(gas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return stored == null || stored.amount == 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.AbstractConduitNetwork;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.render.IconUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class GasConduit extends AbstractGasTankConduit {
|
||||
|
||||
public static final int CONDUIT_VOLUME = 1000;
|
||||
|
||||
public static final String ICON_KEY = "enderio:gasConduit";
|
||||
public static final String ICON_CORE_KEY = "enderio:gasConduitCore";
|
||||
public static final String ICON_EXTRACT_KEY = "enderio:gasConduitInput";
|
||||
public static final String ICON_INSERT_KEY = "enderio:gasConduitOutput";
|
||||
public static final String ICON_EMPTY_EDGE = "enderio:gasConduitEdge";
|
||||
|
||||
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void initIcons() {
|
||||
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
ICONS.put(ICON_KEY, register.registerIcon(ICON_KEY));
|
||||
ICONS.put(ICON_CORE_KEY, register.registerIcon(ICON_CORE_KEY));
|
||||
ICONS.put(ICON_EXTRACT_KEY, register.registerIcon(ICON_EXTRACT_KEY));
|
||||
ICONS.put(ICON_INSERT_KEY, register.registerIcon(ICON_INSERT_KEY));
|
||||
ICONS.put(ICON_EMPTY_EDGE, register.registerIcon(ICON_EMPTY_EDGE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private GasConduitNetwork network;
|
||||
|
||||
private long ticksSinceFailedExtract = 0;
|
||||
|
||||
public static final int MAX_EXTRACT_PER_TICK = Config.gasConduitExtractRate;
|
||||
|
||||
public static final int MAX_IO_PER_TICK = Config.gasConduitMaxIoRate;
|
||||
|
||||
public GasConduit() {
|
||||
updateTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(World world) {
|
||||
super.updateEntity(world);
|
||||
if(world.isRemote) {
|
||||
return;
|
||||
}
|
||||
doExtract();
|
||||
if(stateDirty) {
|
||||
getBundle().dirty();
|
||||
stateDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void doExtract() {
|
||||
BlockCoord loc = getLocation();
|
||||
if(!hasConnectionMode(ConnectionMode.INPUT)) {
|
||||
return;
|
||||
}
|
||||
if(network == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// assume failure, reset to 0 if we do extract
|
||||
ticksSinceFailedExtract++;
|
||||
if(ticksSinceFailedExtract > 25 && ticksSinceFailedExtract % 10 != 0) {
|
||||
// after 25 ticks of failing, only check every 10 ticks
|
||||
return;
|
||||
}
|
||||
|
||||
Gas f = tank.getGas() == null ? null : tank.getGas().getGas();
|
||||
for (ForgeDirection dir : externalConnections) {
|
||||
if(autoExtractForDir(dir)) {
|
||||
if(network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) {
|
||||
ticksSinceFailedExtract = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateTank() {
|
||||
tank.setCapacity(CONDUIT_VOLUME);
|
||||
if(network != null) {
|
||||
network.updateConduitVolumes();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createItem() {
|
||||
return new ItemStack(EnderIO.itemGasConduit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractConduitNetwork<?, ?> getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setNetwork(AbstractConduitNetwork<?, ?> network) {
|
||||
if(network == null) {
|
||||
this.network = null;
|
||||
return true;
|
||||
}
|
||||
if(!(network instanceof GasConduitNetwork)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GasConduitNetwork n = (GasConduitNetwork) network;
|
||||
if(tank.getGas() == null) {
|
||||
tank.setGas(n.getGasType() == null ? null : n.getGasType().copy());
|
||||
} else if(n.getGasType() == null) {
|
||||
n.setGasType(tank.getGas());
|
||||
} else if(!tank.getGas().isGasEqual(n.getGasType())) {
|
||||
return false;
|
||||
}
|
||||
this.network = n;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectToConduit(ForgeDirection direction, IConduit con) {
|
||||
if(!super.canConnectToConduit(direction, con)) {
|
||||
return false;
|
||||
}
|
||||
if(!(con instanceof GasConduit)) {
|
||||
return false;
|
||||
}
|
||||
if(getGasType() != null && ((GasConduit) con).getGasType() == null) {
|
||||
return false;
|
||||
}
|
||||
return GasConduitNetwork.areGassCompatable(getGasType(), ((GasConduit) con).getGasType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConnectionMode(ForgeDirection dir, ConnectionMode mode) {
|
||||
super.setConnectionMode(dir, mode);
|
||||
refreshInputs(dir);
|
||||
}
|
||||
|
||||
private void refreshInputs(ForgeDirection dir) {
|
||||
if(network == null) {
|
||||
return;
|
||||
}
|
||||
GasOutput lo = new GasOutput(getLocation().getLocation(dir), dir.getOpposite());
|
||||
network.removeInput(lo);
|
||||
if(getConectionMode(dir).acceptsOutput() && containsExternalConnection(dir)) {
|
||||
network.addInput(lo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalConnectionAdded(ForgeDirection fromDirection) {
|
||||
super.externalConnectionAdded(fromDirection);
|
||||
refreshInputs(fromDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalConnectionRemoved(ForgeDirection fromDirection) {
|
||||
super.externalConnectionRemoved(fromDirection);
|
||||
refreshInputs(fromDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTextureForState(CollidableComponent component) {
|
||||
if(component.dir == ForgeDirection.UNKNOWN) {
|
||||
return ICONS.get(ICON_CORE_KEY);
|
||||
}
|
||||
return ICONS.get(ICON_KEY);
|
||||
}
|
||||
|
||||
public IIcon getTextureForInputMode() {
|
||||
return ICONS.get(ICON_EXTRACT_KEY);
|
||||
}
|
||||
|
||||
public IIcon getTextureForOutputMode() {
|
||||
return ICONS.get(ICON_INSERT_KEY);
|
||||
}
|
||||
|
||||
public IIcon getNotSetEdgeTexture() {
|
||||
return ICONS.get(ICON_EMPTY_EDGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTransmitionTextureForState(CollidableComponent component) {
|
||||
if(isActive() && tank.containsValidGas()) {
|
||||
return tank.getGas().getGas().getIcon();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ------------------------------------------- Gas API
|
||||
|
||||
@Override
|
||||
public int receiveGas(ForgeDirection from, GasStack resource) {
|
||||
if(network == null || !getConectionMode(from).acceptsInput()) {
|
||||
return 0;
|
||||
}
|
||||
return network.fill(from, resource, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasStack drawGas(ForgeDirection from, int maxDrain) {
|
||||
if(network == null || !getConectionMode(from).acceptsOutput()) {
|
||||
return null;
|
||||
}
|
||||
return network.drain(from, maxDrain, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveGas(ForgeDirection from, Gas gas) {
|
||||
if(network == null) {
|
||||
return false;
|
||||
}
|
||||
return getConectionMode(from).acceptsInput() && GasConduitNetwork.areGassCompatable(getGasType(), new GasStack(gas, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection from, Gas gas) {
|
||||
if(network == null) {
|
||||
return false;
|
||||
}
|
||||
return getConectionMode(from).acceptsOutput() && GasConduitNetwork.areGassCompatable(getGasType(), new GasStack(gas, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canJoinNeighbour(IGasConduit n) {
|
||||
return n instanceof GasConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractGasTankConduitNetwork<? extends AbstractGasTankConduit> getTankNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
|
||||
import crazypants.enderio.conduit.ConduitNetworkTickHandler.TickListener;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit> {
|
||||
|
||||
private final ConduitGasTank tank = new ConduitGasTank(0);
|
||||
|
||||
private final Set<GasOutput> outputs = new HashSet<GasOutput>();
|
||||
|
||||
private Iterator<GasOutput> outputIterator;
|
||||
|
||||
private int ticksActiveUnsynced;
|
||||
|
||||
private boolean lastSyncedActive = false;
|
||||
|
||||
private int lastSyncedVolume = -1;
|
||||
|
||||
private long timeAtLastApply;
|
||||
|
||||
private final InnerTickHandler tickHandler = new InnerTickHandler();
|
||||
|
||||
public GasConduitNetwork() {
|
||||
super(GasConduit.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IGasConduit> getBaseConduitType() {
|
||||
return IGasConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConduit(GasConduit con) {
|
||||
tank.setCapacity(tank.getMaxGas() + GasConduit.CONDUIT_VOLUME);
|
||||
if(con.getTank().containsValidGas()) {
|
||||
tank.addAmount(con.getTank().getStored());
|
||||
}
|
||||
for (ForgeDirection dir : con.getExternalConnections()) {
|
||||
if(con.getConectionMode(dir).acceptsOutput()) {
|
||||
outputs.add(new GasOutput(con.getLocation().getLocation(dir), dir.getOpposite()));
|
||||
}
|
||||
}
|
||||
outputIterator = null;
|
||||
super.addConduit(con);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setGasType(GasStack newType) {
|
||||
if(super.setGasType(newType)) {
|
||||
|
||||
GasStack ft = getGasType();
|
||||
tank.setGas(ft == null ? null : ft.copy());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyNetwork() {
|
||||
setConduitVolumes();
|
||||
outputs.clear();
|
||||
super.destroyNetwork();
|
||||
}
|
||||
|
||||
private void setConduitVolumes() {
|
||||
if(tank.containsValidGas() && !conduits.isEmpty()) {
|
||||
GasStack gasPerConduit = tank.getGas().copy();
|
||||
int numCons = conduits.size();
|
||||
int leftOvers = gasPerConduit.amount % numCons;
|
||||
gasPerConduit.amount = gasPerConduit.amount / numCons;
|
||||
|
||||
for (GasConduit con : conduits) {
|
||||
GasStack f = gasPerConduit.copy();
|
||||
if(leftOvers > 0) {
|
||||
f.amount += 1;
|
||||
leftOvers--;
|
||||
}
|
||||
con.getTank().setGas(f);
|
||||
BlockCoord bc = con.getLocation();
|
||||
con.getBundle().getEntity().getWorldObj().markTileEntityChunkModified(bc.x, bc.y, bc.z, con.getBundle().getEntity());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateEntity(IConduit conduit) {
|
||||
World world = conduit.getBundle().getEntity().getWorldObj();
|
||||
if(world == null) {
|
||||
return;
|
||||
}
|
||||
if(world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
long curTime = world.getTotalWorldTime();
|
||||
if(curTime > 0 && curTime != timeAtLastApply) {
|
||||
timeAtLastApply = curTime;
|
||||
ConduitNetworkTickHandler.instance.addListener(tickHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void doTick() {
|
||||
if(gasType == null || outputs.isEmpty() || !tank.containsValidGas() || tank.isEmpty()) {
|
||||
updateActiveState();
|
||||
return;
|
||||
}
|
||||
|
||||
if(outputIterator == null || !outputIterator.hasNext()) {
|
||||
outputIterator = outputs.iterator();
|
||||
}
|
||||
|
||||
updateActiveState();
|
||||
|
||||
int numVisited = 0;
|
||||
while (!tank.isEmpty() && numVisited < outputs.size()) {
|
||||
if(!outputIterator.hasNext()) {
|
||||
outputIterator = outputs.iterator();
|
||||
}
|
||||
GasOutput output = outputIterator.next();
|
||||
if(output != null) {
|
||||
IGasHandler cont = getTankContainer(output.location);
|
||||
if(cont != null) {
|
||||
GasStack offer = tank.getGas().copy();
|
||||
int filled = cont.receiveGas(output.dir, offer);
|
||||
if(filled > 0) {
|
||||
tank.addAmount(-filled);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
numVisited++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateActiveState() {
|
||||
boolean isActive = tank.containsValidGas() && !tank.isEmpty();
|
||||
if(lastSyncedActive != isActive) {
|
||||
ticksActiveUnsynced++;
|
||||
} else {
|
||||
ticksActiveUnsynced = 0;
|
||||
}
|
||||
if(ticksActiveUnsynced >= 10 || ticksActiveUnsynced > 0 && isActive) {
|
||||
if(!isActive) {
|
||||
setGasType(null);
|
||||
}
|
||||
for (IConduit con : conduits) {
|
||||
con.setActive(isActive);
|
||||
}
|
||||
lastSyncedActive = isActive;
|
||||
ticksActiveUnsynced = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int fill(ForgeDirection from, GasStack resource, boolean doFill) {
|
||||
if(resource == null) {
|
||||
return 0;
|
||||
}
|
||||
resource.amount = Math.min(resource.amount, GasConduit.MAX_IO_PER_TICK);
|
||||
boolean gasWasValid = !tank.containsValidGas();
|
||||
int res = tank.receive(resource, doFill);
|
||||
if(doFill && res > 0 && !gasWasValid) {
|
||||
int vol = tank.getStored();
|
||||
setGasType(resource);
|
||||
tank.setAmount(vol);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public GasStack drain(ForgeDirection from, GasStack resource, boolean doDrain) {
|
||||
if(resource == null || tank.isEmpty() || !tank.containsValidGas() || !GasConduitNetwork.areGassCompatable(getGasType(), resource)) {
|
||||
return null;
|
||||
}
|
||||
int amount = Math.min(resource.amount, tank.getStored());
|
||||
amount = Math.min(amount, GasConduit.MAX_IO_PER_TICK);
|
||||
GasStack result = resource.copy();
|
||||
result.amount = amount;
|
||||
if(doDrain) {
|
||||
tank.addAmount(-amount);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public GasStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
if(tank.isEmpty() || !tank.containsValidGas()) {
|
||||
return null;
|
||||
}
|
||||
int amount = Math.min(maxDrain, tank.getStored());
|
||||
GasStack result = tank.getGas().copy();
|
||||
result.amount = amount;
|
||||
if(doDrain) {
|
||||
tank.addAmount(-amount);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean extractFrom(GasConduit advancedGasConduit, ForgeDirection dir, int maxExtractPerTick) {
|
||||
|
||||
if(tank.isFull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IGasHandler extTank = getTankContainer(advancedGasConduit, dir);
|
||||
if(extTank != null) {
|
||||
int maxExtract = Math.min(maxExtractPerTick, tank.getAvailableSpace());
|
||||
|
||||
if(gasType == null || !tank.containsValidGas()) {
|
||||
GasStack drained = extTank.drawGas(dir.getOpposite(), maxExtract);
|
||||
if(drained == null || drained.amount <= 0) {
|
||||
return false;
|
||||
}
|
||||
setGasType(drained);
|
||||
tank.setGas(drained.copy());
|
||||
return true;
|
||||
}
|
||||
|
||||
GasStack couldDrain = gasType.copy();
|
||||
couldDrain.amount = maxExtract;
|
||||
|
||||
// GasStack drained = extTank.drain(dir.getOpposite(), couldDrain, true);
|
||||
// if(drained == null || drained.amount <= 0) {
|
||||
// return false;
|
||||
// }
|
||||
// tank.addAmount(drained.amount);
|
||||
|
||||
//Have to use this 'double handle' approach to work around an issue with TiC
|
||||
GasStack drained = extTank.drawGas(dir.getOpposite(), maxExtract);
|
||||
if(drained == null || drained.amount == 0) {
|
||||
return false;
|
||||
} else {
|
||||
if(drained.isGasEqual(getGasType())) {
|
||||
tank.addAmount(drained.amount);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public IGasHandler getTankContainer(BlockCoord bc) {
|
||||
World w = getWorld();
|
||||
if(w == null) {
|
||||
return null;
|
||||
}
|
||||
TileEntity te = w.getTileEntity(bc.x, bc.y, bc.z);
|
||||
if(te instanceof IGasHandler) {
|
||||
if(te instanceof IPipeTile) {
|
||||
if(((IPipeTile) te).getPipeType() != PipeType.FLUID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return (IGasHandler) te;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IGasHandler getTankContainer(GasConduit con, ForgeDirection dir) {
|
||||
BlockCoord bc = con.getLocation().getLocation(dir);
|
||||
return getTankContainer(bc);
|
||||
}
|
||||
|
||||
World getWorld() {
|
||||
if(conduits.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return conduits.get(0).getBundle().getWorld();
|
||||
}
|
||||
|
||||
public void removeInput(GasOutput lo) {
|
||||
outputs.remove(lo);
|
||||
outputIterator = null;
|
||||
}
|
||||
|
||||
public void addInput(GasOutput lo) {
|
||||
outputs.add(lo);
|
||||
outputIterator = null;
|
||||
}
|
||||
|
||||
public void updateConduitVolumes() {
|
||||
if(tank.getStored() == lastSyncedVolume) {
|
||||
return;
|
||||
}
|
||||
setConduitVolumes();
|
||||
lastSyncedVolume = tank.getStored();
|
||||
}
|
||||
|
||||
private class InnerTickHandler implements TickListener {
|
||||
|
||||
@Override
|
||||
public void tickStart(ServerTickEvent evt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tickEnd(ServerTickEvent evt) {
|
||||
doTick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import static crazypants.render.CubeRenderer.addVecWithUV;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.geom.CollidableComponent;
|
||||
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
|
||||
import crazypants.enderio.conduit.geom.Offset;
|
||||
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
|
||||
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vertex;
|
||||
|
||||
public class GasConduitRenderer extends DefaultConduitRenderer {
|
||||
|
||||
@Override
|
||||
public boolean isRendererForConduit(IConduit conduit) {
|
||||
return conduit instanceof GasConduit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x, double y, double z, float partialTick,
|
||||
float worldLight) {
|
||||
super.renderEntity(conduitBundleRenderer, te, conduit, x, y, z, partialTick, worldLight);
|
||||
|
||||
if(!conduit.hasConnectionMode(ConnectionMode.INPUT) && !conduit.hasConnectionMode(ConnectionMode.OUTPUT)) {
|
||||
return;
|
||||
}
|
||||
GasConduit pc = (GasConduit) conduit;
|
||||
for (ForgeDirection dir : conduit.getExternalConnections()) {
|
||||
IIcon tex = null;
|
||||
if(conduit.getConectionMode(dir) == ConnectionMode.INPUT) {
|
||||
tex = pc.getTextureForInputMode();
|
||||
} else if(conduit.getConectionMode(dir) == ConnectionMode.OUTPUT) {
|
||||
tex = pc.getTextureForOutputMode();
|
||||
}
|
||||
if(tex != null) {
|
||||
Offset offset = te.getOffset(IGasConduit.class, dir);
|
||||
ConnectionModeGeometry.renderModeConnector(dir, offset, tex, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
|
||||
super.renderConduit(tex, conduit, component, brightness);
|
||||
|
||||
if(isNSEWUD(component.dir)) {
|
||||
GasConduit lc = (GasConduit) conduit;
|
||||
|
||||
GasStack gas = lc.getGasType();
|
||||
IIcon texture = null;
|
||||
if(gas != null) {
|
||||
texture = gas.getGas().getIcon();
|
||||
}
|
||||
|
||||
if(texture == null) {
|
||||
texture = lc.getNotSetEdgeTexture();
|
||||
}
|
||||
|
||||
float scaleFactor = 0.75f;
|
||||
float xLen = Math.abs(component.dir.offsetX) == 1 ? 1 : scaleFactor;
|
||||
float yLen = Math.abs(component.dir.offsetY) == 1 ? 1 : scaleFactor;
|
||||
float zLen = Math.abs(component.dir.offsetZ) == 1 ? 1 : scaleFactor;
|
||||
|
||||
BoundingBox cube = component.bound;
|
||||
BoundingBox bb = cube.scale(xLen, yLen, zLen);
|
||||
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if(d != component.dir && d != component.dir.getOpposite()) {
|
||||
|
||||
ForgeDirection vDir = RenderUtil.getVDirForFace(d);
|
||||
if(component.dir == ForgeDirection.UP || component.dir == ForgeDirection.DOWN) {
|
||||
vDir = RenderUtil.getUDirForFace(d);
|
||||
} else if((component.dir == ForgeDirection.NORTH || component.dir == ForgeDirection.SOUTH) && d.offsetY != 0) {
|
||||
vDir = RenderUtil.getUDirForFace(d);
|
||||
}
|
||||
|
||||
float minU = texture.getMinU();
|
||||
float maxU = texture.getMaxU();
|
||||
float minV = texture.getMinV();
|
||||
float maxV = texture.getMaxV();
|
||||
|
||||
float sideScale = Math.max(bb.sizeX(), bb.sizeY()) * 2 / 16f;
|
||||
sideScale = Math.max(sideScale, bb.sizeZ() * 2 / 16f);
|
||||
float width = Math.min(bb.sizeX(), bb.sizeY()) * 15f / 16f;
|
||||
|
||||
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir, width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
|
||||
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
|
||||
moveEdgeCorners(corners, vDir.getOpposite(), width);
|
||||
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(conduit.getConectionMode(component.dir) == ConnectionMode.DISABLED) {
|
||||
tex = EnderIO.blockConduitBundle.getConnectorIcon();
|
||||
List<Vertex> corners = component.bound.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
for (Vertex c : corners) {
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
//back face
|
||||
for (int i = corners.size() - 1; i >= 0; i--) {
|
||||
Vertex c = corners.get(i);
|
||||
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderTransmission(IConduit conduit, IIcon tex, CollidableComponent component, float selfIllum) {
|
||||
super.renderTransmission(conduit, tex, component, selfIllum);
|
||||
}
|
||||
|
||||
private void moveEdgeCorners(List<Vertex> vertices, ForgeDirection edge, float scaleFactor) {
|
||||
int[] indices = getClosest(edge, vertices);
|
||||
vertices.get(indices[0]).xyz.x -= scaleFactor * edge.offsetX;
|
||||
vertices.get(indices[1]).xyz.x -= scaleFactor * edge.offsetX;
|
||||
vertices.get(indices[0]).xyz.y -= scaleFactor * edge.offsetY;
|
||||
vertices.get(indices[1]).xyz.y -= scaleFactor * edge.offsetY;
|
||||
vertices.get(indices[0]).xyz.z -= scaleFactor * edge.offsetZ;
|
||||
vertices.get(indices[1]).xyz.z -= scaleFactor * edge.offsetZ;
|
||||
}
|
||||
|
||||
private int[] getClosest(ForgeDirection edge, List<Vertex> vertices) {
|
||||
int[] res = new int[] { -1, -1 };
|
||||
boolean highest = edge.offsetX > 0 || edge.offsetY > 0 || edge.offsetZ > 0;
|
||||
double minMax = highest ? -Double.MAX_VALUE : Double.MAX_VALUE;
|
||||
int index = 0;
|
||||
for (Vertex v : vertices) {
|
||||
double val = get(v.xyz, edge);
|
||||
if(highest ? val >= minMax : val <= minMax) {
|
||||
if(val != minMax) {
|
||||
res[0] = index;
|
||||
} else {
|
||||
res[1] = index;
|
||||
}
|
||||
minMax = val;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private double get(Vector3d xyz, ForgeDirection edge) {
|
||||
if(edge == ForgeDirection.EAST || edge == ForgeDirection.WEST) {
|
||||
return xyz.x;
|
||||
}
|
||||
if(edge == ForgeDirection.UP || edge == ForgeDirection.DOWN) {
|
||||
return xyz.y;
|
||||
}
|
||||
return xyz.z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class GasOutput {
|
||||
|
||||
final ForgeDirection dir;
|
||||
final BlockCoord location;
|
||||
|
||||
public GasOutput(BlockCoord bc, ForgeDirection dir) {
|
||||
this.dir = dir;
|
||||
this.location = bc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((location == null) ? 0 : location.hashCode());
|
||||
result = prime * result + ((dir == null) ? 0 : dir.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(obj == null)
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
return false;
|
||||
GasOutput other = (GasOutput) obj;
|
||||
if(location == null) {
|
||||
if(other.location != null)
|
||||
return false;
|
||||
} else if(!location.equals(other.location))
|
||||
return false;
|
||||
if(dir != other.dir)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GasOutput [dir=" + dir + ", location=" + location + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class GasUtil {
|
||||
|
||||
public static IGasHandler getExternalGasHandler(IBlockAccess world, BlockCoord bc) {
|
||||
IGasHandler con = getGasHandler(world, bc);
|
||||
return (con != null && !(con instanceof IConduitBundle)) ? con : null;
|
||||
}
|
||||
|
||||
public static IGasHandler getGasHandler(IBlockAccess world, BlockCoord bc) {
|
||||
return getGasHandler(world, bc.x, bc.y, bc.z);
|
||||
}
|
||||
|
||||
public static IGasHandler getGasHandler(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return getGasHandler(te);
|
||||
}
|
||||
|
||||
public static IGasHandler getGasHandler(TileEntity te) {
|
||||
if(te instanceof IGasHandler) {
|
||||
if(te instanceof IPipeTile) {
|
||||
if(((IPipeTile) te).getPipeType() != PipeType.FLUID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return (IGasHandler) te;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isGasValid(GasStack gas) {
|
||||
if(gas != null) {
|
||||
String name = gas.getGas().getLocalizedName();
|
||||
if(name != null && !name.trim().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IExtractor;
|
||||
|
||||
public interface IGasConduit extends IConduit, IGasHandler, IExtractor {
|
||||
|
||||
boolean canOutputToDir(ForgeDirection dir);
|
||||
|
||||
boolean isExtractingFromDir(ForgeDirection dir);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.conduit.AbstractItemConduit;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.ItemConduitSubtype;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IAdvancedTooltipProvider;
|
||||
import crazypants.enderio.gui.TooltipAddera;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
|
||||
|
||||
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
|
||||
new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"),
|
||||
};
|
||||
|
||||
public static ItemGasConduit create() {
|
||||
ItemGasConduit result = new ItemGasConduit();
|
||||
result.init(subtypes);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected ItemGasConduit() {
|
||||
super(ModObject.itemGasConduit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IConduit> getBaseConduitType() {
|
||||
return IGasConduit.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConduit createConduit(ItemStack stack) {
|
||||
return new GasConduit();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
|
||||
String gpt = " " + Lang.localize("gas.gasTick");
|
||||
int extractRate = Config.gasConduitExtractRate;
|
||||
int maxIo = Config.gasConduitMaxIoRate;
|
||||
list.add(Lang.localize("itemGasConduit.tooltip.maxExtract") + " " + extractRate + gpt);
|
||||
list.add(Lang.localize("itemGasConduit.tooltip.maxIo") + " " + maxIo + gpt);
|
||||
TooltipAddera.addDetailedTooltipFromResources(list, "enderio.itemGasConduit");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package crazypants.enderio.conduit.gas;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.network.MessageTileEntity;
|
||||
import crazypants.util.ClientUtil;
|
||||
|
||||
public class PacketGasLevel extends MessageTileEntity<TileEntity> implements IMessageHandler<PacketGasLevel, IMessage> {
|
||||
|
||||
public NBTTagCompound tc;
|
||||
|
||||
public PacketGasLevel() {
|
||||
}
|
||||
|
||||
public PacketGasLevel(IGasConduit conduit) {
|
||||
super(conduit.getBundle().getEntity());
|
||||
tc = new NBTTagCompound();
|
||||
conduit.writeToNBT(tc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
ByteBufUtils.writeTag(buf, tc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
tc = ByteBufUtils.readTag(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketGasLevel message, MessageContext ctx) {
|
||||
ClientUtil.doGasLevelUpdate(message.x, message.y, message.z, message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
@@ -35,6 +36,11 @@ public class Offsets {
|
||||
OFFSETS.put(key(IItemConduit.class, Axis.Y), Offset.EAST);
|
||||
OFFSETS.put(key(IItemConduit.class, Axis.Z), Offset.EAST);
|
||||
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.NONE), Offset.NONE);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.X), Offset.NONE);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.Y), Offset.NONE);
|
||||
OFFSETS.put(key(IGasConduit.class, Axis.Z), Offset.NONE);
|
||||
|
||||
}
|
||||
|
||||
public static Offset get(Class<? extends IConduit> type, ForgeDirection dir) {
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.IIcon;
|
||||
import crazypants.enderio.conduit.ConnectionMode;
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.packet.PacketExtractMode;
|
||||
import crazypants.enderio.gui.ColorButton;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.machine.IRedstoneModeControlable;
|
||||
import crazypants.enderio.machine.RedstoneControlMode;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.DyeColor;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GasSettings extends BaseSettingsPanel {
|
||||
|
||||
static final int ID_REDSTONE_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
|
||||
|
||||
private RedstoneModeButton rsB;
|
||||
|
||||
private ColorButton colorB;
|
||||
|
||||
private String autoExtractStr = Lang.localize("gui.conduit.gas.autoExtract");
|
||||
|
||||
private IGasConduit conduit;
|
||||
|
||||
protected GasSettings(final GuiExternalConnection gui, IConduit con) {
|
||||
super(IconEIO.WRENCH_OVERLAY_GAS, Lang.localize("itemGasConduit.name"), gui, con);
|
||||
|
||||
conduit = (IGasConduit) con;
|
||||
gui.getContainer().setInventorySlotsVisible(false);
|
||||
|
||||
int x = gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap * 2;
|
||||
int y = customTop;
|
||||
|
||||
rsB = new RedstoneModeButton(gui, ID_REDSTONE_BUTTON, x, y, new IRedstoneModeControlable() {
|
||||
|
||||
@Override
|
||||
public void setRedstoneControlMode(RedstoneControlMode mode) {
|
||||
RedstoneControlMode curMode = getRedstoneControlMode();
|
||||
conduit.setExtractionRedstoneMode(mode, gui.getDir());
|
||||
if(curMode != mode) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneControlMode getRedstoneControlMode() {
|
||||
return conduit.getExtractionRedstoneMode(gui.getDir());
|
||||
}
|
||||
});
|
||||
|
||||
x += rsB.getWidth() + gap;
|
||||
colorB = new ColorButton(gui, ID_COLOR_BUTTON, x, y);
|
||||
colorB.setToolTipHeading(Lang.localize("gui.conduit.redstone.signalColor"));
|
||||
colorB.setColorIndex(conduit.getExtractionSignalColor(gui.getDir()).ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
super.actionPerformed(guiButton);
|
||||
if(guiButton.id == ID_COLOR_BUTTON) {
|
||||
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void connectionModeChanged(ConnectionMode conectionMode) {
|
||||
super.connectionModeChanged(conectionMode);
|
||||
if(conectionMode == ConnectionMode.INPUT) {
|
||||
rsB.onGuiInit();
|
||||
colorB.onGuiInit();
|
||||
} else {
|
||||
rsB.detach();
|
||||
colorB.detach();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int x, int y, int par3) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
rsB.setToolTip((String[]) null);
|
||||
colorB.setToolTip((String[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
|
||||
boolean isInput = isInput();
|
||||
if(isInput) {
|
||||
int x = gui.getGuiLeft() + gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap + 2;
|
||||
int y = customTop;
|
||||
gui.getFontRenderer().drawString(autoExtractStr, left, top, ColorUtil.getRGB(Color.DARK_GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGas(Gas f, int x, int y) {
|
||||
IIcon icon = f.getIcon();
|
||||
if(icon != null) {
|
||||
RenderUtil.bindBlockTexture();
|
||||
gui.drawTexturedModelRectFromIcon(x + 1, y + 1, icon, 16, 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isInput() {
|
||||
return conduit.getConectionMode(gui.getDir()) == ConnectionMode.INPUT;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
@@ -27,19 +28,20 @@ import crazypants.render.RenderUtil;
|
||||
public class GuiExternalConnection extends GuiContainerBase {
|
||||
|
||||
private static final int TAB_HEIGHT = 24;
|
||||
|
||||
|
||||
private static int nextButtonId = 1;
|
||||
|
||||
|
||||
public static int nextButtonId() {
|
||||
return nextButtonId++;
|
||||
}
|
||||
|
||||
|
||||
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<Class<? extends IConduit>, Integer>();
|
||||
static {
|
||||
TAB_ORDER.put(IItemConduit.class, 0);
|
||||
TAB_ORDER.put(ILiquidConduit.class, 1);
|
||||
TAB_ORDER.put(IRedstoneConduit.class, 2);
|
||||
TAB_ORDER.put(IPowerConduit.class, 3);
|
||||
TAB_ORDER.put(IGasConduit.class, 4);
|
||||
}
|
||||
|
||||
final InventoryPlayer playerInv;
|
||||
@@ -60,14 +62,14 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
this.playerInv = playerInv;
|
||||
this.bundle = bundle;
|
||||
this.dir = dir;
|
||||
|
||||
|
||||
ySize = 166 + 29;
|
||||
xSize = 206;
|
||||
|
||||
|
||||
getContainer().setInputSlotsVisible(false);
|
||||
getContainer().setOutputSlotsVisible(false);
|
||||
getContainer().setInventorySlotsVisible(false);
|
||||
|
||||
|
||||
List<IConduit> cons = new ArrayList<IConduit>(bundle.getConduits());
|
||||
Collections.sort(cons, new Comparator<IConduit>() {
|
||||
|
||||
@@ -83,10 +85,10 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
}
|
||||
//NB: using Double.comp instead of Integer.comp as the int version is only from Java 1.7+
|
||||
return Double.compare(int1, int2);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (IConduit con : cons) {
|
||||
if(con.containsExternalConnection(dir) || con.canConnectToExternal(dir, true)) {
|
||||
ISettingsPanel tab = TabFactory.instance.createPanelForConduit(this, con);
|
||||
@@ -96,7 +98,7 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,7 +140,7 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
return;
|
||||
}
|
||||
}
|
||||
tabs.get(activeTab).mouseClicked(x,y,par3);
|
||||
tabs.get(activeTab).mouseClicked(x, y, par3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.conduit.gui;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.gui.item.ItemSettings;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
@@ -24,6 +25,8 @@ public class TabFactory {
|
||||
return new ItemSettings(gui, con);
|
||||
} else if(baseType.isAssignableFrom(IRedstoneConduit.class)) {
|
||||
return new RedstoneSettings(gui, con);
|
||||
} else if(baseType.isAssignableFrom(IGasConduit.class)) {
|
||||
return new GasSettings(gui, con);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package crazypants.enderio.conduit.packet;
|
||||
|
||||
import crazypants.enderio.conduit.IConduit;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.item.IItemConduit;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.power.IPowerConduit;
|
||||
@@ -11,7 +12,8 @@ public enum ConTypeEnum {
|
||||
POWER(IPowerConduit.class),
|
||||
FLUID(ILiquidConduit.class),
|
||||
ITEM(IItemConduit.class),
|
||||
REDSTONE(IRedstoneConduit.class);
|
||||
REDSTONE(IRedstoneConduit.class),
|
||||
GAS(IGasConduit.class);
|
||||
|
||||
final Class<? extends IConduit> baseType;
|
||||
|
||||
|
||||
@@ -14,21 +14,21 @@ import crazypants.enderio.Log;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
|
||||
public final class Config {
|
||||
|
||||
|
||||
public static class Section {
|
||||
public final String name;
|
||||
public final String lang;
|
||||
|
||||
|
||||
public Section(String name, String lang) {
|
||||
this.name = name;
|
||||
this.lang = lang;
|
||||
register();
|
||||
}
|
||||
|
||||
|
||||
private void register() {
|
||||
sections.add(this);
|
||||
}
|
||||
|
||||
|
||||
public String lc() {
|
||||
return name.toLowerCase();
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public final class Config {
|
||||
}
|
||||
|
||||
public static Configuration config;
|
||||
|
||||
|
||||
public static final Section sectionPower = new Section("Power Settings", "power");
|
||||
public static final Section sectionRecipe = new Section("Recipe Settings", "recipe");
|
||||
public static final Section sectionItems = new Section("Item Enabling", "item");
|
||||
@@ -57,11 +57,11 @@ public final class Config {
|
||||
public static final Section sectionFluid = new Section("Fluid Settings", "fluid");
|
||||
public static final Section sectionSpawner = new Section("PoweredSpawner Settings", "spawner");
|
||||
public static final Section sectionKiller = new Section("Killer Joe Settings", "killerjoe");
|
||||
|
||||
|
||||
public static final double DEFAULT_CONDUIT_SCALE = 0.5;
|
||||
|
||||
public static boolean reinforcedObsidianEnabled = true;
|
||||
|
||||
public static boolean reinforcedObsidianEnabled = true;
|
||||
|
||||
public static boolean useAlternateBinderRecipe;
|
||||
|
||||
public static boolean useAlternateTesseractModel;
|
||||
@@ -102,6 +102,9 @@ public final class Config {
|
||||
public static int fluidConduitExtractRate = 50;
|
||||
public static int fluidConduitMaxIoRate = 200;
|
||||
|
||||
public static int gasConduitExtractRate = 100;
|
||||
public static int gasConduitMaxIoRate = 400;
|
||||
|
||||
public static boolean updateLightingWhenHidingFacades = false;
|
||||
|
||||
public static boolean travelAnchorEnabled = true;
|
||||
@@ -161,7 +164,7 @@ public final class Config {
|
||||
public static int darkSteelAxePowerUsePerDamagePointMultiHarvest = 1500;
|
||||
public static float darkSteelAxeEffeciencyBoostWhenPowered = 2;
|
||||
public static float darkSteelAxeSpeedPenaltyMultiHarvest = 8;
|
||||
|
||||
|
||||
public static int darkSteelUpgradeVibrantCost = 20;
|
||||
public static int darkSteelUpgradePowerOneCost = 10;
|
||||
public static int darkSteelUpgradePowerTwoCost = 20;
|
||||
@@ -171,11 +174,11 @@ public final class Config {
|
||||
public static double darkSteelGliderHorizontalSpeed = 0.03;
|
||||
public static double darkSteelGliderVerticalSpeed = -0.05;
|
||||
public static double darkSteelGliderVerticalSpeedSprinting = -0.15;
|
||||
|
||||
|
||||
public static int darkSteelSwimCost = 15;
|
||||
|
||||
|
||||
public static int darkSteelNightVisionCost = 15;
|
||||
|
||||
|
||||
public static int darkSteelSoundLocatorCost = 10;
|
||||
public static int darkSteelSoundLocatorRange = 40;
|
||||
public static int darkSteelSoundLocatorLifespan = 40;
|
||||
@@ -228,7 +231,7 @@ public final class Config {
|
||||
public static int powerSpawnerAddSpawnerCost = 30;
|
||||
|
||||
public static double vacuumChestRange = 6;
|
||||
|
||||
|
||||
public static boolean useModMetals = true;
|
||||
|
||||
public static int wirelessChargerRange = 24;
|
||||
@@ -236,18 +239,18 @@ public final class Config {
|
||||
public static long nutrientFoodBoostDelay = 400;
|
||||
|
||||
public static int enchanterBaseLevelCost = 4;
|
||||
|
||||
|
||||
public static boolean machineSoundsEnabled = true;
|
||||
|
||||
public static float machineSoundVolume = 1.0f;
|
||||
public static float machineSoundVolume = 1.0f;
|
||||
|
||||
public static int killerJoeNutrientUsePerAttackMb = 5;
|
||||
public static int killerJoeNutrientUsePerAttackMb = 5;
|
||||
public static double killerJoeAttackHeight = 2;
|
||||
public static double killerJoeAttackWidth = 2;
|
||||
public static double killerJoeAttackLength = 4;
|
||||
|
||||
public static void load(FMLPreInitializationEvent event) {
|
||||
|
||||
|
||||
FMLCommonHandler.instance().bus().register(new Config());
|
||||
configDirectory = new File(event.getModConfigurationDirectory(), EnderIO.MODID.toLowerCase());
|
||||
if(!configDirectory.exists()) {
|
||||
@@ -258,11 +261,11 @@ public final class Config {
|
||||
config = new Configuration(configFile);
|
||||
syncConfig();
|
||||
}
|
||||
|
||||
|
||||
public static void syncConfig() {
|
||||
try {
|
||||
Config.processConfig(config);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.error("EnderIO has a problem loading it's configuration");
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -271,17 +274,18 @@ public final class Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(OnConfigChangedEvent event) {
|
||||
if (event.modID.equals(EnderIO.MODID)) {
|
||||
if(event.modID.equals(EnderIO.MODID)) {
|
||||
Log.info("Updating config...");
|
||||
syncConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static void processConfig(Configuration config) {
|
||||
useRfAsDefault = config.get(sectionPower.name, "displayPowerAsRedstoneFlux", useRfAsDefault, "If true, all power is displayed in RF, otherwise MJ is used.")
|
||||
useRfAsDefault = config
|
||||
.get(sectionPower.name, "displayPowerAsRedstoneFlux", useRfAsDefault, "If true, all power is displayed in RF, otherwise MJ is used.")
|
||||
.getBoolean(useRfAsDefault);
|
||||
|
||||
capacitorBankMaxIoMJ = config.get(sectionPower.name, "capacitorBankMaxIoMJ", capacitorBankMaxIoMJ, "The maximum IO for a single capacitor in MJ/t")
|
||||
@@ -298,8 +302,8 @@ public final class Config {
|
||||
|
||||
numConduitsPerRecipe = config.get(sectionRecipe.name, "numConduitsPerRecipe", numConduitsPerRecipe,
|
||||
"The number of conduits crafted per recipe.").getInt(numConduitsPerRecipe);
|
||||
|
||||
enchanterBaseLevelCost= config.get(sectionRecipe.name, "enchanterBaseLevelCost", enchanterBaseLevelCost,
|
||||
|
||||
enchanterBaseLevelCost = config.get(sectionRecipe.name, "enchanterBaseLevelCost", enchanterBaseLevelCost,
|
||||
"Base level cost added to all recipes in the enchanter.").getInt(enchanterBaseLevelCost);
|
||||
|
||||
photovoltaicCellEnabled = config.get(sectionItems.name, "photovoltaicCellEnabled", photovoltaicCellEnabled,
|
||||
@@ -321,7 +325,7 @@ public final class Config {
|
||||
|
||||
wirelessChargerRange = config.get(sectionEfficiency.name, "wirelessChargerRange", wirelessChargerRange,
|
||||
"The range of the wireless charger").getInt(wirelessChargerRange);
|
||||
|
||||
|
||||
fluidConduitExtractRate = config.get(sectionEfficiency.name, "fluidConduitExtractRate", fluidConduitExtractRate,
|
||||
"Number of millibuckects per tick extracted by a fluid conduits auto extracting").getInt(fluidConduitExtractRate);
|
||||
|
||||
@@ -340,6 +344,12 @@ public final class Config {
|
||||
enderFluidConduitMaxIoRate = config.get(sectionEfficiency.name, "enderFluidConduitMaxIoRate", enderFluidConduitMaxIoRate,
|
||||
"Number of millibuckects per tick that can pass through a single connection to an ender fluid conduit.").getInt(enderFluidConduitMaxIoRate);
|
||||
|
||||
gasConduitExtractRate = config.get(sectionEfficiency.name, "gasConduitExtractRate", gasConduitExtractRate,
|
||||
"Amount of gas per tick extracted by gas conduits auto extracting").getInt(gasConduitExtractRate);
|
||||
|
||||
gasConduitMaxIoRate = config.get(sectionEfficiency.name, "gasConduitMaxIoRate", gasConduitMaxIoRate,
|
||||
"Amount of gas per tick that can pass through a single connection to a gas conduit.").getInt(gasConduitMaxIoRate);
|
||||
|
||||
useAlternateTesseractModel = config.get(sectionAesthetic.name, "useAlternateTransceiverModel", useAlternateTesseractModel,
|
||||
"Use TheKazador's alternative model for the Dimensional Transceiver")
|
||||
.getBoolean(false);
|
||||
@@ -370,12 +380,13 @@ public final class Config {
|
||||
useSneakRightClickYetaWrench = config.get(sectionPersonal.name, "useSneakRightClickYetaWrench", useSneakRightClickYetaWrench,
|
||||
"If true, shift-clicking the YetaWrench on a null or non wrenchable object will change the conduit display mode.")
|
||||
.getBoolean(useSneakRightClickYetaWrench);
|
||||
|
||||
|
||||
machineSoundsEnabled = config.get(sectionPersonal.name, "useMachineSounds", machineSoundsEnabled,
|
||||
"If true, machines will make sounds.")
|
||||
.getBoolean(machineSoundsEnabled);
|
||||
|
||||
machineSoundVolume= (float)config.get(sectionPersonal.name, "machineSoundVolume", machineSoundVolume,"Volume of machine sounds.").getDouble(machineSoundVolume);
|
||||
|
||||
machineSoundVolume = (float) config.get(sectionPersonal.name, "machineSoundVolume", machineSoundVolume, "Volume of machine sounds.").getDouble(
|
||||
machineSoundVolume);
|
||||
|
||||
itemConduitUsePhyscialDistance = config.get(sectionEfficiency.name, "itemConduitUsePhyscialDistance", itemConduitUsePhyscialDistance, "If true, " +
|
||||
"'line of sight' distance rather than conduit path distance is used to calculate priorities.")
|
||||
@@ -390,7 +401,7 @@ public final class Config {
|
||||
|
||||
reinforcedObsidianEnabled = config.get(sectionItems.name, "reinforcedObsidianEnabled", reinforcedObsidianEnabled,
|
||||
"When set to false reinforced obsidian is not craftable.").getBoolean(reinforcedObsidianEnabled);
|
||||
|
||||
|
||||
travelAnchorEnabled = config.get(sectionItems.name, "travelAnchorEnabled", travelAnchorEnabled,
|
||||
"When set to false: the travel anchor will not be craftable.").getBoolean(travelAnchorEnabled);
|
||||
|
||||
@@ -482,54 +493,52 @@ public final class Config {
|
||||
"Base amount of power used per jump (RF) dark steel boots. The second jump in a 'double jump' uses 2x this etc").getInt(darkSteelBootsJumpPowerCost);
|
||||
|
||||
darkSteelFallDistanceCost = config.get(sectionDarkSteel.name, "darkSteelFallDistanceCost", darkSteelFallDistanceCost,
|
||||
"Amount of power used (RF) per block height of fall distance damage negated.").getInt(darkSteelFallDistanceCost);
|
||||
"Amount of power used (RF) per block height of fall distance damage negated.").getInt(darkSteelFallDistanceCost);
|
||||
|
||||
darkSteelSwimCost = config.get(sectionDarkSteel.name, "darkSteelSwimCost", darkSteelSwimCost,
|
||||
"Number of levels required for the 'Swim' upgrade.").getInt(darkSteelSwimCost);
|
||||
|
||||
|
||||
darkSteelNightVisionCost = config.get(sectionDarkSteel.name, "darkSteelNightVisionCost", darkSteelNightVisionCost,
|
||||
"Number of levels required for the 'Night Vision' upgrade.").getInt(darkSteelNightVisionCost);
|
||||
|
||||
darkSteelGliderCost = config.get(sectionDarkSteel.name, "darkSteelGliderCost", darkSteelGliderCost,
|
||||
|
||||
darkSteelGliderCost = config.get(sectionDarkSteel.name, "darkSteelGliderCost", darkSteelGliderCost,
|
||||
"Number of levels required for the 'Glider' upgrade.").getInt(darkSteelGliderCost);
|
||||
darkSteelGliderHorizontalSpeed = config.get(sectionDarkSteel.name, "darkSteelGliderHorizontalSpeed", darkSteelGliderHorizontalSpeed,
|
||||
"Horizontal movement speed modifier when gliding.").getDouble(darkSteelGliderHorizontalSpeed);
|
||||
darkSteelGliderVerticalSpeed = config.get(sectionDarkSteel.name, "darkSteelGliderVerticalSpeed", darkSteelGliderVerticalSpeed,
|
||||
"Rate of altitude loss when gliding.").getDouble(darkSteelGliderVerticalSpeed);
|
||||
darkSteelGliderVerticalSpeedSprinting = config.get(sectionDarkSteel.name, "darkSteelGliderVerticalSpeedSprinting", darkSteelGliderVerticalSpeedSprinting,
|
||||
"Rate of altitude loss when sprinting and gliding.").getDouble(darkSteelGliderVerticalSpeedSprinting);
|
||||
|
||||
"Rate of altitude loss when sprinting and gliding.").getDouble(darkSteelGliderVerticalSpeedSprinting);
|
||||
|
||||
darkSteelSoundLocatorCost = config.get(sectionDarkSteel.name, "darkSteelSoundLocatorCost", darkSteelSoundLocatorCost,
|
||||
"Number of levels required for the 'Sound Locator' upgrade.").getInt(darkSteelSoundLocatorCost);
|
||||
darkSteelSoundLocatorRange = config.get(sectionDarkSteel.name, "darkSteelSoundLocatorRange", darkSteelSoundLocatorRange,
|
||||
"Range of the 'Sound Locator' upgrade.").getInt(darkSteelSoundLocatorRange);
|
||||
darkSteelSoundLocatorLifespan = config.get(sectionDarkSteel.name, "darkSteelSoundLocatorLifespan", darkSteelSoundLocatorLifespan,
|
||||
"Number of ticks the 'Sound Locator' icons are displayed for.").getInt(darkSteelSoundLocatorLifespan);
|
||||
|
||||
|
||||
|
||||
darkSteelSwordSkullChance = (float) config.get(sectionDarkSteel.name, "darkSteelSwordSkullChance", darkSteelSwordSkullChance,
|
||||
"The base chance that a skull will be dropped when using a powered dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
darkSteelSwordSkullChance);
|
||||
darkSteelSwordSkullChance);
|
||||
darkSteelSwordSkullLootingModifier = (float) config.get(sectionDarkSteel.name, "darkSteelSwordSkullLootingModifier", darkSteelSwordSkullLootingModifier,
|
||||
"The chance per looting level that a skull will be dropped when using a powered dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
darkSteelSwordSkullLootingModifier);
|
||||
|
||||
|
||||
darkSteelSwordWitherSkullChance = (float) config.get(sectionDarkSteel.name, "darkSteelSwordWitherSkullChance", darkSteelSwordWitherSkullChance,
|
||||
"The base chance that a wither skull will be dropped when using a powered dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
darkSteelSwordWitherSkullChance);
|
||||
darkSteelSwordWitherSkullChance);
|
||||
darkSteelSwordWitherSkullLootingModifier = (float) config.get(sectionDarkSteel.name, "darkSteelSwordWitherSkullLootingModifie",
|
||||
darkSteelSwordWitherSkullLootingModifier,
|
||||
"The chance per looting level that a wither skull will be dropped when using a powered dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
darkSteelSwordWitherSkullLootingModifier);
|
||||
|
||||
|
||||
vanillaSwordSkullChance = (float) config.get(sectionDarkSteel.name, "vanillaSwordSkullChance", vanillaSwordSkullChance,
|
||||
darkSteelSwordWitherSkullLootingModifier);
|
||||
|
||||
vanillaSwordSkullChance = (float) config.get(sectionDarkSteel.name, "vanillaSwordSkullChance", vanillaSwordSkullChance,
|
||||
"The base chance that a skull will be dropped when using a non dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
vanillaSwordSkullChance);
|
||||
vanillaSwordSkullChance);
|
||||
vanillaSwordSkullLootingModifier = (float) config.get(sectionPersonal.name, "vanillaSwordSkullLootingModifier", vanillaSwordSkullLootingModifier,
|
||||
"The chance per looting level that a skull will be dropped when using a non-dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
vanillaSwordSkullLootingModifier);
|
||||
|
||||
|
||||
darkSteelSwordPowerUsePerHit = config.get(sectionDarkSteel.name, "darkSteelSwordPowerUsePerHit", darkSteelSwordPowerUsePerHit,
|
||||
"The amount of power (RF) used per hit.").getInt(darkSteelSwordPowerUsePerHit);
|
||||
darkSteelSwordEnderPearlDropChance = config.get(sectionDarkSteel.name, "darkSteelSwordEnderPearlDropChance", darkSteelSwordEnderPearlDropChance,
|
||||
@@ -555,7 +564,8 @@ public final class Config {
|
||||
darkSteelAxePowerUsePerDamagePointMultiHarvest = config.get(sectionDarkSteel.name, "darkSteelPickAxeUsePerDamagePointMultiHarvest",
|
||||
darkSteelAxePowerUsePerDamagePointMultiHarvest,
|
||||
"Power use (RF) per damage/durability point avoided when shift-harvesting multiple logs").getInt(darkSteelAxePowerUsePerDamagePointMultiHarvest);
|
||||
darkSteelAxeSpeedPenaltyMultiHarvest = (float) config.get(sectionDarkSteel.name, "darkSteelAxeSpeedPenaltyMultiHarvest", darkSteelAxeSpeedPenaltyMultiHarvest,
|
||||
darkSteelAxeSpeedPenaltyMultiHarvest = (float) config.get(sectionDarkSteel.name, "darkSteelAxeSpeedPenaltyMultiHarvest",
|
||||
darkSteelAxeSpeedPenaltyMultiHarvest,
|
||||
"How much slower shift-harvesting logs is.").getDouble(darkSteelAxeSpeedPenaltyMultiHarvest);
|
||||
darkSteelAxeEffeciencyBoostWhenPowered = (float) config.get(sectionDarkSteel.name, "darkSteelAxeEffeciencyBoostWhenPowered",
|
||||
darkSteelAxeEffeciencyBoostWhenPowered, "The increase in effciency when powered.").getDouble(darkSteelAxeEffeciencyBoostWhenPowered);
|
||||
@@ -595,10 +605,10 @@ public final class Config {
|
||||
"The amount of power used by a farm per action (eg plant, till, harvest) ").getDouble(farmActionEnergyUse);
|
||||
farmDefaultSize = config.get(sectionFarm.name, "farmDefaultSize", farmDefaultSize,
|
||||
"The number of blocks a farm will extend from its center").getInt(farmDefaultSize);
|
||||
farmAxeDamageOnLeafBreak = config.get(sectionFarm.name, "farmAxeDamageOnLeafBreak", farmAxeDamageOnLeafBreak,
|
||||
"Should axes in a farm take damage when breaking leaves?").getBoolean(farmAxeDamageOnLeafBreak);
|
||||
farmToolTakeDamageChance = (float) config.get(sectionFarm.name, "farmToolTakeDamageChance", farmToolTakeDamageChance,
|
||||
"The chance that a tool in the farm will take damage.").getDouble(farmToolTakeDamageChance);
|
||||
farmAxeDamageOnLeafBreak = config.get(sectionFarm.name, "farmAxeDamageOnLeafBreak", farmAxeDamageOnLeafBreak,
|
||||
"Should axes in a farm take damage when breaking leaves?").getBoolean(farmAxeDamageOnLeafBreak);
|
||||
farmToolTakeDamageChance = (float) config.get(sectionFarm.name, "farmToolTakeDamageChance", farmToolTakeDamageChance,
|
||||
"The chance that a tool in the farm will take damage.").getDouble(farmToolTakeDamageChance);
|
||||
|
||||
combustionGeneratorUseOpaqueModel = config.get(sectionAesthetic.name, "combustionGeneratorUseOpaqueModel", combustionGeneratorUseOpaqueModel,
|
||||
"If set to true: fluid will not be shown in combustion generator tanks. Improves FPS. ").getBoolean(combustionGeneratorUseOpaqueModel);
|
||||
@@ -617,32 +627,34 @@ public final class Config {
|
||||
"MJ used per autocrafted recipe").getInt(crafterMjPerCraft);
|
||||
|
||||
poweredSpawnerMinDelayTicks = config.get(sectionSpawner.name, "poweredSpawnerMinDelayTicks", poweredSpawnerMinDelayTicks,
|
||||
"Min tick delay between spawns for a non-upgraded spawner").getInt(poweredSpawnerMinDelayTicks);
|
||||
"Min tick delay between spawns for a non-upgraded spawner").getInt(poweredSpawnerMinDelayTicks);
|
||||
poweredSpawnerMaxDelayTicks = config.get(sectionSpawner.name, "poweredSpawnerMaxDelayTicks", poweredSpawnerMaxDelayTicks,
|
||||
"Min tick delay between spawns for a non-upgraded spawner").getInt(poweredSpawnerMaxDelayTicks);
|
||||
poweredSpawnerLevelOnePowerPerTick = (float)config.get(sectionSpawner.name, "poweredSpawnerLevelOnePowerPerTick", poweredSpawnerLevelOnePowerPerTick,
|
||||
"Min tick delay between spawns for a non-upgraded spawner").getInt(poweredSpawnerMaxDelayTicks);
|
||||
poweredSpawnerLevelOnePowerPerTick = (float) config.get(sectionSpawner.name, "poweredSpawnerLevelOnePowerPerTick", poweredSpawnerLevelOnePowerPerTick,
|
||||
"MJ per tick for a level 1 (non-upgraded) spawner").getDouble(poweredSpawnerLevelOnePowerPerTick);
|
||||
poweredSpawnerLevelTwoPowerPerTick = (float)config.get(sectionSpawner.name, "poweredSpawnerLevelTwoPowerPerTick", poweredSpawnerLevelTwoPowerPerTick,
|
||||
poweredSpawnerLevelTwoPowerPerTick = (float) config.get(sectionSpawner.name, "poweredSpawnerLevelTwoPowerPerTick", poweredSpawnerLevelTwoPowerPerTick,
|
||||
"MJ per tick for a level 2 spawner").getDouble(poweredSpawnerLevelTwoPowerPerTick);
|
||||
poweredSpawnerLevelThreePowerPerTick = (float)config.get(sectionSpawner.name, "poweredSpawnerLevelThreePowerPerTick", poweredSpawnerLevelThreePowerPerTick,
|
||||
poweredSpawnerLevelThreePowerPerTick = (float) config.get(sectionSpawner.name, "poweredSpawnerLevelThreePowerPerTick",
|
||||
poweredSpawnerLevelThreePowerPerTick,
|
||||
"MJ per tick for a level 3 spawner").getDouble(poweredSpawnerLevelThreePowerPerTick);
|
||||
poweredSpawnerMaxPlayerDistance = config.get(sectionSpawner.name, "poweredSpawnerMaxPlayerDistance", poweredSpawnerMaxPlayerDistance,
|
||||
"Max distance of the closest player for the spawner to be active. A zero value will remove the player check").getInt(poweredSpawnerMaxPlayerDistance);
|
||||
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,
|
||||
brokenSpawnerDropChance = (float) config.get(sectionSpawner.name, "brokenSpawnerDropChance", brokenSpawnerDropChance,
|
||||
"The chance a brokne spawner will be dropped when a spawner is broken. 1 = 100% chance, 0 = 0% chance").getDouble(brokenSpawnerDropChance);
|
||||
powerSpawnerAddSpawnerCost = config.get(sectionSpawner.name, "powerSpawnerAddSpawnerCost", powerSpawnerAddSpawnerCost,
|
||||
"The number of levels it costs to add a broken spawner").getInt(powerSpawnerAddSpawnerCost);
|
||||
|
||||
|
||||
useModMetals = config.get(sectionRecipe.name, "useModMetals", useModMetals,
|
||||
"If true copper and tin will be used in recipes when registered in the ore dictionary").getBoolean(useModMetals);
|
||||
|
||||
nutrientFoodBoostDelay = config.get(sectionFluid.name, "nutrientFluidFoodBoostDelay", nutrientFoodBoostDelay, "The delay in ticks between when nutrient distillation boosts your food value.").getInt((int)nutrientFoodBoostDelay);
|
||||
|
||||
|
||||
nutrientFoodBoostDelay = config.get(sectionFluid.name, "nutrientFluidFoodBoostDelay", nutrientFoodBoostDelay,
|
||||
"The delay in ticks between when nutrient distillation boosts your food value.").getInt((int) nutrientFoodBoostDelay);
|
||||
|
||||
killerJoeNutrientUsePerAttackMb = config.get(sectionKiller.name, "killerJoeNutrientUsePerAttackMb", killerJoeNutrientUsePerAttackMb,
|
||||
"The number of millibuckets of nutrient fluid used per attack.").getInt(killerJoeNutrientUsePerAttackMb);
|
||||
|
||||
|
||||
killerJoeAttackHeight = config.get(sectionKiller.name, "killerJoeAttackHeight", killerJoeAttackHeight,
|
||||
"The reach of attacks above and bellow Joe.").getDouble(killerJoeAttackHeight);
|
||||
killerJoeAttackWidth = config.get(sectionKiller.name, "killerJoeAttackWidth", killerJoeAttackWidth,
|
||||
|
||||
@@ -20,19 +20,23 @@ public final class IconEIO {
|
||||
public static final IconEIO BUTTON_DOWN = new IconEIO(48, 116);
|
||||
public static final IconEIO BUTTON_DOWN_HIGHLIGHT = new IconEIO(64, 116);
|
||||
|
||||
public static final IconEIO WRENCH_OVERLAY_ALL_ON = new IconEIO(0, 148, 64, 64);
|
||||
public static final IconEIO WRENCH_OVERLAY_ALL_OFF = new IconEIO(96, 148, 64, 64);
|
||||
public static final IconEIO WRENCH_OVERLAY_ALL_ON = new IconEIO(0, 148, 96, 64);
|
||||
public static final IconEIO WRENCH_OVERLAY_ALL_OFF = new IconEIO(96, 148, 96, 64);
|
||||
|
||||
public static final IconEIO WRENCH_OVERLAY_POWER = new IconEIO(0, 148, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_POWER_OFF = new IconEIO(96, 148, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_POWER = new IconEIO(16, 148, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_POWER_OFF = new IconEIO(16 + 96, 148, 32, 32);
|
||||
|
||||
public static final IconEIO WRENCH_OVERLAY_REDSTONE = new IconEIO(32, 148, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_REDSTONE = new IconEIO(48, 148, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_REDSTONE_OFF = new IconEIO(48 + 96, 148, 32, 32);
|
||||
|
||||
public static final IconEIO WRENCH_OVERLAY_FLUID = new IconEIO(0, 180, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_FLUID_OFF = new IconEIO(96, 180, 32, 32);
|
||||
|
||||
public static final IconEIO WRENCH_OVERLAY_ITEM = new IconEIO(32, 180, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_ITEM_OFF = new IconEIO(32 + 96, 180, 32, 32);
|
||||
|
||||
public static final IconEIO WRENCH_OVERLAY_FLUID = new IconEIO(0, 180, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_FLUID_OFF = new IconEIO(96, 180, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_GAS = new IconEIO(64, 180, 32, 32);
|
||||
public static final IconEIO WRENCH_OVERLAY_GAS_OFF = new IconEIO(64 + 96, 180, 32, 32);
|
||||
|
||||
public static final IconEIO ACTIVE_TAB = new IconEIO(237, 0, 19, 24);
|
||||
public static final IconEIO INACTIVE_TAB = new IconEIO(237, 25, 19, 24);
|
||||
@@ -89,7 +93,7 @@ public final class IconEIO {
|
||||
public static final IconEIO MINUS_BUT = new IconEIO(129, 246, 10, 10);
|
||||
|
||||
public static final IconEIO SOUND = new IconEIO(209, 172, 22, 22);
|
||||
|
||||
|
||||
public static final IconEIO XP = new IconEIO(235, 60, 22, 22);
|
||||
|
||||
private static final int TEX_SIZE = 256;
|
||||
|
||||
@@ -47,22 +47,24 @@ public class YetaWrenchOverlayRenderer {
|
||||
|
||||
if(mode == ConduitDisplayMode.ALL) {
|
||||
GL11.glColor4f(1, 1, 1, 0.75f);
|
||||
IconEIO.WRENCH_OVERLAY_ALL_ON.renderIcon(offsetX, offsetY - 32, 32, 32, 0, true);
|
||||
IconEIO.WRENCH_OVERLAY_ALL_ON.renderIcon(offsetX, offsetY - 32, 48, 32, 0, true);
|
||||
return;
|
||||
}
|
||||
|
||||
float c = 0.6f;
|
||||
GL11.glColor4f(c, c, c, 0.33f);
|
||||
IconEIO.WRENCH_OVERLAY_ALL_OFF.renderIcon(offsetX, offsetY - 32, 32, 32, 0, true);
|
||||
IconEIO.WRENCH_OVERLAY_ALL_OFF.renderIcon(offsetX, offsetY - 32, 48, 32, 0, true);
|
||||
GL11.glColor4f(1, 1, 1, 0.75f);
|
||||
if(mode == ConduitDisplayMode.POWER) {
|
||||
IconEIO.WRENCH_OVERLAY_POWER.renderIcon(offsetX, offsetY - 32, 16, 16, 0, true);
|
||||
IconEIO.WRENCH_OVERLAY_POWER.renderIcon(offsetX + 8, offsetY - 32, 16, 16, 0, true);
|
||||
} else if(mode == ConduitDisplayMode.REDSTONE) {
|
||||
IconEIO.WRENCH_OVERLAY_REDSTONE.renderIcon(offsetX + 24, offsetY - 32, 16, 16, 0, true);
|
||||
} else if(mode == ConduitDisplayMode.FLUID) {
|
||||
IconEIO.WRENCH_OVERLAY_FLUID.renderIcon(offsetX , offsetY - 16, 16, 16, 0, true);
|
||||
IconEIO.WRENCH_OVERLAY_FLUID.renderIcon(offsetX, offsetY - 16, 16, 16, 0, true);
|
||||
} else if(mode == ConduitDisplayMode.ITEM) {
|
||||
IconEIO.WRENCH_OVERLAY_ITEM.renderIcon(offsetX + 16, offsetY - 16, 16, 16, 0, true);
|
||||
} else if(mode == ConduitDisplayMode.REDSTONE) {
|
||||
IconEIO.WRENCH_OVERLAY_REDSTONE.renderIcon(offsetX + 16, offsetY - 32, 16, 16, 0, true);
|
||||
} else if(mode == ConduitDisplayMode.GAS) {
|
||||
IconEIO.WRENCH_OVERLAY_GAS.renderIcon(offsetX + 32, offsetY - 16, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package crazypants.enderio.nei;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
@@ -17,7 +18,7 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
|
||||
API.registerRecipeHandler(new VatRecipeHandler());
|
||||
API.registerUsageHandler(new VatRecipeHandler());
|
||||
|
||||
|
||||
API.registerRecipeHandler(new EnchanterRecipeHandler());
|
||||
API.registerUsageHandler(new EnchanterRecipeHandler());
|
||||
|
||||
@@ -33,6 +34,10 @@ public class NEIEnderIOConfig implements IConfigureNEI {
|
||||
if(!Config.reinforcedObsidianEnabled) {
|
||||
API.hideItem(new ItemStack(EnderIO.blockReinforcedObsidian));
|
||||
}
|
||||
|
||||
if(!Loader.isModLoaded("Mekanism")) {
|
||||
API.hideItem(new ItemStack(EnderIO.itemGasConduit));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.gas.IGasConduit;
|
||||
import crazypants.enderio.conduit.gas.PacketGasLevel;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
import crazypants.enderio.machine.generator.combustion.PacketCombustionTank;
|
||||
@@ -20,7 +22,7 @@ import crazypants.enderio.machine.generator.stirling.TileEntityStirlingGenerator
|
||||
* @author Garrett Spicer-Davis
|
||||
*/
|
||||
public class ClientUtil {
|
||||
|
||||
|
||||
public static void doFluidLevelUpdate(int x, int y, int z, PacketFluidLevel pkt) {
|
||||
TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
|
||||
if(pkt.tc == null || !(tile instanceof IConduitBundle)) {
|
||||
@@ -34,6 +36,19 @@ public class ClientUtil {
|
||||
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
|
||||
}
|
||||
|
||||
public static void doGasLevelUpdate(int x, int y, int z, PacketGasLevel pkt) {
|
||||
TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
|
||||
if(pkt.tc == null || !(tile instanceof IConduitBundle)) {
|
||||
return;
|
||||
}
|
||||
IConduitBundle bundle = (IConduitBundle) tile;
|
||||
IGasConduit con = bundle.getConduit(IGasConduit.class);
|
||||
if(con == null) {
|
||||
return;
|
||||
}
|
||||
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
|
||||
}
|
||||
|
||||
public static void spawnFarmParcticles(Random rand, BlockCoord bc) {
|
||||
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
|
||||
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
|
||||
@@ -42,13 +57,13 @@ public class ClientUtil {
|
||||
(rand.nextDouble() - 0.5) * 1.5);
|
||||
}
|
||||
|
||||
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {
|
||||
TileCombustionGenerator tile = (TileCombustionGenerator) Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
|
||||
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {
|
||||
TileCombustionGenerator tile = (TileCombustionGenerator) Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
|
||||
if(tile == null) {
|
||||
//no loaded on client when receiving message, can happen when loading the chunks
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(message.nbtRoot.hasKey("coolantTank")) {
|
||||
NBTTagCompound tankRoot = message.nbtRoot.getCompoundTag("coolantTank");
|
||||
tile.getCoolantTank().readFromNBT(tankRoot);
|
||||
|
||||
Reference in new issue
Block a user