Add documentation on the Marx generator

Add a command to get/set/regenerate the marx energy factor
This commit is contained in:
malte0811 2017-09-03 20:48:10 +02:00
parent 685a9058f6
commit ac7d36b5e7
8 changed files with 304 additions and 39 deletions

View File

@ -24,12 +24,16 @@ import malte0811.industrialWires.blocks.converter.BlockMechanicalConverter;
import malte0811.industrialWires.blocks.converter.TileEntityIEMotor;
import malte0811.industrialWires.blocks.converter.TileEntityMechICtoIE;
import malte0811.industrialWires.blocks.converter.TileEntityMechIEtoIC;
import malte0811.industrialWires.blocks.hv.*;
import malte0811.industrialWires.blocks.hv.BlockHVMultiblocks;
import malte0811.industrialWires.blocks.hv.BlockJacobsLadder;
import malte0811.industrialWires.blocks.hv.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.hv.TileEntityMarx;
import malte0811.industrialWires.blocks.wire.*;
import malte0811.industrialWires.compat.Compat;
import malte0811.industrialWires.controlpanel.PanelUtils;
import malte0811.industrialWires.crafting.Recipes;
import malte0811.industrialWires.hv.MarxOreHandler;
import malte0811.industrialWires.hv.MultiblockMarx;
import malte0811.industrialWires.items.ItemIC2Coil;
import malte0811.industrialWires.items.ItemKey;
import malte0811.industrialWires.items.ItemPanelComponent;
@ -37,6 +41,7 @@ import malte0811.industrialWires.network.MessageGUIInteract;
import malte0811.industrialWires.network.MessageItemSync;
import malte0811.industrialWires.network.MessagePanelInteract;
import malte0811.industrialWires.network.MessageTileSyncIW;
import malte0811.industrialWires.util.CommandIW;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@ -49,6 +54,7 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
@ -127,7 +133,6 @@ public class IndustrialWires {
GameRegistry.registerTileEntity(TileEntityMechICtoIE.class, MODID + ":mechIcToIe");
GameRegistry.registerTileEntity(TileEntityMechIEtoIC.class, MODID + ":mechIeToIc");
}
MultiblockHandler.registerMultiblock(new MultiblockMarx());
proxy.preInit();
Compat.preInit();
@ -159,6 +164,9 @@ public class IndustrialWires {
@EventHandler
public void init(FMLInitializationEvent e) {
MultiblockMarx.INSTANCE = new MultiblockMarx();
MultiblockHandler.registerMultiblock(MultiblockMarx.INSTANCE);
packetHandler.registerMessage(MessageTileSyncIW.HandlerClient.class, MessageTileSyncIW.class, 0, Side.CLIENT);
packetHandler.registerMessage(MessagePanelInteract.HandlerServer.class, MessagePanelInteract.class, 1, Side.SERVER);
packetHandler.registerMessage(MessageGUIInteract.HandlerServer.class, MessageGUIInteract.class, 2, Side.SERVER);
@ -174,4 +182,8 @@ public class IndustrialWires {
PanelUtils.PANEL_ITEM = Item.getItemFromBlock(panel);
proxy.postInit();
}
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandIW());
}
}

View File

@ -672,7 +672,7 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
signals[channel] = (byte) Math.max(value, signals[channel]);
}
void setStageCount(int stageCount) {
public void setStageCount(int stageCount) {
this.stageCount = stageCount;
rcTimeConst = 5D/stageCount;
timeFactor = Math.exp(-1/(20*rcTimeConst));

View File

@ -18,9 +18,11 @@
package malte0811.industrialWires.client;
import blusunrize.immersiveengineering.api.ManualHelper;
import blusunrize.immersiveengineering.api.ManualPageMultiblock;
import blusunrize.immersiveengineering.client.ClientUtils;
import blusunrize.immersiveengineering.client.models.smart.ConnLoader;
import blusunrize.immersiveengineering.common.Config;
import blusunrize.immersiveengineering.common.util.Utils;
import blusunrize.lib.manual.ManualInstance;
import blusunrize.lib.manual.ManualPages;
import blusunrize.lib.manual.ManualPages.PositionedItemStack;
@ -43,6 +45,8 @@ import malte0811.industrialWires.client.panelmodel.PanelModelLoader;
import malte0811.industrialWires.client.render.TileRenderJacobsLadder;
import malte0811.industrialWires.client.render.TileRenderMarx;
import malte0811.industrialWires.controlpanel.PanelComponent;
import malte0811.industrialWires.hv.MarxOreHandler;
import malte0811.industrialWires.hv.MultiblockMarx;
import malte0811.industrialWires.items.ItemIC2Coil;
import malte0811.industrialWires.items.ItemPanelComponent;
import net.minecraft.client.Minecraft;
@ -50,6 +54,7 @@ import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -64,9 +69,7 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import java.util.Arrays;
import java.util.Random;
import java.util.WeakHashMap;
import java.util.*;
public class ClientProxy extends CommonProxy {
@Override
@ -166,17 +169,17 @@ public class ClientProxy extends CommonProxy {
int oldLength = Config.IEConfig.Tools.earDefenders_SoundBlacklist.length;
Config.IEConfig.Tools.earDefenders_SoundBlacklist =
Arrays.copyOf(Config.IEConfig.Tools.earDefenders_SoundBlacklist, oldLength+1);
Arrays.copyOf(Config.IEConfig.Tools.earDefenders_SoundBlacklist, oldLength + 1);
Config.IEConfig.Tools.earDefenders_SoundBlacklist[oldLength] = TINNITUS_LOC.toString();
m.addEntry("industrialwires.wires", "industrialwires",
m.addEntry("industrialwires.wires", IndustrialWires.MODID,
new ManualPages.CraftingMulti(m, "industrialwires.wires0", new ItemStack(IndustrialWires.ic2conn, 1, 0), new ItemStack(IndustrialWires.ic2conn, 1, 1), new ItemStack(IndustrialWires.ic2conn, 1, 2), new ItemStack(IndustrialWires.ic2conn, 1, 3),
new ItemStack(IndustrialWires.ic2conn, 1, 4), new ItemStack(IndustrialWires.ic2conn, 1, 5), new ItemStack(IndustrialWires.ic2conn, 1, 6), new ItemStack(IndustrialWires.ic2conn, 1, 7)),
new ManualPages.Text(m, "industrialwires.wires1"),
new ManualPages.CraftingMulti(m, "industrialwires.wires2", (Object[]) wireRecipes)
);
if (IndustrialWires.mechConv != null) {
m.addEntry("industrialwires.mechConv", "industrialwires",
m.addEntry("industrialwires.mechConv", IndustrialWires.MODID,
new ManualPages.Crafting(m, "industrialwires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)),
new ManualPages.Crafting(m, "industrialwires.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)),
new ManualPages.Crafting(m, "industrialwires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0))
@ -184,7 +187,7 @@ public class ClientProxy extends CommonProxy {
}
Config.manual_doubleA.put("iwJacobsUsage", IWConfig.HVStuff.jacobsUsageEU);
Config.manual_int.put("iwKeysOnRing", IWConfig.maxKeysOnRing);
m.addEntry("industrialwires.jacobs", "industrialwires",
m.addEntry("industrialwires.jacobs", IndustrialWires.MODID,
new ManualPages.CraftingMulti(m, "industrialwires.jacobs0", new ItemStack(IndustrialWires.jacobsLadder, 1, 0), new ItemStack(IndustrialWires.jacobsLadder, 1, 1), new ItemStack(IndustrialWires.jacobsLadder, 1, 2)),
new ManualPages.Text(m, "industrialwires.jacobs1"));
@ -219,6 +222,32 @@ public class ClientProxy extends CommonProxy {
new ManualPages.Crafting(m, "industrialwires.lock1", new ItemStack(IndustrialWires.key, 1, 2)),
new ManualPages.Crafting(m, "industrialwires.panel_meter", new ItemStack(IndustrialWires.panelComponent, 1, 8))
);
List<MarxOreHandler.OreInfo> ores = MarxOreHandler.getRecipes();
List<ManualPages> marxEntry = new ArrayList<>();
marxEntry.add(new ManualPages.Text(m, IndustrialWires.MODID + ".marx0"));
marxEntry.add(new ManualPageMultiblock(m, IndustrialWires.MODID + ".marx1", MultiblockMarx.INSTANCE));
marxEntry.add(new ManualPages.Text(m, IndustrialWires.MODID + ".marx2"));
marxEntry.add(new ManualPages.Text(m, IndustrialWires.MODID + ".marx3"));
marxEntry.add(new ManualPages.Text(m, IndustrialWires.MODID + ".marx4"));
marxEntry.add(new ManualPages.Text(m, IndustrialWires.MODID + ".marx5"));
marxEntry.add(new ManualPages.Text(m, IndustrialWires.MODID + ".marx6"));
String text = I18n.format("ie.manual.entry.industrialwires.marx7")+"\n";
for (int i = 0; i < ores.size(); ) {
for (int j = 0; j < (i==0?12:13) && i < ores.size(); j+=4, i++) {
MarxOreHandler.OreInfo curr = ores.get(i);
text += I18n.format(IndustrialWires.MODID+".desc.input")+": §l" + curr.exampleInput.get(0).getDisplayName() + "§r\n";
text += I18n.format(IndustrialWires.MODID+".desc.output")+": " + Utils.formatDouble(curr.maxYield, "0.#") + "x" + curr.output.get().getDisplayName() + "\n";
if (curr.outputSmall!=null&&!curr.outputSmall.get().isEmpty()) {
text += I18n.format(IndustrialWires.MODID+".desc.alt")+": " + curr.smallMax + "x" + curr.outputSmall.get().getDisplayName() + "\n";
j++;
}
text += I18n.format(IndustrialWires.MODID+".desc.ideal_e")+": " + Utils.formatDouble(curr.avgEnergy*MarxOreHandler.defaultEnergy / 1000, "0.#") + " kJ\n\n";
}
marxEntry.add(new ManualPages.Text(m, text));
text = "";
}
m.addEntry("industrialwires.marx", IndustrialWires.MODID, marxEntry.toArray(new ManualPages[marxEntry.size()]));
}
private static final ResourceLocation TINNITUS_LOC = new ResourceLocation(IndustrialWires.MODID, "tinnitus");

View File

@ -0,0 +1,38 @@
package malte0811.industrialWires.client;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
public class ClientUtilsIW {
/**
* Base on {@link blusunrize.immersiveengineering.client.ClientUtils#renderModelTESRFast(List, BufferBuilder, World, BlockPos)}
* (which I wrote)
*/
public static void renderModelTESRFast(List<BakedQuad> quads, BufferBuilder renderer) {
int brightness = 15 << 20 | 15 << 4;
int l1 = (brightness >> 0x10) & 0xFFFF;
int l2 = brightness & 0xFFFF;
for (BakedQuad quad : quads) {
int[] vData = quad.getVertexData();
VertexFormat format = quad.getFormat();
int size = format.getIntegerSize();
int uv = format.getUvOffsetById(0) / 4;
for (int i = 0; i < 4; ++i) {
renderer
.pos(Float.intBitsToFloat(vData[size * i]),
Float.intBitsToFloat(vData[size * i + 1]),
Float.intBitsToFloat(vData[size * i + 2]))
.color(255, 255, 255, 255)
.tex(Float.intBitsToFloat(vData[size * i + uv]), Float.intBitsToFloat(vData[size * i + uv + 1]))
.lightmap(l1, l2)
.endVertex();
}
}
}
}

View File

@ -22,22 +22,18 @@ import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.api.crafting.IngredientStack;
import blusunrize.immersiveengineering.common.util.Utils;
import malte0811.industrialWires.IndustrialWires;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
import java.util.function.Supplier;
import static net.minecraftforge.oredict.OreDictionary.getOres;
@ -52,7 +48,7 @@ public class MarxOreHandler {
putOre("oreIron", .5, 4, "dustIron", "nuggetIron");
putOre("oreGold", 1, 4, "dustGold", "nuggetGold");
putOre("oreDiamond", 2, 4, "gemDiamond");
putOre("oreEmerald", 3, 4, "gemEmerald");
putOre("oreEmerald", 2.25, 4, "gemEmerald");
putOre("oreLapis", .75, 10, "gemLapis");
putOre("oreCoal", .75, 8, Items.COAL, 0);
putOre("oreRedstone", 1, 12, "dustRedstone");
@ -80,7 +76,7 @@ public class MarxOreHandler {
}
public static void resetModifier() {
modifier = MathHelper.clamp(Utils.RAND.nextGaussian()*.1+1, .9, 1.1);
modifier = .9+Utils.RAND.nextDouble()*.2;
}
public static ItemStack[] getYield(World world, BlockPos pos, double energy) {

View File

@ -16,7 +16,7 @@
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks.hv;
package malte0811.industrialWires.hv;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.api.IEProperties;
@ -24,34 +24,98 @@ import blusunrize.immersiveengineering.api.MultiblockHandler.IMultiblock;
import blusunrize.immersiveengineering.api.crafting.IngredientStack;
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection;
import blusunrize.immersiveengineering.api.energy.wires.WireType;
import blusunrize.immersiveengineering.common.IEContent;
import blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_Connector;
import blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDecoration0;
import blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDecoration2;
import blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDevice0;
import com.google.common.collect.ImmutableSet;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.IWProperties;
import malte0811.industrialWires.blocks.hv.BlockHVMultiblocks;
import malte0811.industrialWires.blocks.hv.TileEntityMarx;
import malte0811.industrialWires.client.ClientUtilsIW;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.common.property.IExtendedBlockState;
import org.lwjgl.opengl.GL11;
import java.util.Set;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.function.Predicate;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_Connector.CONNECTOR_HV;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_Connector.CONNECTOR_REDSTONE;
import static blusunrize.immersiveengineering.api.ApiUtils.getConnectionCatenary;
import static blusunrize.immersiveengineering.api.IEProperties.*;
import static blusunrize.immersiveengineering.common.IEContent.*;
import static blusunrize.immersiveengineering.common.blocks.BlockTypes_MetalsIE.STEEL;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_Connector.*;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDecoration0.HEAVY_ENGINEERING;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDecoration1.STEEL_FENCE;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDecoration2.STEEL_WALLMOUNT;
import static blusunrize.immersiveengineering.common.blocks.metal.BlockTypes_MetalDevice0.CAPACITOR_HV;
import static malte0811.industrialWires.blocks.IWProperties.MarxType.*;
import static malte0811.industrialWires.blocks.hv.BlockTypes_HVMultiblocks.MARX;
import static malte0811.industrialWires.util.MiscUtils.offset;
public class MultiblockMarx implements IMultiblock {
public static final IBlockState[][][] structure = new IBlockState[2][5][5];
//up forward right
private static final ItemStack[][][] structureStacks = new ItemStack[5][8][2];
private static ItemStack rsConnDummy;
private static ItemStack hvConnDummy;
private static ItemStack hvRel1Dummy;
private static ItemStack hvRel0Dummy;
private static ItemStack wallMountUpDummy;
private static ItemStack wallMountDownDummy;
public static MultiblockMarx INSTANCE;
public MultiblockMarx() {
if (rsConnDummy == null) {
rsConnDummy = new ItemStack(Blocks.BRICK_BLOCK);
hvConnDummy = new ItemStack(Blocks.BRICK_BLOCK);
hvRel1Dummy = new ItemStack(Blocks.BRICK_BLOCK);
hvRel0Dummy = new ItemStack(Blocks.BRICK_BLOCK);
wallMountUpDummy = new ItemStack(Blocks.BRICK_BLOCK);
wallMountDownDummy = new ItemStack(Blocks.BRICK_BLOCK);
}
for (int up = 0; up < 5; up++) {
structureStacks[up][2][0] = structureStacks[up][2][1] = hvRel1Dummy;
structureStacks[up][3][0] = structureStacks[up][3][1]
= new ItemStack(blockMetalDevice0, 1, CAPACITOR_HV.getMeta());
structureStacks[up][4][0] = wallMountDownDummy;
structureStacks[up][4][1] = wallMountUpDummy;
if (up == 0) {
structureStacks[up][0][0] = rsConnDummy;
structureStacks[up][0][1] = hvConnDummy;
structureStacks[up][1][0] = structureStacks[0][1][1]
= new ItemStack(blockMetalDecoration0, 1, HEAVY_ENGINEERING.getMeta());
for (int i = 4; i < structureStacks[up].length; i++) {
structureStacks[up][i][0] = new ItemStack(IEContent.blockMetalDecoration1, 1, STEEL_FENCE.getMeta());
}
structureStacks[up][structureStacks[0].length - 1][1] = new ItemStack(blockStorage, 1, STEEL.getMeta());
} else if (up == 4) {
structureStacks[up][2][0] = structureStacks[up][2][1] = hvRel0Dummy;
for (int i = 4; i < structureStacks[up].length; i++) {
structureStacks[up][i][1] = new ItemStack(IEContent.blockMetalDecoration1, 1, STEEL_FENCE.getMeta());
}
}
}
}
@Override
public String getUniqueName() {
@ -61,7 +125,27 @@ public class MultiblockMarx implements IMultiblock {
@SuppressWarnings("unchecked")
@Override
public boolean isBlockTrigger(IBlockState state) {
return state.getBlock() == IEContent.blockMetalDevice0 && state.getValue(IEContent.blockMetalDevice0.property) == BlockTypes_MetalDevice0.CAPACITOR_HV;
return state.getBlock() == blockMetalDevice0 && state.getValue(blockMetalDevice0.property) == CAPACITOR_HV;
}
@Override
public ItemStack[][][] getStructureManual() {
return structureStacks;
}
@Override
public IngredientStack[] getTotalMaterials() {
return new IngredientStack[] {
new IngredientStack(new ItemStack(blockMetalDevice0, 10, CAPACITOR_HV.getMeta())),
new IngredientStack(new ItemStack(blockMetalDecoration0, 2, HEAVY_ENGINEERING.getMeta())),
new IngredientStack(new ItemStack(blockConnectors, 1, CONNECTOR_HV.getMeta())),
new IngredientStack(new ItemStack(blockConnectors, 1, CONNECTOR_REDSTONE.getMeta())),
new IngredientStack(new ItemStack(blockConnectors, 10, RELAY_HV.getMeta())),
new IngredientStack(new ItemStack(itemWireCoil, 8, 2)),
new IngredientStack(new ItemStack(blockMetalDecoration2, 8, STEEL_WALLMOUNT.getMeta())),
new IngredientStack("fenceSteel", 7),
new IngredientStack("blockSteel", 1)
};
}
private EnumFacing facing;
@SuppressWarnings("unchecked")
@ -74,12 +158,12 @@ public class MultiblockMarx implements IMultiblock {
boolean mirrored = false;
Predicate<BlockPos> hvCap = (local) -> {
IBlockState b = world.getBlockState(local);
return b.getBlock() == IEContent.blockMetalDevice0 && b.getValue(IEContent.blockMetalDevice0.property) == BlockTypes_MetalDevice0.CAPACITOR_HV;
return b.getBlock() == blockMetalDevice0 && b.getValue(blockMetalDevice0.property) == CAPACITOR_HV;
};
Predicate<BlockPos> heavyEng = (local) -> {
IBlockState b = world.getBlockState(local);
IBlockState state = world.getBlockState(local);
return b.getBlock() == IEContent.blockMetalDecoration0 && b.getValue(IEContent.blockMetalDecoration0.property) == BlockTypes_MetalDecoration0.HEAVY_ENGINEERING;
return b.getBlock() == blockMetalDecoration0 && b.getValue(blockMetalDecoration0.property) == HEAVY_ENGINEERING;
};
Predicate<BlockPos> steelBlock = (local) -> {
IBlockState b = world.getBlockState(local);
@ -91,7 +175,7 @@ public class MultiblockMarx implements IMultiblock {
IBlockState b = world.getBlockState(local);
if (b.getBlock()==IEContent.blockMetalDecoration2) {
b = b.getBlock().getActualState(b, world, local);
if (b.getValue(IEContent.blockMetalDecoration2.property)== BlockTypes_MetalDecoration2.STEEL_WALLMOUNT) {
if (b.getValue(IEContent.blockMetalDecoration2.property)== STEEL_WALLMOUNT) {
int int_4_wanted = up ? 0 : 1;
return b.getValue(IEProperties.INT_4)==int_4_wanted;
}
@ -113,7 +197,7 @@ public class MultiblockMarx implements IMultiblock {
if (state.getValue(IEContent.blockConnectors.property)!= BlockTypes_Connector.RELAY_HV) {
return (byte)-1;
}
if (state.getValue(IEProperties.FACING_ALL)!=facing) {
if (state.getValue(FACING_ALL)!=facing) {
return (byte)-1;
}
byte ret = 0;
@ -141,7 +225,7 @@ public class MultiblockMarx implements IMultiblock {
if (state.getValue(IEContent.blockConnectors.property)!= type) {
return false;
}
if (state.getValue(IEProperties.FACING_ALL)!=(facing)) {
if (state.getValue(FACING_ALL)!=(facing)) {
return false;
}
Set<Connection> existingConns = ImmersiveNetHandler.INSTANCE.getConnections(world, local);
@ -281,24 +365,55 @@ public class MultiblockMarx implements IMultiblock {
}
}
@SuppressWarnings("unchecked")
@Override
public ItemStack[][][] getStructureManual() {
return new ItemStack[0][][];
}
@Override
public IngredientStack[] getTotalMaterials() {
return new IngredientStack[0];
public IBlockState getBlockstateFromStack(int index, ItemStack stack) {
IBlockState connBase = blockConnectors.getDefaultState().withProperty(FACING_ALL, EnumFacing.EAST);
IBlockState mountBase = blockMetalDecoration2.getDefaultState().withProperty(FACING_ALL, EnumFacing.WEST)
.withProperty(blockMetalDecoration2.property, STEEL_WALLMOUNT);
if (stack == rsConnDummy) {
return connBase.withProperty(blockConnectors.property, CONNECTOR_REDSTONE);
} else if (stack == hvConnDummy) {
return connBase.withProperty(blockConnectors.property, CONNECTOR_HV);
} else if (stack == hvRel0Dummy || stack == hvRel1Dummy) {
return connBase.withProperty(blockConnectors.property, RELAY_HV);
} else if (stack == wallMountDownDummy) {
return mountBase.withProperty(INT_4, 1);
} else if (stack == wallMountUpDummy) {
return mountBase.withProperty(INT_4, 0);
}
return index==-1?null:IMultiblock.super.getBlockstateFromStack(index, stack);
}
@Override
public boolean overwriteBlockRender(ItemStack stack, int iterator) {
IBlockState here = getBlockstateFromStack(-1, stack);
if (here!=null) {
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
IBakedModel model = dispatcher.getModelForState(here);
if (stack == hvRel1Dummy && here instanceof IExtendedBlockState) {
Connection up = new Connection(BlockPos.ORIGIN, BlockPos.ORIGIN.down(), WireType.STEEL, 1);
up.catenaryVertices = getConnectionCatenary(up, new Vec3d(.125, .5, .5),
new Vec3d(.125, 1.5, .5));
here = ((IExtendedBlockState) here).withProperty(CONNECTIONS, ImmutableSet.of(up));
}
GlStateManager.disableBlend();
ForgeHooksClient.setRenderLayer(BlockRenderLayer.SOLID);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
ClientUtilsIW.renderModelTESRFast(model.getQuads(here, null, 13), buffer);
tessellator.draw();
GlStateManager.enableBlend();
ForgeHooksClient.setRenderLayer(null);
return true;
}
return false;
}
@Override
public float getManualScale() {
return 0;
return 12;
}
@Override

View File

@ -0,0 +1,60 @@
package malte0811.industrialWires.util;
import malte0811.industrialWires.IWSaveData;
import malte0811.industrialWires.hv.MarxOreHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class CommandIW extends CommandBase {
@Nonnull
@Override
public String getName() {
return "iw";
}
@Nonnull
@Override
public String getUsage(@Nonnull ICommandSender sender) {
return "/iw <getmarx|resetmarx|setmarx <value>>";
}
@Override
public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) throws CommandException {
if (args.length==0)
throw new CommandException("1 parameter is required");
switch (args[0].toLowerCase()) {
case "getmarx":
sender.sendMessage(new TextComponentString("Marx energy factor: "+ MarxOreHandler.modifier));
break;
case "resetmarx":
MarxOreHandler.resetModifier();
IWSaveData.INSTANCE.markDirty();
sender.sendMessage(new TextComponentString("Marx energy factor reset was successful"));
break;
case "setmarx":
if (args.length!=2)
throw new CommandException("2 parameters are required for setmarx");
MarxOreHandler.modifier = parseDouble(args[1], .9, 1.1);
IWSaveData.INSTANCE.markDirty();
sender.sendMessage(new TextComponentString("Successfully set Marx energy factor"));
break;
}
}
@Nonnull
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) {
if (args.length==1) {
return getListOfStringsMatchingLastWord(args, "getmarx", "setmarx", "resetmarx");
}
return super.getTabCompletions(server, sender, args, targetPos);
}
}

View File

@ -51,6 +51,10 @@ industrialwires.subtitle.marx_pop=Marx generator misfires
industrialwires.desc.jei.marx=Marx Generator
industrialwires.desc.jei.alt= (alternative)
industrialwires.desc.jei.max= (max.)
industrialwires.desc.input=Input
industrialwires.desc.output=Main Output
industrialwires.desc.alt=Replacement
industrialwires.desc.ideal_e=Ideal Energy
industrialwires.desc.wireLength=Wire length: %1s block(s)
industrialwires.desc.recipe=Please check the Engineer's manual for recipe details
@ -117,11 +121,22 @@ ie.manual.entry.industrialwires.mechConv1=like a waterwheel or a motor (see page
ie.manual.entry.industrialwires.mechConv2=lost with each conversion.<br>As a little extra the "Mechanical converter" product series also contains a Rotational Motor: It consumes IF to produce IE rotational energy. As with the converters this is not a lossless process.
ie.manual.entry.industrialwires.jacobs.name=Jacob's Ladders
# Note for potential translators: This refers to Polychlorinated biphenyls (a poisonous ingredient in old insulation oils) rather than printed circuit boards
ie.manual.entry.industrialwires.jacobs.subtext=Probably contain PCB's!
ie.manual.entry.industrialwires.jacobs0=By applying a high voltage between 2 electrodes forming a "V" one can create an arc travelling upwards. They don't serve a particular purpose apart from being a nice-looking waste of power. Power can be supplied using either Flux or EU. The energy usage varies with the size of the ladder.
ie.manual.entry.industrialwires.jacobs1=These are the required power values in EU: <config;dA;iwJacobsUsage>. Due to the voltages involved touching the ladder while active is not a good idea. Applying salt to the electrodes will cause the arc to be colored orange for a short time due to the sodium contained in the salt.
ie.manual.entry.industrialwires.marx.name=Marx Generator
ie.manual.entry.industrialwires.marx.subtext=I'm Erwin-Otto, not Karl!
ie.manual.entry.industrialwires.marx0=A Marx Generator is a device use to produce high-voltage high-energy pulses. These pulses are visible as lightning between the output terminals and can be used to process ores. Each type of ore has an ideal amount of processing energy (see <link;industrialwires.marx;§oAppendix B§r;7>). The precise values are unknown, estimate values with 10%% accuracy can be found at the end of this entry. The factor between the actual value and the estimate is the same for all types of ore.
ie.manual.entry.industrialwires.marx1=§lConstruction§r<br>The above plan shows a 5-stage generator capable of producing 3 block lightning. An arbitrary amount of stages can be added by increasing the number of
ie.manual.entry.industrialwires.marx2="middle" layers. Power (either IF or EU) is connected to the HV connector, the redstone wire for the control signals is connected to the redstone connector<br>§lEnergy§r<br>Each stage of the Marx generator consists of a 1.6μF capacitor that is charged to up to 250kV (see <link;industrialwires.marx;§oAppendix A§r;6>). When the generator is fully charged the voltage of each capacitor is roughly equal to the charging voltage. The total energy is the sum of the energy stored in the individual
ie.manual.entry.industrialwires.marx3=capacitors and is split equally between the ores to be processed.<br>§lControl signals§r<br>Voltages are represented by 2 signals: The first signal is simply proportional to the voltage to represent. The second signal is proportional to the voltage in the "gap" between 2 values of the first signal.<br>The charging voltage is controlled by the white and yellow signals. The voltages of the top and bottom capacitor are output to the magenta and
ie.manual.entry.industrialwires.marx4=pink resp. the orange and lime signals. The light blue signal is a firing control. If it is high the generator will attempt to fire. If the voltage of the bottom capacitor is lower than 125 kV or the total voltage is lower than 30%% of the maximum output voltage the generator will misfire, discharging the capacitors without actually producing lightning.<br> §lSafety§r<br>Due to the high voltages and energies involved in firing a Marx generator a safe distance should be maintained to avoid
ie.manual.entry.industrialwires.marx5=injury or death. Even outside of this area hearing protection (As provided by Immersive Engineering) is obligatory. Formulas to calculate the safe distances can be found in <link;industrialwires.marx;§oAppendix A§r;6>.
ie.manual.entry.industrialwires.marx6=§lAppendix A: Formulas§r<br>Energy stored in a capacitor:<br>E=0.5*C*U^2<br>E: Energy, C: Capacitance, U: Voltage<br>Voltage from redstone signals:<br>U=250/255*(16*a+b)<br>U: Voltage, a: First signal, b: Second signal<br>Safe distance (Physical damage):<br>r=sqrt(e/50,000)<br>r: Safe distance, e: Energy stored<br>Safe distance (Ear damage):<br>r=sqrt(e)/100<br>r: Safe distance, e: Energy stored
ie.manual.entry.industrialwires.marx7=§lAppendix B: Ore Energy Values§r
ie.manual.entry.industrialwires.intro.name=Introduction
ie.manual.entry.industrialwires.intro.subtext=