Merge branch 'marx' into MC1.12

This commit is contained in:
malte0811 2017-09-04 17:42:50 +02:00
commit 8d4c0fcad2
53 changed files with 5553 additions and 193 deletions

View file

@ -30,7 +30,7 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft {
version = "14.21.1.2443"
version = "14.22.0.2463"
runDir = "run"
replace '${version}', project.version
@ -50,6 +50,13 @@ repositories {
name 'jared maven'
url 'http://blamejared.com/maven'
}
maven { // Albedo Lights
url 'https://repo.elytradev.com/'
}
maven { // JEI & Tinkers
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
// dependencies of TR...
maven {
url 'http://maven.epoxide.xyz'
@ -66,6 +73,9 @@ dependencies {
deobfCompile "blusunrize:ImmersiveEngineering:0.12-+:deobf"
compileOnly "TechReborn:TechReborn-1.12:2.6.+:dev"
compileOnly "RebornCore:RebornCore-1.12:3.2.+:dev"
deobfCompile 'elucent:albedo:2.0-SNAPSHOT'
deobfCompile "mezz.jei:jei_1.12:4.+"
deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.+"
}
jar {

View file

@ -17,9 +17,10 @@
*/
package malte0811.industrialWires;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanelCreator;
import malte0811.industrialWires.blocks.controlpanel.TileEntityRSPanelConn;
import malte0811.industrialWires.blocks.hv.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.hv.TileEntityMarx;
import malte0811.industrialWires.containers.ContainerPanelComponent;
import malte0811.industrialWires.containers.ContainerPanelCreator;
import malte0811.industrialWires.containers.ContainerRSPanelConn;
@ -49,6 +50,8 @@ public class CommonProxy implements IGuiHandler {
public void playJacobsLadderSound(TileEntityJacobsLadder te, int phase, Vec3d soundPos) {
}
public void startTinnitus() {
}
@Override
public Container getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
@ -78,4 +81,6 @@ public class CommonProxy implements IGuiHandler {
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
public void playMarxBang(TileEntityMarx tileEntityMarx, Vec3d vec3d, float energy) {}
}

View file

@ -1,25 +0,0 @@
package malte0811.industrialWires;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.api.tool.ToolboxHandler;
import ic2.api.item.IBoxable;
import ic2.api.item.IC2Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ExtraIC2Compat {
public static void addToolConmpat() {
Item tinnedFood = IC2Items.getItem("filled_tin_can").getItem();
ItemStack emptyMug = IC2Items.getItem("mug", "empty");
ToolboxHandler.addFoodType((s)->s.getItem()==tinnedFood);
ToolboxHandler.addFoodType((s)->
s.getItem()==emptyMug.getItem()&&!ItemStack.areItemStacksEqual(emptyMug, ApiUtils.copyStackWithAmount(s, 1))
);
Item cable = IC2Items.getItem("cable", "type:copper,insulation:0").getItem();
ToolboxHandler.addWiringType((s, w)->s.getItem()==cable);
ToolboxHandler.addToolType((s)-> {
Item a = s.getItem();
return a instanceof IBoxable && ((IBoxable) a).canBeStoredInToolbox(s);
});
}
}

View file

@ -63,5 +63,8 @@ public class IWConfig {
public static double[] jacobsUsageEU = {20, 50, 100};
@Comment({"The damage dealt by a small Jacobs Ladder. Normal Ladders deal twice this damage, huge ones 3 times as much"})
public static float jacobsBaseDmg = 5;
@Comment({"The effect of standing somewhat close to a Marx generator discharge.",
"0: Tinnitus, 1: Nausea, 2: normal damage"})
public static int marxSoundDamage = 0;
}
}

View file

@ -0,0 +1,32 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires;
import net.minecraft.util.DamageSource;
public class IWDamageSources {
public static class MarxDamage extends DamageSource {
public MarxDamage() {
super("industrialwires.marx");
setDamageBypassesArmor();
}
}
public static final MarxDamage dmg_marx = new MarxDamage();
public static final DamageSource dmg_jacobs = new DamageSource("industrialwires.jacobs_ladder");
}

View file

@ -0,0 +1,68 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class IWPotions {
public static PotionTinnitus tinnitus;
public static void init() {
tinnitus = new PotionTinnitus();
}
static class PotionTinnitus extends Potion {
ResourceLocation tex = new ResourceLocation(IndustrialWires.MODID,"textures/gui/tinnitus.png");
protected PotionTinnitus() {
super(true, 0xffff0000);
setIconIndex(0, 0);
this.setRegistryName(new ResourceLocation(IndustrialWires.MODID, "tinnitus"));
ForgeRegistries.POTIONS.register(this);
}
@Override
public boolean isReady(int duration, int amplifier) {
return true;
}
@Override
public void performEffect(@Nonnull EntityLivingBase affected, int amp) {
if (affected.getEntityWorld().isRemote) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.player==affected) {
IndustrialWires.proxy.startTinnitus();
}
}
}
@Override
@SideOnly(Side.CLIENT)
public int getStatusIconIndex()
{
Minecraft.getMinecraft().getTextureManager().bindTexture(tex);
return super.getStatusIconIndex();
}
}
}

View file

@ -0,0 +1,73 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires;
import malte0811.industrialWires.hv.MarxOreHandler;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.storage.WorldSavedData;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import javax.annotation.Nonnull;
@Mod.EventBusSubscriber
public class IWSaveData extends WorldSavedData {
private final static String MARX_MOD = "marxOreModifier";
public static IWSaveData INSTANCE = new IWSaveData();
public IWSaveData() {
super(IndustrialWires.MODID);
}
public IWSaveData(String name) {
super(name);
}
@Override
public void readFromNBT(@Nonnull NBTTagCompound nbt) {
if (nbt.hasKey(MARX_MOD)) {
MarxOreHandler.modifier = nbt.getDouble(MARX_MOD);
} else {
MarxOreHandler.resetModifier();
}
}
@Nonnull
@Override
public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound compound) {
compound.setDouble(MARX_MOD, MarxOreHandler.modifier);
return compound;
}
@SubscribeEvent
public static void onWorldLoad(WorldEvent.Load event) {
World w = event.getWorld();
if (!w.isRemote) {
INSTANCE = (IWSaveData) w.loadData(IWSaveData.class, IndustrialWires.MODID);
if (INSTANCE==null) {
INSTANCE = new IWSaveData();
MarxOreHandler.resetModifier();
w.setData(IndustrialWires.MODID, INSTANCE);
INSTANCE.setDirty(true);
}
}
}
}

View file

@ -17,17 +17,23 @@
*/
package malte0811.industrialWires;
import blusunrize.immersiveengineering.api.MultiblockHandler;
import malte0811.industrialWires.blocks.BlockIWBase;
import malte0811.industrialWires.blocks.BlockJacobsLadder;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.controlpanel.*;
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.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;
@ -35,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 +56,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;
@ -65,6 +73,7 @@ import java.util.List;
public class IndustrialWires {
public static final String MODID = "industrialwires";
public static final String VERSION = "${version}";
public static final String MODNAME = "Industrial Wires";
public static final List<BlockIWBase> blocks = new ArrayList<>();
public static final List<Item> items = new ArrayList<>();
@ -77,6 +86,8 @@ public class IndustrialWires {
public static BlockJacobsLadder jacobsLadder = null;
@GameRegistry.ObjectHolder(MODID+":"+BlockPanel.NAME)
public static BlockPanel panel = null;
@GameRegistry.ObjectHolder(MODID+":"+BlockHVMultiblocks.NAME)
public static BlockHVMultiblocks hvMultiblocks = null;
@GameRegistry.ObjectHolder(MODID+":"+ItemIC2Coil.NAME)
public static ItemIC2Coil coil = null;
@ -111,7 +122,6 @@ public class IndustrialWires {
hasTechReborn = Loader.isModLoaded("techreborn");
logger = e.getModLog();
new IWConfig();
if (hasIC2) {
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, MODID + ":ic2ConnectorTin");
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + ":ic2ConnectorCopper");
@ -132,12 +142,16 @@ public class IndustrialWires {
}
}
GameRegistry.registerTileEntity(TileEntityJacobsLadder.class, MODID + ":jacobsLadder");
GameRegistry.registerTileEntity(TileEntityMarx.class, MODID + ":marx_generator");
GameRegistry.registerTileEntity(TileEntityPanel.class, MODID + ":control_panel");
GameRegistry.registerTileEntity(TileEntityRSPanelConn.class, MODID + ":control_panel_rs");
GameRegistry.registerTileEntity(TileEntityPanelCreator.class, MODID + ":panel_creator");
GameRegistry.registerTileEntity(TileEntityUnfinishedPanel.class, MODID + ":unfinished_panel");
GameRegistry.registerTileEntity(TileEntityComponentPanel.class, MODID + ":single_component_panel");
proxy.preInit();
Compat.preInit();
MarxOreHandler.preInit();
}
@SubscribeEvent
@ -146,11 +160,12 @@ public class IndustrialWires {
if (IWConfig.enableConversion&&hasIC2) {
event.getRegistry().register(new BlockMechanicalConverter());
}
if (hasIC2/*||hasTechReborn TODO talk to modmuss*/) {
if (hasIC2) {
event.getRegistry().register(new BlockIC2Connector());
}
event.getRegistry().register(new BlockJacobsLadder());
event.getRegistry().register(new BlockPanel());
event.getRegistry().register(new BlockHVMultiblocks());
}
@SubscribeEvent
@ -159,7 +174,7 @@ public class IndustrialWires {
event.getRegistry().register(b.createItemBlock());
}
if (hasIC2/*||hasTechReborn TODO talk to modmuss*/) {
if (hasIC2) {
event.getRegistry().register(new ItemIC2Coil());
}
event.getRegistry().register(new ItemPanelComponent());
@ -173,10 +188,8 @@ public class IndustrialWires {
@EventHandler
public void init(FMLInitializationEvent e) {
if (hasIC2) {
ExtraIC2Compat.addToolConmpat();
}
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);
@ -184,11 +197,17 @@ public class IndustrialWires {
packetHandler.registerMessage(MessageItemSync.HandlerServer.class, MessageItemSync.class, 3, Side.SERVER);
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
IWPotions.init();
Compat.init();
}
@EventHandler
public void postInit(FMLPostInitializationEvent e) {
proxy.postInit();
PanelUtils.PANEL_ITEM = Item.getItemFromBlock(panel);
PanelUtils.PANEL_ITEM = Item.getItemFromBlock(panel);
proxy.postInit();
}
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandIW());
}
}

View file

@ -31,6 +31,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
@ -44,7 +45,9 @@ import net.minecraft.world.World;
import net.minecraftforge.common.property.IExtendedBlockState;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
public abstract class BlockIWBase extends Block {
@ -141,6 +144,15 @@ public abstract class BlockIWBase extends Block {
return super.getBoundingBox(state, source, pos);
}
@Override
public void addCollisionBoxToList(IBlockState state, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull AxisAlignedBB entityBox,
@Nonnull List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) {
AxisAlignedBB aabb = getBoundingBox(state, worldIn, pos).offset(pos);
if (entityBox.intersects(aabb)) {
collidingBoxes.add(aabb);
}
}
//mostly copied from IE
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player,

View file

@ -0,0 +1,83 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks;
import malte0811.industrialWires.util.MiscUtils;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public abstract class BlockIWMultiblock extends BlockIWBase {
public BlockIWMultiblock(Material mat, String name) {
super(mat, name);
}
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
TileEntity te = world.getTileEntity(pos);
if(te instanceof TileEntityIWMultiblock) {
((TileEntityIWMultiblock)te).disassemble();
}
super.breakBlock(world, pos, state);
}
@Override
public void getDrops(@Nonnull NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune) {
//NOP
}
@Override
public boolean isTopSolid(IBlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullBlock(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileEntityIWMultiblock) {
return MiscUtils.getItemStack(((TileEntityIWMultiblock) te).getOriginalBlock(), world, pos);
}
return ItemStack.EMPTY;
}
}

View file

@ -0,0 +1,39 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.util.IStringSerializable;
public final class IWProperties {
private IWProperties() {}
public static PropertyEnum<MarxType> MARX_TYPE = PropertyEnum.create("marx_type", MarxType.class);
public enum MarxType implements IStringSerializable {
NO_MODEL,
BOTTOM,
STAGE,
TOP,
CONNECTOR;
@Override
public String getName() {
return name().toLowerCase();
}
}
}

View file

@ -0,0 +1,132 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks;
import malte0811.industrialWires.util.MiscUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.function.BiConsumer;
public abstract class TileEntityIWMultiblock extends TileEntityIWBase {
protected final static String OFFSET = "offset";
protected final static String FORMED = "formed";
protected final static String MIRRORED = "mirrored";
protected final static String FACING = "facing";
//HFR
protected Vec3i size;
public Vec3i offset = new Vec3i(0, 0, 0);
public boolean formed;
public boolean mirrored;
public long onlyLocalDissassembly;
public EnumFacing facing = EnumFacing.NORTH;
@Nonnull
protected abstract BlockPos getOrigin();
public abstract IBlockState getOriginalBlock();
public BiConsumer<World, BlockPos> getOriginalBlockPlacer() {
return (w, p)->w.setBlockState(p, getOriginalBlock());
}
@Nullable
public <T extends TileEntityIWMultiblock> T master(T here) {
if (offset.getX()==0&&offset.getY()==0&&offset.getZ()==0) {
return here;
}
TileEntity m = world.getTileEntity(pos.subtract(offset));
if (m!=null&&m.getClass().equals(this.getClass())) {
return (T) m;
}
return null;
}
@Nonnull
public <T extends TileEntityIWMultiblock> T masterOr(T here, @Nonnull T def) {
T master = master(here);
return master!=null?master:def;
}
public void disassemble() {
if (formed && !world.isRemote) {
BlockPos startPos = getOrigin();
BlockPos masterPos = getPos().subtract(offset);
long time = world.getTotalWorldTime();
Vec3i size = getSize();
for (int up = 0; up < size.getX(); up++) {
for (int forward = 0; forward < size.getY(); forward++) {
for (int right = 0; right < size.getZ(); right++) {
BlockPos pos = MiscUtils.offset(startPos, facing, mirrored, right, forward, up);
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileEntityIWMultiblock) {
TileEntityIWMultiblock part = (TileEntityIWMultiblock) te;
Vec3i diff = pos.subtract(masterPos);
if (part.offset.equals(diff) && time != part.onlyLocalDissassembly) {
part.formed = false;
if (!pos.equals(this.pos)) {
part.getOriginalBlockPlacer().accept(world, pos);
} else if (part.getOriginalBlock()!=null) {
ItemStack drop = MiscUtils.getItemStack(part.getOriginalBlock(), world, pos);
world.spawnEntity(new EntityItem(world, pos.getX()+.5,pos.getY()+.5,pos.getZ()+.5, drop));
}
}
}
}
}
}
}
}
@Override
public void writeNBT(NBTTagCompound out, boolean updatePacket) {
out.setInteger(FACING, facing.getHorizontalIndex());
out.setIntArray(OFFSET, new int[]{offset.getX(), offset.getY(), offset.getZ()});
out.setBoolean(MIRRORED, mirrored);
out.setBoolean(FORMED, formed);
}
@Override
public void readNBT(NBTTagCompound in, boolean updatePacket) {
formed = in.getBoolean(FORMED);
mirrored = in.getBoolean(MIRRORED);
int[] offset = in.getIntArray(OFFSET);
this.offset = new Vec3i(offset[0], offset[1], offset[2]);
facing = EnumFacing.getHorizontal(in.getInteger(FACING));
}
public Vec3i getSize() {
return size;
}
public int getRight() {
return dot(offset, facing.rotateY().getDirectionVec())*(mirrored?-1:1);
}
public int getForward() {
return dot(offset, facing.getDirectionVec());
}
protected int dot(Vec3i a, Vec3i b) {
return a.getX()*b.getX()+a.getY()*b.getY()+a.getZ()*b.getZ();
}
}

View file

@ -52,6 +52,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static malte0811.industrialWires.util.MiscUtils.apply;
public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTile, IBlockBoundsIW, IPlayerInteraction, ITickable, IEBlockInterfaces.ITileDrop {
protected PropertyComponents.PanelRenderProperties components = new PropertyComponents.PanelRenderProperties();
public boolean firstTick = true;

View file

@ -0,0 +1,106 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks.hv;
import blusunrize.immersiveengineering.api.IEProperties;
import malte0811.industrialWires.blocks.BlockIWMultiblock;
import malte0811.industrialWires.blocks.IMetaEnum;
import malte0811.industrialWires.blocks.IWProperties;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BlockHVMultiblocks extends BlockIWMultiblock implements IMetaEnum {
public static final PropertyEnum<BlockTypes_HVMultiblocks> type = PropertyEnum.create("type", BlockTypes_HVMultiblocks.class);
public BlockHVMultiblocks() {
super(Material.IRON, "hv_multiblock");
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
// No MB's in the creative inventory!
}
@Override
protected IProperty[] getProperties() {
return new IProperty[]{type, IWProperties.MARX_TYPE, IEProperties.FACING_HORIZONTAL, IEProperties.BOOLEANS[0]};
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
switch (state.getValue(type)) {
case MARX:
return new TileEntityMarx(state.getValue(IEProperties.FACING_HORIZONTAL), state.getValue(IWProperties.MARX_TYPE), state.getValue(IEProperties.BOOLEANS[0]));
}
return null;
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(type).getMeta();
}
@Nonnull
@Override
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) {
IBlockState ret = super.getActualState(state, worldIn, pos);
TileEntity te = worldIn.getTileEntity(pos);
if (te instanceof TileEntityMarx) {
ret = ret.withProperty(IWProperties.MARX_TYPE, ((TileEntityMarx) te).type);
ret = ret.withProperty(IEProperties.FACING_HORIZONTAL, ((TileEntityMarx)te).facing);
ret = ret.withProperty(IEProperties.BOOLEANS[0], ((TileEntityMarx)te).mirrored);
}
return ret;
}
@Nonnull
@Override
protected BlockStateContainer createBlockState() {
BlockStateContainer base = super.createBlockState();
return new ExtendedBlockState(this, base.getProperties().toArray(new IProperty[0]), new IUnlistedProperty[]{
IEProperties.CONNECTIONS
});
}
@Override
public Object[] getValues() {
return BlockTypes_HVMultiblocks.values();
}
}

View file

@ -16,10 +16,13 @@
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks;
package malte0811.industrialWires.blocks.hv;
import blusunrize.immersiveengineering.api.IEProperties;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder.LadderSize;
import malte0811.industrialWires.blocks.BlockIWBase;
import malte0811.industrialWires.blocks.IMetaEnum;
import malte0811.industrialWires.blocks.IPlacementCheck;
import malte0811.industrialWires.blocks.hv.TileEntityJacobsLadder.LadderSize;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
@ -75,7 +78,7 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return super.getStateFromMeta(meta).withProperty(size_property, LadderSize.values()[meta]);
return super.getStateFromMeta(meta).withProperty(size_property, TileEntityJacobsLadder.LadderSize.values()[meta]);
}
@Override

View file

@ -0,0 +1,40 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks.hv;
import blusunrize.immersiveengineering.common.blocks.BlockIEBase;
public enum BlockTypes_HVMultiblocks implements BlockIEBase.IBlockEnum {
MARX;
@Override
public int getMeta() {
return ordinal();
}
@Override
public boolean listForCreative() {
return false;
}
@Override
public String getName() {
return name().toLowerCase();
}
}

View file

@ -16,7 +16,7 @@
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks;
package malte0811.industrialWires.blocks.hv;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDirectionalTile;
@ -26,7 +26,11 @@ import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergyEmitter;
import ic2.api.energy.tile.IEnergySink;
import malte0811.industrialWires.IWConfig;
import malte0811.industrialWires.IWDamageSources;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.IBlockBoundsIW;
import malte0811.industrialWires.blocks.IHasDummyBlocksIW;
import malte0811.industrialWires.blocks.ISyncReceiver;
import malte0811.industrialWires.network.MessageTileSyncIW;
import malte0811.industrialWires.util.Beziers;
import malte0811.industrialWires.util.DualEnergyStorage;
@ -209,7 +213,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
initControl();
}
dummy = nbt.getInteger("dummy");
energy = DualEnergyStorage.readFromNBT(nbt.getCompoundTag("energy"));
energy.readFromNBT(nbt.getCompoundTag("energy"));
facing = EnumFacing.HORIZONTALS[nbt.getInteger("facing")];
salt = nbt.getDouble("salt");
}
@ -335,7 +339,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
}
private void hurtEntity(Entity e) {
e.attackEntityFrom(new DamageSource("industrialwires.jacobs_ladder"), IWConfig.HVStuff.jacobsBaseDmg * (size.ordinal() + 1));
e.attackEntityFrom(IWDamageSources.dmg_jacobs, IWConfig.HVStuff.jacobsBaseDmg * (size.ordinal() + 1));
}
public boolean onActivated(EntityPlayer player, EnumHand hand) {

View file

@ -0,0 +1,791 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.blocks.hv;
import blusunrize.immersiveengineering.api.IEProperties;
import blusunrize.immersiveengineering.api.TargetingInfo;
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
import blusunrize.immersiveengineering.api.energy.wires.WireType;
import blusunrize.immersiveengineering.api.energy.wires.redstone.IRedstoneConnector;
import blusunrize.immersiveengineering.api.energy.wires.redstone.RedstoneWireNetwork;
import blusunrize.immersiveengineering.common.IEContent;
import blusunrize.immersiveengineering.common.blocks.BlockTypes_MetalsIE;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces.IDirectionalTile;
import blusunrize.immersiveengineering.common.blocks.metal.*;
import blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWallmount;
import blusunrize.immersiveengineering.common.util.Utils;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
import elucent.albedo.event.GatherLightsEvent;
import elucent.albedo.lighting.Light;
import malte0811.industrialWires.*;
import malte0811.industrialWires.blocks.IBlockBoundsIW;
import malte0811.industrialWires.blocks.ISyncReceiver;
import malte0811.industrialWires.blocks.IWProperties;
import malte0811.industrialWires.blocks.TileEntityIWMultiblock;
import malte0811.industrialWires.hv.MarxOreHandler;
import malte0811.industrialWires.network.MessageTileSyncIW;
import malte0811.industrialWires.util.DualEnergyStorage;
import malte0811.industrialWires.util.MiscUtils;
import malte0811.industrialWires.wires.IC2Wiretype;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.function.BiConsumer;
import static malte0811.industrialWires.blocks.hv.TileEntityMarx.FiringState.FIRE;
import static malte0811.industrialWires.util.MiscUtils.getOffset;
import static malte0811.industrialWires.util.MiscUtils.offset;
import static net.minecraft.item.EnumDyeColor.*;
/**
* Channel: Purpose
* White: Coarse Vcharge
* Orange: Coarse bottom cap voltage
* Magenta: Coarse top voltage
* LBlue: Firing trigger
* Yellow: Fine Vcharge
* Lime: Fine bottom cap voltage
* Pink: Fine top cap voltage
*/
@Mod.EventBusSubscriber
public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable, ISyncReceiver, IBlockBoundsIW, IImmersiveConnectable, IIC2Connector,
IRedstoneConnector {
//Only relevant client-side.
private static final Set<TileEntityMarx> FIRING_GENERATORS = Collections.newSetFromMap(new WeakHashMap<>());
private static final String TYPE = "type";
private static final String STAGES = "stages";
private static final String HAS_CONN = "hasConn";
private static final String CAP_VOLTAGES = "capVoltages";
private double rcTimeConst;
private double timeFactor;
private double timeFactorBottom;
private final static double CAPACITANCE = 0.000_001_6;
private final static double MAX_VOLTAGE = 250_000;
public IWProperties.MarxType type = IWProperties.MarxType.NO_MODEL;
private int stageCount = 0;
public FiringState state = FiringState.CHARGING;
@SideOnly(Side.CLIENT)
public Discharge dischargeData;
// Voltage=100*storedEU
private DualEnergyStorage storage = new DualEnergyStorage(50_000, 32_000);
private boolean hasConnection;
private double[] capVoltages;
private int voltageControl = 0;
private boolean loaded = false;
private double leftover;
private long lastUpdate = -1;
TileEntityMarx(EnumFacing facing, IWProperties.MarxType type, boolean mirrored) {
this.facing = facing;
this.type = type;
this.mirrored = mirrored;
}
public TileEntityMarx() {}
@Override
public void writeNBT(NBTTagCompound out, boolean updatePacket) {
super.writeNBT(out, updatePacket);
out.setInteger(TYPE, type.ordinal());
out.setInteger(STAGES, stageCount);
out.setBoolean(HAS_CONN, hasConnection);
storage.writeToNbt(out, ENERGY_TAG);
NBTTagList voltages = new NBTTagList();
if (capVoltages != null) {
for (int i = 0; i < stageCount; i++) {
voltages.appendTag(new NBTTagDouble(capVoltages[i]));
}
}
out.setTag(CAP_VOLTAGES, voltages);
}
@Override
public void readNBT(NBTTagCompound in, boolean updatePacket) {
super.readNBT(in, updatePacket);
type = IWProperties.MarxType.values()[in.getInteger(TYPE)];
setStageCount(in.getInteger(STAGES));
NBTTagList voltages = in.getTagList(CAP_VOLTAGES, 6);//DOUBLE
capVoltages = new double[stageCount];
for (int i = 0;i<stageCount;i++) {
capVoltages[i] = voltages.getDoubleAt(i);
}
storage.readFromNBT(in.getCompoundTag(ENERGY_TAG));
hasConnection = in.getBoolean(HAS_CONN);
collisionAabb = null;
renderAabb = null;
}
@Nonnull
@Override
protected BlockPos getOrigin() {
return getPos().subtract(offset).offset(facing.getOpposite(), 3);
}
@SuppressWarnings("unchecked")
@Override
public IBlockState getOriginalBlock() {
int forward = getForward();
int right = getRight();
int up = offset.getY();
if (forward==0) {
return IEContent.blockMetalDevice0.getDefaultState().withProperty(IEContent.blockMetalDevice0.property, BlockTypes_MetalDevice0.CAPACITOR_HV);
} else if (forward==-1) {
return IEContent.blockConnectors.getDefaultState().withProperty(IEContent.blockConnectors.property, BlockTypes_Connector.RELAY_HV)
.withProperty(IEProperties.FACING_ALL, facing);
} else if (forward==4&&up==0&&right==1) {
return IEContent.blockStorage.getDefaultState().withProperty(IEContent.blockStorage.property, BlockTypes_MetalsIE.STEEL);
} else if (forward>0) {
if ((right==0&&up==0)||(right==1&&up==stageCount-1)) {
return IEContent.blockMetalDecoration1.getDefaultState().withProperty(IEContent.blockMetalDecoration1.property, BlockTypes_MetalDecoration1.STEEL_FENCE);
} else {
return IEContent.blockMetalDecoration2.getDefaultState().withProperty(IEContent.blockMetalDecoration2.property, BlockTypes_MetalDecoration2.STEEL_WALLMOUNT)
.withProperty(IEProperties.INT_4, 1-right).withProperty(IEProperties.FACING_ALL, facing.getOpposite());
}
} else if (forward==-2) {
return IEContent.blockMetalDecoration0.getDefaultState().withProperty(IEContent.blockMetalDecoration0.property, BlockTypes_MetalDecoration0.HEAVY_ENGINEERING);
} else if (right==0) {
return IEContent.blockConnectors.getDefaultState().withProperty(IEContent.blockConnectors.property, BlockTypes_Connector.CONNECTOR_REDSTONE)
.withProperty(IEProperties.FACING_ALL, facing);
} else {
return IEContent.blockConnectors.getDefaultState().withProperty(IEContent.blockConnectors.property, BlockTypes_Connector.CONNECTOR_HV)
.withProperty(IEProperties.FACING_ALL, facing);
}
}
@Override
public BiConsumer<World, BlockPos> getOriginalBlockPlacer() {
IBlockState original = getOriginalBlock();
if (original!=null) {
return (w, p) -> {
w.setBlockState(p, original);
TileEntity te = w.getTileEntity(p);
if (te instanceof IDirectionalTile&&original.getProperties().containsKey(IEProperties.FACING_ALL)) {
((IDirectionalTile) te).setFacing(original.getValue(IEProperties.FACING_ALL));
te.markDirty();
}
if (te instanceof TileEntityWallmount) {
((TileEntityWallmount) te).orientation = original.getValue(IEProperties.INT_4);
}
};
}
return (a, b)->IndustrialWires.logger.warn(a+", "+b+" wasn't found");//NOP
}
@Override
public void update() {
FIRING_GENERATORS.remove(this);
switch (state) {
case NEXT_TICK:
state = FIRE;
if (world.isRemote) {
FIRING_GENERATORS.add(this);
IndustrialWires.proxy.playMarxBang(this, getMiddle(), (float) getNormedEnergy(dischargeData.energy));
} else {
fire();
}
break;
case FIRE:
state = FiringState.CHARGING;
break;
}
if (!world.isRemote&&type== IWProperties.MarxType.BOTTOM) {
if (capVoltages == null || capVoltages.length != stageCount) {
capVoltages = new double[stageCount];
}
final double oldTopVoltage = capVoltages[stageCount - 1];
final double oldBottomVoltage = capVoltages[0];
for (int i = stageCount - 1; i > 0; i--) {
double oldVoltage = capVoltages[i];
double u0 = capVoltages[i - 1];
capVoltages[i] = u0 - (u0 - oldVoltage) * timeFactor;
capVoltages[i - 1] -= capVoltages[i] - oldVoltage;
}
//charge bottom cap from storage
double setVoltage = MAX_VOLTAGE * voltageControl / 255F;
double u0 = Math.min(setVoltage, 100 * storage.getEnergyStoredEU());
if (u0 < 0) {
u0 = 0;
}
if (u0 < capVoltages[0] && setVoltage > capVoltages[0]) {
u0 = capVoltages[0];
}
double tmp = u0 - (u0 - oldBottomVoltage) * timeFactorBottom;
double energyUsed = .5 * (tmp * tmp - oldBottomVoltage * oldBottomVoltage) * CAPACITANCE;
if (energyUsed > 0 && storage.extractEU(energyUsed, false) == energyUsed) {// energyUsed can be negative when discharging the caps
storage.extractEU(energyUsed, true);
capVoltages[0] = tmp;
} else if (energyUsed <= 0) {
capVoltages[0] = tmp;
}
int delta = (int) (lastUpdate+15-world.getTotalWorldTime());
if (Math.abs(getRSSignalFromVoltage(oldBottomVoltage)-getRSSignalFromVoltage(capVoltages[0]))>delta) {
net.updateValues();
} else if (Math.abs(getRSSignalFromVoltage(oldTopVoltage)-getRSSignalFromVoltage(capVoltages[stageCount-1]))>delta) {
net.updateValues();
}
if (capVoltages[0] > MAX_VOLTAGE * 14.5 / 15) {
state = FiringState.NEXT_TICK;
}
}
leftover = storage.getMaxInputIF();
}
private void fire() {
if (!world.isRemote) {
//calculate energy
double energyStored = 0;
boolean failed = capVoltages[0]<MAX_VOLTAGE*.5;
double totalVoltage = 0;
for (int i = 0;i<stageCount;i++) {
energyStored += .5*capVoltages[i]*capVoltages[i]*CAPACITANCE;
totalVoltage += capVoltages[i];
capVoltages[i] = 0;
}
if (totalVoltage<.1*MAX_VOLTAGE*stageCount) {
return;
}
failed |= totalVoltage<MAX_VOLTAGE*.3*stageCount;
net.updateValues();
NBTTagCompound data = new NBTTagCompound();
if (failed) {
energyStored = -energyStored;
} else {
int seed = Utils.RAND.nextInt();
genDischarge((float) energyStored, seed);//TODO test on a dedicated server
data.setInteger("randSeed", seed);
handleEntities(energyStored);
handleOreProcessing(energyStored);//After entities to prevent killing the newly dropped items
}
data.setDouble("energy", energyStored);
IndustrialWires.packetHandler.sendToDimension(new MessageTileSyncIW(this, data), world.provider.getDimension());
}
}
private void handleOreProcessing(double energyStored) {
BlockPos bottom = getBottomElectrode();
Vec3d origin = new Vec3d(bottom).addVector(.5, 1, .5);
Set<BlockPos> toBreak = new HashSet<>(dischargeData.vertices.length);
int ores = 0;
for (int i = 1;i<dischargeData.vertices.length;i++) {
Vec3d vecHere = origin.add(dischargeData.vertices[i]);
BlockPos blockHere = new BlockPos(vecHere);
if (!world.isAirBlock(blockHere) && canBreak(blockHere)) {
toBreak.add(blockHere);
ores++;
}
}
if (ores>0) {
double energyPerOre = energyStored / ores;
for (BlockPos here:toBreak) {
IBlockState state = world.getBlockState(here);
if (state.getBlockHardness(world, here) < 0) {
continue;
}
if (!world.isAirBlock(here)) {
ItemStack[] out = MarxOreHandler.getYield(world, here, energyPerOre);
for (ItemStack stack : out) {
EntityItem item = new EntityItem(world, here.getX() + .5, here.getY() + .5, here.getZ() + .5, stack);
final double maxMotion = .3;
item.motionX = 2 * maxMotion * (Utils.RAND.nextDouble() - .5);
item.motionY = 2 * maxMotion * (Utils.RAND.nextDouble() - .5);
item.motionZ = 2 * maxMotion * (Utils.RAND.nextDouble() - .5);
world.spawnEntity(item);
}
world.setBlockToAir(here);
}
}
}
}
private void handleEntities(double energyStored) {
Vec3d v0 = getMiddle();
AxisAlignedBB aabb = new AxisAlignedBB(v0, v0);
aabb = aabb.grow(0, stageCount/2-1,0);
final double sqrtStages = Math.sqrt(stageCount);
aabb = aabb.grow(5*sqrtStages);
List<Entity> fools = world.getEntitiesWithinAABB(Entity.class, aabb);
double energyNormed = getNormedEnergy(energyStored);
double damageDistSqu = energyNormed * stageCount;
double tinnitusDistSqu = 5 * energyNormed * stageCount;
damageDistSqu *= damageDistSqu;
tinnitusDistSqu *= tinnitusDistSqu;
if (IWConfig.HVStuff.marxSoundDamage == 2) {
damageDistSqu = tinnitusDistSqu;
tinnitusDistSqu = -1;
}
for (Entity entity : fools) {
double y;
if (entity.posY<pos.getY()+1) {
y = pos.getY()+1;
} else if (entity.posY>pos.getY()+stageCount-2) {
y = pos.getY()+stageCount-2;
} else {
y = entity.posY;
}
double distSqu = entity.getDistanceSq(v0.x, y, v0.z);
if (distSqu<=damageDistSqu) {
float dmg = (float) (10*stageCount*(1-distSqu/damageDistSqu));
entity.attackEntityFrom(IWDamageSources.dmg_marx, dmg);
}
if (distSqu<=tinnitusDistSqu && entity instanceof EntityPlayer) {
ItemStack helmet = ((EntityPlayer) entity).inventory.armorInventory.get(3);
boolean earMuff = helmet.getItem()==IEContent.itemEarmuffs;
if (!earMuff&&helmet.hasTagCompound()) {
earMuff = helmet.getTagCompound().hasKey("IE:Earmuffs");
}
if (!earMuff) {
double multipl = Math.min(5, Math.sqrt(stageCount));
int duration = (int) (20*20*(1+multipl*(1-distSqu/tinnitusDistSqu)));
if (IWConfig.HVStuff.marxSoundDamage == 0) {
((EntityPlayer) entity).addPotionEffect(new PotionEffect(IWPotions.tinnitus, duration));
} else {
((EntityPlayer) entity).addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("nausea"), duration));
}
}
}
}
}
//checks whether the given pos can't be broken because it is part of the generator
private boolean canBreak(BlockPos pos) {
BlockPos dischargePos = offset(this.pos, facing, mirrored, 1, 3, 0);
Vec3i offset = getOffset(dischargePos, facing, mirrored, pos);
if (offset.getZ()<1||offset.getZ()>=stageCount-1) {
return false;
}
return Math.abs(offset.getX())>Math.abs(offset.getY());
}
private int getRSSignalFromVoltage(double voltage) {
return (int) (Math.round(255 * voltage / MAX_VOLTAGE)&0xff);
}
@Override
public Vec3i getSize() {
return new Vec3i(stageCount, 8, 2);
}
@Override
public void onSync(NBTTagCompound nbt) {
state = FiringState.NEXT_TICK;
float energy = nbt.getFloat("energy");
if (energy>0) {
genDischarge(energy, nbt.getInteger("randSeed"));
} else {
if (dischargeData==null) {
dischargeData = new Discharge(stageCount);
}
dischargeData.energy = energy;
}
}
private void genDischarge(float energy, int seed) {
if (dischargeData==null) {
dischargeData = new Discharge(stageCount);
}
dischargeData.energy = energy;
dischargeData.diameter = (float) getNormedEnergy(dischargeData.energy);
dischargeData.genMarxPoint(seed);
}
private double getNormedEnergy(double total) {
return total*2/(stageCount*MAX_VOLTAGE*MAX_VOLTAGE*CAPACITANCE);
}
private AxisAlignedBB renderAabb = null;
@Nonnull
@Override
public AxisAlignedBB getRenderBoundingBox() {
if (renderAabb ==null) {
if (type== IWProperties.MarxType.BOTTOM) {
renderAabb = new AxisAlignedBB(pos,
offset(pos, facing, mirrored, 2, 4, stageCount));
} else {
renderAabb = new AxisAlignedBB(pos, pos);
}
}
return renderAabb;
}
private AxisAlignedBB collisionAabb = null;
@Override
public AxisAlignedBB getBoundingBox() {
if (collisionAabb ==null) {
int forward = getForward();
int right = getRight();
int up = offset.getY();
AxisAlignedBB ret = Block.FULL_BLOCK_AABB;
switch (forward) {
case -3://IO
if (right == 1) {
ret = new AxisAlignedBB(5 / 16D, 5 / 16D, .25, 11 / 16D, 11 / 16D, 1);
} else {
ret = new AxisAlignedBB(5 / 16D, 5 / 16D, 7 / 16D, 11 / 16D, 11 / 16D, 1);
}
break;
case -1://charging resistors
if (up == 0) {
ret = new AxisAlignedBB(.375, 0, 0, .625, 1, 1);
} else if (up == stageCount - 1) {
ret = new AxisAlignedBB(.375, 0, 9 / 16D, .625, 5 / 16D, 1);
} else {
ret = new AxisAlignedBB(.375, 0, 9 / 16D, .625, 1, 1);
}
break;
case 1://spark gaps
if (right == 0) {
if (up!=0) {
ret = new AxisAlignedBB(0, 0, 0, 9 / 16D, up == stageCount - 1 ? .5 : 1, 7 / 16D);
} else {
ret = new AxisAlignedBB(7/16D, 0, 0, 9/16D, 5/16D, 1);
}
} else {
if (stageCount - 1 == up) {
ret = new AxisAlignedBB(7 / 16D, 3 / 16D, 0, 9 / 16D, 5 / 16D, 1);
} else {
ret = new AxisAlignedBB(7 / 16D, 0, 0, 1, 1, 7 / 16D);
}
}
break;
case -2://Controller
break;
case 0://Caps
if (up == stageCount - 1) {
ret = new AxisAlignedBB(0, 0, 0, 1, .5, 1);
}
break;
default:
if (right == 0) {
if (forward<4) {
ret = new AxisAlignedBB(7/16D, 0, 0, 9/16D, 5/16D, 1);
} else {
ret = new AxisAlignedBB(0, 0, 0, 9/16D, 5/16D, 9/16D);
}
} else {
if (up==0) {
ret = Block.FULL_BLOCK_AABB;
} else if (forward < 4) {
ret = new AxisAlignedBB(7 / 16D, 3 / 16D, 0, 9 / 16D, 5 / 16D, 1);
} else {
ret = new AxisAlignedBB(6 / 16D, 1 / 16D, 0, 10 / 16D, 5 / 16D, 10 / 16D);
}
}
}
collisionAabb = MiscUtils.apply(getBaseTransform(), ret);
}
return collisionAabb;
}
private Matrix4 getBaseTransform() {
Matrix4 transform = new Matrix4();
transform.translate(.5, 0, .5);
transform.rotate(facing.getHorizontalAngle() * Math.PI / 180, 0, 1, 0);
if (mirrored) {
transform.scale(-1, 1, 1);
}
transform.translate(-.5, 0, -.5);
return transform;
}
//WIRE STUFF
@Override
public boolean canConnect() {
return getForward()==-3;
}
@Override
public boolean isEnergyOutput() {
return getForward()==-3&&getRight()==1;
}
@Override
public int outputEnergy(int amount, boolean simulate, int energyType) {
TileEntityMarx master = master(this);
if (master!=null && amount>0) {
double ret = master.storage.insertIF(amount, leftover, !simulate);
leftover -= ret;
return (int) ret;
} else {
return 0;
}
}
@Override
public double insertEnergy(double eu, boolean simulate) {
TileEntityMarx master = master(this);
if (master!=null) {
double ret = master.storage.insertEU(eu, leftover, !simulate);
leftover -= ret;
return eu-ret;
} else {
return 0;
}
}
@Override
public BlockPos getConnectionMaster(@Nullable WireType cableType, TargetingInfo target) {
return pos;
}
@Override
public boolean canConnectCable(WireType cableType, TargetingInfo target) {
if (hasConnection) {
return false;
}
if (getRight()==0) {
return cableType==WireType.REDSTONE;
} else {
return cableType==WireType.STEEL||cableType== IC2Wiretype.IC2_TYPES[3];
}
}
@Override
public void connectCable(WireType cableType, TargetingInfo target, IImmersiveConnectable other) {
hasConnection = true;
}
@Override
public WireType getCableLimiter(TargetingInfo target) {
return getRight()==0?WireType.REDSTONE:IC2Wiretype.IC2_TYPES[3];
}
@Override
public boolean allowEnergyToPass(ImmersiveNetHandler.Connection con) {
return false;
}
@Override
public void onEnergyPassthrough(int amount) {
}
@Override
public void removeCable(ImmersiveNetHandler.Connection connection) {
hasConnection = false;
}
@Override
public Vec3d getRaytraceOffset(IImmersiveConnectable link) {
Matrix4 transf = getBaseTransform();
if (getRight()==0) {
return transf.apply(new Vec3d(.5, .5, 7/16D));
} else {
return transf.apply(new Vec3d(.5, .5, 4/16D));
}
}
@Override
public Vec3d getConnectionOffset(ImmersiveNetHandler.Connection con) {
return getRaytraceOffset(null);
}
private RedstoneWireNetwork net = new RedstoneWireNetwork();
@Override
public void setNetwork(RedstoneWireNetwork net) {
masterOr(this, this).net = net;
}
@Override
public RedstoneWireNetwork getNetwork() {
TileEntityMarx master = masterOr(this, this);
if (!loaded) {
master.net.add(this);
loaded = true;
}
return master.net;
}
@Override
public void onChange() {
TileEntityMarx master = masterOr(this, this);
master.voltageControl = (master.net.channelValues[WHITE.getMetadata()]<<4)|master.net.channelValues[YELLOW.getMetadata()];
if (master.net.channelValues[LIGHT_BLUE.getMetadata()]!=0) {
master.tryTriggeredDischarge();
}
master.lastUpdate = world.getTotalWorldTime();
}
private void tryTriggeredDischarge() {
state = FiringState.NEXT_TICK;
}
@Override
public World getConnectorWorld() {
return world;
}
@Override
public void updateInput(byte[] signals) {
TileEntityMarx master = masterOr(this, this);
if (master.capVoltages!=null&&master.capVoltages.length==stageCount) {
int signalTop = getRSSignalFromVoltage(master.capVoltages[stageCount-1]);
int signalBottom = getRSSignalFromVoltage(master.capVoltages[0]);
setSignal(ORANGE.getMetadata(), (signalBottom>>4)&0xf, signals);
setSignal(MAGENTA.getMetadata(), (signalTop>>4)&0xf, signals);
setSignal(LIME.getMetadata(), signalBottom&0xf, signals);
setSignal(PINK.getMetadata(), signalTop&0xf, signals);
}
}
private void setSignal(int channel, int value, byte[] signals) {
signals[channel] = (byte) Math.max(value, signals[channel]);
}
public void setStageCount(int stageCount) {
this.stageCount = stageCount;
rcTimeConst = 5D/stageCount;
timeFactor = Math.exp(-1/(20*rcTimeConst));
timeFactorBottom = Math.exp(-1 / (20 * rcTimeConst * 2 / 3));
collisionAabb = null;
renderAabb = null;
}
public int getStageCount() {
return stageCount;
}
private Vec3d getMiddle() {
double middleY = pos.getY()+(stageCount)/2D;
Vec3i electrodXZ = getBottomElectrode();
return new Vec3d(electrodXZ.getX()+.5, middleY, electrodXZ.getZ()+.5);
}
private BlockPos getBottomElectrode() {
return offset(pos, facing, mirrored, 1, 4, 0);
}
@Optional.Method(modid="albedo")
@SubscribeEvent
public static void gatherLights(GatherLightsEvent event) {
for (TileEntityMarx te:FIRING_GENERATORS) {
Vec3d origin = te.getMiddle().subtract(0, .5*te.stageCount+1,0);
Light.Builder builder = Light.builder()
.color(1, 1, 1)
.radius(5);
List<Light> toAdd = new ArrayList<>(te.stageCount*2-3);
if (te.dischargeData!=null&&te.dischargeData.energy>0) {
for (int i = 1;i<te.stageCount-1;i++) {
toAdd.add(builder.pos(origin.addVector(0, i, 0)).build());
}
}
origin = new Vec3d(offset(te.pos, te.facing, te.mirrored, 1, 0, 0))
.addVector(0, .75, 0)
.add(new Vec3d(te.facing.getDirectionVec()).scale(.25));
builder.radius(.5F);
for (int i = 0;i<te.stageCount-1;i++) {
toAdd.add(builder.pos(origin.addVector(0, i, 0)).build());
}
event.getLightList().addAll(toAdd);
}
}
public enum FiringState {
CHARGING,
NEXT_TICK,
FIRE
}
public static final class Discharge {
public float energy;
public Vec3d[] vertices;
public float diameter = .25F;
final int stageCount;
Discharge(int stages) {
stageCount = stages;
int count = 1;
while (count<stageCount) {
count <<= 1;
}
count = 8;
vertices = new Vec3d[2*count];
vertices[0] = new Vec3d(0, -.5F, 0);
for (int i = 1;i<vertices.length;i++) {
vertices[i] = new Vec3d(0, 0, 0);
}
vertices[vertices.length-1] = new Vec3d(0, stageCount-1.9375F, 0);
}
// Meant to be const
private final Vec3d side = new Vec3d(0, 0, 1);
//used for calculation buffering
private Vec3d diff;
private Vec3d center;
private Vec3d v0;
private Matrix4 transform = new Matrix4();
void genMarxPoint(int randSeed) {
genMarxPoint(0, vertices.length-1, new Random(randSeed));
}
/**
* @param min The first point of the discharge section to be generated. has to be pre-populated
* @param max The last point of the discharge section to be generated. has to be pre-populated
*/
void genMarxPoint(int min, int max, Random rand) {
int toGenerate = (min+max)/2;
diff = vertices[max].subtract(vertices[min]);
v0 = diff.crossProduct(side);
transform.setIdentity();
double diffLength = diff.lengthVector();
double noise = Math.sqrt(diffLength)*rand.nextDouble()*1/(1+Math.abs(stageCount/2.0-toGenerate))*.75;
if ((max-min)%2==1) {
noise *= (toGenerate-min)/(double)(max-min);
}
v0 = v0.scale((float) (noise/v0.lengthVector()));
diff = diff.scale(1/diffLength);
transform.rotate(Math.PI*2*rand.nextDouble(), diff.x, diff.y, diff.z);
center = vertices[max].add(vertices[min]).scale(.5);
vertices[toGenerate] = transform.apply(v0);
vertices[toGenerate] = center.add(vertices[toGenerate]);
if (toGenerate-min>1) {
genMarxPoint(min, toGenerate, rand);
}
if (max-toGenerate>1) {
genMarxPoint(toGenerate, max, rand);
}
}
}
}

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;
@ -28,48 +30,46 @@ import com.google.common.collect.ImmutableMap;
import ic2.api.item.IC2Items;
import malte0811.industrialWires.CommonProxy;
import malte0811.industrialWires.IWConfig;
import malte0811.industrialWires.IWPotions;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.IMetaEnum;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.controlpanel.BlockTypes_Panel;
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanelCreator;
import malte0811.industrialWires.blocks.controlpanel.TileEntityRSPanelConn;
import malte0811.industrialWires.blocks.hv.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.hv.TileEntityMarx;
import malte0811.industrialWires.client.gui.GuiPanelComponent;
import malte0811.industrialWires.client.gui.GuiPanelCreator;
import malte0811.industrialWires.client.gui.GuiRSPanelConn;
import malte0811.industrialWires.client.gui.GuiRenameKey;
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.crafting.IC2TRHelper;
import malte0811.industrialWires.items.ItemIC2Coil;
import malte0811.industrialWires.items.ItemKey;
import malte0811.industrialWires.items.ItemPanelComponent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
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.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.relauncher.Side;
import java.util.*;
@ -112,22 +112,29 @@ public class ClientProxy extends CommonProxy {
IndustrialWires.MODID + ":blocks/ic2_relay_glass"));
}
ConnLoader.baseModels.put("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj"));
ConnLoader.baseModels.put("empty", new ResourceLocation("builtin/generated"));
OBJLoader.INSTANCE.addDomain(IndustrialWires.MODID);
ModelLoaderRegistry.registerLoader(new PanelModelLoader());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJacobsLadder.class, new TileRenderJacobsLadder());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMarx.class, new TileRenderMarx());
}
@Override
public void postInit() {
super.postInit();
ManualInstance m = ManualHelper.getManual();
if (IndustrialWires.hasIC2) {
if (IndustrialWires.hasIC2)
{
PositionedItemStack[][] wireRecipes = new PositionedItemStack[3][10];
int xBase = 15;
Ingredient tinCable = IC2TRHelper.getStack("cable", "type:tin,insulation:0");
List<ItemStack> tinCableList = Arrays.asList(tinCable.getMatchingStacks());
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
wireRecipes[0][3 * i + j] = new PositionedItemStack(tinCableList, 18 * i + xBase, 18 * j);
}
}
@ -135,15 +142,20 @@ public class ClientProxy extends CommonProxy {
ItemIC2Coil.setLength(tmp, 9);
wireRecipes[0][9] = new PositionedItemStack(tmp, 18 * 4 + xBase, 18);
Random r = new Random();
for (int i = 1; i < 3; i++) {
for (int i = 1; i < 3; i++)
{
int lengthSum = 0;
for (int j1 = 0; j1 < 3; j1++) {
for (int j2 = 0; j2 < 3; j2++) {
if (r.nextBoolean()) {
for (int j1 = 0; j1 < 3; j1++)
{
for (int j2 = 0; j2 < 3; j2++)
{
if (r.nextBoolean())
{
// cable
lengthSum++;
wireRecipes[i][3 * j1 + j2] = new PositionedItemStack(tinCableList, 18 * j1 + xBase, 18 * j2);
} else {
} else
{
// wire coil
int length = r.nextInt(99) + 1;
tmp = new ItemStack(IndustrialWires.coil);
@ -164,7 +176,8 @@ public class ClientProxy extends CommonProxy {
new ManualPages.Text(m, "industrialwires.wires1"),
new ManualPages.CraftingMulti(m, "industrialwires.wires2", (Object[]) wireRecipes)
);
if (IndustrialWires.mechConv != null) {
if (IndustrialWires.mechConv != null)
{
m.addEntry("industrialwires.mechConv", "industrialwires",
new ManualPages.Crafting(m, "industrialwires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)),
new ManualPages.Crafting(m, "industrialwires.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)),
@ -172,7 +185,12 @@ public class ClientProxy extends CommonProxy {
);
}
}
ClientUtils.mc().getItemColors().registerItemColorHandler((stack, pass) -> {
int oldLength = Config.IEConfig.Tools.earDefenders_SoundBlacklist.length;
Config.IEConfig.Tools.earDefenders_SoundBlacklist =
Arrays.copyOf(Config.IEConfig.Tools.earDefenders_SoundBlacklist, oldLength + 1);
Config.IEConfig.Tools.earDefenders_SoundBlacklist[oldLength] = TINNITUS_LOC.toString();
ClientUtils.mc().getItemColors().registerItemColorHandler((stack, pass) -> {
if (pass == 1) {
PanelComponent pc = ItemPanelComponent.componentFromStack(stack);
if (pc != null) {
@ -182,9 +200,16 @@ public class ClientProxy extends CommonProxy {
return ~0;
}, IndustrialWires.panelComponent);
if (IndustrialWires.mechConv != null) {
m.addEntry("industrialwires.mechConv", "industrialwires",
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))
);
}
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 +244,81 @@ 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");
private static ISound playingTinnitus = null;
@Override
public void startTinnitus() {
final Minecraft mc = Minecraft.getMinecraft();
if (playingTinnitus==null) {
playingTinnitus = getTinnitus();
mc.getSoundHandler().playSound(playingTinnitus);
}
}
private ISound getTinnitus() {
final Minecraft mc = Minecraft.getMinecraft();
return new MovingSound(new SoundEvent(TINNITUS_LOC), SoundCategory.PLAYERS) {
@Override
public void update() {
if (mc.player.getActivePotionEffect(IWPotions.tinnitus)==null) {
donePlaying = true;
playingTinnitus = null;
}
}
@Override
public float getVolume() {
return .1F;
}
@Override
public float getXPosF() {
return (float) mc.player.posX;
}
@Override
public float getYPosF() {
return (float) mc.player.posY;
}
@Override
public float getZPosF() {
return (float) mc.player.posZ;
}
@Override
public boolean canRepeat() {
return true;
}
};
}
@Override
@ -230,6 +330,8 @@ public class ClientProxy extends CommonProxy {
private static ResourceLocation jacobsStart = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_start");//~470 ms ~=9 ticks
private static ResourceLocation jacobsMiddle = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_middle");
private static ResourceLocation jacobsEnd = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_end");//~210 ms ~= 4 ticks
private static ResourceLocation marxBang = new ResourceLocation(IndustrialWires.MODID, "marx_bang");
private static ResourceLocation marxPop = new ResourceLocation(IndustrialWires.MODID, "marx_pop");
@Override
public void playJacobsLadderSound(TileEntityJacobsLadder te, int phase, Vec3d soundPos) {
@ -256,6 +358,18 @@ public class ClientProxy extends CommonProxy {
playingSounds.put(te.getPos(), sound);
}
@Override
public void playMarxBang(TileEntityMarx te, Vec3d pos, float energy) {
ResourceLocation soundLoc = marxBang;
if (energy<0) {
energy = -energy;
soundLoc = marxPop;
}
PositionedSoundRecord sound = new PositionedSoundRecord(soundLoc, SoundCategory.BLOCKS, 5*energy, 1, false, 0, ISound.AttenuationType.LINEAR, (float) pos.x, (float) pos.y, (float) pos.z);
ClientUtils.mc().getSoundHandler().playSound(sound);
playingSounds.put(te.getPos(), sound);
}
@Override
public Gui getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == 0) {

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

@ -135,6 +135,11 @@ public class GuiPanelComponent extends GuiContainer {
sync(i, picker.getSelected());
}
if (stopNow) {
for (GuiChannelPicker picker2:rsChannelChoosers) {
if (picker!=picker2&&picker2 instanceof GuiChannelPickerSmall) {
((GuiChannelPickerSmall) picker2).close();
}
}
return;
}
}
@ -192,9 +197,6 @@ public class GuiPanelComponent extends GuiContainer {
this.renderHoveredToolTip(mouseX, mouseY);
GlStateManager.color(1, 1, 1, 1);
RenderHelper.disableStandardItemLighting();
for (GuiChannelPicker pick : rsChannelChoosers) {
pick.drawButton(mc, mouseX, mouseY, partialTicks);
}
for (GuiButtonCheckbox box : boolButtons) {
box.drawButton(mc, mouseX, mouseY, partialTicks);
}
@ -207,12 +209,24 @@ public class GuiPanelComponent extends GuiContainer {
for (GuiSliderIE choose : floatSliders) {
choose.drawButton(mc, mouseX, mouseY, partialTicks);
}
GuiChannelPickerSmall openPicker = null;
for (GuiChannelPicker pick : rsChannelChoosers) {
if (pick instanceof GuiChannelPickerSmall&&((GuiChannelPickerSmall) pick).open) {
openPicker = (GuiChannelPickerSmall) pick;
} else {
pick.drawButton(mc, mouseX, mouseY, partialTicks);
}
}
if (openPicker != null) {
openPicker.drawButton(mc, mouseX, mouseY, partialTicks);
}
//TOOLTIPS
for (int i = 0; i < rsChannelChoosers.size(); i++) {
GuiChannelPicker pick = rsChannelChoosers.get(i);
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.RS_CHANNEL, i);
if (tooltip != null && pick.isHovered(mouseX, mouseY)) {
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
return;
}
}
for (int i = 0; i < boolButtons.size(); i++) {
@ -220,6 +234,7 @@ public class GuiPanelComponent extends GuiContainer {
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.BOOL, i);
if (tooltip != null && box.isMouseOver()) {
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
return;
}
}
for (int i = 0; i < stringTexts.size(); i++) {
@ -228,6 +243,7 @@ public class GuiPanelComponent extends GuiContainer {
if (tooltip != null && mouseX >= field.x && mouseX < field.x + field.width &&
mouseY >= field.y && mouseY < field.y + field.height) {
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
return;
}
}
for (int i = 0; i < intChoosers.size(); i++) {
@ -235,6 +251,7 @@ public class GuiPanelComponent extends GuiContainer {
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.INT, i);
if (tooltip != null && choose.isMouseOver(mouseX, mouseY)) {
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
return;
}
}
for (int i = 0; i < floatSliders.size(); i++) {
@ -242,6 +259,7 @@ public class GuiPanelComponent extends GuiContainer {
String tooltip = confComp.fomatConfigDescription(IConfigurableComponent.ConfigType.FLOAT, i);
if (tooltip != null && choose.isMouseOver()) {
ClientUtils.drawHoveringText(ImmutableList.of(tooltip), mouseX, mouseY, mc.fontRenderer);
return;
}
}
}

View file

@ -39,14 +39,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import org.apache.commons.lang3.tuple.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
public class GuiPanelCreator extends GuiContainer {
public int panelSize = 128;
private ContainerPanelCreator container;
private boolean snapToGrid = false;
private int snapToGrid = 0;
private ResourceLocation textureLoc = new ResourceLocation(IndustrialWires.MODID, "textures/gui/panel_creator.png");
public GuiPanelCreator(InventoryPlayer ip, TileEntityPanelCreator te) {
@ -60,23 +66,123 @@ public class GuiPanelCreator extends GuiContainer {
GlStateManager.color(1, 1, 1, 1);
mc.getTextureManager().bindTexture(textureLoc);
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
for (PanelComponent pc : container.tile.components) {
drawPanelComponent(pc, -1, -1);
}
int x0 = getX0();
int y0 = getY0();
int xRel = mouseX - x0;
int yRel = mouseY - y0;
if (snapToGrid) {
xRel = (int) Math.floor(xRel * 16 / panelSize) * panelSize / 16;
yRel = (int) Math.floor(yRel * 16 / panelSize) * panelSize / 16;
}
for (PanelComponent pc : container.tile.components) {
drawPanelComponent(pc, -1, -1);
}
PanelComponent curr = getFloatingPC();
if (curr != null && 0 <= xRel && xRel <= panelSize && 0 <= yRel && yRel <= panelSize) {
Runnable after = ()->{};
if (snapToGrid != 0) {
curr.setX(xRel/(float)panelSize);
curr.setY(yRel/(float)panelSize);
BiFunction<Integer, Integer, Integer> right = (a, b)->b;
BiFunction<Integer, Integer, Integer> left = (a, b)->a;
Function<PanelComponent, Double> xSize = (pc)->{
AxisAlignedBB aabb = pc.getBlockRelativeAABB();
return aabb.maxX-aabb.minX;
};
Function<PanelComponent, Double> ySize = (pc)->{
AxisAlignedBB aabb = pc.getBlockRelativeAABB();
return aabb.maxZ-aabb.minZ;
};
Pair<Integer, Runnable> xSnap = snapToGrid(xRel, curr, PanelComponent::getX, PanelComponent::getY,
xSize, ySize, left, right);
xRel = xSnap.getLeft();
Pair<Integer, Runnable> ySnap = snapToGrid(yRel, curr, PanelComponent::getY, PanelComponent::getX,
ySize, xSize, right, left);
yRel = ySnap.getLeft();
after = ()->{
xSnap.getRight().run();
ySnap.getRight().run();
};
}
drawPanelComponent(curr, xRel, yRel);
after.run();
}
}
private Pair<Integer, Runnable> snapToGrid(int mouse, PanelComponent toPlace, Function<PanelComponent, Float> pos, Function<PanelComponent, Float> pos2,
Function<PanelComponent, Double> size,Function<PanelComponent, Double> size2,
BiFunction<Integer, Integer, Integer> getY, BiFunction<Integer, Integer, Integer> getX) {
List<PanelComponent> components = container.tile.components;
if (snapToGrid==2&&!components.isEmpty()) {
List<Pair<PanelComponent, Double>> compLefts = new ArrayList<>(components.size());
List<Pair<PanelComponent, Double>> compCenters = new ArrayList<>(components.size());
List<Pair<PanelComponent, Double>> compRights = new ArrayList<>(components.size());
for (PanelComponent pc : components) {
double compLeft = pos.apply(pc);
double compSize = size.apply(pc);
compLefts.add(new ImmutablePair<>(pc, compLeft));
compRights.add(new ImmutablePair<>(pc, compLeft + compSize));
compCenters.add(new ImmutablePair<>(pc, compLeft + compSize / 2));
}
double mainLeft = pos.apply(toPlace);
double mainSize = size.apply(toPlace);
double mainRight = mainLeft + mainSize;
double mainCenter = (mainRight + mainLeft) / 2;
Triple<PanelComponent, ComponentSnapType, Double> min = getMinDist(compLefts, mainLeft, mainCenter, mainRight);
{
Triple<PanelComponent, ComponentSnapType, Double> tmpMin = getMinDist(compCenters, mainLeft, mainCenter, mainRight);
if (Math.abs(tmpMin.getRight()) < Math.abs(min.getRight())) {
min = tmpMin;
}
tmpMin = getMinDist(compRights, mainLeft, mainCenter, mainRight);
if (Math.abs(tmpMin.getRight()) < Math.abs(min.getRight())) {
min = tmpMin;
}
}
if (Math.abs(min.getRight())<.5/16) {
int ret = (int)(mouse+min.getRight()*panelSize);
PanelComponent snappedTo = min.getLeft();
ComponentSnapType type = min.getMiddle();
return new ImmutablePair<>(ret,()->{
int hor1, hor2;
float posOther = pos2.apply(toPlace);
hor1 = Math.round(Math.min(posOther, pos2.apply(snappedTo))*panelSize);
hor2 = (int) Math.round(Math.max(posOther+size2.apply(toPlace), pos2.apply(snappedTo)+size2.apply(snappedTo))*panelSize);
int vert1 = (int) (ret+(.5*type.ordinal())*mainSize*panelSize);
int vert2 = vert1+1;
int x0 = getX0(), y0 = getY0();
drawRect(x0+getX.apply(hor1, vert1), y0+getY.apply(hor1, vert1), x0+getX.apply(hor2, vert2),
y0+getY.apply(hor2, vert2), 0xff666666);
});
}
}
if (snapToGrid!=0) {
mouse = Math.round(mouse * 16 / panelSize) * panelSize / 16;
}
return new ImmutablePair<>(mouse, ()->{});
}
private Triple<PanelComponent, ComponentSnapType, Double> getMinDist(List<Pair<PanelComponent, Double>> comps,
double left, double center, double right) {
Pair<PanelComponent, Double> tmpMin = Collections.min(comps, Comparator.comparingDouble(a -> Math.abs(a.getRight() - left)));
Triple<PanelComponent, ComponentSnapType, Double> totalMin = new ImmutableTriple<>(tmpMin.getLeft(), ComponentSnapType.LEFT,
tmpMin.getRight()-left);
tmpMin = Collections.min(comps, Comparator.comparingDouble(a -> Math.abs(a.getRight() - center)));
if (Math.abs(tmpMin.getRight() - center)<Math.abs(totalMin.getRight())) {
totalMin = new ImmutableTriple<>(tmpMin.getLeft(), ComponentSnapType.CENTER,
tmpMin.getRight()-center);
}
tmpMin = Collections.min(comps, Comparator.comparingDouble(a -> Math.abs(a.getRight() - right)));
if (Math.abs(tmpMin.getRight() - right)<Math.abs(totalMin.getRight())) {
totalMin = new ImmutableTriple<>(tmpMin.getLeft(), ComponentSnapType.RIGHT,
tmpMin.getRight()-right);
}
return totalMin;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
@ -89,11 +195,7 @@ public class GuiPanelCreator extends GuiContainer {
} else if (buttonList.get(1).isMouseOver()) {
tooltip = I18n.format(IndustrialWires.MODID + ".desc.remove_all");
} else if (buttonList.get(2).isMouseOver()) {
if (snapToGrid) {
tooltip = I18n.format(IndustrialWires.MODID + ".desc.disable_snap");
} else {
tooltip = I18n.format(IndustrialWires.MODID + ".desc.enable_snap");
}
tooltip = I18n.format(IndustrialWires.MODID + ".desc.snap"+snapToGrid);
} else if (buttonList.get(3).isMouseOver()) {
tooltip = I18n.format(IndustrialWires.MODID + ".desc.disassemble");
}
@ -201,7 +303,7 @@ public class GuiPanelCreator extends GuiContainer {
nbt.setInteger("type", MessageType.REMOVE_ALL.ordinal());
break;
case 2:
snapToGrid = !snapToGrid;
snapToGrid = (snapToGrid+1)%3;
break;
case 3:
nbt.setInteger("type", MessageType.DISASSEMBLE.ordinal());
@ -227,4 +329,10 @@ public class GuiPanelCreator extends GuiContainer {
lastFloatingPC = ItemPanelComponent.componentFromStack(floating);
return lastFloatingPC;
}
private enum ComponentSnapType {
LEFT,
CENTER,
RIGHT;
}
}

View file

@ -25,7 +25,7 @@ import net.minecraft.item.EnumDyeColor;
import javax.annotation.Nonnull;
public class GuiChannelPickerSmall extends GuiChannelPicker {
private boolean open = false;
public boolean open = false;
private int offSize, onSize;
public GuiChannelPickerSmall(int id, int x, int y, int offSize, int onSize, byte selectedChannel) {
@ -42,6 +42,7 @@ public class GuiChannelPickerSmall extends GuiChannelPicker {
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
if (open) {
drawRect(x, y, x + width, y + height, 0xff99ff99);
super.drawButton(mc, mouseX, mouseY, partialTicks);
} else {
EnumDyeColor color = EnumDyeColor.byMetadata(selected);
@ -66,10 +67,14 @@ public class GuiChannelPickerSmall extends GuiChannelPicker {
select();
ret = true;
}
open = false;
width = offSize;
height = offSize;
close();
return ret;
}
}
public void close() {
open = false;
width = offSize;
height = offSize;
}
}

View file

@ -24,13 +24,23 @@ public class GuiIntChooser extends Gui {
public void drawChooser() {
int color = 0xE0E0E0;
String val = String.format(format, Integer.toString(value)).replace(' ', '0');
if (value >= 0 && allowNegative) {
val = "+" + val;
String val = String.format(format, Integer.toString(Math.abs(value))).replace(' ', '0');
if (allowNegative) {
if (value > 0) {
val = "+" + val;
} else if (value < 0) {
val = "-" + val;
} else {
val = "0" + val;
}
}
mc.fontRenderer.drawStringWithShadow(val, xPos + mc.fontRenderer.getCharWidth('-') + 1, yPos, color);
mc.fontRenderer.drawStringWithShadow("-", xPos, yPos, color);
mc.fontRenderer.drawStringWithShadow("+", xPlus, yPos, color);
color = 0x9999ff;
if (allowNegative&&value!=0) {
color = value<0?0xff9999:0x99ff99;
}
mc.fontRenderer.drawStringWithShadow(val, xPos + mc.fontRenderer.getCharWidth('-') + 1, yPos, color);
}
public void click(int x, int y) {
@ -41,7 +51,7 @@ public class GuiIntChooser extends Gui {
value++;
}
} else if (x >= xPos && x <= xPos + mc.fontRenderer.getCharWidth('-')) {
if (value > (allowNegative ? -value : 0)) {
if (value > (allowNegative ? -1 : 0)) {
value--;
}
}

View file

@ -18,12 +18,11 @@
package malte0811.industrialWires.client.render;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder.LadderSize;
import malte0811.industrialWires.blocks.hv.TileEntityJacobsLadder;
import malte0811.industrialWires.blocks.hv.TileEntityJacobsLadder.LadderSize;
import malte0811.industrialWires.util.Beziers;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@ -45,10 +44,8 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
GlStateManager.disableLighting();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
float oldBX = OpenGlHelper.lastBrightnessX;
float oldBY = OpenGlHelper.lastBrightnessY;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 238, 238);
GlStateManager.color(1, .85F, 1, alpha);
setLightmapDisabled(true);
GlStateManager.color(1, .85F, 1, 1);
Vec3d[] controls = new Vec3d[tile.size.arcPoints];
for (int i = 0; i < tile.size.arcPoints; i++) {
Vec3d speed = tile.controlMovement[i];
@ -70,7 +67,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
tes.draw();*/
//END OF DEBUG CODE
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, oldBX, oldBY);
setLightmapDisabled(false);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();

View file

@ -0,0 +1,138 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.client.render;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
import malte0811.industrialWires.blocks.IWProperties;
import malte0811.industrialWires.blocks.hv.TileEntityMarx;
import malte0811.industrialWires.blocks.hv.TileEntityMarx.Discharge;
import malte0811.industrialWires.util.MiscUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import org.lwjgl.opengl.GL11;
import static malte0811.industrialWires.blocks.hv.TileEntityMarx.FiringState.FIRE;
public class TileRenderMarx extends TileEntitySpecialRenderer<TileEntityMarx> {
@Override
public void render(TileEntityMarx te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
final boolean debug = false;
//noinspection ConstantConditions,PointlessBooleanExpression
if (te.type == IWProperties.MarxType.BOTTOM && (debug || te.state == FIRE) && te.dischargeData!=null) {
Vec3d player = Minecraft.getMinecraft().player.getPositionEyes(partialTicks);
Tessellator tes = Tessellator.getInstance();
BufferBuilder vb = tes.getBuffer();
Matrix4 mat = prepare(x, y, z, te, player);
if (te.dischargeData.energy>0) {
drawDischarge(te.dischargeData, vb, tes, mat);
}
GlStateManager.popMatrix();
//draw firing spark gaps
Vec3i offset = MiscUtils.offset(BlockPos.ORIGIN, te.facing, te.mirrored, 1, 1, 0);
final float pos = .6875F;
Vec3i facing = te.facing.getDirectionVec();
Vec3d gapDir = new Vec3d(facing.getZ(), 1, facing.getX());
Vec3d up = new Vec3d(-facing.getZ(), 1, -facing.getX());
Vec3d bottomGap = new Vec3d(offset.getX()-facing.getX()*pos, offset.getY()+.75, offset.getZ()-facing.getZ() * pos);
GlStateManager.pushMatrix();
GlStateManager.translate(x + bottomGap.x, y + bottomGap.y, z + bottomGap.z);
bottomGap = bottomGap.addVector(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ());
for (int i = 0; i < te.getStageCount() - 1; i++) {
renderGap(i, facing, vb, tes, player, gapDir, up, bottomGap);
}
cleanUp();
te.state = TileEntityMarx.FiringState.CHARGING;
}
}
private void renderGap(int i, Vec3i facing, BufferBuilder vb, Tessellator tes, Vec3d player, Vec3d gapDir, Vec3d up, Vec3d bottomGap) {
GlStateManager.pushMatrix();
GlStateManager.translate(0, i, 0);
GlStateManager.rotate(-45, facing.getX(), facing.getY(), facing.getZ());
player = player.subtract(bottomGap.x, bottomGap.y+i, bottomGap.z);
double t = player.dotProduct(gapDir)/2;
Vec3d playerToLine = player.subtract(gapDir.scale(t));
double angleRad = Math.acos(up.dotProduct(playerToLine)/(up.lengthVector()*playerToLine.lengthVector()));
angleRad *= Math.signum(playerToLine.dotProduct(new Vec3d(facing)));
GlStateManager.rotate((float) Math.toDegrees(angleRad)+90, 0, 1, 0);
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
drawDischargeSection(new Vec3d(0, -.2F, 0), new Vec3d(0, .2F, 0), .25F, vb);
tes.draw();
GlStateManager.popMatrix();
}
private Matrix4 prepare(double x, double y, double z, TileEntityMarx te, Vec3d player) {
setLightmapDisabled(true);
GlStateManager.pushMatrix();
Vec3i offset = MiscUtils.offset(BlockPos.ORIGIN, te.facing, te.mirrored, 1, 4, 1);
Vec3d bottom = new Vec3d(offset.getX()+.5, offset.getY(), offset.getZ()+.5);
GlStateManager.translate(x+bottom.x, y+bottom.y, z+bottom.z);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.color(1, 1, 1, 1);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
player = player.subtract(bottom.add(new Vec3d(te.getPos())));
double angle = Math.atan2(player.x, player.z);
Matrix4 ret = new Matrix4();
ret.rotate(-angle, 0, 1, 0);
GlStateManager.rotate((float) Math.toDegrees(angle), 0, 1, 0);
return ret;
}
private void cleanUp() {
setLightmapDisabled(false);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();
}
private static final float[] WHITE = {1, 1, 1, 1};
private static final float[] WHITE_TRANSPARENT = {1, 1, 1, 0};
private void drawDischarge(Discharge d, BufferBuilder vb, Tessellator tes, Matrix4 mat) {
if (d!=null&&d.vertices!=null) {
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
for (int i = 0;i<d.vertices.length-1;i++) {
drawDischargeSection(mat.apply(d.vertices[i]), mat.apply(d.vertices[i+1]), d.diameter, vb);
}
tes.draw();
}
}
private void drawDischargeSection(Vec3d start, Vec3d end, float diameter, BufferBuilder vb) {
drawPart(start, end, diameter/3, diameter/3, WHITE_TRANSPARENT, WHITE, vb);
drawPart(start, end, 0, diameter/3, WHITE, WHITE, vb);
drawPart(start, end, -diameter/3, diameter/3, WHITE, WHITE_TRANSPARENT, vb);
}
private void drawPart(Vec3d start, Vec3d end, float offset, float width, float[] color1, float[] color2, BufferBuilder vb) {
vb.setTranslation(-offset-width/2, 0, 0);
vb.pos(start.x, start.y, start.z).color(color1[0], color1[1], color1[2], color1[3]).endVertex();
vb.pos(start.x+width, start.y, start.z).color(color2[0], color2[1], color2[2], color2[3]).endVertex();
vb.pos(end.x+width, end.y, end.z).color(color2[0], color2[1], color2[2], color2[3]).endVertex();
vb.pos(end.x, end.y, end.z).color(color1[0], color1[1], color1[2], color1[3]).endVertex();
vb.setTranslation(0, 0, 0);
}
}

View file

@ -0,0 +1,112 @@
package malte0811.industrialWires.compat;
import com.google.common.collect.ImmutableList;
import crafttweaker.CraftTweakerAPI;
import crafttweaker.IAction;
import crafttweaker.api.block.IBlock;
import crafttweaker.api.item.IIngredient;
import crafttweaker.api.item.IItemStack;
import crafttweaker.api.minecraft.CraftTweakerMC;
import crafttweaker.api.oredict.IOreDictEntry;
import malte0811.industrialWires.hv.MarxOreHandler;
import malte0811.industrialWires.hv.MarxOreHandler.OreChecker;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import java.util.Iterator;
import java.util.function.Predicate;
import java.util.function.Supplier;
@ZenClass("mods.industrialwires.MarxGenerator")
public class CTMarxGenerator {
@ZenMethod
public static void addRecipe(IIngredient in, double avgRelEnergy, double maxMain, IItemStack outMain, @Optional int smallLargeRatio, @Optional IItemStack outSmall) {
Supplier<ItemStack> out = () -> CraftTweakerMC.getItemStack(outMain);
Supplier<ItemStack> supSmall = outSmall!=null?() -> CraftTweakerMC.getItemStack(outSmall):null;
if (in instanceof IItemStack) {
IBlock properIn = ((IItemStack) in).asBlock();
if (properIn!=null) {
CraftTweakerAPI.apply(new Add(new MarxOreHandler.OreInfo((world, pos) -> CraftTweakerMC.getBlock(world, pos.getX(), pos.getY(), pos.getZ()).matches(properIn),
ImmutableList.of(CraftTweakerMC.getItemStack(in)), avgRelEnergy, maxMain, out, supSmall, smallLargeRatio)));
return;
}
} else if (in instanceof IOreDictEntry) {
String oreName = ((IOreDictEntry) in).getName();
CraftTweakerAPI.apply(new Add(new MarxOreHandler.OreInfo(new OreChecker(oreName), OreDictionary.getOres(oreName),
avgRelEnergy, maxMain, out, supSmall, smallLargeRatio)));
return;
}
throw new IllegalArgumentException("Invalid parameter "+in);
}
private static class Add implements IAction {
private final MarxOreHandler.OreInfo recipe;
public Add(MarxOreHandler.OreInfo recipe) {
this.recipe = recipe;
}
@Override
public void apply() {
MarxOreHandler.put(recipe);
Compat.addMarx.accept(recipe);
}
@Override
public String describe() {
return "Adding Marx Generator Recipe for "+ recipe.output.get();
}
}
@ZenMethod
public static void removeRecipe(IIngredient input) {
if (input instanceof IItemStack) {
CraftTweakerAPI.apply(new Remove((o)-> input.matches(CraftTweakerMC.getIItemStack(o))));
return;
} else if (input instanceof IOreDictEntry) {
String oreName = ((IOreDictEntry) input).getName();
int mainId = OreDictionary.getOreID(oreName);
CraftTweakerAPI.apply(new Remove((i)->{
int[] ids = OreDictionary.getOreIDs(i);
for (int id:ids) {
if (id==mainId) {
return true;
}
}
return false;
}));
return;
}
throw new IllegalArgumentException("Invalid parameter "+input);
}
private static class Remove implements IAction {
private final Predicate<ItemStack> inputMatcher;
public Remove(Predicate<ItemStack> inputMatcher) {
this.inputMatcher = inputMatcher;
}
@Override
public void apply() {
Iterator<MarxOreHandler.OreInfo> ores = MarxOreHandler.getRecipes().iterator();
while (ores.hasNext()) {
MarxOreHandler.OreInfo curr = ores.next();
for (ItemStack input:curr.exampleInput) {
if (inputMatcher.test(input)) {
ores.remove();
Compat.removeMarx.accept(curr);
break;
}
}
}
}
@Override
public String describe() {
return "Removing Marx Generator Recipes";
}
}
}

View file

@ -0,0 +1,66 @@
package malte0811.industrialWires.compat;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.api.tool.ToolboxHandler;
import crafttweaker.CraftTweakerAPI;
import ic2.api.item.IBoxable;
import ic2.api.item.IC2Items;
import malte0811.industrialWires.hv.MarxOreHandler;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Optional;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.function.Consumer;
public class Compat {
public static Consumer<MarxOreHandler.OreInfo> addMarx = (o)->{};
public static Consumer<MarxOreHandler.OreInfo> removeMarx = (o)->{};
public static void preInit() {
callAllForClass(PreInit.class);
}
public static void init() {
callAllForClass(Init.class);
}
private static void callAllForClass(Class c) {
Method[] methods = c.getDeclaredMethods();
for (Method m : methods) {
if (m.getReturnType() == void.class && m.getParameterCount() == 0) {
try {
m.setAccessible(true);
m.invoke(null);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
private static class PreInit {
@Optional.Method(modid = "crafttweaker")
private static void preInitCraftTweaker() {
CraftTweakerAPI.registerClass(CTMarxGenerator.class);
}
}
private static class Init {
@Optional.Method(modid = "ic2")
private static void initIC2() {
Item tinnedFood = IC2Items.getItem("filled_tin_can").getItem();
ItemStack emptyMug = IC2Items.getItem("mug", "empty");
ToolboxHandler.addFoodType((s) -> s.getItem() == tinnedFood);
ToolboxHandler.addFoodType((s) ->
s.getItem() == emptyMug.getItem() && !ItemStack.areItemStacksEqual(emptyMug, ApiUtils.copyStackWithAmount(s, 1))
);
Item cable = IC2Items.getItem("cable", "type:copper,insulation:0").getItem();
ToolboxHandler.addWiringType((s, w) -> s.getItem() == cable);
ToolboxHandler.addToolType((s) -> {
Item a = s.getItem();
return a instanceof IBoxable && ((IBoxable) a).canBeStoredInToolbox(s);
});
}
}
}

View file

@ -0,0 +1,135 @@
package malte0811.industrialWires.compat;
import blusunrize.immersiveengineering.common.util.Utils;
import com.google.common.collect.ImmutableList;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.hv.BlockTypes_HVMultiblocks;
import malte0811.industrialWires.hv.MarxOreHandler;
import malte0811.industrialWires.hv.MarxOreHandler.OreInfo;
import mezz.jei.api.*;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.IModIngredientRegistration;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@JEIPlugin
public class JEIMarx implements IModPlugin {
public static IJeiHelpers jeiHelpers;
private static JEIMarx.MarxCategory marx;
@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
}
@Override
public void registerIngredients(IModIngredientRegistration registry) {
}
@Override
public void registerCategories(IRecipeCategoryRegistration registry) {
jeiHelpers = registry.getJeiHelpers();
marx = new MarxCategory();
registry.addRecipeCategories(marx);
}
@Override
public void register(IModRegistry registryIn) {
registryIn.handleRecipes(OreInfo.class, MarxRecipeWrapper::new, IndustrialWires.MODID+".marx");
registryIn.addRecipes(MarxOreHandler.getRecipes(), IndustrialWires.MODID+".marx");
registryIn.addRecipeCatalyst(new ItemStack(IndustrialWires.hvMultiblocks, 1,
BlockTypes_HVMultiblocks.MARX.getMeta()), marx.getUid());
}
@Override
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
Compat.addMarx = (o) -> jeiRuntime.getRecipeRegistry().addRecipe(new MarxRecipeWrapper(o), marx.getUid());
Compat.removeMarx = (o) -> jeiRuntime.getRecipeRegistry().removeRecipe(new MarxRecipeWrapper(o), marx.getUid());
}
private class MarxCategory implements IRecipeCategory<MarxRecipeWrapper> {
@Nonnull
@Override
public String getUid() {
return IndustrialWires.MODID + ".marx";
}
@Nonnull
@Override
public String getTitle() {
return I18n.format(IndustrialWires.MODID + ".desc.jei.marx");
}
@Nonnull
@Override
public String getModName() {
return IndustrialWires.MODNAME;
}
@Nonnull
@Override
public IDrawable getBackground() {
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
return guiHelper.createBlankDrawable(140, 50);
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull MarxRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
guiItemStacks.init(0, true, 10, 17);
guiItemStacks.init(1, false, 62, 4);
guiItemStacks.init(2, false, 62, 29);
guiItemStacks.set(ingredients);
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
}
private class MarxRecipeWrapper implements IRecipeWrapper {
OreInfo recipe;
public MarxRecipeWrapper(OreInfo recipe) {
this.recipe = recipe;
}
@Override
public void getIngredients(@Nonnull IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, ImmutableList.of(recipe.exampleInput));
if (recipe.outputSmall!=null) {
ingredients.setOutputs(ItemStack.class, ImmutableList.of(
recipe.output.get(),
recipe.outputSmall.get()));
} else {
ingredients.setOutputs(ItemStack.class, ImmutableList.of(recipe.output.get(), ItemStack.EMPTY));//TODO remove second output?
}
}
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
IDrawable slot = jeiHelpers.getGuiHelper().getSlotDrawable();
slot.draw(minecraft, 10, 17);
slot.draw(minecraft, 62, 4);
if (recipe.outputSmall!=null&&!recipe.outputSmall.get().isEmpty()) {
slot.draw(minecraft, 62, 29);
minecraft.fontRenderer.drawString("x"+ recipe.smallMax+I18n.format(IndustrialWires.MODID+".desc.jei.alt"), 85, 33, 0xff000000);
}
minecraft.fontRenderer.drawString("x"+ Utils.formatDouble(recipe.maxYield, "0.#") + I18n.format(IndustrialWires.MODID+".desc.jei.max"), 85, 8, 0xff000000);
minecraft.fontRenderer.drawString("~", 0, 3, 0xff000000);
minecraft.fontRenderer.drawString((int) (recipe.avgEnergy*MarxOreHandler.defaultEnergy/1000)+" kJ",
minecraft.fontRenderer.getCharWidth('~'), 0, 0xff000000);
}
}
}

View file

@ -22,6 +22,7 @@ import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
import malte0811.industrialWires.client.RawQuad;
import malte0811.industrialWires.client.gui.GuiPanelCreator;
import malte0811.industrialWires.util.MiscUtils;
import malte0811.industrialWires.util.TriConsumer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
@ -57,6 +58,9 @@ public abstract class PanelComponent {
public final static String COLOR = "color";
public final static String RS_CHANNEL = "rsChannel";
public final static String RS_ID = "rsId";
public final static String HAS_SECOND_CHANNEL = "has2ndChannel";
public final static String RS_CHANNEL2 = "rsChannel2";
public final static String RS_ID2 = "rsId2";
public final static String TEXT = "text";
public static final String HORIZONTAL = "horizontal";
public static final String LENGTH = "length";

View file

@ -48,19 +48,23 @@ import java.util.function.Consumer;
public class PanelMeter extends PanelComponent implements IConfigurableComponent {
public static final String WIDE = "wide";
private int rsInputId;
private byte rsInputChannel;
private byte rsInput;
private int rsInputId, rsInputId2 = -1;
private byte rsInputChannel, rsInputChannel2;
private int rsInput;
private boolean wide = true;
private boolean hasSecond;
public PanelMeter() {
super("panel_meter");
}
public PanelMeter(int rsId, byte rsChannel, boolean wide) {
public PanelMeter(int rsId, byte rsChannel, int rsId2, byte rsChannel2, boolean wide, boolean hasSecond) {
this();
rsInputChannel = rsChannel;
rsInputId = rsId;
rsInputChannel2 = rsChannel2;
rsInputId2 = rsId2;
this.hasSecond = hasSecond;
this.wide = wide;
}
@ -68,6 +72,11 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
protected void writeCustomNBT(NBTTagCompound nbt, boolean toItem) {
nbt.setInteger(RS_ID, rsInputId);
nbt.setByte(RS_CHANNEL, rsInputChannel);
nbt.setBoolean(HAS_SECOND_CHANNEL, hasSecond);
if (hasSecond) {
nbt.setInteger(RS_ID2, rsInputId2);
nbt.setByte(RS_CHANNEL2, rsInputChannel2);
}
nbt.setBoolean(WIDE, wide);
if (!toItem) {
nbt.setInteger("rsInput", rsInput);
@ -78,14 +87,22 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
protected void readCustomNBT(NBTTagCompound nbt) {
rsInputId = nbt.getInteger(RS_ID);
rsInputChannel = nbt.getByte(RS_CHANNEL);
rsInput = nbt.getByte("rsInput");
rsInput = nbt.getInteger("rsInput");
wide = nbt.getBoolean(WIDE);
hasSecond = nbt.getBoolean(HAS_SECOND_CHANNEL);
if (hasSecond) {
rsInputId2 = nbt.getInteger(RS_ID2);
rsInputChannel2 = nbt.getByte(RS_CHANNEL2);
} else {
rsInputId2 = -1;
rsInputChannel2 = -1;
}
}
private static final float SIZE = .25F;
private static final float WIDTH = 1.5F*SIZE;
private static final float BORDER = SIZE /20;
private static final float antiZOffset = .0001F;
private static final float antiZOffset = .001F;
private static final float[] BLACK = {0, 0, 0, 1};
private static final float[] WHITE = {1, 1, 1, 1};
@Override
@ -101,7 +118,7 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
RawModelFontRenderer r = fontRenderer();
r.transform = new Matrix4();
for (int i = 0;i<=3;i++) {
transformNumber(r.transform, (byte)(5*i));
transformNumber(r.transform, 5*17*i);
String asString = Integer.toString(5*i);
int lengthHalf = r.getStringWidth(asString)/2;
r.transform.translate(-lengthHalf*r.scale, 0, -3.5*r.scale);
@ -127,7 +144,7 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
return renderer;
}
private void transformNumber(Matrix4 mat, byte value) {
private void transformNumber(Matrix4 mat, int value) {
if (wide) {
transformNeedle(mat, value);
mat.translate(0, 0, getLength()+1.5*BORDER);
@ -135,22 +152,22 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
} else {
mat.setIdentity().translate(0, antiZOffset, SIZE);
mat.translate(SIZE-3*BORDER, 0, -3*BORDER);
float angle = 90*(1-value/15F);
float angle = 90*(1-value/255F);
angle = (float) (angle*Math.PI/180);
float length = getLength()+BORDER;
mat.translate((float)(-Math.sin(angle)*length), 0, (float)(-Math.cos(angle)*length));
}
}
private void transformNeedle(Matrix4 mat, byte value) {
private void transformNeedle(Matrix4 mat, int value) {
mat.setIdentity().translate(0, 2*antiZOffset, SIZE);
float angle;
if (wide) {
mat.translate(WIDTH/2, 0, -2*BORDER);
angle = 50-(100*(value/15F));
angle = 50-(100*(value/255F));
} else {
mat.translate(SIZE-3*BORDER, 0, -3*BORDER);
angle = 90-(90*(value/15F));
angle = 90-(90*(value/255F));
}
angle = (float) ((180+angle)*Math.PI/180);
mat.rotate(angle, 0, 1, 0);
@ -162,7 +179,7 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
@Nonnull
@Override
public PanelComponent copyOf() {
PanelMeter ret = new PanelMeter(rsInputId, rsInputChannel, wide);
PanelMeter ret = new PanelMeter(rsInputId, rsInputChannel, rsInputId2, rsInputChannel2, wide, hasSecond);
ret.rsInput = rsInput;
ret.setX(x);
ret.setY(y);
@ -189,13 +206,27 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
}
private TileEntityPanel panel;
private Consumer<byte[]> handler = (input) -> {
if (input[rsInputChannel] != rsInput) {
rsInput = input[rsInputChannel];
private Consumer<byte[]> handlerSec = (input) -> {
if (input[rsInputChannel2] != (rsInput&0xf)) {
rsInput = (input[rsInputChannel2]&0xf)|(rsInput&0xf0);
panel.markDirty();
panel.triggerRenderUpdate();
}
};
private Consumer<byte[]> handler = (input) -> {
if (input[rsInputChannel] != rsInput>>4) {
if (hasSecond) {
rsInput = (input[rsInputChannel]<<4)|(rsInput&0xf);
} else {
rsInput = input[rsInputChannel]*17;
}
panel.markDirty();
panel.triggerRenderUpdate();
}
if (rsInputId2==rsInputId) {
handlerSec.accept(input);
}
};
@Nullable
@Override
@ -203,6 +234,9 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
if (matchesId(rsInputId, id)) {
this.panel = panel;
return handler;
} else if (matchesId(rsInputId2, id)) {
this.panel = panel;
return handlerSec;
}
return null;
}
@ -221,18 +255,24 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
PanelMeter that = (PanelMeter) o;
if (rsInputId != that.rsInputId) return false;
if (rsInputId2 != that.rsInputId2) return false;
if (rsInputChannel != that.rsInputChannel) return false;
if (rsInputChannel2 != that.rsInputChannel2) return false;
if (rsInput != that.rsInput) return false;
return wide == that.wide;
if (wide != that.wide) return false;
return hasSecond == that.hasSecond;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + rsInputId;
result = 31 * result + rsInputId2;
result = 31 * result + (int) rsInputChannel;
result = 31 * result + (int) rsInput;
result = 31 * result + (int) rsInputChannel2;
result = 31 * result + rsInput;
result = 31 * result + (wide ? 1 : 0);
result = 31 * result + (hasSecond ? 1 : 0);
return result;
}
@ -267,14 +307,23 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
@Override
public void applyConfigOption(ConfigType type, int id, NBTBase value) {
switch (type) {
case RS_CHANNEL:
rsInputChannel = ((NBTTagByte) value).getByte();
break;
case INT:
rsInputId = ((NBTTagInt) value).getInt();
break;
case BOOL:
wide = ((NBTTagByte)value).getByte()!=0;
case RS_CHANNEL:
if (id == 0) {
rsInputChannel = ((NBTTagByte) value).getByte();
} else {
rsInputChannel2 = ((NBTTagByte) value).getByte();
}
break;
case INT:
if (id == 0) {
rsInputId = ((NBTTagInt) value).getInt();
} else {
rsInputId2 = ((NBTTagInt) value).getInt();
hasSecond = rsInputId2>=0;
}
break;
case BOOL:
wide = ((NBTTagByte) value).getByte() != 0;
}
}
@ -300,9 +349,9 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
case FLOAT:
return null;
case RS_CHANNEL:
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info");
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info"+(id==1?"2":""));
case INT:
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info");
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info"+(id==1?"2":""));
default:
return null;
}
@ -311,21 +360,23 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
@Override
public RSChannelConfig[] getRSChannelOptions() {
return new RSChannelConfig[]{
new RSChannelConfig("channel", 0, 0, rsInputChannel)
new RSChannelConfig("channel", 0, 0, rsInputChannel, false),
new RSChannelConfig("channel2", 60, 0, rsInputChannel2, false)
};
}
@Override
public IntConfig[] getIntegerOptions() {
return new IntConfig[]{
new IntConfig("rsId", 0, 45, rsInputId, 2, false)
new IntConfig("rsId", 0, 60, rsInputId, 2, false),
new IntConfig("rsId2", 60, 60, rsInputId2, 2, true)
};
}
@Override
public BoolConfig[] getBooleanOptions() {
return new BoolConfig[]{
new BoolConfig("wide", 70, 10, wide)
new BoolConfig("wide", 0, 80, wide)
};
}

View file

@ -34,24 +34,33 @@ import org.lwjgl.util.vector.Vector3f;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Slider extends PanelComponent implements IConfigurableComponent {
private static final float WIDTH = .0625F;
private float length = .5F;
private int color = 0xffff00;
private boolean horizontal;
private byte out;
private int out;
private byte rsChannel;
private int rsId;
private boolean hasSecond;
private byte rsChannel2;
private int rsId2 = -1;
private Set<TriConsumer<Integer, Byte, PanelComponent>> secOutputs = new HashSet<>();
public Slider(float length, int color, boolean horizontal, int rsId, byte rsChannel) {
public Slider(float length, int color, boolean horizontal, int rsId, byte rsChannel, boolean hasSecond, int rsId2, byte rsChannel2) {
this();
this.color = color;
this.length = length;
this.horizontal = horizontal;
this.rsChannel = rsChannel;
this.rsId = rsId;
this.hasSecond = hasSecond;
this.rsChannel2 = rsChannel2;
this.rsId2 = rsId2;
}
public Slider() {
@ -63,10 +72,13 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
nbt.setInteger(COLOR, color);
nbt.setFloat(LENGTH, length);
if (!toItem) {
nbt.setByte("output", out);
nbt.setInteger("output", out);
}
nbt.setByte(RS_CHANNEL, rsChannel);
nbt.setInteger(RS_ID, rsId);
nbt.setByte(RS_CHANNEL2, rsChannel2);
nbt.setInteger(RS_ID2, rsId2);
nbt.setBoolean(HAS_SECOND_CHANNEL, hasSecond);
nbt.setBoolean(HORIZONTAL, horizontal);
}
@ -74,9 +86,12 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
protected void readCustomNBT(NBTTagCompound nbt) {
color = nbt.getInteger(COLOR);
length = nbt.getFloat(LENGTH);
out = nbt.getByte("output");
out = nbt.getInteger("output");
rsChannel = nbt.getByte(RS_CHANNEL);
rsId = nbt.getInteger(RS_ID);
rsChannel2 = nbt.getByte(RS_CHANNEL2);
rsId2 = nbt.getInteger(RS_ID2);
hasSecond = nbt.getBoolean(HAS_SECOND_CHANNEL);
horizontal = nbt.getBoolean(HORIZONTAL);
}
@ -91,13 +106,13 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
float[] color = new float[4];
color[3] = 1;
for (int i = 0; i < 3; i++) {
color[i] = ((this.color >> (8 * (2 - i))) & 255) / 255F * (.5F + out / 30F);
color[i] = ((this.color >> (8 * (2 - i))) & 255) / 255F * (.5F + out / 255F/2);
}
float val;
if (horizontal) {
val = (out / 15F) * (length - .0625F);
val = (out / 255F) * (length - .0625F);
} else {
val = (1 - out / 15F) * (length - .0625F);
val = (1 - out / 255F) * (length - .0625F);
}
PanelUtils.addColoredBox(color, GRAY, null, new Vector3f(horizontal ? val : 0, 0, horizontal ? 0 : val),
new Vector3f(.0625F, getHeight(), .0625F), ret, false);
@ -110,7 +125,7 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
@Nonnull
@Override
public PanelComponent copyOf() {
Slider ret = new Slider(length, color, horizontal, rsId, rsChannel);
Slider ret = new Slider(length, color, horizontal, rsId, rsChannel, hasSecond, rsId2, rsChannel2);
ret.out = out;
ret.setX(x);
ret.setY(y);
@ -130,9 +145,9 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
@Override
public void interactWith(Vec3d hitRelative, TileEntityPanel tile, EntityPlayerMP player) {
double pos = horizontal ? hitRelative.x : (length - hitRelative.z);
byte newLevel = (byte) (Math.min(pos * 16 / length, 15));
int newLevel = (int) Math.min(pos * 256 / length, 255);
if (newLevel != out) {
setOut(rsChannel, newLevel);
setOut(newLevel);
out = newLevel;
tile.markDirty();
tile.triggerRenderUpdate();
@ -143,8 +158,18 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
public void registerRSOutput(int id, @Nonnull TriConsumer<Integer, Byte, PanelComponent> out) {
if (matchesId(rsId, id)) {
super.registerRSOutput(id, out);
out.accept((int) rsChannel, this.out, this);
out.accept((int) rsChannel, (byte) (this.out>>4), this);
}
if (matchesId(rsId2, id)) {
secOutputs.add(out);
out.accept((int) rsChannel, (byte) (this.out&0xf), this);
}
}
@Override
public void unregisterRSOutput(int id, @Nonnull TriConsumer<Integer, Byte, PanelComponent> out) {
super.unregisterRSOutput(id, out);
secOutputs.remove(out);
}
@Override
@ -171,7 +196,16 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
@Override
public void invalidate(TileEntityPanel te) {
setOut(rsChannel, 0);
setOut(0);
}
public void setOut(int value) {
super.setOut(rsChannel, value>>4);
if (hasSecond) {
for (TriConsumer<Integer, Byte, PanelComponent> cons:secOutputs) {
cons.accept((int) rsChannel2, (byte) (value&0xf), this);
}
}
}
@Override
@ -187,7 +221,10 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
if (horizontal != slider.horizontal) return false;
if (out != slider.out) return false;
if (rsChannel != slider.rsChannel) return false;
return rsId == slider.rsId;
if (rsId != slider.rsId) return false;
if (hasSecond != slider.hasSecond) return false;
if (rsChannel2 != slider.rsChannel2) return false;
return rsId2 == slider.rsId2;
}
@Override
@ -196,9 +233,12 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
result = 31 * result + (length != +0.0f ? Float.floatToIntBits(length) : 0);
result = 31 * result + color;
result = 31 * result + (horizontal ? 1 : 0);
result = 31 * result + (int) out;
result = 31 * result + out;
result = 31 * result + (int) rsChannel;
result = 31 * result + rsId;
result = 31 * result + (hasSecond ? 1 : 0);
result = 31 * result + (int) rsChannel2;
result = 31 * result + rsId2;
return result;
}
@ -209,10 +249,19 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
horizontal = ((NBTTagByte) value).getByte() != 0;
break;
case RS_CHANNEL:
rsChannel = ((NBTTagByte) value).getByte();
if (id==0) {
rsChannel = ((NBTTagByte) value).getByte();
} else {
rsChannel2 = ((NBTTagByte) value).getByte();
}
break;
case INT:
rsId = ((NBTTagInt) value).getInt();
if (id==0) {
rsId = ((NBTTagInt) value).getInt();
} else {
rsId2 = ((NBTTagInt) value).getInt();
hasSecond = rsId2>=0;
}
break;
case FLOAT:
if (id < 3) {
@ -249,9 +298,9 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
case BOOL:
return null;
case RS_CHANNEL:
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info");
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info"+(id==0?"":"2"));
case INT:
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info");
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info"+(id==0?"":"2"));
case FLOAT:
return null;
default:
@ -262,14 +311,16 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
@Override
public RSChannelConfig[] getRSChannelOptions() {
return new RSChannelConfig[]{
new RSChannelConfig("channel", 0, 0, rsChannel)
new RSChannelConfig("channel", 0, 0, rsChannel, true),
new RSChannelConfig("channel", 30, 0, rsChannel2, true)
};
}
@Override
public IntConfig[] getIntegerOptions() {
return new IntConfig[]{
new IntConfig("rsId", 0, 50, rsId, 2, false)
new IntConfig("rsId", 0, 30, rsId, 2, false),
new IntConfig("rsId", 30, 30, rsId2, 2, true)
};
}

View file

@ -39,7 +39,9 @@ import org.lwjgl.util.vector.Vector3f;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Variac extends PanelComponent implements IConfigurableComponent {
private static final float SIZE = 3 / 16F;
@ -51,14 +53,21 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
private static final float rodOffset = (SIZE - rodDia) / 2;
private static final float arrowSize = .0625F / 2;
private byte out;
private int out;
private byte rsChannel;
private int rsId;
private boolean hasSecond;
private byte rsChannel2;
private int rsId2 = -1;
private Set<TriConsumer<Integer, Byte, PanelComponent>> secOutputs = new HashSet<>();
public Variac(int rsId, byte rsChannel) {
public Variac(int rsId, byte rsChannel, int rsId2, byte rsChannel2, boolean hasSecond) {
this();
this.rsChannel = rsChannel;
this.rsId = rsId;
this.hasSecond = hasSecond;
this.rsChannel2 = rsChannel2;
this.rsId2 = rsId2;
}
public Variac() {
@ -68,23 +77,29 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
@Override
protected void writeCustomNBT(NBTTagCompound nbt, boolean toItem) {
if (!toItem) {
nbt.setByte("output", out);
nbt.setInteger("output", out);
}
nbt.setByte(RS_CHANNEL, rsChannel);
nbt.setInteger(RS_ID, rsId);
nbt.setByte(RS_CHANNEL2, rsChannel2);
nbt.setInteger(RS_ID2, rsId2);
nbt.setBoolean(HAS_SECOND_CHANNEL, hasSecond);
}
@Override
protected void readCustomNBT(NBTTagCompound nbt) {
out = nbt.getByte("output");
out = nbt.getInteger("output");
rsChannel = nbt.getByte(RS_CHANNEL);
rsId = nbt.getInteger(RS_ID);
rsChannel2 = nbt.getByte(RS_CHANNEL2);
rsId2 = nbt.getInteger(RS_ID2);
hasSecond = nbt.getBoolean(HAS_SECOND_CHANNEL);
}
@Override
public List<RawQuad> getQuads() {
List<RawQuad> ret = new ArrayList<>();
float angle = -(float) (2 * Math.PI * (.5 + out) / 17F);
float angle = -(float) (2 * Math.PI * (8.5 + out) / (17F*16F));
Matrix4 mat = new Matrix4();
mat.translate(SIZE / 2, 0, SIZE / 2);
mat.rotate(angle, 0, 1, 0);
@ -110,7 +125,7 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
@Nonnull
@Override
public PanelComponent copyOf() {
Variac ret = new Variac(rsId, rsChannel);
Variac ret = new Variac(rsId, rsChannel, rsId2, rsChannel2, hasSecond);
ret.out = out;
ret.setX(x);
ret.setY(y);
@ -137,20 +152,20 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
} else if (angle > 2 * Math.PI) {
angle -= 2 * Math.PI;
}
angle -= .5 * Math.PI / 17;
angle /= 2 * Math.PI;
if (angle < 0 || angle >= 16 / 17D) {
return;
int step = (hasSecond&&player.isSneaking())?1:16;
int newLevel = (int) ((angle-1/34F) * 17 * 16);
int diff = Math.abs(newLevel-out);
if (diff>step) {
if (newLevel > out) {
newLevel = out + step;
} else if (newLevel < out) {
newLevel = out - step;
}
}
byte newLevel = (byte) (angle * 17);
if (newLevel > out) {
newLevel = (byte) (out + 1);
} else if (newLevel < out) {
newLevel = (byte) (out - 1);
}
newLevel = (byte) Math.max(0, Math.min(newLevel, 15));
newLevel = Math.max(0, Math.min(newLevel, 255));
if (newLevel != out) {
setOut(rsChannel, newLevel);
setOut(newLevel);
out = newLevel;
tile.markDirty();
tile.triggerRenderUpdate();
@ -161,8 +176,18 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
public void registerRSOutput(int id, @Nonnull TriConsumer<Integer, Byte, PanelComponent> out) {
if (matchesId(rsId, id)) {
super.registerRSOutput(id, out);
out.accept((int) rsChannel, this.out, this);
out.accept((int) rsChannel, (byte) (this.out>>4), this);
}
if (matchesId(rsId2, id)) {
secOutputs.add(out);
out.accept((int)rsChannel2, (byte) (this.out&0xf), this);
}
}
@Override
public void unregisterRSOutput(int id, @Nonnull TriConsumer<Integer, Byte, PanelComponent> out) {
super.unregisterRSOutput(id, out);
secOutputs.remove(out);
}
@Override
@ -197,7 +222,16 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
@Override
public void invalidate(TileEntityPanel te) {
setOut(rsChannel, 0);
setOut(0);
}
public void setOut(int level) {
if (hasSecond) {
for (TriConsumer<Integer, Byte, PanelComponent> cons:secOutputs) {
cons.accept((int)rsChannel2, (byte) (level&0xf), this);
}
}
super.setOut(rsChannel, (byte)(level>>4));
}
@Override
@ -209,14 +243,22 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
Variac variac = (Variac) o;
if (out != variac.out) return false;
return rsChannel == variac.rsChannel;
if (rsChannel != variac.rsChannel) return false;
if (rsId != variac.rsId) return false;
if (hasSecond != variac.hasSecond) return false;
if (rsChannel2 != variac.rsChannel2) return false;
return rsId2 == variac.rsId2;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (int) out;
result = 31 * result + out;
result = 31 * result + (int) rsChannel;
result = 31 * result + rsId;
result = 31 * result + (hasSecond ? 1 : 0);
result = 31 * result + (int) rsChannel2;
result = 31 * result + rsId2;
return result;
}
@ -224,10 +266,19 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
public void applyConfigOption(IConfigurableComponent.ConfigType type, int id, NBTBase value) {
switch (type) {
case RS_CHANNEL:
rsChannel = ((NBTTagByte) value).getByte();
if (id==0) {
rsChannel = ((NBTTagByte) value).getByte();
} else {
rsChannel2 = ((NBTTagByte) value).getByte();
}
break;
case INT:
rsId = ((NBTTagInt) value).getInt();
if (id==0) {
rsId = ((NBTTagInt) value).getInt();
} else {
rsId2 = ((NBTTagInt) value).getInt();
hasSecond = rsId2>=0;
}
break;
}
}
@ -240,26 +291,28 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
@Override
public String fomatConfigDescription(IConfigurableComponent.ConfigType type, int id) {
switch (type) {
case RS_CHANNEL:
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info");
case INT:
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info");
default:
return "INVALID?";
case RS_CHANNEL:
return I18n.format(IndustrialWires.MODID + ".desc.rschannel_info" + (id == 1 ? "2" : ""));
case INT:
return I18n.format(IndustrialWires.MODID + ".desc.rsid_info" + (id == 1 ? "2" : ""));
default:
return "INVALID?";
}
}
@Override
public IConfigurableComponent.RSChannelConfig[] getRSChannelOptions() {
return new IConfigurableComponent.RSChannelConfig[]{
new IConfigurableComponent.RSChannelConfig("channel", 0, 0, rsChannel)
new IConfigurableComponent.RSChannelConfig("channel", 0, 0, rsChannel),
new IConfigurableComponent.RSChannelConfig("channel", 90, 0, rsChannel2)
};
}
@Override
public IConfigurableComponent.IntConfig[] getIntegerOptions() {
return new IConfigurableComponent.IntConfig[]{
new IConfigurableComponent.IntConfig("rsId", 0, 50, rsId, 2, false)
new IConfigurableComponent.IntConfig("rsId", 0, 50, rsId, 2, false),
new IConfigurableComponent.IntConfig("rsId", 90, 50, rsId2, 2, true)
};
}

View file

@ -0,0 +1,205 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.hv;
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.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.world.World;
import net.minecraftforge.oredict.OreDictionary;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiPredicate;
import java.util.function.Supplier;
import static net.minecraftforge.oredict.OreDictionary.getOres;
public class MarxOreHandler {
private static final List<OreInfo> oreData = new ArrayList<>();
public static double defaultEnergy = 100_000;
public static double modifier;
public static void preInit() {
// Vanilla ores
putOre("oreIron", .5, 4, "dustIron", "nuggetIron");
putOre("oreGold", 1, 4, "dustGold", "nuggetGold");
putOre("oreDiamond", 2, 4, "gemDiamond");
putOre("oreEmerald", 2.25, 4, "gemEmerald");
putOre("oreLapis", .75, 10, "gemLapis");
putOre("oreCoal", .75, 8, Items.COAL, 0);
putOre("oreRedstone", 1, 12, "dustRedstone");
putOre("oreQuartz", 1, 6, "gemQuartz");
// IE ores
String[] ores = {"Copper", "Aluminum", "Lead", "Silver", "Nickel", "Tin"};
for (String ore : ores) {
putOre("ore" + ore, .75, 4, "dust" + ore, "nugget" + ore);
}
putOre("oreUranium", 1.25, 4, "crushedUranium", "nuggetUranium");
}
public static void putOre(String oreName, double avgEnergy, double maxYield, String oreOut) {
putOre(oreName, avgEnergy, maxYield, oreOut, null);
}
public static void putOre(String oreName, double avgEnergy, double maxYield, String oreOut, @Nullable String oreSmall) {
put(new OreInfo(new OreChecker(oreName), getOres(oreName), avgEnergy, maxYield, oreOut, oreSmall));
}
public static void putOre(String oreName, double avgEnergy, double maxYield, Item oreOut, int meta) {
put(new OreInfo(new OreChecker(oreName), getOres(oreName), avgEnergy, maxYield, oreOut, meta));
}
public static void put(MarxOreHandler.OreInfo output) {
oreData.add(output);
}
public static void resetModifier() {
modifier = .9+Utils.RAND.nextDouble()*.2;
}
public static ItemStack[] getYield(World world, BlockPos pos, double energy) {
if (modifier<.89||modifier>1.11) {
IndustrialWires.logger.error("The energy-modifier for Marx generators wasn't loaded correctly. It will be reset.");
resetModifier();
}
for (OreInfo ore:oreData) {
if (ore.isValid.test(world, pos)) {
double idealE = modifier * ore.avgEnergy * defaultEnergy;
if (energy >= .75 * idealE) {
double sigma = idealE / 9;
double dist = getNormalizedNormalDist(energy, sigma, idealE);
double out = dist * ore.maxYield;
int yield = (int) Math.floor(out);
out -= yield;
int yieldNuggets = (int) Math.round(out * ore.smallMax);
if (yieldNuggets >= ore.smallMax || (ore.outputSmall == null && yieldNuggets >= ore.smallMax/2F)) {
yield++;
yieldNuggets = 0;
}
if (yield > 0 && yieldNuggets > 0 && ore.outputSmall != null) {
return new ItemStack[]{
ApiUtils.copyStackWithAmount(ore.output.get(), yield),
ApiUtils.copyStackWithAmount(ore.outputSmall.get(), yieldNuggets)
};
} else if (yield > 0) {
return new ItemStack[]{
ApiUtils.copyStackWithAmount(ore.output.get(), yield)
};
} else if (yieldNuggets > 0 && ore.outputSmall != null) {
return new ItemStack[]{
ApiUtils.copyStackWithAmount(ore.outputSmall.get(), yieldNuggets)
};
}
}
}
}
return new ItemStack[0];
}
private static double getNormalizedNormalDist(double x, double sigma, double mu) {
return Math.exp(-(x - mu) * (x - mu) / (2 * sigma * sigma));
}
public static List<OreInfo> getRecipes() {
return oreData;
}
public static class OreInfo {
//Input
public BiPredicate<World, BlockPos> isValid;
public List<ItemStack> exampleInput;
//Output
public final double avgEnergy;
public final double maxYield;
public final Supplier<ItemStack> output;
@Nullable
public final Supplier<ItemStack> outputSmall;//1/9 of output
public final int smallMax;
public OreInfo(BiPredicate<World, BlockPos> isValid, List<ItemStack> exampleInput, double avg, double maxYield,
Supplier<ItemStack> out, @Nullable Supplier<ItemStack> outSmall, int smallCount) {
avgEnergy = avg;
this.maxYield = maxYield;
output = out;
outputSmall = outSmall;
smallMax = smallCount;
this.isValid = isValid;
this.exampleInput = exampleInput;
}
public OreInfo(BiPredicate<World, BlockPos> isValid, List<ItemStack> exampleInput, double avgEnergy, double maxYield,
Item iOut, int mOut, @Nullable Item iOutSmall, int mOutSmall) {
this.avgEnergy = avgEnergy;
this.maxYield = maxYield;
this.output = new IngredientStack(new ItemStack(iOut, 1, mOut))::getExampleStack;
this.outputSmall = iOutSmall == null ? null : new IngredientStack(new ItemStack(iOutSmall, 1, mOutSmall))::getExampleStack;
smallMax = 9;
this.isValid = isValid;
this.exampleInput = exampleInput;
}
public OreInfo(BiPredicate<World, BlockPos> isValid, List<ItemStack> exampleInput, double avgEnergy,
double maxYield, Item iOut, int mOut) {
this(isValid, exampleInput, avgEnergy, maxYield, iOut, mOut, null, 0);
}
public OreInfo(BiPredicate<World, BlockPos> isValid, List<ItemStack> exampleInput, double avgEnergy, double maxYield,
String oreOut, @Nullable String oreSmall) {
this.avgEnergy = avgEnergy;
this.maxYield = maxYield;
this.output = new IngredientStack(oreOut)::getExampleStack;
this.outputSmall = oreSmall == null ? null : new IngredientStack(oreSmall)::getExampleStack;
smallMax = 9;
this.isValid = isValid;
this.exampleInput = exampleInput;
}
public OreInfo(BiPredicate<World, BlockPos> isValid, List<ItemStack> exampleInput, double avgEnergy, double maxYield,
String oreOut) {
this(isValid, exampleInput, avgEnergy, maxYield, oreOut, null);
}
}
public static class OreChecker implements BiPredicate<World, BlockPos> {
String oreName;
public OreChecker(String ore) {
oreName = ore;
}
@Override
public boolean test(World world, BlockPos here) {
IBlockState state = world.getBlockState(here);
ItemStack input = state.getBlock().getPickBlock(state, null, world, here, null);
int[] ores = OreDictionary.getOreIDs(input);
for (int id : ores) {
String name = OreDictionary.getOreName(id);
if (name.equals(oreName)) {
return true;
}
}
return false;
}
}
}

View file

@ -0,0 +1,428 @@
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
package malte0811.industrialWires.hv;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.api.IEProperties;
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 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.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 {
//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() {
return "iw:marx_generator";
}
@SuppressWarnings("unchecked")
@Override
public boolean isBlockTrigger(IBlockState state) {
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")
@Override
public boolean createStructure(World world, BlockPos pos, EnumFacing side, EntityPlayer player) {
if (side.getAxis().isVertical()) {
return false;
}
facing = side.rotateY();
boolean mirrored = false;
Predicate<BlockPos> hvCap = (local) -> {
IBlockState b = world.getBlockState(local);
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() == blockMetalDecoration0 && b.getValue(blockMetalDecoration0.property) == HEAVY_ENGINEERING;
};
Predicate<BlockPos> steelBlock = (local) -> {
IBlockState b = world.getBlockState(local);
b = b.getBlock().getActualState(b, world, local);
ItemStack stack = new ItemStack(b.getBlock(), 1, b.getBlock().getMetaFromState(b));
return ApiUtils.compareToOreName(stack, "blockSteel");
};
BiPredicate<BlockPos, Boolean> wallmount = (local, up) -> {
IBlockState b = world.getBlockState(local);
if (b.getBlock()==IEContent.blockMetalDecoration2) {
b = b.getBlock().getActualState(b, world, local);
if (b.getValue(IEContent.blockMetalDecoration2.property)== STEEL_WALLMOUNT) {
int int_4_wanted = up ? 0 : 1;
return b.getValue(IEProperties.INT_4)==int_4_wanted;
}
}
return false;
};
Predicate<BlockPos> steelFence = (local) -> {
IBlockState b = world.getBlockState(local);
b = b.getBlock().getActualState(b, world, local);
ItemStack stack = new ItemStack(b.getBlock(), 1, b.getBlock().getMetaFromState(b));
return ApiUtils.compareToOreName(stack, "fenceSteel");
};
Function<BlockPos, Byte> hvRelayWith = (local) -> {
IBlockState state = world.getBlockState(local);
state = state.getBlock().getActualState(state, world, local);
if (state.getBlock() != IEContent.blockConnectors) {
return (byte)-1;
}
if (state.getValue(IEContent.blockConnectors.property)!= BlockTypes_Connector.RELAY_HV) {
return (byte)-1;
}
if (state.getValue(FACING_ALL)!=facing) {
return (byte)-1;
}
byte ret = 0;
Set<Connection> existingConns = ImmersiveNetHandler.INSTANCE.getConnections(world, local);
if (existingConns==null) {
return (byte)0;
}
for (Connection c:existingConns) {
if (c.end.equals(local.up())) {
ret |= 1;
} else if (c.end.equals(local.down())) {
ret |= 2;
} else {
return (byte) -1;
}
}
return ret;
};
BiPredicate<BlockPos, BlockTypes_Connector> connNoConns = (local, type) -> {
IBlockState state = world.getBlockState(local);
state = state.getBlock().getActualState(state, world, local);
if (state.getBlock() != IEContent.blockConnectors) {
return false;
}
if (state.getValue(IEContent.blockConnectors.property)!= type) {
return false;
}
if (state.getValue(FACING_ALL)!=(facing)) {
return false;
}
Set<Connection> existingConns = ImmersiveNetHandler.INSTANCE.getConnections(world, local);
return existingConns==null||existingConns.isEmpty();
};
mirrorLoop:for (int fakeI = 0; fakeI < 2; fakeI++) {
mirrored = !mirrored;
// PSU
if (!connNoConns.test(offset(pos, facing, mirrored, 0, -3, 0), CONNECTOR_REDSTONE)) {
continue;
}
if (!connNoConns.test(offset(pos, facing, mirrored, 1, -3, 0), CONNECTOR_HV)) {
continue;
}
for (int i = 0;i<2;i++) {
if (!heavyEng.test(offset(pos, facing, mirrored, i, -2, 0))) {
continue mirrorLoop;
}
}
//Ground discharge electrode
for (int i = 0;i<4;i++) {
if (!steelFence.test(offset(pos, facing, mirrored, 0, i+1, 0))) {
continue mirrorLoop;
}
}
if (!steelBlock.test(offset(pos, facing, mirrored, 1, 4, 0))) {
continue;
}
// stage tower
int stages = 0;
while (pos.getY()+stages<=255) {
boolean end = false;
byte other = -1;
for (int right = 0;right<2;right++) {
if (!hvCap.test(offset(pos, facing, mirrored, right, 0, stages))) {
continue mirrorLoop;
}
if (!wallmount.test(offset(pos, facing, mirrored, right, 1, stages), right!=0)) {
if (right==0) {
if (stages!=0) {
continue mirrorLoop;
}
} else {
end = true;
}
}
byte here = hvRelayWith.apply(offset(pos, facing, mirrored, right, -1, stages));
if (right==1&&here!=other) {
continue mirrorLoop;
}
if (stages!=0&&(here&2)==0) {
continue mirrorLoop;
}
if (here<=0) {
continue mirrorLoop;
}
if ((here&1)==0) {
end = true;
}
other = here;
}
stages++;
if (end) {
if (stages>=5) {
break;
} else {
continue mirrorLoop;
}
}
}
// Top electrode
for (int i = 0;i<4;i++) {
if (!steelFence.test(offset(pos, facing, mirrored, 1, i+1, stages-1))) {
continue mirrorLoop;
}
}
//REPLACE STRUCTURE
if (!world.isRemote) {
IBlockState noModel = IndustrialWires.hvMultiblocks.getDefaultState().withProperty(BlockHVMultiblocks.type, MARX)
.withProperty(IWProperties.MARX_TYPE, NO_MODEL).withProperty(IEProperties.BOOLEANS[0], mirrored);
IBlockState stageModel = noModel.withProperty(IWProperties.MARX_TYPE, STAGE);
IBlockState connModel = noModel.withProperty(IWProperties.MARX_TYPE, CONNECTOR);
// Main tower
for (int s = 0; s < stages; s++) {
for (int f = -1; f < 2; f++) {
for (int r = 0; r < 2; r++) {
BlockPos p = offset(pos, facing, mirrored, r, f, s);
if (f==-1) {
ImmersiveNetHandler.INSTANCE.clearAllConnectionsFor(p, world, false);
}
if (f == 0 && r == 0) {
if (s != 0 && s != stages - 1) {
set(world, p, stageModel, stages, pos);
}
} else {
set(world, p, noModel, stages, pos);
}
}
}
}
//conns
for (int i = 0; i < 2; i++) {
set(world, offset(pos, facing, mirrored, i, -3, 0), connModel, stages, pos);
}
//bottom electrode
for (int i = -2;i<5;i++) {
if (i>-2&&i<2) {
continue;
}
for (int j = 0;j<2;j++) {
if (j==1&&i>1&&i<4) {
continue;
}
set(world, offset(pos, facing, mirrored, j, i, 0), noModel, stages, pos);
}
}
set(world, pos, noModel.withProperty(IWProperties.MARX_TYPE, BOTTOM), stages, pos);
set(world, pos.up(stages-1), noModel.withProperty(IWProperties.MARX_TYPE, TOP), stages, pos);
for (int i = 0;i<3;i++) {
set(world, offset(pos, facing, mirrored, 1,2+i, stages-1), noModel, stages, pos);
}
}
return true;
}
return false;
}
private void set(World world, BlockPos p, IBlockState state, int stages, BlockPos origin) {
world.setBlockState(p, state);
TileEntity te = world.getTileEntity(p);
if (te instanceof TileEntityMarx) {
TileEntityMarx marx = (TileEntityMarx) te;
marx.offset = p.subtract(origin);
marx.formed = true;
marx.setStageCount(stages);
marx.markDirty();
}
}
@SuppressWarnings("unchecked")
@Override
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 12;
}
@Override
public boolean canRenderFormedStructure() {
return false;
}
@Override
public void renderFormedStructure() {
}
}

View file

@ -22,6 +22,7 @@ import blusunrize.immersiveengineering.common.blocks.TileEntityIEBase;
import io.netty.buffer.ByteBuf;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.ISyncReceiver;
import malte0811.industrialWires.blocks.TileEntityIWBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@ -36,7 +37,7 @@ public class MessageTileSyncIW implements IMessage {
BlockPos pos;
NBTTagCompound nbt;
public MessageTileSyncIW(TileEntityIEBase tile, NBTTagCompound nbt) {
public MessageTileSyncIW(TileEntity tile, NBTTagCompound nbt) {
this.pos = tile.getPos();
this.nbt = nbt;
}

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

@ -65,13 +65,20 @@ public class DualEnergyStorage {
return extr;
}
public void extractEURaw(double extract) {
storedEU -= extract;
}
public double extractIF(int extractMax, boolean doExtract) {
double eu = extractMax * ConversionUtil.euPerIfIdeal();
return ConversionUtil.ifPerEuIdeal() * extractEU(eu, doExtract);
}
public double insertEU(double insertMax, boolean doInsert) {
double ins = Math.min(insertMax, maxEU - storedEU);
return insertEU(insertMax, maxInEU, doInsert);
}
public double insertEU(double insertMax, double leftover, boolean doInsert) {
double ins = Math.min(Math.min(insertMax, maxEU - storedEU), leftover);
if (doInsert) {
storedEU += ins;
}
@ -79,8 +86,12 @@ public class DualEnergyStorage {
}
public double insertIF(int insertMax, boolean doInsert) {
return insertIF(insertMax, ConversionUtil.ifPerEuIdeal()*maxInEU, doInsert);
}
public double insertIF(int insertMax, double leftover, boolean doInsert) {
double eu = insertMax * ConversionUtil.euPerIfIdeal();
return ConversionUtil.ifPerEuIdeal() * insertEU(eu, doInsert);
double euMax = leftover* ConversionUtil.euPerIfIdeal();
return ConversionUtil.ifPerEuIdeal() * insertEU(eu, euMax, doInsert);
}
public double getEnergyStoredEU() {
@ -114,7 +125,11 @@ public class DualEnergyStorage {
}
}
public static DualEnergyStorage readFromNBT(NBTTagCompound nbt) {
return new DualEnergyStorage(nbt.getDouble("stored"), nbt.getDouble("maxStored"), nbt.getDouble("maxIn"), nbt.getDouble("maxOut"));
public void readFromNBT(NBTTagCompound nbt) {
storedEU = nbt.getDouble("stored");
}
public double getMaxInputIF() {
return maxInEU*ConversionUtil.ifPerEuIdeal();
}
}

View file

@ -21,11 +21,20 @@ package malte0811.industrialWires.util;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable;
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces;
import blusunrize.immersiveengineering.common.util.chickenbones.Matrix4;
import com.google.common.collect.ImmutableSet;
import malte0811.industrialWires.blocks.TileEntityIWMultiblock;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -84,4 +93,64 @@ public final class MiscUtils {
}
return ret;
}
/**
* @param mirror inverts right
*/
public static BlockPos offset(BlockPos p, EnumFacing f, boolean mirror, int right, int forward, int up) {
if (mirror) {
right *= -1;
}
return p.offset(f, forward).offset(f.rotateY(), right).add(0, up, 0);
}
/**
* Calculates the parameters for offset to generate here from origin
* @return right, forward, up
*/
public static BlockPos getOffset(BlockPos origin, EnumFacing f, boolean mirror, BlockPos here) {
int dX = origin.getZ()-here.getZ();
int dZ = origin.getX()-here.getX();
int forward = 0;
int right = 0;
int up = here.getY()-origin.getY();
switch (f) {
case NORTH:
forward = dZ;
right = -dX;
break;
case SOUTH:
forward = -dZ;
right = dX;
break;
case WEST:
right = dZ;
forward = dX;
break;
case EAST:
right = -dZ;
forward = -dX;
break;
}
if (mirror) {
right *= -1;
}
return new BlockPos(right, forward, up);
}
@Nonnull
public static AxisAlignedBB apply(@Nonnull Matrix4 mat, @Nonnull AxisAlignedBB in) {
Vec3d min = new Vec3d(in.minX, in.minY, in.minZ);
Vec3d max = new Vec3d(in.maxX, in.maxY, in.maxZ);
min = mat.apply(min);
max = mat.apply(max);
return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z);
}
public static ItemStack getItemStack(IBlockState origState, World w, BlockPos pos) {
if (origState.getBlock() instanceof IEBlockInterfaces.IIEMetaBlock) {
int meta = origState.getBlock().getMetaFromState(origState);
return new ItemStack(origState.getBlock(), 1, meta);
}
return origState.getBlock().getPickBlock(origState, null, w, pos, null);
}
}

View file

@ -0,0 +1,95 @@
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-block",
"custom": {
"flip-v": true
},
"textures": {
"particle": "immersiveengineering:blocks/storage_steel"
}
},
"variants": {
"inventory,type=marx": [
{
"model": "industrialwires:marx_stage.obj",
"transform": {
"scale": 0.375,
"rotation": [
{
"x": 20
},
{
"y": 135
}
],
"translation": [
0.15, 0, 0
]
}
}
],
"type": {
"marx": {
}
},
"facing": {
"north": {
"transform": {
"rotation": {
"y": 0
}
}
},
"south": {
"transform": {
"rotation": {
"y": 180
}
}
},
"west": {
"transform": {
"rotation": {
"y": 90
}
}
},
"east": {
"transform": {
"rotation": {
"y": -90
}
}
}
},
"marx_type": {
"bottom": {
"model": "industrialwires:marx_bottom.obj"
},
"stage": {
"model": "industrialwires:marx_stage.obj"
},
"top": {
"model": "industrialwires:marx_top.obj"
},
"no_model": {
"model": "builtin/generated"
},
"connector": {
"model": "immersiveengineering:smartmodel/conn_empty"
}
},
"boolean0":
{
"false": {},
"true": {
"transform": {
"rotation": {
"y": 0
}
}
}
}
}
}

View file

@ -43,18 +43,33 @@ item.industrialwires.key.key_named.name=Key for
item.industrialwires.key.blank_key.name=Blank Key
item.industrialwires.key.key_ring.name=Key Ring
industrialwires.subtitle.tinnitus=You have a tinnitus
industrialwires.subtitle.jacobs_ladder=Jacob's ladder hums
industrialwires.subtitle.marx_bang=Marx generator discharges
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
industrialwires.desc.remove_all=Remove all components from this panel
industrialwires.desc.create_panel=Create a new control panel
industrialwires.desc.enable_snap=Snap new components to the 16*16 grid
industrialwires.desc.disable_snap=Allow free placing of components
industrialwires.desc.snap0=Allow free placing of components
industrialwires.desc.snap1=Snap to grid
industrialwires.desc.snap2=Snap to other components
industrialwires.desc.latching=Latching
industrialwires.desc.latching_info=Does this button stay on indefinitely?
industrialwires.desc.disassemble=Disassemble the panel
industrialwires.desc.rsid_info=The ID of the redstone wire controller to output a signal to
industrialwires.desc.rschannel_info=The color of the channel to output the signal to
industrialwires.desc.rsid_info=The ID of the redstone wire controller to interact with
industrialwires.desc.rschannel_info=The color of the channel to use
industrialwires.desc.rsid_info2=The ID of the redstone wire controller for the second signal. -1 to disable.
industrialwires.desc.rschannel_info2=The color of the channel to use for the second signal
industrialwires.desc.label_text=The text in this label
industrialwires.desc.red=Red
industrialwires.desc.green=Green
@ -85,6 +100,7 @@ industrialwires.chat.tooLong=This coil does not contain enough wire for this con
industrialwires.chat.stackSize=Linking is only possible with a stack of size 1
death.attack.industrialwires.jacobs_ladder=%1$s was electrocuted by a Jacob's Ladder
death.attack.industrialwires.marx=%1$s was struck by lightning produced by a Marx generator
itemGroup.industrialwires=Industrial Wires
@ -105,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, thus allowing more precise control/measurements. Panel components capable of interacting with analog signals usually support this dual-channel setup.
ie.manual.entry.industrialwires.marx4=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 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.
ie.manual.entry.industrialwires.marx5=§lSafety§r<br>Due to the high voltages and energies involved in firing a Marx generator a safe distance should be maintained to avoid 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=
@ -124,7 +151,7 @@ ie.manual.entry.industrialwires.panel_creator.name=Panel Creator
ie.manual.entry.industrialwires.panel_creator.subtext=
ie.manual.entry.industrialwires.panel_creator0=The GUI of the panel creator consists of two major sections: The controls on the left and the panel on the right. Components can be placed on the panel by "placing" the items in the corresponding point in the GUI. If the component is surrounded by a red area, it can not be placed in that
ie.manual.entry.industrialwires.panel_creator1=position on the panel. This usually means that it is either overlapping with an other component or isn't completely on the panel.<br>The top button on the left (D) disassembles an existing control panel when it is placed in the slot beneath the button: The components of that panel are placed in the GUI, allowing them to be repositioned. The casing is lost in this process.<br>The next button (C) places the components from the right of the GUI on an Unfinished Control Panel in the slot in the
ie.manual.entry.industrialwires.panel_creator2=left of the GUI, turning it into a regular Control Panel.<br>The button labeled R removes all components from the GUI panel area and places them in your inventory.<br>Finally the last button (S) changes between being able to place components anywhere on the panel to only being able to place them on a 16x16 grid.
ie.manual.entry.industrialwires.panel_creator2=left of the GUI, turning it into a regular Control Panel.<br>The button labeled R removes all components from the GUI panel area and places them in your inventory.<br>Finally the last button (S) changes the snapping mode. Components can be placed anywhere by default. The first snapping option forces the component to align with the 16x16 grid, the second option forces it to align with components already placed on the panel.
ie.manual.entry.industrialwires.redstone.name=Redstone Connections
ie.manual.entry.industrialwires.redstone.subtext=Could also be blood vessels

View file

@ -0,0 +1,8 @@
newmtl marx
map_Ka industrialwires:blocks/marx
newmtl connectorHV
map_Ka immersiveengineering:blocks/connector_connector_hv
newmtl connectorRedstone
map_Ka immersiveengineering:blocks/connector_connector_redstone

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
# Blender MTL File: 'NewMarx.blend'
# Material Count: 3
newmtl marx
map_Kd industrialwires:blocks/marx

View file

@ -0,0 +1,635 @@
# Blender v2.78 (sub 0) OBJ File: 'NewMarx.blend'
# www.blender.org
mtllib marx_stage.mtl
o Cube.021_Cube.003
v 0.437498 0.187500 1.375000
v 0.437498 0.312500 1.375000
v 0.437498 0.187500 1.000000
v 0.437498 0.312500 1.000000
v 0.562498 0.187500 1.375000
v 0.562498 0.312500 1.375000
v 0.562498 0.187500 1.000000
v 0.562498 0.312500 1.000000
vt 0.4219 0.2031
vt 0.4062 0.2031
vt 0.4062 0.1562
vt 0.4219 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1562
vt 0.4062 0.2031
vt 0.3906 0.2031
vt 0.4297 0.2031
vt 0.4297 0.2188
vt 0.4141 0.2188
vt 0.4141 0.2031
vt 0.4531 0.2031
vt 0.4375 0.2031
vt 0.4375 0.1562
vt 0.4531 0.1562
vt 0.4219 0.1562
vt 0.4375 0.1562
vt 0.4375 0.2031
vt 0.4219 0.2031
vn -1.0000 0.0000 0.0000
vn 1.0000 -0.0000 0.0000
vn -0.0000 0.0000 1.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 1/1/1 2/2/1 4/3/1 3/4/1
f 7/5/2 8/6/2 6/7/2 5/8/2
f 5/9/3 6/10/3 2/11/3 1/12/3
f 3/13/4 7/14/4 5/15/4 1/16/4
f 8/17/5 4/18/5 2/19/5 6/20/5
o Cube.003_Cube.013
v 1.999999 -0.000001 0.000001
v 1.999999 -0.000001 1.000000
v 0.000000 0.000000 1.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.499999 0.000001
v 1.999999 0.499999 1.000000
v -0.000000 0.500000 1.000000
v 0.000000 0.500000 0.000001
vt 0.1250 0.5000
vt 0.0000 0.5000
vt 0.0000 0.2500
vt 0.1250 0.2500
vt 0.0000 0.2500
vt 0.0000 -0.0000
vt 0.1250 -0.0000
vt 0.1250 0.2500
vt -0.0000 0.5000
vt 0.0625 0.5000
vt 0.0625 0.6250
vt -0.0000 0.6250
vt 0.1250 0.1250
vt 0.1250 0.0625
vt 0.3750 0.0625
vt 0.3750 0.1250
vt 0.1250 0.6250
vt 0.0625 0.6250
vt 0.0625 0.5000
vt 0.1250 0.5000
vt 0.3750 -0.0000
vt 0.3750 0.0625
vt 0.1250 0.0625
vt 0.1250 -0.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 -0.0000
vn 1.0000 -0.0000 0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
usemtl marx
f 9/21/6 10/22/6 11/23/6 12/24/6
f 13/25/7 16/26/7 15/27/7 14/28/7
f 9/29/8 13/30/8 14/31/8 10/32/8
f 10/33/9 14/34/9 15/35/9 11/36/9
f 11/37/10 15/38/10 16/39/10 12/40/10
f 13/41/11 9/42/11 12/43/11 16/44/11
o Cube.011_Cube.026
v 1.374998 0.500000 0.625000
v 1.374998 1.000000 0.625000
v 1.374998 0.500000 0.375000
v 1.374998 1.000000 0.375000
v 1.624998 0.500000 0.625000
v 1.624998 1.000000 0.625000
v 1.624998 0.500000 0.375000
v 1.624998 1.000000 0.375000
v 1.250000 0.687500 0.750000
v 1.250000 0.812500 0.750000
v 1.250000 0.687500 0.250000
v 1.250000 0.812500 0.250000
v 1.750000 0.687500 0.750000
v 1.750000 0.812500 0.750000
v 1.750000 0.687500 0.250000
v 1.750000 0.812500 0.250000
vt 0.2266 0.4609
vt 0.2266 0.3984
vt 0.2578 0.3984
vt 0.2578 0.4609
vt 0.2578 0.3359
vt 0.2266 0.3984
vt 0.2266 0.3359
vt 0.1953 0.3984
vt 0.1953 0.3359
vt 0.2266 0.3984
vt 0.2266 0.4609
vt 0.1953 0.4609
vt 0.1953 0.3984
vt 0.2578 0.3984
vt 0.2734 0.3984
vt 0.2734 0.4609
vt 0.2578 0.4609
vt 0.2734 0.3359
vt 0.2891 0.3359
vt 0.2891 0.3984
vt 0.2734 0.3984
vt 0.2891 0.4609
vt 0.2734 0.4609
vt 0.2578 0.3359
vt 0.2734 0.3359
vt 0.1328 0.3984
vt 0.1953 0.3984
vt 0.1953 0.4609
vt 0.1328 0.4609
vt 0.1328 0.3359
vt 0.1953 0.3359
vt 0.1953 0.3984
vt 0.1328 0.3984
vn -1.0000 0.0000 0.0000
vn -0.0000 0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 17/45/12 18/46/12 20/47/12 19/48/12
f 19/49/13 20/47/13 24/50/13 23/51/13
f 23/51/14 24/50/14 22/52/14 21/53/14
f 21/54/15 22/55/15 18/56/15 17/57/15
f 25/58/12 26/59/12 28/60/12 27/61/12
f 27/62/13 28/63/13 32/64/13 31/65/13
f 31/65/14 32/64/14 30/66/14 29/67/14
f 29/68/15 30/69/15 26/59/15 25/58/15
f 27/70/16 31/71/16 29/72/16 25/73/16
f 32/74/17 28/75/17 26/76/17 30/77/17
o Cube.014_Cube.027
v 1.187498 0.385723 -0.187500
v 1.010721 0.562500 -0.187500
v 1.187498 0.385723 -0.437500
v 1.010721 0.562500 -0.437500
v 1.364275 0.562500 -0.187500
v 1.187498 0.739277 -0.187500
v 1.364275 0.562500 -0.437500
v 1.187498 0.739277 -0.437500
v 1.455804 0.205806 -0.250000
v 1.102251 0.559359 -0.250000
v 1.455804 0.205806 -0.373125
v 1.102251 0.559359 -0.373125
v 1.544192 0.294194 -0.250000
v 1.190639 0.647748 -0.250000
v 1.544192 0.294194 -0.373125
v 1.190639 0.647748 -0.373125
v 1.562498 0.312500 -0.375000
v 1.437498 0.312500 -0.375000
v 1.562498 0.312500 -0.000000
v 1.437498 0.312500 0.000000
v 1.562498 0.187500 -0.375000
v 1.437498 0.187500 -0.375000
v 1.562498 0.187500 -0.000000
v 1.437498 0.187500 0.000000
vt 0.3750 0.0938
vt 0.3750 0.0625
vt 0.4062 0.0625
vt 0.4062 0.0938
vt 0.4062 0.1250
vt 0.4062 0.1562
vt 0.3750 0.1562
vt 0.3750 0.1250
vt 0.4688 0.1562
vt 0.4375 0.1562
vt 0.4375 0.1250
vt 0.4688 0.1250
vt 0.4375 0.0938
vt 0.4062 0.1250
vt 0.4062 0.0938
vt 0.3750 0.0938
vt 0.3438 0.1562
vt 0.3438 0.1250
vt 0.3750 0.1250
vt 0.4844 0.0625
vt 0.4844 0.1250
vt 0.4688 0.1250
vt 0.4688 0.0625
vt 0.4531 0.0625
vt 0.4531 0.1250
vt 0.4375 0.1250
vt 0.4375 0.0625
vt 0.4844 0.1250
vt 0.4844 0.0625
vt 0.5000 0.0625
vt 0.5000 0.1250
vt 0.4531 0.1250
vt 0.4531 0.0625
vt 0.4688 0.0625
vt 0.4688 0.1250
vt 0.4844 0.1719
vt 0.4688 0.1719
vt 0.4688 0.1250
vt 0.4844 0.1250
vt 0.4375 0.1719
vt 0.4219 0.1719
vt 0.4219 0.1250
vt 0.4375 0.1250
vt 0.3906 0.1719
vt 0.3750 0.1719
vt 0.3750 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1250
vt 0.4219 0.1250
vt 0.4219 0.1719
vt 0.4062 0.1719
vt 0.5000 0.1719
vt 0.4844 0.1719
vt 0.4844 0.1250
vt 0.5000 0.1250
vn -0.7071 -0.7071 -0.0000
vn -0.0000 0.0000 -1.0000
vn 0.7071 0.7071 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.7071 -0.7071 -0.0000
vn -0.7071 0.7071 0.0000
vn 0.0000 1.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 -0.0000
vn -1.0000 0.0000 0.0000
usemtl marx
f 33/78/18 34/79/18 36/80/18 35/81/18
f 35/82/19 36/83/19 40/84/19 39/85/19
f 39/86/20 40/87/20 38/88/20 37/89/20
f 37/90/21 38/88/21 34/91/21 33/92/21
f 35/82/22 39/85/22 37/93/22 33/92/22
f 40/84/23 36/94/23 34/95/23 38/96/23
f 41/97/18 42/98/18 44/99/18 43/100/18
f 43/101/19 44/102/19 48/103/19 47/104/19
f 47/105/20 48/106/20 46/107/20 45/108/20
f 45/109/21 46/110/21 42/111/21 41/112/21
f 49/113/24 50/114/24 52/115/24 51/116/24
f 55/117/25 56/118/25 54/119/25 53/120/25
f 53/121/19 54/122/19 50/123/19 49/124/19
f 51/125/26 55/126/26 53/127/26 49/128/26
f 56/129/27 52/130/27 50/131/27 54/132/27
o Cube.015_Cube.028
v 0.374998 0.500000 0.625000
v 0.374998 1.000000 0.625000
v 0.374998 0.500000 0.375000
v 0.374998 1.000000 0.375000
v 0.624998 0.500000 0.625000
v 0.624998 1.000000 0.625000
v 0.624998 0.500000 0.375000
v 0.624998 1.000000 0.375000
v 0.250000 0.687500 0.750000
v 0.250000 0.812500 0.750000
v 0.250000 0.687500 0.250000
v 0.250000 0.812500 0.250000
v 0.750000 0.687500 0.750000
v 0.750000 0.812500 0.750000
v 0.750000 0.687500 0.250000
v 0.750000 0.812500 0.250000
vt 0.2266 0.4609
vt 0.2266 0.3984
vt 0.2578 0.3984
vt 0.2578 0.4609
vt 0.2578 0.3359
vt 0.2266 0.3984
vt 0.2266 0.3359
vt 0.1953 0.3984
vt 0.1953 0.3359
vt 0.2266 0.3984
vt 0.2266 0.4609
vt 0.1953 0.4609
vt 0.1953 0.3984
vt 0.2578 0.3984
vt 0.2734 0.3984
vt 0.2734 0.4609
vt 0.2578 0.4609
vt 0.2734 0.3359
vt 0.2891 0.3359
vt 0.2891 0.3984
vt 0.2734 0.3984
vt 0.2891 0.4609
vt 0.2734 0.4609
vt 0.2578 0.3359
vt 0.2734 0.3359
vt 0.1328 0.3984
vt 0.1953 0.3984
vt 0.1953 0.4609
vt 0.1328 0.4609
vt 0.1328 0.3359
vt 0.1953 0.3359
vt 0.1953 0.3984
vt 0.1328 0.3984
vn -1.0000 0.0000 0.0000
vn -0.0000 0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 57/133/28 58/134/28 60/135/28 59/136/28
f 59/137/29 60/135/29 64/138/29 63/139/29
f 63/139/30 64/138/30 62/140/30 61/141/30
f 61/142/31 62/143/31 58/144/31 57/145/31
f 65/146/28 66/147/28 68/148/28 67/149/28
f 67/150/29 68/151/29 72/152/29 71/153/29
f 71/153/30 72/152/30 70/154/30 69/155/30
f 69/156/31 70/157/31 66/147/31 65/146/31
f 67/158/32 71/159/32 69/160/32 65/161/32
f 72/162/33 68/163/33 66/164/33 70/165/33
o Cube.016_Cube.029
v 1.437498 0.312500 1.375000
v 1.437498 1.187500 1.375000
v 1.437498 0.312500 1.250000
v 1.437498 1.187500 1.250000
v 1.562498 0.312500 1.375000
v 1.562498 1.187500 1.375000
v 1.562498 0.312500 1.250000
v 1.562498 1.187500 1.250000
vt 0.4219 0.1172
vt 0.4219 0.0078
vt 0.4375 0.0078
vt 0.4375 0.1172
vt 0.3906 0.3984
vt 0.3906 0.2891
vt 0.4062 0.2891
vt 0.4062 0.3984
vt 0.4688 0.0703
vt 0.4688 0.1797
vt 0.4531 0.1797
vt 0.4531 0.0703
vt 0.4141 0.0938
vt 0.4141 0.2031
vt 0.3984 0.2031
vt 0.3984 0.0938
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 0.0000 1.0000
usemtl marx
f 73/166/34 74/167/34 76/168/34 75/169/34
f 75/170/35 76/171/35 80/172/35 79/173/35
f 79/174/36 80/175/36 78/176/36 77/177/36
f 77/178/37 78/179/37 74/180/37 73/181/37
o Cube.017_Cube.030
v 1.374998 0.375000 1.437500
v 1.374998 1.125000 1.437500
v 1.374998 0.375000 1.187500
v 1.374998 1.125000 1.187500
v 1.624998 0.375000 1.437500
v 1.624998 1.125000 1.437500
v 1.624998 0.375000 1.187500
v 1.624998 1.125000 1.187500
vt 0.1953 0.2266
vt 0.1953 0.1328
vt 0.2266 0.1328
vt 0.2266 0.2266
vt 0.1641 0.1328
vt 0.1641 0.2266
vt 0.1328 0.2266
vt 0.1328 0.1328
vt 0.1641 0.2266
vt 0.1641 0.3203
vt 0.1328 0.3203
vt 0.1328 0.2266
vt 0.1953 0.1328
vt 0.1953 0.2266
vt 0.1641 0.2266
vt 0.1641 0.1328
vt 0.1953 0.2266
vt 0.1953 0.2578
vt 0.1641 0.2578
vt 0.1641 0.2266
vt 0.2266 0.2578
vt 0.1953 0.2578
vt 0.1953 0.2266
vt 0.2266 0.2266
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 81/182/38 82/183/38 84/184/38 83/185/38
f 83/186/39 84/187/39 88/188/39 87/189/39
f 87/190/40 88/191/40 86/192/40 85/193/40
f 85/194/41 86/195/41 82/196/41 81/197/41
f 83/198/42 87/199/42 85/200/42 81/201/42
f 88/202/43 84/203/43 82/204/43 86/205/43
o Cube.018_Cube.031
v 0.437498 0.312500 1.375000
v 0.437499 1.187500 1.375000
v 0.437498 0.312500 1.250000
v 0.437499 1.187500 1.250000
v 0.562498 0.312500 1.375000
v 0.562499 1.187500 1.375000
v 0.562498 0.312500 1.250000
v 0.562499 1.187500 1.250000
vt 0.4219 0.1172
vt 0.4219 0.0078
vt 0.4375 0.0078
vt 0.4375 0.1172
vt 0.3906 0.3984
vt 0.3906 0.2891
vt 0.4062 0.2891
vt 0.4062 0.3984
vt 0.4688 0.0703
vt 0.4688 0.1797
vt 0.4531 0.1797
vt 0.4531 0.0703
vt 0.4141 0.0938
vt 0.4141 0.2031
vt 0.3984 0.2031
vt 0.3984 0.0938
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 0.0000 1.0000
usemtl marx
f 89/206/44 90/207/44 92/208/44 91/209/44
f 91/210/45 92/211/45 96/212/45 95/213/45
f 95/214/46 96/215/46 94/216/46 93/217/46
f 93/218/47 94/219/47 90/220/47 89/221/47
o Cube.020_Cube.032
v 0.374998 0.375000 1.437500
v 0.374998 1.125000 1.437500
v 0.374998 0.375000 1.187500
v 0.374998 1.125000 1.187500
v 0.624998 0.375000 1.437500
v 0.624998 1.125000 1.437500
v 0.624998 0.375000 1.187500
v 0.624998 1.125000 1.187500
vt 0.1953 0.2266
vt 0.1953 0.1328
vt 0.2266 0.1328
vt 0.2266 0.2266
vt 0.1641 0.1328
vt 0.1641 0.2266
vt 0.1328 0.2266
vt 0.1328 0.1328
vt 0.1641 0.2266
vt 0.1641 0.3203
vt 0.1328 0.3203
vt 0.1328 0.2266
vt 0.1953 0.1328
vt 0.1953 0.2266
vt 0.1641 0.2266
vt 0.1641 0.1328
vt 0.1953 0.2266
vt 0.1953 0.2578
vt 0.1641 0.2578
vt 0.1641 0.2266
vt 0.2266 0.2578
vt 0.1953 0.2578
vt 0.1953 0.2266
vt 0.2266 0.2266
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 97/222/48 98/223/48 100/224/48 99/225/48
f 99/226/49 100/227/49 104/228/49 103/229/49
f 103/230/50 104/231/50 102/232/50 101/233/50
f 101/234/51 102/235/51 98/236/51 97/237/51
f 99/238/52 103/239/52 101/240/52 97/241/52
f 104/242/53 100/243/53 98/244/53 102/245/53
o Cube.022_Cube.033
v 0.812498 0.114277 -0.187500
v 0.989275 -0.062500 -0.187500
v 0.812498 0.114276 -0.437500
v 0.989275 -0.062500 -0.437500
v 0.635721 -0.062500 -0.187500
v 0.812498 -0.239277 -0.187500
v 0.635722 -0.062500 -0.437500
v 0.812498 -0.239277 -0.437500
v 0.544192 0.294194 -0.250000
v 0.897746 -0.059359 -0.250000
v 0.544193 0.294194 -0.373125
v 0.897746 -0.059359 -0.373125
v 0.455804 0.205806 -0.250000
v 0.809357 -0.147748 -0.250000
v 0.455804 0.205806 -0.373125
v 0.809357 -0.147748 -0.373125
v 0.437498 0.187500 -0.375000
v 0.562498 0.187500 -0.375000
v 0.437498 0.187500 -0.000000
v 0.562498 0.187500 0.000000
v 0.437498 0.312500 -0.375000
v 0.562498 0.312500 -0.375000
v 0.437498 0.312500 -0.000000
v 0.562498 0.312500 0.000000
vt 0.3750 0.0938
vt 0.3750 0.0625
vt 0.4062 0.0625
vt 0.4062 0.0938
vt 0.4062 0.1250
vt 0.4062 0.1562
vt 0.3750 0.1562
vt 0.3750 0.1250
vt 0.4688 0.1562
vt 0.4375 0.1562
vt 0.4375 0.1250
vt 0.4688 0.1250
vt 0.4375 0.0938
vt 0.4062 0.1250
vt 0.4062 0.0938
vt 0.3750 0.0938
vt 0.3438 0.1562
vt 0.3438 0.1250
vt 0.3750 0.1250
vt 0.4844 0.0625
vt 0.4844 0.1250
vt 0.4688 0.1250
vt 0.4688 0.0625
vt 0.4531 0.0625
vt 0.4531 0.1250
vt 0.4375 0.1250
vt 0.4375 0.0625
vt 0.4844 0.1250
vt 0.4844 0.0625
vt 0.5000 0.0625
vt 0.5000 0.1250
vt 0.4531 0.1250
vt 0.4531 0.0625
vt 0.4688 0.0625
vt 0.4688 0.1250
vt 0.4844 0.1719
vt 0.4688 0.1719
vt 0.4688 0.1250
vt 0.4844 0.1250
vt 0.4375 0.1719
vt 0.4219 0.1719
vt 0.4219 0.1250
vt 0.4375 0.1250
vt 0.3906 0.1719
vt 0.3750 0.1719
vt 0.3750 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1250
vt 0.4219 0.1250
vt 0.4219 0.1719
vt 0.4062 0.1719
vt 0.5000 0.1719
vt 0.4844 0.1719
vt 0.4844 0.1250
vt 0.5000 0.1250
vn 0.7071 0.7071 0.0000
vn 0.0000 -0.0000 -1.0000
vn -0.7071 -0.7071 -0.0000
vn -0.0000 0.0000 1.0000
vn -0.7071 0.7071 -0.0000
vn 0.7071 -0.7071 0.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn -1.0000 0.0000 -0.0000
vn 1.0000 -0.0000 0.0000
usemtl marx
f 105/246/54 106/247/54 108/248/54 107/249/54
f 107/250/55 108/251/55 112/252/55 111/253/55
f 111/254/56 112/255/56 110/256/56 109/257/56
f 109/258/57 110/256/57 106/259/57 105/260/57
f 107/250/58 111/253/58 109/261/58 105/260/58
f 112/252/59 108/262/59 106/263/59 110/264/59
f 113/265/54 114/266/54 116/267/54 115/268/54
f 115/269/55 116/270/55 120/271/55 119/272/55
f 119/273/56 120/274/56 118/275/56 117/276/56
f 117/277/57 118/278/57 114/279/57 113/280/57
f 121/281/60 122/282/60 124/283/60 123/284/60
f 127/285/61 128/286/61 126/287/61 125/288/61
f 125/289/55 126/290/55 122/291/55 121/292/55
f 123/293/62 127/294/62 125/295/62 121/296/62
f 128/297/63 124/298/63 122/299/63 126/300/63
o Cube.012_Cube.034
v 1.437498 0.187500 1.375000
v 1.437498 0.312500 1.375000
v 1.437498 0.187500 1.000000
v 1.437498 0.312500 1.000000
v 1.562498 0.187500 1.375000
v 1.562498 0.312500 1.375000
v 1.562498 0.187500 1.000000
v 1.562498 0.312500 1.000000
vt 0.4219 0.2031
vt 0.4062 0.2031
vt 0.4062 0.1562
vt 0.4219 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1562
vt 0.4062 0.2031
vt 0.3906 0.2031
vt 0.4297 0.2031
vt 0.4297 0.2188
vt 0.4141 0.2188
vt 0.4141 0.2031
vt 0.4531 0.2031
vt 0.4375 0.2031
vt 0.4375 0.1562
vt 0.4531 0.1562
vt 0.4219 0.1562
vt 0.4375 0.1562
vt 0.4375 0.2031
vt 0.4219 0.2031
vn -1.0000 0.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 0.0000 1.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 129/301/64 130/302/64 132/303/64 131/304/64
f 135/305/65 136/306/65 134/307/65 133/308/65
f 133/309/66 134/310/66 130/311/66 129/312/66
f 131/313/67 135/314/67 133/315/67 129/316/67
f 136/317/68 132/318/68 130/319/68 134/320/68

View file

@ -0,0 +1,2 @@
newmtl marx
map_Ka industrialwires:blocks/marx

View file

@ -0,0 +1,316 @@
# Blender v2.78 (sub 0) OBJ File: 'NewMarx.blend'
# www.blender.org
mtllib marx_top.mtl
o Cube.037_Cube.157
v 1.406250 0.062500 -3.406250
v 1.406250 0.187500 -3.406250
v 1.406250 0.062500 -3.593750
v 1.406250 0.187500 -3.593750
v 1.593750 0.062500 -3.406250
v 1.593750 0.187500 -3.406250
v 1.593750 0.062500 -3.593750
v 1.593750 0.187500 -3.593750
vt 0.4531 0.1641
vt 0.4375 0.1641
vt 0.4375 0.1406
vt 0.4531 0.1406
vt 0.4375 0.1172
vt 0.4531 0.1172
vt 0.4375 0.1406
vt 0.4219 0.1406
vt 0.4219 0.1172
vt 0.4375 0.1172
vt 0.4219 0.1406
vt 0.4375 0.1406
vt 0.4219 0.1641
vt 0.3984 0.1641
vt 0.3984 0.1406
vt 0.4219 0.1172
vt 0.4219 0.1406
vt 0.3984 0.1406
vt 0.3984 0.1172
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/7/3 8/8/3 6/9/3 5/10/3
f 5/11/4 6/12/4 2/2/4 1/13/4
f 3/14/5 7/15/5 5/11/5 1/13/5
f 8/16/6 4/17/6 2/18/6 6/19/6
o Cube.027_Cube.115
v 1.437500 0.187500 0.000000
v 1.437500 0.312500 0.000000
v 1.437500 0.187500 -3.562500
v 1.437500 0.312500 -3.562500
v 1.562500 0.187500 0.000000
v 1.562500 0.312500 0.000000
v 1.562500 0.187500 -3.562500
v 1.562500 0.312500 -3.562500
vt 0.4219 0.4453
vt 0.4062 0.4453
vt 0.4062 -0.0000
vt 0.4219 -0.0000
vt 0.4375 0.0156
vt 0.4375 -0.0000
vt 0.4531 -0.0000
vt 0.4531 0.0156
vt 0.3906 0.4453
vt 0.3750 0.4453
vt 0.3750 -0.0000
vt 0.3906 -0.0000
vt 0.3906 -0.0000
vt 0.4062 -0.0000
vt 0.4062 0.4453
vt 0.3906 0.4453
vt 0.4375 0.4453
vt 0.4219 0.4453
vt 0.4219 -0.0000
vt 0.4375 -0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 9/20/7 10/21/7 12/22/7 11/23/7
f 11/24/8 12/25/8 16/26/8 15/27/8
f 15/28/9 16/29/9 14/30/9 13/31/9
f 11/32/10 15/33/10 13/34/10 9/35/10
f 16/36/11 12/37/11 10/38/11 14/39/11
o Cube.013_Cube.035
v 1.999999 -0.000001 0.000001
v 1.999999 -0.000001 1.000000
v 0.000000 0.000000 1.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.499999 0.000001
v 1.999999 0.499999 1.000000
v -0.000000 0.500000 1.000000
v 0.000000 0.500000 0.000001
vt 0.1250 0.5000
vt 0.0000 0.5000
vt 0.0000 0.2500
vt 0.1250 0.2500
vt 0.0000 0.2500
vt 0.0000 -0.0000
vt 0.1250 -0.0000
vt 0.1250 0.2500
vt -0.0000 0.5000
vt 0.0625 0.5000
vt 0.0625 0.6250
vt -0.0000 0.6250
vt 0.1250 0.1250
vt 0.1250 0.0625
vt 0.3750 0.0625
vt 0.3750 0.1250
vt 0.1250 0.6250
vt 0.0625 0.6250
vt 0.0625 0.5000
vt 0.1250 0.5000
vt 0.3750 -0.0000
vt 0.3750 0.0625
vt 0.1250 0.0625
vt 0.1250 -0.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 -0.0000
vn 1.0000 -0.0000 0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
usemtl marx
f 17/40/12 18/41/12 19/42/12 20/43/12
f 21/44/13 24/45/13 23/46/13 22/47/13
f 17/48/14 21/49/14 22/50/14 18/51/14
f 18/52/15 22/53/15 23/54/15 19/55/15
f 19/56/16 23/57/16 24/58/16 20/59/16
f 21/60/17 17/61/17 20/62/17 24/63/17
o Cube.019_Cube.036
v 1.437498 0.187500 1.375000
v 1.437498 0.312500 1.375000
v 1.437498 0.187500 1.000000
v 1.437498 0.312500 1.000000
v 1.562498 0.187500 1.375000
v 1.562498 0.312500 1.375000
v 1.562498 0.187500 1.000000
v 1.562498 0.312500 1.000000
vt 0.4219 0.2031
vt 0.4062 0.2031
vt 0.4062 0.1562
vt 0.4219 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1562
vt 0.4062 0.2031
vt 0.3906 0.2031
vt 0.4297 0.2031
vt 0.4297 0.2188
vt 0.4141 0.2188
vt 0.4141 0.2031
vt 0.4531 0.2031
vt 0.4375 0.2031
vt 0.4375 0.1562
vt 0.4531 0.1562
vt 0.4219 0.1562
vt 0.4375 0.1562
vt 0.4375 0.2031
vt 0.4219 0.2031
vn -1.0000 0.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 0.0000 1.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 25/64/18 26/65/18 28/66/18 27/67/18
f 31/68/19 32/69/19 30/70/19 29/71/19
f 29/72/20 30/73/20 26/74/20 25/75/20
f 27/76/21 31/77/21 29/78/21 25/79/21
f 32/80/22 28/81/22 26/82/22 30/83/22
o Cube.023_Cube.037
v 0.437498 0.187500 1.375000
v 0.437498 0.312500 1.375000
v 0.437498 0.187500 1.000000
v 0.437498 0.312500 1.000000
v 0.562498 0.187500 1.375000
v 0.562498 0.312500 1.375000
v 0.562498 0.187500 1.000000
v 0.562498 0.312500 1.000000
vt 0.4219 0.2031
vt 0.4062 0.2031
vt 0.4062 0.1562
vt 0.4219 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1562
vt 0.4062 0.2031
vt 0.3906 0.2031
vt 0.4297 0.2031
vt 0.4297 0.2188
vt 0.4141 0.2188
vt 0.4141 0.2031
vt 0.4531 0.2031
vt 0.4375 0.2031
vt 0.4375 0.1562
vt 0.4531 0.1562
vt 0.4219 0.1562
vt 0.4375 0.1562
vt 0.4375 0.2031
vt 0.4219 0.2031
vn -1.0000 0.0000 0.0000
vn 1.0000 -0.0000 0.0000
vn -0.0000 0.0000 1.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl marx
f 33/84/23 34/85/23 36/86/23 35/87/23
f 39/88/24 40/89/24 38/90/24 37/91/24
f 37/92/25 38/93/25 34/94/25 33/95/25
f 35/96/26 39/97/26 37/98/26 33/99/26
f 40/100/27 36/101/27 34/102/27 38/103/27
o Cube.024_Cube.038
v 0.812498 0.114277 -0.187500
v 0.989275 -0.062500 -0.187500
v 0.812498 0.114276 -0.437500
v 0.989275 -0.062500 -0.437500
v 0.635721 -0.062500 -0.187500
v 0.812498 -0.239277 -0.187500
v 0.635722 -0.062500 -0.437500
v 0.812498 -0.239277 -0.437500
v 0.544192 0.294194 -0.250000
v 0.897746 -0.059359 -0.250000
v 0.544193 0.294194 -0.373125
v 0.897746 -0.059359 -0.373125
v 0.455804 0.205806 -0.250000
v 0.809357 -0.147748 -0.250000
v 0.455804 0.205806 -0.373125
v 0.809357 -0.147748 -0.373125
v 0.437498 0.187500 -0.375000
v 0.562498 0.187500 -0.375000
v 0.437498 0.187500 -0.000000
v 0.562498 0.187500 0.000000
v 0.437498 0.312500 -0.375000
v 0.562498 0.312500 -0.375000
v 0.437498 0.312500 -0.000000
v 0.562498 0.312500 0.000000
vt 0.3750 0.0938
vt 0.3750 0.0625
vt 0.4062 0.0625
vt 0.4062 0.0938
vt 0.4062 0.1250
vt 0.4062 0.1562
vt 0.3750 0.1562
vt 0.3750 0.1250
vt 0.4688 0.1562
vt 0.4375 0.1562
vt 0.4375 0.1250
vt 0.4688 0.1250
vt 0.4375 0.0938
vt 0.4062 0.1250
vt 0.4062 0.0938
vt 0.3750 0.0938
vt 0.3438 0.1562
vt 0.3438 0.1250
vt 0.3750 0.1250
vt 0.4844 0.0625
vt 0.4844 0.1250
vt 0.4688 0.1250
vt 0.4688 0.0625
vt 0.4531 0.0625
vt 0.4531 0.1250
vt 0.4375 0.1250
vt 0.4375 0.0625
vt 0.4844 0.1250
vt 0.4844 0.0625
vt 0.5000 0.0625
vt 0.5000 0.1250
vt 0.4531 0.1250
vt 0.4531 0.0625
vt 0.4688 0.0625
vt 0.4688 0.1250
vt 0.4844 0.1719
vt 0.4688 0.1719
vt 0.4688 0.1250
vt 0.4844 0.1250
vt 0.4375 0.1719
vt 0.4219 0.1719
vt 0.4219 0.1250
vt 0.4375 0.1250
vt 0.3906 0.1719
vt 0.3750 0.1719
vt 0.3750 0.1562
vt 0.3906 0.1562
vt 0.4062 0.1250
vt 0.4219 0.1250
vt 0.4219 0.1719
vt 0.4062 0.1719
vt 0.5000 0.1719
vt 0.4844 0.1719
vt 0.4844 0.1250
vt 0.5000 0.1250
vn 0.7071 0.7071 0.0000
vn 0.0000 -0.0000 -1.0000
vn -0.7071 -0.7071 -0.0000
vn -0.0000 0.0000 1.0000
vn -0.7071 0.7071 -0.0000
vn 0.7071 -0.7071 0.0000
vn -0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn -1.0000 0.0000 -0.0000
vn 1.0000 -0.0000 0.0000
usemtl marx
f 41/104/28 42/105/28 44/106/28 43/107/28
f 43/108/29 44/109/29 48/110/29 47/111/29
f 47/112/30 48/113/30 46/114/30 45/115/30
f 45/116/31 46/114/31 42/117/31 41/118/31
f 43/108/32 47/111/32 45/119/32 41/118/32
f 48/110/33 44/120/33 42/121/33 46/122/33
f 49/123/28 50/124/28 52/125/28 51/126/28
f 51/127/29 52/128/29 56/129/29 55/130/29
f 55/131/30 56/132/30 54/133/30 53/134/30
f 53/135/31 54/136/31 50/137/31 49/138/31
f 57/139/34 58/140/34 60/141/34 59/142/34
f 63/143/35 64/144/35 62/145/35 61/146/35
f 61/147/29 62/148/29 58/149/29 57/150/29
f 59/151/36 63/152/36 61/153/36 57/154/36
f 64/155/37 60/156/37 58/157/37 62/158/37

View file

@ -19,5 +19,26 @@
"sounds": [
"industrialwires:jacobs_ladder/end"
]
},
"tinnitus": {
"category": "player",
"subtitle": "industrialwires.subtitle.tinnitus",
"sounds": [
"industrialwires:tinnitus"
]
},
"marx_bang": {
"category": "block",
"subtitle": "industrialwires.subtitle.marx_bang",
"sounds": [
"industrialwires:marx_bang"
]
},
"marx_pop": {
"category": "block",
"subtitle": "industrialwires.subtitle.marx_pop",
"sounds": [
"industrialwires:marx_pop"
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB