Compare commits

...

2 Commits

Author SHA1 Message Date
Tom Dodd 9ce3f948ed v2o.3.2 2020-07-09 05:55:36 +01:00
Tom Dodd c730c6aa94 v2o.3.2 2020-07-09 05:55:11 +01:00
51 changed files with 1436 additions and 1241 deletions

140
build.gradle Normal file
View File

@ -0,0 +1,140 @@
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
repositories {
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
maven {
// JEI & TiC
name = "progwml6"
url = "http://dvs1.progwml6.com/files/maven/"
}
maven {
// CraftTweaker
name = "blamejared"
url = "http://maven.blamejared.com/"
}
maven {
// IC2
name = "ic2"
url = "http://maven.ic2.player.to/"
}
maven {
// OpenComputers
name = "cil"
url = "http://maven.cil.li/"
}
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name = "CCL Maven"
url = "http://chickenbones.net/maven/"
}
maven {
// CyclopsMC
name = "CyclopsMC"
url = "https://oss.jfrog.org/artifactory/simple/libs-release/"
}
maven {
// tterrag
name 'tterrag Maven'
url "https://maven.tterrag.com/"
}
maven {
// General
name = "mcmoddev"
url = "https://maven.mcmoddev.com"
}
maven {
// Fallbacks
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
}
version = "${mod_version}-${mc_version}"
group = "nc"
archivesBaseName = "NuclearCraft"
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "${mc_version}-${forge_version}"
runDir = "run"
replace "@VERSION@", "${mod_version}"
mappings = "${mapping_version}"
makeObfSourceJar = true
}
dependencies {
// compile against the JEI API but do not include it at runtime
deobfProvided "mezz.jei:jei_${mc_version}:${jei_version}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "baubles:Baubles:${baubles_version}"
deobfCompile ("cofh:CoFHCore:${cofh_core_version}:universal") {
transitive = false
}
deobfCompile "codechicken:CodeChickenLib:1.12.2-+:universal"
deobfCompile "cofh:RedstoneFlux:1.12-+:universal"
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:${crafttweaker_version}"
deobfCompile "slimeknights.mantle:Mantle:${mantle_version}"
deobfCompile "slimeknights:TConstruct:${tic_version}"
deobfCompile "constructs-armory:conarm:${conarm_version}"
deobfCompile "li.cil.oc:OpenComputers:${oc_version}"
deobfCompile "gregtechce:gregtech:${gregtech_version}"
deobfCompile "mekanism:Mekanism:${mekanism_version}"
deobfCompile "projecte:ProjectE:${projecte_version}"
deobfCompile "org.cyclops.commoncapabilities:CommonCapabilities:${mc_version}-${common_capabilities_version}"
deobfCompile "net.darkhax.bookshelf:Bookshelf-${mc_version}:${bookshelf_version}"
deobfCompile "net.darkhax.gamestages:GameStages-${mc_version}:${gamestages_version}"
deobfCompile ("appeng:appliedenergistics2:rv6-stable-6") {
transitive = false
}
deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}"
deobfCompile "hwyla:Hwyla:${hwyla_version}"
}
processResources {
exclude '**/Thumbs.db'
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
artifacts {
archives deobfJar
}

View File

@ -1,3 +1,15 @@
v2o.3.2
* Remade turbine render rotor
+ Added support for The One Probe to display large energy storages correctly
* Fixed heavy water moderator not having a creative tab
* Minor refactors and texture changes
v2o.3.1
* Fixed crash during load with QMD and/or Trinity also installed
v2o.3.0
+ Added configurable fission and turbine dynamo placement rules

View File

@ -1,7 +1,7 @@
mc_version=1.12.2
forge_version=14.23.5.2847
mapping_version=stable_39
mod_version=2o.3.0
mod_version=2o.3.2
ic2_version=2.8.197-ex112
jei_version=4.15.0.293
@ -13,6 +13,7 @@ cofh_core_version=1.12.2-4.6.3.27
common_capabilities_version=2.4.6-328
bookshelf_version=2.3.590
gamestages_version=2.0.119
top_version=1.12-1.4.28-17
baubles_version=1.12:1.5.2
conarm_version=1.12.2:1.2.5.4

View File

@ -8,7 +8,7 @@ import nc.network.PacketHandler;
import nc.network.config.ConfigUpdatePacket;
import nc.radiation.RadSources;
import nc.recipe.ProcessorRecipeHandler;
import nc.util.Lang;
import nc.util.*;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.text.*;
@ -96,8 +96,7 @@ public class NCConfig {
public static double[] fission_irradiator_heat_per_flux;
public static double[] fission_irradiator_efficiency;
public static int fission_cooling_efficiency_leniency;
public static double[] fission_sparsity_penalty_params; // Multiplier and
// threshold
public static double[] fission_sparsity_penalty_params; // Multiplier and threshold
public static boolean fission_overheat;
public static boolean fission_explosions;
public static double fission_meltdown_radiation_multiplier;
@ -209,6 +208,8 @@ public class NCConfig {
public static double turbine_tension_throughput_factor;
public static double turbine_power_bonus_multiplier;
public static double turbine_sound_volume;
public static double turbine_render_blade_width;
public static double turbine_render_rotor_expansion;
public static double accelerator_electromagnet_power;
public static double accelerator_supercooler_coolant;
@ -731,6 +732,10 @@ public class NCConfig {
propertyTurbinePowerBonusMultiplier.setLanguageKey("gui.nc.config.turbine_power_bonus_multiplier");
Property propertyTurbineSoundVolume = config.get(CATEGORY_TURBINE, "turbine_sound_volume", 1D, Lang.localise("gui.nc.config.turbine_sound_volume.comment"), 0D, 15D);
propertyTurbineSoundVolume.setLanguageKey("gui.nc.config.turbine_sound_volume");
Property propertyTurbineRenderBladeWidth = config.get(CATEGORY_TURBINE, "turbine_render_blade_width", NCMath.SQRT2, Lang.localise("gui.nc.config.turbine_render_blade_width.comment"), 0.01D, 4D);
propertyTurbineRenderBladeWidth.setLanguageKey("gui.nc.config.turbine_render_blade_width");
Property propertyTurbineRenderRotorExpansion = config.get(CATEGORY_TURBINE, "turbine_render_rotor_expansion", 4D, Lang.localise("gui.nc.config.turbine_render_rotor_expansion.comment"), 1D, 15D);
propertyTurbineRenderRotorExpansion.setLanguageKey("gui.nc.config.turbine_render_rotor_expansion");
Property propertyAcceleratorElectromagnetPower = config.get(CATEGORY_ACCELERATOR, "accelerator_electromagnet_power", 1000D, Lang.localise("gui.nc.config.accelerator_electromagnet_power.comment"), 0D, Integer.MAX_VALUE);
propertyAcceleratorElectromagnetPower.setLanguageKey("gui.nc.config.accelerator_electromagnet_power");
@ -1169,6 +1174,8 @@ public class NCConfig {
propertyOrderTurbine.add(propertyTurbineTensionThroughputFactor.getName());
propertyOrderTurbine.add(propertyTurbinePowerBonusMultiplier.getName());
propertyOrderTurbine.add(propertyTurbineSoundVolume.getName());
propertyOrderTurbine.add(propertyTurbineRenderBladeWidth.getName());
propertyOrderTurbine.add(propertyTurbineRenderRotorExpansion.getName());
config.setCategoryPropertyOrder(CATEGORY_TURBINE, propertyOrderTurbine);
List<String> propertyOrderAccelerator = new ArrayList<>();
@ -1487,6 +1494,8 @@ public class NCConfig {
turbine_tension_throughput_factor = propertyTurbineTensionThroughputFactor.getDouble();
turbine_power_bonus_multiplier = propertyTurbinePowerBonusMultiplier.getDouble();
turbine_sound_volume = propertyTurbineSoundVolume.getDouble();
turbine_render_blade_width = propertyTurbineRenderBladeWidth.getDouble();
turbine_render_rotor_expansion = propertyTurbineRenderRotorExpansion.getDouble();
accelerator_electromagnet_power = propertyAcceleratorElectromagnetPower.getDouble();
accelerator_supercooler_coolant = propertyAcceleratorSupercoolerCoolant.getDouble();
@ -1802,6 +1811,8 @@ public class NCConfig {
propertyTurbineTensionThroughputFactor.set(turbine_tension_throughput_factor);
propertyTurbinePowerBonusMultiplier.set(turbine_power_bonus_multiplier);
propertyTurbineSoundVolume.set(turbine_sound_volume);
propertyTurbineRenderBladeWidth.set(turbine_render_blade_width);
propertyTurbineRenderRotorExpansion.set(turbine_render_rotor_expansion);
propertyAcceleratorElectromagnetPower.set(accelerator_electromagnet_power);
propertyAcceleratorSupercoolerCoolant.set(accelerator_supercooler_coolant);

View File

@ -199,7 +199,7 @@ public class NCBlocks {
supercold_ice = withName(new NCBlockIce(0.999F).setCreativeTab(NCTabs.MATERIAL), "supercold_ice");
heavy_water_moderator = withName(new NCBlock(Material.IRON), "heavy_water_moderator");
heavy_water_moderator = withName(new NCBlock(Material.IRON).setCreativeTab(NCTabs.MISC), "heavy_water_moderator");
if (register_processor[0]) {
nuclear_furnace = withName(new BlockNuclearFurnace(), "nuclear_furnace");

View File

@ -129,7 +129,7 @@ public abstract class MultiblockLogic<MULTIBLOCK extends Multiblock<T, PACKET> &
Int2IntMap targetCountMap = new Int2IntOpenHashMap();
for (PORT port : portMap.values()) {
int filter = port.getFilterID();
if (BlockPosHelper.DEFAULT_NON.equals(port.getMasterPortPos()) && !masterPortMap.containsKey(filter)) {
if (PosHelper.DEFAULT_NON.equals(port.getMasterPortPos()) && !masterPortMap.containsKey(filter)) {
masterPortMap.put(filter, port);
targetCountMap.put(filter, 0);
}

View File

@ -311,7 +311,7 @@ public abstract class PlacementRule<T extends ITileMultiblockPart> {
return count == amount / 2;
}
else {
loop: for (EnumFacing[] axialDirs : BlockPosHelper.axialDirsList()) {
loop: for (EnumFacing[] axialDirs : PosHelper.axialDirsList()) {
for (EnumFacing dir : axialDirs) {
if (!satisfied(tile, dir)) {
continue loop;
@ -339,7 +339,7 @@ public abstract class PlacementRule<T extends ITileMultiblockPart> {
}
if (count != amount) return false;
loop: for (EnumFacing[] vertexDirs : BlockPosHelper.vertexDirsList()) {
loop: for (EnumFacing[] vertexDirs : PosHelper.vertexDirsList()) {
for (EnumFacing dir : vertexDirs) {
if (!dirs[dir.getIndex()]) {
continue loop;
@ -350,7 +350,7 @@ public abstract class PlacementRule<T extends ITileMultiblockPart> {
return false;
}
else {
loop: for (EnumFacing[] vertexDirs : BlockPosHelper.vertexDirsList()) {
loop: for (EnumFacing[] vertexDirs : PosHelper.vertexDirsList()) {
for (EnumFacing dir : vertexDirs) {
if (!satisfied(tile, dir)) {
continue loop;

View File

@ -1,5 +1,7 @@
package nc.multiblock.cuboidal;
import javax.vecmath.Vector3f;
import nc.multiblock.*;
import nc.multiblock.network.MultiblockUpdatePacket;
import nc.multiblock.tile.ITileMultiblockPart;
@ -461,6 +463,12 @@ public abstract class CuboidalMultiblock<T extends ITileMultiblockPart, PACKET e
}
}
public Vector3f getMiddleInteriorPlaneCoord(EnumFacing normal, int depth, int minUCushion, int minVCushion, int maxUCushion, int maxVCushion) {
BlockPos min = getMinimumInteriorPlaneCoord(normal, depth, minUCushion, minVCushion);
BlockPos max = getMaximumInteriorPlaneCoord(normal, depth, maxUCushion, maxVCushion);
return new Vector3f((min.getX() + max.getX()) / 2F, (min.getY() + max.getY()) / 2F, (min.getZ() + max.getZ()) / 2F);
}
public Iterable<MutableBlockPos> getInteriorPlaneMinX(int depth, int minUCushion, int minVCushion, int maxUCushion, int maxVCushion) {
return BlockPos.getAllInBoxMutable(getMinimumInteriorPlaneCoord(EnumFacing.WEST, depth, minUCushion, minVCushion), getMaximumInteriorPlaneCoord(EnumFacing.WEST, depth, maxUCushion, maxVCushion));
}

View File

@ -4,7 +4,7 @@ import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.multiblock.fission.block.BlockFissionPart;
import nc.multiblock.fission.tile.port.*;
import nc.util.BlockPosHelper;
import nc.util.PosHelper;
import net.minecraft.block.state.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing;
@ -28,7 +28,7 @@ public abstract class BlockFissionPort<PORT extends TileFissionPort<PORT, TARGET
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(AXIS_ALL, BlockPosHelper.AXES[meta]);
return getDefaultState().withProperty(AXIS_ALL, PosHelper.AXES[meta]);
}
@Override

View File

@ -3,7 +3,7 @@ package nc.multiblock.fission.salt.tile;
import static nc.config.NCConfig.enable_mek_gas;
import static nc.init.NCCoolantFluids.COOLANTS;
import static nc.recipe.NCRecipes.coolant_heater;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME;
import java.util.*;

View File

@ -2,7 +2,7 @@ package nc.multiblock.fission.salt.tile;
import static nc.config.NCConfig.*;
import static nc.recipe.NCRecipes.*;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME;
import java.util.*;

View File

@ -2,7 +2,7 @@ package nc.multiblock.fission.solid.tile;
import static nc.config.NCConfig.*;
import static nc.recipe.NCRecipes.solid_fission;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*;

View File

@ -2,7 +2,7 @@ package nc.multiblock.fission.tile;
import static nc.config.NCConfig.smart_processor_input;
import static nc.recipe.NCRecipes.fission_irradiator;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile;
import static nc.block.property.BlockProperties.FACING_ALL;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.fission.FissionReactor;

View File

@ -1,6 +1,6 @@
package nc.multiblock.fission.tile;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import javax.annotation.Nullable;
@ -12,7 +12,7 @@ import nc.multiblock.fission.*;
import nc.multiblock.fission.block.BlockFissionShield;
import nc.multiblock.fission.tile.IFissionFuelComponent.*;
import nc.multiblock.fission.tile.manager.*;
import nc.util.BlockPosHelper;
import nc.util.PosHelper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@ -98,8 +98,8 @@ public abstract class TileFissionShield extends TileFissionPart implements IFiss
validActiveModeratorPos[dir.getIndex()] = false;
}
flux = 0;
for (Axis axis : BlockPosHelper.AXES) {
activeModeratorLines[BlockPosHelper.getAxisIndex(axis)] = null;
for (Axis axis : PosHelper.AXES) {
activeModeratorLines[PosHelper.getAxisIndex(axis)] = null;
}
}
@ -160,7 +160,7 @@ public abstract class TileFissionShield extends TileFissionPart implements IFiss
if (validActiveModeratorPos[dir.getIndex()]) {
activeModerator = true;
}
int index = BlockPosHelper.getAxisIndex(dir.getAxis());
int index = PosHelper.getAxisIndex(dir.getAxis());
if (activeModeratorLines[index] == null) {
flux += getLineFluxContribution(line, thisInfo);
activeModeratorLines[index] = line;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile.port;
import static nc.recipe.NCRecipes.solid_fission;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.Set;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile.port;
import static nc.config.NCConfig.enable_mek_gas;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*;

View File

@ -2,7 +2,7 @@ package nc.multiblock.fission.tile.port;
import static nc.init.NCCoolantFluids.COOLANTS;
import static nc.recipe.NCRecipes.coolant_heater;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME;
import java.util.Set;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile.port;
import static nc.recipe.NCRecipes.fission_irradiator;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.Set;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile.port;
import static nc.config.NCConfig.smart_processor_input;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile.port;
import static nc.block.property.BlockProperties.AXIS_ALL;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import javax.annotation.*;

View File

@ -1,7 +1,7 @@
package nc.multiblock.fission.tile.port;
import static nc.recipe.NCRecipes.*;
import static nc.util.BlockPosHelper.DEFAULT_NON;
import static nc.util.PosHelper.DEFAULT_NON;
import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME;
import java.util.Set;

View File

@ -3,7 +3,7 @@ package nc.multiblock.heatExchanger.block;
import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.multiblock.heatExchanger.tile.TileHeatExchangerVent;
import nc.util.BlockPosHelper;
import nc.util.PosHelper;
import net.minecraft.block.state.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -26,7 +26,7 @@ public class BlockHeatExchangerVent extends BlockHeatExchangerPart {
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(AXIS_ALL, BlockPosHelper.AXES[meta]);
return getDefaultState().withProperty(AXIS_ALL, PosHelper.AXES[meta]);
}
@Override

View File

@ -0,0 +1,81 @@
package nc.multiblock.network;
import javax.vecmath.Vector3f;
import io.netty.buffer.ByteBuf;
import nc.multiblock.turbine.Turbine;
import nc.multiblock.turbine.tile.TileTurbineController;
import net.minecraft.util.math.BlockPos;
public class TurbineFormPacket extends MultiblockUpdatePacket {
public BlockPos[] bladePosArray;
public Vector3f[] renderPosArray;
public float[] bladeAngleArray;
public TurbineFormPacket() {
messageValid = false;
}
public TurbineFormPacket(BlockPos pos, BlockPos[] bladePosArray, Vector3f[] renderPosArray, float[] bladeAngleArray) {
this.pos = pos;
this.bladePosArray = bladePosArray;
this.renderPosArray = renderPosArray;
this.bladeAngleArray = bladeAngleArray;
messageValid = true;
}
@Override
public void readMessage(ByteBuf buf) {
pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
bladePosArray = new BlockPos[buf.readInt()];
for (int i = 0; i < bladePosArray.length; i++) {
bladePosArray[i] = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
}
renderPosArray = new Vector3f[buf.readInt()];
for (int i = 0; i < renderPosArray.length; i++) {
renderPosArray[i] = new Vector3f(buf.readFloat(), buf.readFloat(), buf.readFloat());
}
bladeAngleArray = new float[buf.readInt()];
for (int i = 0; i < bladeAngleArray.length; i++) {
bladeAngleArray[i] = buf.readFloat();
}
}
@Override
public void writeMessage(ByteBuf buf) {
buf.writeInt(pos.getX());
buf.writeInt(pos.getY());
buf.writeInt(pos.getZ());
buf.writeInt(bladePosArray.length);
for (BlockPos rotorPos : bladePosArray) {
buf.writeInt(rotorPos.getX());
buf.writeInt(rotorPos.getY());
buf.writeInt(rotorPos.getZ());
}
buf.writeInt(renderPosArray.length);
for (Vector3f planePos : renderPosArray) {
buf.writeFloat(planePos.x);
buf.writeFloat(planePos.y);
buf.writeFloat(planePos.z);
}
buf.writeInt(bladeAngleArray.length);
for (float bladeAngle : bladeAngleArray) {
buf.writeFloat(bladeAngle);
}
}
public static class Handler extends MultiblockUpdatePacket.Handler<TurbineFormPacket, Turbine, TileTurbineController> {
public Handler() {
super(TileTurbineController.class);
}
@Override
protected void onPacket(TurbineFormPacket message, Turbine multiblock) {
multiblock.onFormPacket(message);
}
}
}

View File

@ -6,13 +6,16 @@ import java.lang.reflect.Constructor;
import java.util.List;
import javax.annotation.Nonnull;
import javax.vecmath.Vector3f;
import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.doubles.*;
import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.objects.*;
import nc.Global;
import nc.handler.SoundHandler.SoundInfo;
import nc.init.NCBlocks;
import nc.multiblock.*;
import nc.multiblock.container.ContainerTurbineController;
import nc.multiblock.cuboidal.CuboidalMultiblock;
@ -25,6 +28,7 @@ import nc.recipe.*;
import nc.tile.internal.energy.EnergyStorage;
import nc.tile.internal.fluid.Tank;
import nc.util.NCMath;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -71,6 +75,12 @@ public class Turbine extends CuboidalMultiblock<ITurbinePart, TurbineUpdatePacke
public long prevRenderTime = 0L;
public Iterable<MutableBlockPos>[] inputPlane = new Iterable[4];
public BlockPos[] bladePosArray = null;
public Vector3f[] renderPosArray = null;
public float[] bladeAngleArray = null;
public IBlockState[] rotorStateArray = null;
public IntList bladeDepths = null, statorDepths = null;
public Turbine(World world) {
super(world);
for (Class<? extends ITurbinePart> clazz : PART_CLASSES) {
@ -233,7 +243,7 @@ public class Turbine extends CuboidalMultiblock<ITurbinePart, TurbineUpdatePacke
}
}
protected TurbinePartDir getBladeDir(PlaneDir planeDir) {
public TurbinePartDir getBladeDir(PlaneDir planeDir) {
switch (flowDir.getAxis()) {
case Y:
switch (planeDir) {
@ -261,7 +271,7 @@ public class Turbine extends CuboidalMultiblock<ITurbinePart, TurbineUpdatePacke
}
}
protected enum PlaneDir {
public enum PlaneDir {
U,
V;
}
@ -426,6 +436,37 @@ public class Turbine extends CuboidalMultiblock<ITurbinePart, TurbineUpdatePacke
logic.onRenderPacket(message);
}
protected TurbineFormPacket getFormPacket() {
return logic.getFormPacket();
}
public void onFormPacket(TurbineFormPacket message) {
bladePosArray = message.bladePosArray;
renderPosArray = message.renderPosArray;
bladeAngleArray = message.bladeAngleArray;
rotorStateArray = new IBlockState[1 + 4 * getFlowLength()];
rotorStateArray[4 * getFlowLength()] = NCBlocks.turbine_rotor_shaft.getDefaultState().withProperty(TurbineRotorBladeUtil.DIR, getShaftDir());
for (int i = 0; i < bladePosArray.length; i++) {
BlockPos pos = bladePosArray[i];
ITurbineRotorBlade thisBlade = getBlade(pos);
rotorStateArray[i] = thisBlade == null ? WORLD.getBlockState(pos).getBlock().getDefaultState() : thisBlade.getRenderState();
}
bladeDepths = new IntArrayList();
statorDepths = new IntArrayList();
for (int i = 0; i < getFlowLength(); i++) {
if (getBlade(bladePosArray[i]).getBladeType() == TurbineRotorStatorType.STATOR) {
statorDepths.add(i);
}
else {
bladeDepths.add(i);
}
}
}
public ContainerTurbineController getContainer(EntityPlayer player) {
return logic.getContainer(player);
}

View File

@ -5,6 +5,8 @@ import static nc.recipe.NCRecipes.turbine;
import java.util.*;
import javax.vecmath.Vector3f;
import org.apache.commons.lang3.tuple.Pair;
import it.unimi.dsi.fastutil.doubles.*;
@ -99,11 +101,13 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
getTurbine().energyStorage.setMaxTransfer(Turbine.BASE_MAX_ENERGY * getTurbine().getExteriorSurfaceArea());
getTurbine().tanks.get(0).setCapacity(Turbine.BASE_MAX_INPUT * getTurbine().getExteriorSurfaceArea());
getTurbine().tanks.get(1).setCapacity(Turbine.BASE_MAX_OUTPUT * getTurbine().getExteriorSurfaceArea());
}
if (getTurbine().flowDir == null) {
return;
}
if (!getWorld().isRemote) {
componentFailCache.clear();
do {
assumedValidCache.clear();
@ -150,10 +154,30 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
}
}
getTurbine().inputPlane[0] = getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), 0, 0, 0, getTurbine().bladeLength, getTurbine().shaftWidth + getTurbine().bladeLength);
getTurbine().inputPlane[1] = getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), 0, getTurbine().shaftWidth + getTurbine().bladeLength, 0, 0, getTurbine().bladeLength);
getTurbine().inputPlane[2] = getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), 0, getTurbine().bladeLength, getTurbine().shaftWidth + getTurbine().bladeLength, 0, 0);
getTurbine().inputPlane[3] = getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), 0, 0, getTurbine().bladeLength, getTurbine().shaftWidth + getTurbine().bladeLength, 0);
EnumFacing oppositeDir = getTurbine().flowDir.getOpposite();
int flowLength = getTurbine().getFlowLength(), bladeLength = getTurbine().bladeLength, shaftWidth = getTurbine().shaftWidth;
getTurbine().inputPlane[0] = getTurbine().getInteriorPlane(oppositeDir, 0, 0, 0, bladeLength, shaftWidth + bladeLength);
getTurbine().inputPlane[1] = getTurbine().getInteriorPlane(oppositeDir, 0, shaftWidth + bladeLength, 0, 0, bladeLength);
getTurbine().inputPlane[2] = getTurbine().getInteriorPlane(oppositeDir, 0, bladeLength, shaftWidth + bladeLength, 0, 0);
getTurbine().inputPlane[3] = getTurbine().getInteriorPlane(oppositeDir, 0, 0, bladeLength, shaftWidth + bladeLength, 0);
getTurbine().renderPosArray = new Vector3f[(1 + 4 * shaftWidth) * flowLength];
for (int depth = 0; depth < flowLength; depth++) {
for (int w = 0; w < shaftWidth; w++) {
getTurbine().renderPosArray[w + depth * shaftWidth] = getTurbine().getMiddleInteriorPlaneCoord(oppositeDir, depth, 1 + w + bladeLength, 0, shaftWidth - w + bladeLength, shaftWidth + bladeLength);
getTurbine().renderPosArray[w + (depth + flowLength) * shaftWidth] = getTurbine().getMiddleInteriorPlaneCoord(oppositeDir, depth, 0, shaftWidth - w + bladeLength, shaftWidth + bladeLength, 1 + w + bladeLength);
getTurbine().renderPosArray[w + (depth + 2 * flowLength) * shaftWidth] = getTurbine().getMiddleInteriorPlaneCoord(oppositeDir, depth, shaftWidth + bladeLength, 1 + w + bladeLength, 0, shaftWidth - w + bladeLength);
getTurbine().renderPosArray[w + (depth + 3 * flowLength) * shaftWidth] = getTurbine().getMiddleInteriorPlaneCoord(oppositeDir, depth, shaftWidth - w + bladeLength, shaftWidth + bladeLength, 1 + w + bladeLength, 0);
}
getTurbine().renderPosArray[depth + 4 * flowLength * shaftWidth] = getTurbine().getMiddleInteriorPlaneCoord(oppositeDir, depth, 0, 0, 0, 0);
}
if (getTurbine().controller != null) {
PacketHandler.instance.sendToAll(getFormPacket());
getTurbine().sendUpdateToListeningPlayers();
}
}
protected void refreshDynamos() {
@ -326,9 +350,7 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
dirMaxZ = true;
}
else {
notInAWall = true; // If the bearing is not at any of those
// positions, that means our bearing isn't
// part of the wall at all
notInAWall = true; // If the bearing is not at any of those positions, that means our bearing isn't part of the wall at all
}
}
@ -362,10 +384,8 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
return false;
}
// At this point, all bearings are guaranteed to be part of walls in the
// same axis
// Also, it can only ever succeed up to this point if we already have at
// least two bearings, so no need to check for that
// At this point, all bearings are guaranteed to be part of walls in the same axis
// Also, it can only ever succeed up to this point if we already have at least two bearings, so no need to check for that
int internalDiameter;
if (axis == Axis.X) {
@ -392,8 +412,7 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
return false;
}
// Last thing that needs to be checked concerning bearings is whether
// they are grouped correctly at the centre of their respective walls
// Last thing that needs to be checked concerning bearings is whether they are grouped correctly at the centre of their respective walls
getTurbine().bladeLength = (internalDiameter - getTurbine().shaftWidth) / 2;
@ -471,6 +490,9 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
int flowLength = getTurbine().getFlowLength();
getTurbine().bladePosArray = new BlockPos[4 * flowLength];
getTurbine().bladeAngleArray = new float[4 * flowLength];
for (int slice = 0; slice < flowLength; slice++) {
for (BlockPos pos : getTurbine().getInteriorPlane(EnumFacing.getFacingFromAxis(AxisDirection.POSITIVE, axis), slice, getTurbine().bladeLength, getTurbine().bladeLength, getTurbine().bladeLength, getTurbine().bladeLength)) {
TileEntity tile = getWorld().getTileEntity(pos);
@ -550,6 +572,9 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
thisBlade.setDir(getTurbine().getBladeDir(PlaneDir.V));
thisBlade.setDepth(depth);
thisBlade.setRenderRotation(45F);
getTurbine().bladePosArray[depth] = thisBlade.bladePos();
getTurbine().bladeAngleArray[depth] = thisBlade.getRenderRotation();
}
for (BlockPos pos : getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), depth, 0, getTurbine().bladeLength, getTurbine().shaftWidth + getTurbine().bladeLength, getTurbine().bladeLength)) {
@ -566,6 +591,9 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
thisBlade.setDir(getTurbine().getBladeDir(PlaneDir.U));
thisBlade.setDepth(depth);
thisBlade.setRenderRotation(getTurbine().flowDir.getAxis() == Axis.Z ? -45F : 45F);
getTurbine().bladePosArray[depth + flowLength] = thisBlade.bladePos();
getTurbine().bladeAngleArray[depth + flowLength] = thisBlade.getRenderRotation();
}
for (BlockPos pos : getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), depth, getTurbine().shaftWidth + getTurbine().bladeLength, getTurbine().bladeLength, 0, getTurbine().bladeLength)) {
@ -582,6 +610,9 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
thisBlade.setDir(getTurbine().getBladeDir(PlaneDir.U));
thisBlade.setDepth(depth);
thisBlade.setRenderRotation(getTurbine().flowDir.getAxis() == Axis.Z ? 45F : -45F);
getTurbine().bladePosArray[depth + 2 * flowLength] = thisBlade.bladePos();
getTurbine().bladeAngleArray[depth + 2 * flowLength] = thisBlade.getRenderRotation();
}
for (BlockPos pos : getTurbine().getInteriorPlane(getTurbine().flowDir.getOpposite(), depth, getTurbine().bladeLength, getTurbine().shaftWidth + getTurbine().bladeLength, getTurbine().bladeLength, 0)) {
@ -598,6 +629,9 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
thisBlade.setDir(getTurbine().getBladeDir(PlaneDir.V));
thisBlade.setDepth(depth);
thisBlade.setRenderRotation(-45F);
getTurbine().bladePosArray[depth + 3 * flowLength] = thisBlade.bladePos();
getTurbine().bladeAngleArray[depth + 3 * flowLength] = thisBlade.getRenderRotation();
}
if (currentBladeType == null) {
@ -609,7 +643,7 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
if (currentBladeType == TurbineRotorStatorType.STATOR) {
getTurbine().totalExpansionLevel *= turbine_stator_expansion;
getTurbine().expansionLevels.add((prevExpansionLevel + getTurbine().totalExpansionLevel) / 2D);
getTurbine().rawBladeEfficiencies.add(0D);
getTurbine().rawBladeEfficiencies.add(-1D);
}
else if (currentBladeType instanceof TurbineRotorBladeType) {
getTurbine().totalExpansionLevel *= ((TurbineRotorBladeType) currentBladeType).getExpansionCoefficient();
@ -871,6 +905,18 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
return getTurbine().rotorEfficiency * getExpansionIdealityMultiplier(getTurbine().idealTotalExpansionLevel, getTurbine().totalExpansionLevel) * recipeInputRate * getTurbine().basePowerPerMB;
}
public void setRotorEfficiency() {
getTurbine().rotorEfficiency = 0D;
for (int depth = 0; depth < getTurbine().getFlowLength(); depth++) {
if (getTurbine().rawBladeEfficiencies.get(depth) < 0D) {
continue;
}
getTurbine().rotorEfficiency += getTurbine().rawBladeEfficiencies.get(depth) * getExpansionIdealityMultiplier(getIdealExpansionLevel(depth), getTurbine().expansionLevels.get(depth));
}
getTurbine().rotorEfficiency /= getTurbine().noBladeSets;
}
public static double getExpansionIdealityMultiplier(double ideal, double actual) {
if (ideal <= 0D || actual <= 0D) {
return 0D;
@ -882,22 +928,6 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
return Math.pow(getTurbine().idealTotalExpansionLevel, (depth + 0.5D) / getTurbine().getFlowLength());
}
public void setRotorEfficiency() {
getTurbine().rotorEfficiency = 0D;
for (int depth = 0; depth < getTurbine().getFlowLength(); depth++) {
if (getTurbine().rawBladeEfficiencies.get(depth) <= 0D) {
continue;
}
getTurbine().rotorEfficiency += getTurbine().rawBladeEfficiencies.get(depth) * getExpansionIdealityMultiplier(getIdealExpansionLevel(depth), getTurbine().expansionLevels.get(depth));
}
getTurbine().rotorEfficiency /= getTurbine().noBladeSets;
}
public void setInputRatePowerBonus() {
getTurbine().powerBonus = 1D + turbine_power_bonus_multiplier * Math.min(getTurbine().recipeInputRate, getMaxRecipeRateMultiplier()) / (2D * turbine_mb_per_blade * NCMath.sq(getMaximumInteriorLength()));
}
public DoubleList getIdealExpansionLevels() {
DoubleList levels = new DoubleArrayList();
if (getTurbine().flowDir == null) {
@ -909,6 +939,10 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
return levels;
}
public void setInputRatePowerBonus() {
getTurbine().powerBonus = 1D + turbine_power_bonus_multiplier * Math.min(getTurbine().recipeInputRate, getMaxRecipeRateMultiplier()) / (2D * turbine_mb_per_blade * NCMath.sq(getMaximumInteriorLength()));
}
// Client
@Override
@ -1081,6 +1115,14 @@ public class TurbineLogic extends MultiblockLogic<Turbine, TurbineLogic, ITurbin
}
public TurbineFormPacket getFormPacket() {
return new TurbineFormPacket(getTurbine().controller.getTilePos(), getTurbine().bladePosArray, getTurbine().renderPosArray, getTurbine().bladeAngleArray);
}
public void onFormPacket(TurbineFormPacket message) {
}
public ContainerTurbineController getContainer(EntityPlayer player) {
return new ContainerTurbineController(player, (TileTurbineController) getTurbine().controller);
}

View File

@ -13,7 +13,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.*;
import net.minecraft.world.*;
public class BlockTurbineController extends BlockTurbinePart {
@ -83,6 +83,19 @@ public class BlockTurbineController extends BlockTurbinePart {
return rightClickOnPart(world, pos, player, hand, facing, true);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
/*TileEntity tile = source.getTileEntity(pos);
if (tile instanceof TileTurbineController) {
TileTurbineController controller = (TileTurbineController) tile;
if (!controller.isRenderer || !controller.isMultiblockAssembled()) {
return FULL_BLOCK_AABB;
}
return new AxisAlignedBB(controller.getMultiblock().getMinimumCoord().subtract(pos), controller.getMultiblock().getMaximumCoord().subtract(pos));
}*/
return FULL_BLOCK_AABB;
}
@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) {
return side != null;

View File

@ -3,7 +3,7 @@ package nc.multiblock.turbine.block;
import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.multiblock.turbine.tile.TileTurbineInlet;
import nc.util.BlockPosHelper;
import nc.util.PosHelper;
import net.minecraft.block.state.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -26,7 +26,7 @@ public class BlockTurbineInlet extends BlockTurbinePart {
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(AXIS_ALL, BlockPosHelper.AXES[meta]);
return getDefaultState().withProperty(AXIS_ALL, PosHelper.AXES[meta]);
}
@Override

View File

@ -3,7 +3,7 @@ package nc.multiblock.turbine.block;
import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.multiblock.turbine.tile.TileTurbineOutlet;
import nc.util.BlockPosHelper;
import nc.util.PosHelper;
import net.minecraft.block.state.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -26,7 +26,7 @@ public class BlockTurbineOutlet extends BlockTurbinePart {
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(AXIS_ALL, BlockPosHelper.AXES[meta]);
return getDefaultState().withProperty(AXIS_ALL, PosHelper.AXES[meta]);
}
@Override

View File

@ -57,10 +57,21 @@ public class TileTurbineController extends TileTurbinePart implements ITurbineCo
if (!isRenderer || !isMultiblockAssembled()) {
return Block.FULL_BLOCK_AABB.offset(pos);
}
return new AxisAlignedBB(pos.add(getMultiblock().getMinX() - pos.getX(), getMultiblock().getMinY() - pos.getY(), getMultiblock().getMinZ() - pos.getZ()), pos.add(getMultiblock().getMaxX() - pos.getX(), getMultiblock().getMaxY() - pos.getY(), getMultiblock().getMaxZ() - pos.getZ()));
return new AxisAlignedBB(getMultiblock().getMinimumCoord(), getMultiblock().getMaximumCoord());
// return INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return super.getMaxRenderDistanceSquared();
}
@Override
public boolean hasFastRenderer() {
return super.hasFastRenderer();
}
@Override
public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) {
super.onBlockNeighborChanged(state, world, pos, fromPos);

View File

@ -65,6 +65,7 @@ public class PacketHandler {
instance.registerMessage(HeatExchangerUpdatePacket.Handler.class, HeatExchangerUpdatePacket.class, nextID(), Side.CLIENT);
instance.registerMessage(TurbineUpdatePacket.Handler.class, TurbineUpdatePacket.class, nextID(), Side.CLIENT);
instance.registerMessage(TurbineRenderPacket.Handler.class, TurbineRenderPacket.class, nextID(), Side.CLIENT);
instance.registerMessage(TurbineFormPacket.Handler.class, TurbineFormPacket.class, nextID(), Side.CLIENT);
instance.registerMessage(QuantumComputerQubitRenderPacket.Handler.class, QuantumComputerQubitRenderPacket.class, nextID(), Side.CLIENT);
instance.registerMessage(PlayerRadsUpdatePacket.Handler.class, PlayerRadsUpdatePacket.class, nextID(), Side.CLIENT);

View File

@ -18,43 +18,43 @@ public class NCRecipes {
private static boolean initialized = false;
public static ProcessorRecipeHandler manufactory;
public static ProcessorRecipeHandler separator;
public static ProcessorRecipeHandler decay_hastener;
public static ProcessorRecipeHandler fuel_reprocessor;
public static ProcessorRecipeHandler alloy_furnace;
public static ProcessorRecipeHandler infuser;
public static ProcessorRecipeHandler melter;
public static ProcessorRecipeHandler supercooler;
public static ProcessorRecipeHandler electrolyzer;
public static ProcessorRecipeHandler assembler;
public static ProcessorRecipeHandler ingot_former;
public static ProcessorRecipeHandler pressurizer;
public static ProcessorRecipeHandler chemical_reactor;
public static ProcessorRecipeHandler salt_mixer;
public static ProcessorRecipeHandler crystallizer;
public static ProcessorRecipeHandler enricher;
public static ProcessorRecipeHandler extractor;
public static ProcessorRecipeHandler centrifuge;
public static ProcessorRecipeHandler rock_crusher;
public static ProcessorRecipeHandler collector;
public static ProcessorRecipeHandler decay_generator;
public static ProcessorRecipeHandler fission_moderator;
public static ProcessorRecipeHandler fission_reflector;
public static ProcessorRecipeHandler fission_irradiator;
public static ProcessorRecipeHandler pebble_fission;
public static ProcessorRecipeHandler solid_fission;
public static ProcessorRecipeHandler fission_heating;
public static ProcessorRecipeHandler salt_fission;
public static ProcessorRecipeHandler fusion;
public static ProcessorRecipeHandler coolant_heater;
public static ProcessorRecipeHandler fission_emergency_cooling;
public static ProcessorRecipeHandler heat_exchanger;
public static ProcessorRecipeHandler condenser;
public static ProcessorRecipeHandler turbine;
public static ProcessorRecipeHandler radiation_scrubber;
public static ProcessorRecipeHandler radiation_block_mutation;
public static ProcessorRecipeHandler radiation_block_purification;
public static ManufactoryRecipes manufactory;
public static SeparatorRecipes separator;
public static DecayHastenerRecipes decay_hastener;
public static FuelReprocessorRecipes fuel_reprocessor;
public static AlloyFurnaceRecipes alloy_furnace;
public static InfuserRecipes infuser;
public static MelterRecipes melter;
public static SupercoolerRecipes supercooler;
public static ElectrolyzerRecipes electrolyzer;
public static AssemblerRecipes assembler;
public static IngotFormerRecipes ingot_former;
public static PressurizerRecipes pressurizer;
public static ChemicalReactorRecipes chemical_reactor;
public static SaltMixerRecipes salt_mixer;
public static CrystallizerRecipes crystallizer;
public static EnricherRecipes enricher;
public static ExtractorRecipes extractor;
public static CentrifugeRecipes centrifuge;
public static RockCrusherRecipes rock_crusher;
public static CollectorRecipes collector;
public static DecayGeneratorRecipes decay_generator;
public static FissionModeratorRecipes fission_moderator;
public static FissionReflectorRecipes fission_reflector;
public static FissionIrradiatorRecipes fission_irradiator;
public static PebbleFissionRecipes pebble_fission;
public static SolidFissionRecipes solid_fission;
public static FissionHeatingRecipes fission_heating;
public static SaltFissionRecipes salt_fission;
public static FusionRecipes fusion;
public static CoolantHeaterRecipes coolant_heater;
public static FissionEmergencyCoolingRecipes fission_emergency_cooling;
public static HeatExchangerRecipes heat_exchanger;
public static CondenserRecipes condenser;
public static TurbineRecipes turbine;
public static RadiationScrubberRecipes radiation_scrubber;
public static RadiationBlockMutation radiation_block_mutation;
public static RadiationBlockPurification radiation_block_purification;
@SubscribeEvent(priority = EventPriority.LOW)
public void registerRecipes(RegistryEvent.Register<IRecipe> event) {

View File

@ -1,9 +1,12 @@
package nc.render.tile;
import nc.init.NCBlocks;
import javax.vecmath.Vector3f;
import nc.config.NCConfig;
import nc.multiblock.turbine.*;
import nc.multiblock.turbine.Turbine.PlaneDir;
import nc.multiblock.turbine.TurbineRotorBladeUtil.TurbinePartDir;
import nc.multiblock.turbine.tile.*;
import nc.multiblock.turbine.tile.TileTurbineController;
import nc.util.NCMath;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -36,34 +39,20 @@ public class RenderTurbineRotor extends TileEntitySpecialRenderer<TileTurbineCon
}
Turbine turbine = controller.getMultiblock();
if (turbine == null) {
return;
}
if (turbine == null) return;
EnumFacing dir = turbine.flowDir;
if (dir == null) {
return;
}
IBlockState shaftState = NCBlocks.turbine_rotor_shaft.getDefaultState().withProperty(TurbineRotorBladeUtil.DIR, turbine.getShaftDir());
boolean[] isStatorSet = new boolean[turbine.getFlowLength()];
for (TileTurbineRotorStator stator : turbine.getPartMap(TileTurbineRotorStator.class).values()) {
isStatorSet[dir.getAxisDirection() == AxisDirection.POSITIVE ? turbine.getFlowLength() - stator.getDepth() - 1 : stator.getDepth()] = true;
}
if (dir == null) return;
BlockRendererDispatcher renderer = MC.getBlockRendererDispatcher();
// brightness =
// tile.getWorld().getLightBrightness(turbine.getMinimumInteriorPlaneCoord(dir,
// turbine.getFlowLength()/2, turbine.bladeLength - 1,
// turbine.bladeLength - 1));
// brightness = tile.getWorld().getLightBrightness(turbine.getMinimumInteriorPlaneCoord(dir, turbine.getFlowLength()/2, bladeLength - 1,bladeLength - 1));
brightness[count] = controller.getWorld().getLightBrightness(turbine.getExtremeInteriorCoord(NCMath.getBit(count, 0) == 1, NCMath.getBit(count, 1) == 1, NCMath.getBit(count, 2) == 1));
count++;
count %= 8;
float bright = (brightness[0] + brightness[1] + brightness[2] + brightness[3] + brightness[4] + brightness[5] + brightness[6] + brightness[7]) / 8F;
MC.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.pushMatrix();
MC.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.color(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 0, 15 * 16);
@ -73,77 +62,104 @@ public class RenderTurbineRotor extends TileEntitySpecialRenderer<TileTurbineCon
double rY = -turbine.getMaxY() + pos.getY() + (dir.getAxis() == Axis.Y ? 0D : r);
double rZ = -turbine.getMaxZ() + pos.getZ() + (dir.getAxis() == Axis.Z ? 0D : r);
double scale = r / Math.sqrt(r * r + NCMath.sq(turbine.shaftWidth) / 4D);
int flowLength = turbine.getFlowLength(), bladeLength = turbine.bladeLength, shaftWidth = turbine.shaftWidth;
double scale = r / Math.sqrt(r * r + NCMath.sq(shaftWidth) / 4D);
// Enter rotated frame
GlStateManager.pushMatrix();
GlStateManager.translate(posX - rX, posY - rY, posZ - rZ);
GlStateManager.scale(dir.getAxis() == Axis.X ? 1D : scale, dir.getAxis() == Axis.Y ? 1D : scale, dir.getAxis() == Axis.Z ? 1D : scale);
{
long systemTime = Minecraft.getSystemTime();
if (!MC.isGamePaused()) {
turbine.rotorAngle = (turbine.rotorAngle + (systemTime - turbine.prevRenderTime) * turbine.angVel) % 360F;
}
if (!MC.isGamePaused()) turbine.rotorAngle = (turbine.rotorAngle + (systemTime - turbine.prevRenderTime) * turbine.angVel) % 360F;
turbine.prevRenderTime = systemTime;
GlStateManager.rotate(turbine.rotorAngle, dir.getAxis() == Axis.X ? 1F : 0F, dir.getAxis() == Axis.Y ? 1F : 0F, dir.getAxis() == Axis.Z ? 1F : 0F);
}
GlStateManager.translate(-pos.getX() + rX, -pos.getY() + rY, -pos.getZ() + rZ);
for (TileTurbineRotorShaft shaft : turbine.getPartMap(TileTurbineRotorShaft.class).values()) {
if (!shaft.render || isStatorSet[shaft.depth]) {
continue;
}
GlStateManager.pushMatrix();
pos = shaft.getPos();
GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ());
GlStateManager.rotate(-90F, 0F, 1F, 0F);
renderer.renderBlockBrightness(shaftState, bright);
GlStateManager.popMatrix();
if (turbine.rotorStateArray == null) return;
IBlockState shaftState = turbine.rotorStateArray[turbine.bladePosArray.length];
for (int depth : turbine.bladeDepths) {
renderRotor(turbine, renderer, bright, shaftState, dir, flowLength, bladeLength, shaftWidth, NCConfig.turbine_render_blade_width, depth);
}
for (TileTurbineRotorBlade blade : turbine.getPartMap(TileTurbineRotorBlade.class).values()) {
GlStateManager.pushMatrix();
pos = blade.bladePos();
TurbinePartDir bladeDir = blade.getDir();
GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ());
GlStateManager.translate(0.5D, 0.5D, 0.5D);
GlStateManager.rotate(blade.getRenderRotation() * (dir.getAxisDirection() == AxisDirection.POSITIVE ^ dir.getAxis() == Axis.X ? 1F : -1F), bladeDir == TurbinePartDir.X ? 1F : 0F, bladeDir == TurbinePartDir.Y ? 1F : 0F, bladeDir == TurbinePartDir.Z ? 1F : 0F);
GlStateManager.translate(-0.5D, -0.5D, -0.5D);
GlStateManager.rotate(-90F, 0F, 1F, 0F);
renderer.renderBlockBrightness(blade.getRenderState(), bright);
GlStateManager.popMatrix();
}
// Leave rotated frame
GlStateManager.popMatrix();
// Enter stationary frame
GlStateManager.pushMatrix();
pos = controller.getPos();
GlStateManager.translate(posX - rX, posY - rY, posZ - rZ);
GlStateManager.scale(dir.getAxis() == Axis.X ? 1D : scale, dir.getAxis() == Axis.Y ? 1D : scale, dir.getAxis() == Axis.Z ? 1D : scale);
GlStateManager.translate(-pos.getX() + rX, -pos.getY() + rY, -pos.getZ() + rZ);
for (TileTurbineRotorShaft shaft : turbine.getPartMap(TileTurbineRotorShaft.class).values()) {
if (!shaft.render || !isStatorSet[shaft.depth]) {
continue;
for (int depth : turbine.statorDepths) {
renderRotor(turbine, renderer, bright, shaftState, dir, flowLength, bladeLength, shaftWidth, NCConfig.turbine_render_blade_width, depth);
}
GlStateManager.pushMatrix();
pos = shaft.getPos();
GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ());
GlStateManager.rotate(-90F, 0F, 1F, 0F);
renderer.renderBlockBrightness(shaftState, bright);
GlStateManager.popMatrix();
}
for (TileTurbineRotorStator stator : turbine.getPartMap(TileTurbineRotorStator.class).values()) {
public void renderRotor(Turbine turbine, BlockRendererDispatcher renderer, float bright, IBlockState shaftState, EnumFacing flowDir, int flowLength, int bladeLength, int shaftWidth, double bladeWidth, int depth) {
double depthScale = Math.pow(NCConfig.turbine_render_rotor_expansion, (double) (1 + depth - flowLength) / (double) flowLength);
GlStateManager.pushMatrix();
pos = stator.bladePos();
TurbinePartDir bladeDir = stator.getDir();
GlStateManager.translate(pos.getX(), pos.getY(), pos.getZ());
GlStateManager.translate(0.5D, 0.5D, 0.5D);
GlStateManager.rotate(stator.getRenderRotation() * (dir.getAxisDirection() == AxisDirection.POSITIVE ^ dir.getAxis() == Axis.X ? 1F : -1F), bladeDir == TurbinePartDir.X ? 1F : 0F, bladeDir == TurbinePartDir.Y ? 1F : 0F, bladeDir == TurbinePartDir.Z ? 1F : 0F);
Vector3f renderPos = turbine.renderPosArray[4 * flowLength * shaftWidth + depth];
GlStateManager.translate(renderPos.x + 0.5D, renderPos.y + 0.5D, renderPos.z + 0.5D);
GlStateManager.scale(flowDir.getAxis() == Axis.X ? 1D : depthScale, flowDir.getAxis() == Axis.Y ? 1D : depthScale, flowDir.getAxis() == Axis.Z ? 1D : depthScale);
GlStateManager.translate(-renderPos.x - 0.5D, -renderPos.y - 0.5D, -renderPos.z - 0.5D);
renderShaft(turbine, renderer, bright, shaftState, flowDir, flowLength, shaftWidth, depth);
for (int j : new int[] { 0, flowLength, 2 * flowLength, 3 * flowLength }) {
renderBlades(turbine, renderer, bright, flowDir, flowLength, bladeLength, shaftWidth, bladeWidth, j, depth);
}
GlStateManager.popMatrix();
}
public void renderShaft(Turbine turbine, BlockRendererDispatcher renderer, float bright, IBlockState shaftState, EnumFacing flowDir, int flowLength, int shaftWidth, int depth) {
GlStateManager.pushMatrix();
Vector3f renderPos = turbine.renderPosArray[4 * flowLength * shaftWidth + depth];
GlStateManager.translate(renderPos.x + 0.5D, renderPos.y + 0.5D, renderPos.z + 0.5D);
GlStateManager.scale(flowDir.getAxis() == Axis.X ? 1D : shaftWidth, flowDir.getAxis() == Axis.Y ? 1D : shaftWidth, flowDir.getAxis() == Axis.Z ? 1D : shaftWidth);
GlStateManager.translate(-0.5D, -0.5D, -0.5D);
GlStateManager.rotate(-90F, 0F, 1F, 0F);
renderer.renderBlockBrightness(stator.getRenderState(), bright);
renderer.renderBlockBrightness(shaftState, bright);
GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
public void renderBlades(Turbine turbine, BlockRendererDispatcher renderer, float bright, EnumFacing flowDir, int flowLength, int bladeLength, int shaftWidth, double bladeWidth, int jMult, int depth) {
Vector3f renderPos;
IBlockState rotorState;
TurbinePartDir bladeDir;
PlaneDir planeDir;
int i = jMult + depth;
for (int w = 0; w < shaftWidth; w++) {
GlStateManager.pushMatrix();
renderPos = turbine.renderPosArray[w + i * shaftWidth];
rotorState = turbine.rotorStateArray[i];
bladeDir = rotorState.getValue(TurbineRotorBladeUtil.DIR);
planeDir = (i < flowLength || i >= 3 * flowLength) ? PlaneDir.V : PlaneDir.U;
GlStateManager.translate(renderPos.x + 0.5D, renderPos.y + 0.5D, renderPos.z + 0.5D);
GlStateManager.scale(flowDir.getAxis() == Axis.X ? 1D : (turbine.getBladeDir(planeDir) == TurbinePartDir.X ? bladeLength : bladeWidth), flowDir.getAxis() == Axis.Y ? 1D : (turbine.getBladeDir(planeDir) == TurbinePartDir.Y ? bladeLength : bladeWidth), flowDir.getAxis() == Axis.Z ? 1D : (turbine.getBladeDir(planeDir) == TurbinePartDir.Z ? bladeLength : bladeWidth));
GlStateManager.rotate(turbine.bladeAngleArray[i] * (flowDir.getAxisDirection() == AxisDirection.POSITIVE ^ flowDir.getAxis() == Axis.X ? 1F : -1F), bladeDir == TurbinePartDir.X ? 1F : 0F, bladeDir == TurbinePartDir.Y ? 1F : 0F, bladeDir == TurbinePartDir.Z ? 1F : 0F);
GlStateManager.translate(-0.5D, -0.5D, -0.5D);
GlStateManager.rotate(-90F, 0F, 1F, 0F);
renderer.renderBlockBrightness(rotorState, bright);
GlStateManager.popMatrix();
}
}
}

View File

@ -6,7 +6,7 @@ import net.minecraft.creativetab.CreativeTabs;
public class NCTabs {
public static final CreativeTabs NUCLEARCRAFT = single_creative_tab ? new TabNuclearCraft() : CreativeTabs.MISC;
private static final CreativeTabs NUCLEARCRAFT = single_creative_tab ? new TabNuclearCraft() : CreativeTabs.MISC;
public static final CreativeTabs MATERIAL = single_creative_tab ? NUCLEARCRAFT : new TabMaterial();
public static final CreativeTabs MACHINE = single_creative_tab ? NUCLEARCRAFT : new TabMachine();

View File

@ -6,6 +6,7 @@ import javax.annotation.*;
import gregtech.api.capability.*;
import ic2.api.energy.tile.IEnergySink;
import mcjty.lib.api.power.IBigPower;
import nc.ModCheck;
import nc.tile.ITile;
import nc.tile.internal.energy.*;
@ -19,7 +20,8 @@ import net.minecraft.util.math.MathHelper;
import net.minecraftforge.energy.*;
import net.minecraftforge.fml.common.Optional;
public interface ITileEnergy extends ITile {
@Optional.Interface(iface = "mcjty.lib.api.power.IBigPower", modid = "theoneprobe")
public interface ITileEnergy extends ITile, IBigPower {
// Storage
@ -243,4 +245,18 @@ public interface ITileEnergy extends ITile {
public default boolean hasEnergySideCapability(@Nullable EnumFacing side) {
return side == null || getEnergyConnection(side).canConnect();
}
// TOP
@Override
@Optional.Method(modid = "theoneprobe")
public default long getStoredPower() {
return getEnergyStorage().getEnergyStoredLong();
}
@Override
@Optional.Method(modid = "theoneprobe")
public default long getCapacity() {
return getEnergyStorage().getMaxEnergyStoredLong();
}
}

View File

@ -1,293 +0,0 @@
package nc.util;
import java.util.*;
import javax.annotation.Nonnull;
import com.google.common.collect.Lists;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
public class BlockPosHelper {
public static final BlockPos DEFAULT_NON = new BlockPos(0, -1, 0);
private final BlockPos pos;
public BlockPosHelper(BlockPos pos) {
this.pos = pos;
}
public BlockPosHelper(int x, int y, int z) {
pos = new BlockPos(x, y, z);
}
public BlockPos[] offsets(EnumFacing[] sides, int dist) {
BlockPos[] posList = new BlockPos[sides.length];
for (int i = 0; i < sides.length; i++) {
posList[i] = pos.offset(sides[i], dist);
}
return posList;
}
private BlockPos position(int x, int y, int z) {
return new BlockPos(pos.getX() + x, pos.getY() + y, pos.getZ() + z);
}
// Adjacents
public BlockPos[] adjacents(int dist) {
return offsets(EnumFacing.VALUES, dist);
}
public BlockPos[] adjacents() {
return adjacents(1);
}
// Horizontals
private static final EnumFacing[] HORIZONTALS_X = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.UP, EnumFacing.NORTH, EnumFacing.SOUTH};
private static final EnumFacing[] HORIZONTALS_Y = EnumFacing.HORIZONTALS;
private static final EnumFacing[] HORIZONTALS_Z = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.UP, EnumFacing.WEST, EnumFacing.EAST};
public BlockPos[] horizontalsX(int dist) {
return offsets(HORIZONTALS_X, dist);
}
public BlockPos[] horizontalsX() {
return horizontalsX(1);
}
public BlockPos[] horizontalsY(int dist) {
return offsets(HORIZONTALS_Y, dist);
}
public BlockPos[] horizontalsY() {
return horizontalsY(1);
}
public BlockPos[] horizontalsZ(int dist) {
return offsets(HORIZONTALS_Z, dist);
}
public BlockPos[] horizontalsZ() {
return horizontalsZ(1);
}
public List<BlockPos[]> horizontalsList(int dist) {
return Lists.newArrayList(horizontalsX(dist), horizontalsY(dist), horizontalsZ(dist));
}
public List<BlockPos[]> horizontalsList() {
return horizontalsList(1);
}
public static EnumFacing[] getHorizontals(EnumFacing dir) {
switch (dir) {
case DOWN:
return HORIZONTALS_Y;
case UP:
return HORIZONTALS_Y;
case NORTH:
return HORIZONTALS_Z;
case SOUTH:
return HORIZONTALS_Z;
case WEST:
return HORIZONTALS_X;
case EAST:
return HORIZONTALS_X;
default:
return HORIZONTALS_Y;
}
}
// Axials
private static final EnumFacing[] AXIALS_X = new EnumFacing[] {EnumFacing.WEST, EnumFacing.EAST};
private static final EnumFacing[] AXIALS_Y = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.UP};
private static final EnumFacing[] AXIALS_Z = new EnumFacing[] {EnumFacing.NORTH, EnumFacing.SOUTH};
public BlockPos[] axialsX(int dist) {
return offsets(AXIALS_X, dist);
}
public BlockPos[] axialsX() {
return axialsX(1);
}
public BlockPos[] axialsY(int dist) {
return offsets(AXIALS_Y, dist);
}
public BlockPos[] axialsY() {
return axialsY(1);
}
public BlockPos[] axialsZ(int dist) {
return offsets(AXIALS_Z, dist);
}
public BlockPos[] axialsZ() {
return axialsZ(1);
}
public List<BlockPos[]> axialsList(int dist) {
return Lists.newArrayList(axialsX(dist), axialsY(dist), axialsZ(dist));
}
public List<BlockPos[]> axialsList() {
return axialsList(1);
}
public static List<EnumFacing[]> axialDirsList() {
return Lists.newArrayList(AXIALS_X, AXIALS_Y, AXIALS_Z);
}
public static EnumFacing[] getAxialDirs(EnumFacing dir) {
switch (dir) {
case DOWN:
return AXIALS_Y;
case UP:
return AXIALS_Y;
case NORTH:
return AXIALS_Z;
case SOUTH:
return AXIALS_Z;
case WEST:
return AXIALS_X;
case EAST:
return AXIALS_X;
default:
return AXIALS_Y;
}
}
// Vertices
private static final EnumFacing[] VERTEX_DNW = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_DNE = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.EAST};
private static final EnumFacing[] VERTEX_DSW = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_DSE = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.EAST};
private static final EnumFacing[] VERTEX_UNW = new EnumFacing[] {EnumFacing.UP, EnumFacing.NORTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_UNE = new EnumFacing[] {EnumFacing.UP, EnumFacing.NORTH, EnumFacing.EAST};
private static final EnumFacing[] VERTEX_USW = new EnumFacing[] {EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_USE = new EnumFacing[] {EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.EAST};
public BlockPos[] vertexDNW() {
return offsets(VERTEX_DNW, 1);
}
public BlockPos[] vertexDNE() {
return offsets(VERTEX_DNE, 1);
}
public BlockPos[] vertexDSW() {
return offsets(VERTEX_DSW, 1);
}
public BlockPos[] vertexDSE() {
return offsets(VERTEX_DSE, 1);
}
public BlockPos[] vertexUNW() {
return offsets(VERTEX_UNW, 1);
}
public BlockPos[] vertexUNE() {
return offsets(VERTEX_UNE, 1);
}
public BlockPos[] vertexUSW() {
return offsets(VERTEX_USW, 1);
}
public BlockPos[] vertexUSE() {
return offsets(VERTEX_USE, 1);
}
public List<BlockPos[]> vertexList() {
return Lists.newArrayList(vertexDNW(), vertexDNE(), vertexDSW(), vertexDSE(), vertexUNW(), vertexUNE(), vertexUSW(), vertexUSE());
}
public static List<EnumFacing[]> vertexDirsList() {
return Lists.newArrayList(VERTEX_DNW, VERTEX_DNE, VERTEX_DSW, VERTEX_DSE, VERTEX_UNW, VERTEX_UNE, VERTEX_USW, VERTEX_USE);
}
// Ring
public List<BlockPos> squareRing(int radius, int height) {
List<BlockPos> posList = new ArrayList<>();
for (int i = -radius; i < radius; i++) {
posList.add(position(i, height, radius));
posList.add(position(-i, height, -radius));
posList.add(position(radius, height, -i));
posList.add(position(-radius, height, i));
}
return posList;
}
public List<BlockPos> cutoffRing(int radius, int height) {
List<BlockPos> posList = new ArrayList<>();
for (int i = -radius + 1; i < radius; i++) {
posList.add(position(i, height, radius));
posList.add(position(-i, height, -radius));
posList.add(position(radius, height, -i));
posList.add(position(-radius, height, i));
}
return posList;
}
public List<BlockPos> squareTube(int radius, int height) {
return CollectionHelper.concatenate(squareRing(radius - 1, height), squareRing(radius, height - 1), squareRing(radius, height + 1), squareRing(radius + 1, height));
}
public List<BlockPos> squareTubeDiagonals(int radius, int height) {
return CollectionHelper.concatenate(squareRing(radius - 1, height - 1), squareRing(radius - 1, height + 1), squareRing(radius + 1, height - 1), squareRing(radius + 1, height + 1));
}
public List<BlockPos> squareTubeNotHidden(int radius, int height) {
return CollectionHelper.concatenate(cutoffRing(radius - 1, height), squareRing(radius, height - 1), squareRing(radius, height + 1), squareRing(radius + 1, height));
}
// Other
public static final EnumFacing.Axis[] AXES = new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Y, EnumFacing.Axis.Z};
public static int getAxisIndex(@Nonnull EnumFacing.Axis axis) {
return axis == EnumFacing.Axis.X ? 0 : axis == EnumFacing.Axis.Y ? 1 : 2;
}
public static final EnumFacing.AxisDirection[] AXISDIRS = new EnumFacing.AxisDirection[] {EnumFacing.AxisDirection.POSITIVE, EnumFacing.AxisDirection.NEGATIVE};
public static int getAxisDirIndex(@Nonnull EnumFacing.AxisDirection dir) {
return dir == EnumFacing.AxisDirection.POSITIVE ? 0 : 1;
}
public List<BlockPos> cuboid(int x1, int y1, int z1, int x2, int y2, int z2) {
List<BlockPos> posList = new ArrayList<>();
for (BlockPos pos : BlockPos.getAllInBox(position(x1, y1, z1), position(x2, y2, z2))) {
posList.add(pos);
}
return posList;
}
public static String stringPos(BlockPos pos) {
return "[" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + "]";
}
public static BlockPos[] getOtherPlaneCorners(BlockPos pos1, BlockPos pos2) {
if (pos1.getX() == pos2.getX()) {
return new BlockPos[] {new BlockPos(pos1.getX(), pos2.getY(), pos1.getZ()), new BlockPos(pos1.getX(), pos1.getY(), pos2.getZ())};
}
else if (pos1.getY() == pos2.getY()) {
return new BlockPos[] {new BlockPos(pos1.getX(), pos1.getY(), pos2.getZ()), new BlockPos(pos2.getX(), pos1.getY(), pos1.getZ())};
}
else if (pos1.getZ() == pos2.getZ()) {
return new BlockPos[] {new BlockPos(pos2.getX(), pos1.getY(), pos1.getZ()), new BlockPos(pos1.getX(), pos2.getY(), pos1.getZ())};
}
else {
return new BlockPos[] {pos1, pos2};
}
}
}

View File

@ -0,0 +1,98 @@
package nc.util;
import java.util.List;
import javax.annotation.Nonnull;
import com.google.common.collect.Lists;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
public class PosHelper {
public static final BlockPos DEFAULT_NON = new BlockPos(0, -1, 0);
// Horizontals
private static final EnumFacing[] HORIZONTALS_X = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.UP, EnumFacing.NORTH, EnumFacing.SOUTH};
private static final EnumFacing[] HORIZONTALS_Y = EnumFacing.HORIZONTALS;
private static final EnumFacing[] HORIZONTALS_Z = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.UP, EnumFacing.WEST, EnumFacing.EAST};
public static EnumFacing[] getHorizontals(EnumFacing dir) {
switch (dir) {
case DOWN:
return HORIZONTALS_Y;
case UP:
return HORIZONTALS_Y;
case NORTH:
return HORIZONTALS_Z;
case SOUTH:
return HORIZONTALS_Z;
case WEST:
return HORIZONTALS_X;
case EAST:
return HORIZONTALS_X;
default:
return HORIZONTALS_Y;
}
}
// Axials
private static final EnumFacing[] AXIALS_X = new EnumFacing[] {EnumFacing.WEST, EnumFacing.EAST};
private static final EnumFacing[] AXIALS_Y = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.UP};
private static final EnumFacing[] AXIALS_Z = new EnumFacing[] {EnumFacing.NORTH, EnumFacing.SOUTH};
public static List<EnumFacing[]> axialDirsList() {
return Lists.newArrayList(AXIALS_X, AXIALS_Y, AXIALS_Z);
}
public static EnumFacing[] getAxialDirs(EnumFacing dir) {
switch (dir) {
case DOWN:
return AXIALS_Y;
case UP:
return AXIALS_Y;
case NORTH:
return AXIALS_Z;
case SOUTH:
return AXIALS_Z;
case WEST:
return AXIALS_X;
case EAST:
return AXIALS_X;
default:
return AXIALS_Y;
}
}
// Vertices
private static final EnumFacing[] VERTEX_DNW = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_DNE = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.EAST};
private static final EnumFacing[] VERTEX_DSW = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_DSE = new EnumFacing[] {EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.EAST};
private static final EnumFacing[] VERTEX_UNW = new EnumFacing[] {EnumFacing.UP, EnumFacing.NORTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_UNE = new EnumFacing[] {EnumFacing.UP, EnumFacing.NORTH, EnumFacing.EAST};
private static final EnumFacing[] VERTEX_USW = new EnumFacing[] {EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.WEST};
private static final EnumFacing[] VERTEX_USE = new EnumFacing[] {EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.EAST};
public static List<EnumFacing[]> vertexDirsList() {
return Lists.newArrayList(VERTEX_DNW, VERTEX_DNE, VERTEX_DSW, VERTEX_DSE, VERTEX_UNW, VERTEX_UNE, VERTEX_USW, VERTEX_USE);
}
// Axes
public static final EnumFacing.Axis[] AXES = new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Y, EnumFacing.Axis.Z};
public static int getAxisIndex(@Nonnull EnumFacing.Axis axis) {
return axis == EnumFacing.Axis.X ? 0 : axis == EnumFacing.Axis.Y ? 1 : 2;
}
public static final EnumFacing.AxisDirection[] AXISDIRS = new EnumFacing.AxisDirection[] {EnumFacing.AxisDirection.POSITIVE, EnumFacing.AxisDirection.NEGATIVE};
public static int getAxisDirIndex(@Nonnull EnumFacing.AxisDirection dir) {
return dir == EnumFacing.AxisDirection.POSITIVE ? 0 : 1;
}
}

View File

@ -1,9 +1,10 @@
{
"forge_marker": 1,
"defaults": {
"model": "cube_all",
"model": "cube_column",
"textures": {
"all": "nuclearcraft:blocks/turbine/rotor_shaft"
"end": "nuclearcraft:blocks/turbine/rotor_shaft_end",
"side": "nuclearcraft:blocks/turbine/rotor_shaft_side"
}
},
"variants": {

View File

@ -6,7 +6,7 @@
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"rotation": [ 30, 225, 0 ],
"translation": [ 0, 0, 0],
"scale":[ 0.625, 0.625, 0.625 ]
},
@ -16,24 +16,24 @@
"scale":[ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
"scale":[ 0.5, 0.5, 0.5 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"rotation": [ 75, 45, 0 ],
"translation": [ 0, 2.5, 0],
"scale": [ 0.375, 0.375, 0.375 ]
},
"firstperson_righthand": {
"rotation": [ 0, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 225, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"elements": [

View File

@ -6,7 +6,7 @@
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"rotation": [ 30, 225, 0 ],
"translation": [ 0, 0, 0],
"scale":[ 0.625, 0.625, 0.625 ]
},
@ -16,24 +16,24 @@
"scale":[ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
"scale":[ 0.5, 0.5, 0.5 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"rotation": [ 75, 45, 0 ],
"translation": [ 0, 2.5, 0],
"scale": [ 0.375, 0.375, 0.375 ]
},
"firstperson_righthand": {
"rotation": [ 0, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 225, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"elements": [

View File

@ -1,12 +1,5 @@
{
"parent": "block/cube",
"display": {
"firstperson_righthand": {
"rotation": [ 0, 135, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"textures": {
"particle": "#top",
"down": "#bottom",

View File

@ -7,7 +7,7 @@
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"rotation": [ 30, 225, 0 ],
"translation": [ 0, 0, 0],
"scale":[ 0.625, 0.625, 0.625 ]
},
@ -17,24 +17,24 @@
"scale":[ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
"scale":[ 0.5, 0.5, 0.5 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"rotation": [ 75, 45, 0 ],
"translation": [ 0, 2.5, 0],
"scale": [ 0.375, 0.375, 0.375 ]
},
"firstperson_righthand": {
"rotation": [ 0, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 225, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"elements": [

View File

@ -6,7 +6,7 @@
},
"display": {
"gui": {
"rotation": [ 30, 45, 0 ],
"rotation": [ 30, 225, 0 ],
"translation": [ 0, 0, 0],
"scale":[ 0.625, 0.625, 0.625 ]
},
@ -16,24 +16,24 @@
"scale":[ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0],
"scale": [ 1, 1, 1 ]
},
"head": {
"rotation": [ 0, 180, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 1, 1, 1 ]
},
"firstperson_righthand": {
"rotation": [ 0, 315, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.4, 0.4, 0.4 ]
"scale":[ 0.5, 0.5, 0.5 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 315, 0 ],
"rotation": [ 75, 45, 0 ],
"translation": [ 0, 2.5, 0],
"scale": [ 0.375, 0.375, 0.375 ]
},
"firstperson_righthand": {
"rotation": [ 0, 45, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 225, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"elements": [

View File

@ -1,12 +1,5 @@
{
"parent": "block/cube",
"display": {
"firstperson_righthand": {
"rotation": [ 0, 135, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"textures": {
"particle": "#side",
"down": "#top",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,10 @@
{
"ctm": {
"ctm_version": 1,
"type":"ctm",
"layer":"SOLID",
"textures":[
"nuclearcraft:blocks/turbine/rotor_shaft_end_ctm"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB