Compare commits

...

10 Commits

Author SHA1 Message Date
Tom Dodd a36d7cf32b
Merge pull request #685 from LWHK/master
CHS Translation
2020-08-24 03:43:55 +01:00
Tom Dodd 3776c67038 Continuing towards 2o.4.0... 2020-08-24 03:43:08 +01:00
WuzgXY 2107b0dbb0
v2o.4.0
Subtitles and correction of Feral Ghoul
I must go and play Fallout _(:3 <)_
2020-08-21 09:51:50 +08:00
WuzgXY ab4ce1e0d3
v2o.3.7 2020-08-12 08:35:46 +08:00
WuzgXY be40004357
Punctuation Marks 2020-08-12 08:27:34 +08:00
WuzgXY 2f0a7d3c66
Merge pull request #3 from ghostbird03/master
Changed Some Punctuation Marks
2020-08-12 08:23:28 +08:00
ghostbird03 b44382b4cf changed some punctuation marks 2020-08-09 11:17:53 +08:00
WuzgXY 8aed4d3af3
Merge pull request #2 from ghostbird03/master
Added translation of Wasteland
2020-08-09 08:23:08 +08:00
ghostbird03 9bc33e48a6 fixed multitool‘s anchor in zh_cn 2020-08-07 23:35:27 +08:00
ghostbird03 a110ba63e3 Added translation of Wasteland 2020-08-07 23:12:17 +08:00
296 changed files with 3068 additions and 1562 deletions

View File

@ -1,7 +1,15 @@
v2o.3.7 v2o.4.0
+ Added CT script addon loader and merger system!
+ Put all script addons into "resources/nuclearcraft/addons/" to have them loaded!
+ See the GitHub repository for examples of the script addon format
* Updated Chinese Patchouli localisation [thanks to WuzgXY and ghostbird03!] * Updated Chinese Patchouli localisation [thanks to WuzgXY and ghostbird03!]
+ Added input and output settings for all fission ports
* Shields can no longer act as active moderators in MSRs
* Tweaked turbine throughput bonus (ask in Discord server for subtle details) * Tweaked turbine throughput bonus (ask in Discord server for subtle details)
* Tweaked default turbine coil efficiencies * Tweaked default turbine coil efficiencies
@ -13,7 +21,14 @@ v2o.3.7
* Fixed radiation immunity not being applied when radiation death persistence is disabled * Fixed radiation immunity not being applied when radiation death persistence is disabled
* Fixed CT radiation methods being called too late * Fixed CT radiation methods being called too late
* CT scripts can now be stored in the "resources/nuclearcraft/scripts/" directory * Large refactoring and improvement of tile entity block update logic
* Fixed some models not correctly updating on the client-side
* Fixed CT input recipe removal methods not correctly removing recipes with matching array ingredients
* Various other minor fixes, changes and refactors
* Possible other things that I have forgotten
- Removed Paulobrine and Herobrian
v2o.3.6 v2o.3.6

View File

@ -1,7 +1,7 @@
mc_version=1.12.2 mc_version=1.12.2
forge_version=14.23.5.2847 forge_version=14.23.5.2847
mapping_version=stable_39 mapping_version=stable_39
mod_version=2o.3.7 mod_version=2o.4.0_test_build_please_back_your_worlds_up_people
ic2_version=2.8.197-ex112 ic2_version=2.8.197-ex112
jei_version=4.15.0.293 jei_version=4.15.0.293

View File

@ -0,0 +1,26 @@
{
"forge_marker": 1,
"defaults": {
"model": "nuclearcraft:fission_port_overlayed",
"textures": {
"front": "nuclearcraft:blocks/heater_port_extreme",
"overlay": "nuclearcraft:blocks/fission/port/heater/off"
}
},
"variants": {
"inventory": [{}],
"active": {
"false": {},
"true": {
"textures": {
"overlay": "nuclearcraft:blocks/fission/port/heater/on"
}
}
},
"axis": {
"x": {"y": 90},
"y": {"x": 90},
"z": {}
}
}
}

View File

@ -0,0 +1,26 @@
{
"forge_marker": 1,
"defaults": {
"model": "nuclearcraft:fission_port_overlayed",
"textures": {
"front": "nuclearcraft:blocks/heater_port_sic_sic_cmc",
"overlay": "nuclearcraft:blocks/fission/port/heater/off"
}
},
"variants": {
"inventory": [{}],
"active": {
"false": {},
"true": {
"textures": {
"overlay": "nuclearcraft:blocks/fission/port/heater/on"
}
}
},
"axis": {
"x": {"y": 90},
"y": {"x": 90},
"z": {}
}
}
}

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"model":"cube_all",
"textures": {
"all": "nuclearcraft:blocks/heater_extreme"
}
},
"variants": {
"inventory": [{}],
"normal": [{}]
}
}

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"model":"cube_all",
"textures": {
"all": "nuclearcraft:blocks/heater_sic_sic_cmc"
}
},
"variants": {
"inventory": [{}],
"normal": [{}]
}
}

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"model":"cube_all",
"textures": {
"all": "nuclearcraft:blocks/sink_extreme"
}
},
"variants": {
"inventory": [{}],
"normal": [{}]
}
}

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"model":"cube_all",
"textures": {
"all": "nuclearcraft:blocks/sink_sic_sic_cmc"
}
},
"variants": {
"inventory": [{}],
"normal": [{}]
}
}

View File

@ -0,0 +1,18 @@
tile.nuclearcraft.solid_fission_sink_extreme.name=Extreme Alloy Fission Heat Sink
tile.nuclearcraft.solid_fission_sink_sic_sic_cmc.name=SiC-SiC CMC Fission Heat Sink
tile.nuclearcraft.salt_fission_heater_extreme.name=Extreme Alloy Fission Coolant Heater
tile.nuclearcraft.salt_fission_heater_sic_sic_cmc.name=SiC-SiC CMC Fission Coolant Heater
tile.nuclearcraft.fission_heater_port_extreme.name=Extreme Alloy Fission Coolant Heater Port
tile.nuclearcraft.fission_heater_port_sic_sic_cmc.name=SiC-SiC CMC Fission Coolant Heater Port
nc.sf.extreme_sink0=%s valid extreme alloy sink
nc.sf.extreme_sink1=%s valid extreme alloy sinks
nc.sf.sic_sic_cmc_sink0=%s valid SiC-SiC CMC sink
nc.sf.sic_sic_cmc_sink1=%s valid SiC-SiC CMC sinks
nc.sf.extreme_heater0=%s functional extreme alloy heater
nc.sf.extreme_heater1=%s functional extreme alloy heaters
nc.sf.sic_sic_cmc_heater0=%s functional SiC-SiC CMC heater
nc.sf.sic_sic_cmc_heater1=%s functional SiC-SiC CMC heaters

View File

@ -0,0 +1,7 @@
#loader nc_preinit
mods.nuclearcraft.Registration.registerFissionSink("extreme", 210, "exactly one sic_sic_cmc sink");
mods.nuclearcraft.Registration.registerFissionSink("sic_sic_cmc", 215, "exactly one lead sink");
mods.nuclearcraft.Registration.registerFissionHeater("extreme", "tritium", 1, "deuterium", 1, 210, "exactly one sic_sic_cmc heater");
mods.nuclearcraft.Registration.registerFissionHeater("sic_sic_cmc", "helium3", 1, "helium", 1, 215, "exactly one lead heater");

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"model":"cube_all",
"textures": {
"all": "nuclearcraft:blocks/coil_extreme"
}
},
"variants": {
"inventory": [{}],
"normal": [{}]
}
}

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"model":"cube_all",
"textures": {
"all": "nuclearcraft:blocks/coil_sic_sic_cmc"
}
},
"variants": {
"inventory": [{}],
"normal": [{}]
}
}

View File

@ -0,0 +1,20 @@
{
"forge_marker": 1,
"defaults": {
"model": "nuclearcraft:turbine_rotor_blade",
"textures": {
"texture": "nuclearcraft:blocks/blade_copper"
}
},
"variants": {
"inventory": [{}],
"dir": {
"invisible": {
"model": "nuclearcraft:block_invisible"
},
"x": {"x": 90, "y": 90},
"y": {},
"z": {"x": 90}
}
}
}

View File

@ -0,0 +1,20 @@
{
"forge_marker": 1,
"defaults": {
"model": "nuclearcraft:turbine_rotor_blade",
"textures": {
"texture": "nuclearcraft:blocks/blade_manganese"
}
},
"variants": {
"inventory": [{}],
"dir": {
"invisible": {
"model": "nuclearcraft:block_invisible"
},
"x": {"x": 90, "y": 90},
"y": {},
"z": {"x": 90}
}
}
}

View File

@ -0,0 +1,20 @@
{
"forge_marker": 1,
"defaults": {
"model": "nuclearcraft:turbine_rotor_stator",
"textures": {
"texture": "nuclearcraft:blocks/stator_boron"
}
},
"variants": {
"inventory": [{}],
"dir": {
"invisible": {
"model": "nuclearcraft:block_invisible"
},
"x": {"x": 90, "y": 90},
"y": {},
"z": {"x": 90}
}
}
}

View File

@ -0,0 +1,20 @@
{
"forge_marker": 1,
"defaults": {
"model": "nuclearcraft:turbine_rotor_stator",
"textures": {
"texture": "nuclearcraft:blocks/stator_magnesium"
}
},
"variants": {
"inventory": [{}],
"dir": {
"invisible": {
"model": "nuclearcraft:block_invisible"
},
"x": {"x": 90, "y": 90},
"y": {},
"z": {"x": 90}
}
}
}

View File

@ -0,0 +1,13 @@
tile.nuclearcraft.turbine_dynamo_coil_extreme.name=Extreme Alloy Turbine Dynamo Coil
tile.nuclearcraft.turbine_dynamo_coil_sic_sic_cmc.name=SiC-SiC CMC Turbine Dynamo Coil
tile.nuclearcraft.turbine_rotor_blade_manganese.name=Manganese Turbine Rotor Blade
tile.nuclearcraft.turbine_rotor_blade_copper.name=Copper Turbine Rotor Blade
tile.nuclearcraft.turbine_rotor_stator_magnesium.name=Magnesium Turbine Rotor Stator
tile.nuclearcraft.turbine_rotor_stator_boron.name=Boron Turbine Rotor Stator
nc.sf.extreme_coil0=%s extreme alloy dynamo coil
nc.sf.extreme_coil1=%s extreme alloy dynamo coils
nc.sf.sic_sic_cmc_coil0=%s SiC-SiC CMC dynamo coil
nc.sf.sic_sic_cmc_coil1=%s SiC-SiC CMC dynamo coils

View File

@ -1,11 +1,5 @@
#loader nc_preinit #loader nc_preinit
mods.nuclearcraft.Registration.registerFissionSink("extreme", 210, "exactly one sic_sic_cmc sink");
mods.nuclearcraft.Registration.registerFissionSink("sic_sic_cmc", 215, "exactly one lead sink");
mods.nuclearcraft.Registration.registerFissionHeater("extreme", "tritium", 1, "deuterium", 1, 210, "exactly one sic_sic_cmc heater");
mods.nuclearcraft.Registration.registerFissionHeater("sic_sic_cmc", "helium3", 1, "helium", 1, 215, "exactly one lead heater");
mods.nuclearcraft.Registration.registerTurbineCoil("extreme", 1.14, "four of any coil"); mods.nuclearcraft.Registration.registerTurbineCoil("extreme", 1.14, "four of any coil");
mods.nuclearcraft.Registration.registerTurbineCoil("sic_sic_cmc", 1.16, "exactly two axial connectors"); mods.nuclearcraft.Registration.registerTurbineCoil("sic_sic_cmc", 1.16, "exactly two axial connectors");

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

View File

@ -1,3 +1,5 @@
# Addon Test A
tile.nuclearcraft.solid_fission_sink_extreme.name=Extreme Alloy Fission Heat Sink tile.nuclearcraft.solid_fission_sink_extreme.name=Extreme Alloy Fission Heat Sink
tile.nuclearcraft.solid_fission_sink_sic_sic_cmc.name=SiC-SiC CMC Fission Heat Sink tile.nuclearcraft.solid_fission_sink_sic_sic_cmc.name=SiC-SiC CMC Fission Heat Sink
@ -7,15 +9,6 @@ tile.nuclearcraft.salt_fission_heater_sic_sic_cmc.name=SiC-SiC CMC Fission Coola
tile.nuclearcraft.fission_heater_port_extreme.name=Extreme Alloy Fission Coolant Heater Port tile.nuclearcraft.fission_heater_port_extreme.name=Extreme Alloy Fission Coolant Heater Port
tile.nuclearcraft.fission_heater_port_sic_sic_cmc.name=SiC-SiC CMC Fission Coolant Heater Port tile.nuclearcraft.fission_heater_port_sic_sic_cmc.name=SiC-SiC CMC Fission Coolant Heater Port
tile.nuclearcraft.turbine_dynamo_coil_extreme.name=Extreme Alloy Turbine Dynamo Coil
tile.nuclearcraft.turbine_dynamo_coil_sic_sic_cmc.name=SiC-SiC CMC Turbine Dynamo Coil
tile.nuclearcraft.turbine_rotor_blade_manganese.name=Manganese Turbine Rotor Blade
tile.nuclearcraft.turbine_rotor_blade_copper.name=Copper Turbine Rotor Blade
tile.nuclearcraft.turbine_rotor_stator_magnesium.name=Magnesium Turbine Rotor Stator
tile.nuclearcraft.turbine_rotor_stator_boron.name=Boron Turbine Rotor Stator
nc.sf.extreme_sink0=%s valid extreme alloy sink nc.sf.extreme_sink0=%s valid extreme alloy sink
nc.sf.extreme_sink1=%s valid extreme alloy sinks nc.sf.extreme_sink1=%s valid extreme alloy sinks
nc.sf.sic_sic_cmc_sink0=%s valid SiC-SiC CMC sink nc.sf.sic_sic_cmc_sink0=%s valid SiC-SiC CMC sink
@ -26,6 +19,18 @@ nc.sf.extreme_heater1=%s functional extreme alloy heaters
nc.sf.sic_sic_cmc_heater0=%s functional SiC-SiC CMC heater nc.sf.sic_sic_cmc_heater0=%s functional SiC-SiC CMC heater
nc.sf.sic_sic_cmc_heater1=%s functional SiC-SiC CMC heaters nc.sf.sic_sic_cmc_heater1=%s functional SiC-SiC CMC heaters
# Addon Test B
tile.nuclearcraft.turbine_dynamo_coil_extreme.name=Extreme Alloy Turbine Dynamo Coil
tile.nuclearcraft.turbine_dynamo_coil_sic_sic_cmc.name=SiC-SiC CMC Turbine Dynamo Coil
tile.nuclearcraft.turbine_rotor_blade_manganese.name=Manganese Turbine Rotor Blade
tile.nuclearcraft.turbine_rotor_blade_copper.name=Copper Turbine Rotor Blade
tile.nuclearcraft.turbine_rotor_stator_magnesium.name=Magnesium Turbine Rotor Stator
tile.nuclearcraft.turbine_rotor_stator_boron.name=Boron Turbine Rotor Stator
nc.sf.extreme_coil0=%s extreme alloy dynamo coil nc.sf.extreme_coil0=%s extreme alloy dynamo coil
nc.sf.extreme_coil1=%s extreme alloy dynamo coils nc.sf.extreme_coil1=%s extreme alloy dynamo coils
nc.sf.sic_sic_cmc_coil0=%s SiC-SiC CMC dynamo coil nc.sf.sic_sic_cmc_coil0=%s SiC-SiC CMC dynamo coil

View File

@ -0,0 +1,7 @@
#loader nc_preinit
mods.nuclearcraft.Registration.registerFissionSink("extreme", 210, "exactly one sic_sic_cmc sink");
mods.nuclearcraft.Registration.registerFissionSink("sic_sic_cmc", 215, "exactly one lead sink");
mods.nuclearcraft.Registration.registerFissionHeater("extreme", "tritium", 1, "deuterium", 1, 210, "exactly one sic_sic_cmc heater");
mods.nuclearcraft.Registration.registerFissionHeater("sic_sic_cmc", "helium3", 1, "helium", 1, 215, "exactly one lead heater");

View File

@ -1,11 +1,5 @@
#loader nc_preinit #loader nc_preinit
mods.nuclearcraft.Registration.registerFissionSink("extreme", 210, "exactly one sic_sic_cmc sink");
mods.nuclearcraft.Registration.registerFissionSink("sic_sic_cmc", 215, "exactly one lead sink");
mods.nuclearcraft.Registration.registerFissionHeater("extreme", "tritium", 1, "deuterium", 1, 210, "exactly one sic_sic_cmc heater");
mods.nuclearcraft.Registration.registerFissionHeater("sic_sic_cmc", "helium3", 1, "helium", 1, 215, "exactly one lead heater");
mods.nuclearcraft.Registration.registerTurbineCoil("extreme", 1.14, "four of any coil"); mods.nuclearcraft.Registration.registerTurbineCoil("extreme", 1.14, "four of any coil");
mods.nuclearcraft.Registration.registerTurbineCoil("sic_sic_cmc", 1.16, "exactly two axial connectors"); mods.nuclearcraft.Registration.registerTurbineCoil("sic_sic_cmc", 1.16, "exactly two axial connectors");

View File

@ -0,0 +1,7 @@
#loader nc_preinit
mods.nuclearcraft.Registration.registerFissionSink("extreme", 210, "exactly one sic_sic_cmc sink");
mods.nuclearcraft.Registration.registerFissionSink("sic_sic_cmc", 215, "exactly one lead sink");
mods.nuclearcraft.Registration.registerFissionHeater("extreme", "tritium", 1, "deuterium", 1, 210, "exactly one sic_sic_cmc heater");
mods.nuclearcraft.Registration.registerFissionHeater("sic_sic_cmc", "helium3", 1, "helium", 1, 215, "exactly one lead heater");

View File

@ -0,0 +1,10 @@
#loader nc_preinit
mods.nuclearcraft.Registration.registerTurbineCoil("extreme", 1.14, "four of any coil");
mods.nuclearcraft.Registration.registerTurbineCoil("sic_sic_cmc", 1.16, "exactly two axial connectors");
mods.nuclearcraft.Registration.registerTurbineBlade("manganese", 1.05, 1.35);
mods.nuclearcraft.Registration.registerTurbineBlade("copper", 1.15, 1.55);
mods.nuclearcraft.Registration.registerTurbineStator("magnesium", 0.6);
mods.nuclearcraft.Registration.registerTurbineStator("boron", 0.85);

View File

@ -7,3 +7,5 @@
#mods.nuclearcraft.Manufactory.addRecipe(<minecraft:magma_cream>*5, null); #mods.nuclearcraft.Manufactory.addRecipe(<minecraft:magma_cream>*5, null);
#mods.nuclearcraft.SolidFission.addRecipe(<minecraft:magma_cream>*4 | <minecraft:diamond>*2, mods.nuclearcraft.ChanceItemIngredient.create(<ore:ingotSilver>*4, 50, 2), 100, 125, 1.15, 99, true, 0.005); #mods.nuclearcraft.SolidFission.addRecipe(<minecraft:magma_cream>*4 | <minecraft:diamond>*2, mods.nuclearcraft.ChanceItemIngredient.create(<ore:ingotSilver>*4, 50, 2), 100, 125, 1.15, 99, true, 0.005);
#mods.nuclearcraft.DecayHastener.removeRecipeWithInput(<ore:ingotUranium235> | <ore:ingotUranium235Oxide> | <ore:ingotUranium235Nitride>);

View File

@ -10,6 +10,7 @@ public class ModCheck {
private static boolean ic2Loaded = false; private static boolean ic2Loaded = false;
private static boolean mekanismLoaded = false; private static boolean mekanismLoaded = false;
private static boolean craftTweakerLoaded = false; private static boolean craftTweakerLoaded = false;
private static boolean contentTweakerLoaded = false;
private static boolean mantleLoaded = false; private static boolean mantleLoaded = false;
private static boolean tinkersLoaded = false; private static boolean tinkersLoaded = false;
private static boolean constructsArmoryLoaded = false; private static boolean constructsArmoryLoaded = false;
@ -36,6 +37,7 @@ public class ModCheck {
ic2Loaded = Loader.isModLoaded("ic2"); ic2Loaded = Loader.isModLoaded("ic2");
mekanismLoaded = Loader.isModLoaded("mekanism"); mekanismLoaded = Loader.isModLoaded("mekanism");
craftTweakerLoaded = Loader.isModLoaded("crafttweaker"); craftTweakerLoaded = Loader.isModLoaded("crafttweaker");
contentTweakerLoaded = craftTweakerLoaded && Loader.isModLoaded("contenttweaker");
mantleLoaded = Loader.isModLoaded("mantle"); mantleLoaded = Loader.isModLoaded("mantle");
tinkersLoaded = mantleLoaded && Loader.isModLoaded("tconstruct"); tinkersLoaded = mantleLoaded && Loader.isModLoaded("tconstruct");
constructsArmoryLoaded = tinkersLoaded && Loader.isModLoaded("conarm"); constructsArmoryLoaded = tinkersLoaded && Loader.isModLoaded("conarm");
@ -72,6 +74,10 @@ public class ModCheck {
return craftTweakerLoaded; return craftTweakerLoaded;
} }
public static boolean contentTweakerLoaded() {
return contentTweakerLoaded;
}
public static boolean mantleLoaded() { public static boolean mantleLoaded() {
return mantleLoaded; return mantleLoaded;
} }

View File

@ -57,18 +57,6 @@ public class BlockActivatable extends BlockTile implements IActivatable, ITileTy
return getDefaultState().withProperty(ACTIVE, Boolean.valueOf(false)); return getDefaultState().withProperty(ACTIVE, Boolean.valueOf(false));
} }
@Override
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() == type.getBlock()) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
public static class Transparent extends BlockActivatable { public static class Transparent extends BlockActivatable {
protected final boolean smartRender; protected final boolean smartRender;

View File

@ -1,8 +1,22 @@
package nc.block.tile; package nc.block.tile;
import static nc.block.property.BlockProperties.ACTIVE;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IActivatable { public interface IActivatable extends IDynamicState {
public void setState(boolean isActive, TileEntity tile); public default void setActivity(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && getClass().isInstance(state.getBlock())) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -0,0 +1,5 @@
package nc.block.tile;
public interface IDynamicState {
}

View File

@ -1,29 +1,39 @@
package nc.block.tile.processor; package nc.block.tile.processor;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_HORIZONTAL;
import java.util.Random; import java.util.Random;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.block.tile.IActivatable; import nc.block.tile.IActivatable;
import nc.init.NCBlocks; import nc.block.tile.IDynamicState;
import nc.tab.NCTabs; import nc.tab.NCTabs;
import nc.tile.processor.TileNuclearFurnace; import nc.tile.processor.TileNuclearFurnace;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.*; import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.*; import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler; import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
import net.minecraftforge.fml.relauncher.*; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockNuclearFurnace extends Block implements ITileEntityProvider, IActivatable { public class BlockNuclearFurnace extends Block implements ITileEntityProvider, IActivatable {
@ -91,18 +101,6 @@ public class BlockNuclearFurnace extends Block implements ITileEntityProvider, I
return true; return true;
} }
@Override
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() == NCBlocks.nuclear_furnace) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@SuppressWarnings("incomplete-switch") @SuppressWarnings("incomplete-switch")

View File

@ -1,21 +1,27 @@
package nc.block.tile.processor; package nc.block.tile.processor;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_HORIZONTAL;
import java.util.Random; import java.util.Random;
import nc.block.tile.*; import nc.block.tile.BlockSidedTile;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.block.tile.ITileType;
import nc.enumm.BlockEnums.ProcessorType; import nc.enumm.BlockEnums.ProcessorType;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.*; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockProcessor extends BlockSidedTile implements IActivatable, ITileType { public class BlockProcessor extends BlockSidedTile implements IActivatable, ITileType {
@ -67,18 +73,6 @@ public class BlockProcessor extends BlockSidedTile implements IActivatable, ITil
return getDefaultState().withProperty(FACING_HORIZONTAL, placer.getHorizontalFacing().getOpposite()).withProperty(ACTIVE, Boolean.valueOf(false)); return getDefaultState().withProperty(FACING_HORIZONTAL, placer.getHorizontalFacing().getOpposite()).withProperty(ACTIVE, Boolean.valueOf(false));
} }
@Override
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() == type.getBlock()) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {

View File

@ -1001,7 +1001,7 @@ public class NCConfig {
propertyOreDictRawMaterialRecipes.setLanguageKey("gui.nc.config.ore_dict_raw_material_recipes"); propertyOreDictRawMaterialRecipes.setLanguageKey("gui.nc.config.ore_dict_raw_material_recipes");
Property propertyOreDictPriorityBool = config.get(CATEGORY_MISC, "ore_dict_priority_bool", true, Lang.localise("gui.nc.config.ore_dict_priority_bool.comment")); Property propertyOreDictPriorityBool = config.get(CATEGORY_MISC, "ore_dict_priority_bool", true, Lang.localise("gui.nc.config.ore_dict_priority_bool.comment"));
propertyOreDictPriorityBool.setLanguageKey("gui.nc.config.ore_dict_priority_bool"); propertyOreDictPriorityBool.setLanguageKey("gui.nc.config.ore_dict_priority_bool");
Property propertyOreDictPriority = config.get(CATEGORY_MISC, "ore_dict_priority", new String[] {"minecraft", "thermalfoundation", "techreborn", "nuclearcraft", "immersiveengineering", "mekanism", "ic2", "appliedenergistics2", "refinedstorage", "actuallyadditions", "advancedRocketry", "thaumcraft", "biomesoplenty"}, Lang.localise("gui.nc.config.ore_dict_priority.comment")); Property propertyOreDictPriority = config.get(CATEGORY_MISC, "ore_dict_priority", new String[] {"minecraft", "thermalfoundation", "techreborn", "nuclearcraft", "immersiveengineering", "mekanism", "ic2", "appliedenergistics2", "refinedstorage", "actuallyadditions", "libvulpes", "advancedrocketry", "thaumcraft", "biomesoplenty"}, Lang.localise("gui.nc.config.ore_dict_priority.comment"));
propertyOreDictPriority.setLanguageKey("gui.nc.config.ore_dict_priority"); propertyOreDictPriority.setLanguageKey("gui.nc.config.ore_dict_priority");
Property propertyHWYLAEnabled = config.get(CATEGORY_MISC, "hwyla_enabled", true, Lang.localise("gui.nc.config.hwyla_enabled.comment")); Property propertyHWYLAEnabled = config.get(CATEGORY_MISC, "hwyla_enabled", true, Lang.localise("gui.nc.config.hwyla_enabled.comment"));
propertyHWYLAEnabled.setLanguageKey("gui.nc.config.hwyla_enabled"); propertyHWYLAEnabled.setLanguageKey("gui.nc.config.hwyla_enabled");

View File

@ -264,7 +264,7 @@ public class BlockEnums {
} }
public enum ActivatableTileType implements IStringSerializable { public enum ActivatableTileType implements IStringSerializable {
/* FUSION_ELECTROMAGNET("fusion_electromagnet", NCTabs.FUSION), FUSION_ELECTROMAGNET_TRANSPARENT("fusion_electromagnet_transparent", NCTabs.FUSION), ACCELERATOR_ELECTROMAGNET("accelerator_electromagnet", NCTabs.ACCELERATOR), ELECTROMAGNET_SUPERCOOLER("electromagnet_supercooler", NCTabs.ACCELERATOR) */; ;
private final String name; private final String name;
private final CreativeTabs tab; private final CreativeTabs tab;
@ -281,7 +281,6 @@ public class BlockEnums {
public TileEntity getTile() { public TileEntity getTile() {
switch (this) { switch (this) {
/* case FUSION_ELECTROMAGNET: return new TilePassive.FusionElectromagnet(); case FUSION_ELECTROMAGNET_TRANSPARENT: return new TilePassive.FusionElectromagnet(); case ACCELERATOR_ELECTROMAGNET: return new TilePassive.AcceleratorElectromagnet(); case ELECTROMAGNET_SUPERCOOLER: return new TilePassive.ElectromagnetSupercooler(); */
default: default:
return null; return null;
} }
@ -293,9 +292,8 @@ public class BlockEnums {
public Block getBlock() { public Block getBlock() {
switch (this) { switch (this) {
/* case FUSION_ELECTROMAGNET: return NCBlocks.fusion_electromagnet; case FUSION_ELECTROMAGNET_TRANSPARENT: return NCBlocks.fusion_electromagnet_transparent; case ACCELERATOR_ELECTROMAGNET: return NCBlocks.accelerator_electromagnet; case ELECTROMAGNET_SUPERCOOLER: return NCBlocks.electromagnet_supercooler; */
default: default:
return /* NCBlocks.fusion_electromagnet */ null; return null;
} }
} }
} }

View File

@ -598,14 +598,14 @@ public class NCBlocks {
public static void registerRenders() { public static void registerRenders() {
for (int i = 0; i < MetaEnums.OreType.values().length; i++) { for (int i = 0; i < MetaEnums.OreType.values().length; i++) {
registerRender(ore, i, MetaEnums.OreType.values()[i].getName()); registerRender(ore, i, "type=" + MetaEnums.OreType.values()[i].getName());
} }
for (int i = 0; i < MetaEnums.IngotType.values().length; i++) { for (int i = 0; i < MetaEnums.IngotType.values().length; i++) {
registerRender(ingot_block, i, MetaEnums.IngotType.values()[i].getName()); registerRender(ingot_block, i, "type=" + MetaEnums.IngotType.values()[i].getName());
} }
for (int i = 0; i < MetaEnums.FertileIsotopeType.values().length; i++) { for (int i = 0; i < MetaEnums.FertileIsotopeType.values().length; i++) {
registerRender(fertile_isotope, i, MetaEnums.FertileIsotopeType.values()[i].getName()); registerRender(fertile_isotope, i, "type=" + MetaEnums.FertileIsotopeType.values()[i].getName());
} }
registerRender(supercold_ice); registerRender(supercold_ice);
@ -708,16 +708,16 @@ public class NCBlocks {
registerRender(fission_conductor); registerRender(fission_conductor);
registerRender(fission_monitor); registerRender(fission_monitor);
for (int i = 0; i < MetaEnums.NeutronReflectorType.values().length; i++) { for (int i = 0; i < MetaEnums.NeutronReflectorType.values().length; i++) {
registerRender(fission_reflector, i, MetaEnums.NeutronReflectorType.values()[i].getName()); registerRender(fission_reflector, i, "type=" + MetaEnums.NeutronReflectorType.values()[i].getName());
} }
registerRender(fission_power_port); registerRender(fission_power_port);
registerRender(fission_vent); registerRender(fission_vent);
registerRender(fission_irradiator); registerRender(fission_irradiator);
for (int i = 0; i < MetaEnums.NeutronSourceType.values().length; i++) { for (int i = 0; i < MetaEnums.NeutronSourceType.values().length; i++) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(fission_source), i, new ModelResourceLocation(new ResourceLocation(Global.MOD_ID, fission_source.getRegistryName().getPath()), "active=false,facing=south,type=" + MetaEnums.NeutronSourceType.values()[i].getName())); registerRender(fission_source, i, "active=false,facing=south,type=" + MetaEnums.NeutronSourceType.values()[i].getName());
} }
for (int i = 0; i < MetaEnums.NeutronShieldType.values().length; i++) { for (int i = 0; i < MetaEnums.NeutronShieldType.values().length; i++) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(fission_shield), i, new ModelResourceLocation(new ResourceLocation(Global.MOD_ID, fission_shield.getRegistryName().getPath()), "active=true,type=" + MetaEnums.NeutronShieldType.values()[i].getName())); registerRender(fission_shield, i, "active=true,type=" + MetaEnums.NeutronShieldType.values()[i].getName());
} }
registerRender(fission_computer_port); registerRender(fission_computer_port);
@ -727,10 +727,10 @@ public class NCBlocks {
registerRender(fission_vessel_port); registerRender(fission_vessel_port);
for (int i = 0; i < MetaEnums.CoolantHeaterType.values().length; i++) { for (int i = 0; i < MetaEnums.CoolantHeaterType.values().length; i++) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(fission_heater_port), i, new ModelResourceLocation(new ResourceLocation(Global.MOD_ID, fission_heater_port.getRegistryName().getPath()), "axis=z,type=" + MetaEnums.CoolantHeaterType.values()[i].getName())); registerRender(fission_heater_port, i, "active=false,axis=z,type=" + MetaEnums.CoolantHeaterType.values()[i].getName());
} }
for (int i = 0; i < MetaEnums.CoolantHeaterType2.values().length; i++) { for (int i = 0; i < MetaEnums.CoolantHeaterType2.values().length; i++) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(fission_heater_port2), i, new ModelResourceLocation(new ResourceLocation(Global.MOD_ID, fission_heater_port2.getRegistryName().getPath()), "axis=z,type=" + MetaEnums.CoolantHeaterType2.values()[i].getName())); registerRender(fission_heater_port2, i, "active=false,axis=z,type=" + MetaEnums.CoolantHeaterType2.values()[i].getName());
} }
registerRender(fission_shield_manager); registerRender(fission_shield_manager);
@ -738,19 +738,19 @@ public class NCBlocks {
registerRender(solid_fission_controller); registerRender(solid_fission_controller);
registerRender(solid_fission_cell); registerRender(solid_fission_cell);
for (int i = 0; i < MetaEnums.HeatSinkType.values().length; i++) { for (int i = 0; i < MetaEnums.HeatSinkType.values().length; i++) {
registerRender(solid_fission_sink, i, MetaEnums.HeatSinkType.values()[i].getName()); registerRender(solid_fission_sink, i, "type=" + MetaEnums.HeatSinkType.values()[i].getName());
} }
for (int i = 0; i < MetaEnums.HeatSinkType2.values().length; i++) { for (int i = 0; i < MetaEnums.HeatSinkType2.values().length; i++) {
registerRender(solid_fission_sink2, i, MetaEnums.HeatSinkType2.values()[i].getName()); registerRender(solid_fission_sink2, i, "type=" + MetaEnums.HeatSinkType2.values()[i].getName());
} }
registerRender(salt_fission_controller); registerRender(salt_fission_controller);
registerRender(salt_fission_vessel); registerRender(salt_fission_vessel);
for (int i = 0; i < MetaEnums.CoolantHeaterType.values().length; i++) { for (int i = 0; i < MetaEnums.CoolantHeaterType.values().length; i++) {
registerRender(salt_fission_heater, i, MetaEnums.CoolantHeaterType.values()[i].getName()); registerRender(salt_fission_heater, i, "type=" + MetaEnums.CoolantHeaterType.values()[i].getName());
} }
for (int i = 0; i < MetaEnums.CoolantHeaterType2.values().length; i++) { for (int i = 0; i < MetaEnums.CoolantHeaterType2.values().length; i++) {
registerRender(salt_fission_heater2, i, MetaEnums.CoolantHeaterType2.values()[i].getName()); registerRender(salt_fission_heater2, i, "type=" + MetaEnums.CoolantHeaterType2.values()[i].getName());
} }
registerRender(heat_exchanger_controller); registerRender(heat_exchanger_controller);
@ -777,7 +777,7 @@ public class NCBlocks {
registerRender(turbine_rotor_stator); registerRender(turbine_rotor_stator);
registerRender(turbine_rotor_bearing); registerRender(turbine_rotor_bearing);
for (int i = 0; i < TurbineDynamoCoilType.values().length; i++) { for (int i = 0; i < TurbineDynamoCoilType.values().length; i++) {
registerRender(turbine_dynamo_coil, i, TurbineDynamoCoilType.values()[i].getName()); registerRender(turbine_dynamo_coil, i, "type=" + TurbineDynamoCoilType.values()[i].getName());
} }
registerRender(turbine_coil_connector); registerRender(turbine_coil_connector);
registerRender(turbine_inlet); registerRender(turbine_inlet);
@ -816,13 +816,13 @@ public class NCBlocks {
registerRender(quantum_computer_qubit); registerRender(quantum_computer_qubit);
for (int i = 0; i < QuantumGateEnums.SingleType.values().length; i++) { for (int i = 0; i < QuantumGateEnums.SingleType.values().length; i++) {
registerRender(quantum_computer_gate_single, i, QuantumGateEnums.SingleType.values()[i].getName()); registerRender(quantum_computer_gate_single, i, "type=" + QuantumGateEnums.SingleType.values()[i].getName());
} }
for (int i = 0; i < QuantumGateEnums.ControlType.values().length; i++) { for (int i = 0; i < QuantumGateEnums.ControlType.values().length; i++) {
registerRender(quantum_computer_gate_control, i, QuantumGateEnums.ControlType.values()[i].getName()); registerRender(quantum_computer_gate_control, i, "type=" + QuantumGateEnums.ControlType.values()[i].getName());
} }
for (int i = 0; i < QuantumGateEnums.SwapType.values().length; i++) { for (int i = 0; i < QuantumGateEnums.SwapType.values().length; i++) {
registerRender(quantum_computer_gate_swap, i, QuantumGateEnums.SwapType.values()[i].getName()); registerRender(quantum_computer_gate_swap, i, "type=" + QuantumGateEnums.SwapType.values()[i].getName());
} }
registerRender(quantum_computer_connector); registerRender(quantum_computer_connector);
@ -869,7 +869,7 @@ public class NCBlocks {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
} }
public static void registerRender(Block block, int meta, String type) { public static void registerRender(Block block, int meta, String variant) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(new ResourceLocation(Global.MOD_ID, block.getRegistryName().getPath()), "type=" + type)); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(new ResourceLocation(Global.MOD_ID, block.getRegistryName().getPath()), variant));
} }
} }

View File

@ -2,7 +2,6 @@ package nc.init;
import nc.Global; import nc.Global;
import nc.enumm.MetaEnums; import nc.enumm.MetaEnums;
import nc.integration.crafttweaker.CTRegistration;
import nc.multiblock.battery.tile.TileBattery; import nc.multiblock.battery.tile.TileBattery;
import nc.multiblock.fission.salt.tile.TileSaltFissionController; import nc.multiblock.fission.salt.tile.TileSaltFissionController;
import nc.multiblock.fission.salt.tile.TileSaltFissionHeater; import nc.multiblock.fission.salt.tile.TileSaltFissionHeater;
@ -146,7 +145,6 @@ public class NCTiles {
GameRegistry.registerTileEntity(TileFissionHeaterPort.LiquidHelium.class, Global.MOD_ID + ":fission_heater_port_" + MetaEnums.CoolantHeaterType2.LIQUID_HELIUM.getName()); GameRegistry.registerTileEntity(TileFissionHeaterPort.LiquidHelium.class, Global.MOD_ID + ":fission_heater_port_" + MetaEnums.CoolantHeaterType2.LIQUID_HELIUM.getName());
GameRegistry.registerTileEntity(TileFissionHeaterPort.Enderium.class, Global.MOD_ID + ":fission_heater_port_" + MetaEnums.CoolantHeaterType2.ENDERIUM.getName()); GameRegistry.registerTileEntity(TileFissionHeaterPort.Enderium.class, Global.MOD_ID + ":fission_heater_port_" + MetaEnums.CoolantHeaterType2.ENDERIUM.getName());
GameRegistry.registerTileEntity(TileFissionHeaterPort.Cryotheum.class, Global.MOD_ID + ":fission_heater_port_" + MetaEnums.CoolantHeaterType2.CRYOTHEUM.getName()); GameRegistry.registerTileEntity(TileFissionHeaterPort.Cryotheum.class, Global.MOD_ID + ":fission_heater_port_" + MetaEnums.CoolantHeaterType2.CRYOTHEUM.getName());
GameRegistry.registerTileEntity(CTRegistration.TileHeaterPort.class, Global.MOD_ID + ":fission_heater_port_ct");
GameRegistry.registerTileEntity(TileFissionShieldManager.class, Global.MOD_ID + ":fission_shield_manager"); GameRegistry.registerTileEntity(TileFissionShieldManager.class, Global.MOD_ID + ":fission_shield_manager");
@ -185,7 +183,6 @@ public class NCTiles {
GameRegistry.registerTileEntity(TileSolidFissionSink.LiquidHelium.class, Global.MOD_ID + ":solid_fission_sink_" + MetaEnums.HeatSinkType2.LIQUID_HELIUM.getName()); GameRegistry.registerTileEntity(TileSolidFissionSink.LiquidHelium.class, Global.MOD_ID + ":solid_fission_sink_" + MetaEnums.HeatSinkType2.LIQUID_HELIUM.getName());
GameRegistry.registerTileEntity(TileSolidFissionSink.Enderium.class, Global.MOD_ID + ":solid_fission_sink_" + MetaEnums.HeatSinkType2.ENDERIUM.getName()); GameRegistry.registerTileEntity(TileSolidFissionSink.Enderium.class, Global.MOD_ID + ":solid_fission_sink_" + MetaEnums.HeatSinkType2.ENDERIUM.getName());
GameRegistry.registerTileEntity(TileSolidFissionSink.Cryotheum.class, Global.MOD_ID + ":solid_fission_sink_" + MetaEnums.HeatSinkType2.CRYOTHEUM.getName()); GameRegistry.registerTileEntity(TileSolidFissionSink.Cryotheum.class, Global.MOD_ID + ":solid_fission_sink_" + MetaEnums.HeatSinkType2.CRYOTHEUM.getName());
GameRegistry.registerTileEntity(CTRegistration.TileSink.class, Global.MOD_ID + ":solid_fission_sink_ct");
GameRegistry.registerTileEntity(TileSaltFissionController.class, Global.MOD_ID + ":salt_fission_controller"); GameRegistry.registerTileEntity(TileSaltFissionController.class, Global.MOD_ID + ":salt_fission_controller");
GameRegistry.registerTileEntity(TileSaltFissionVessel.class, Global.MOD_ID + ":salt_fission_vessel"); GameRegistry.registerTileEntity(TileSaltFissionVessel.class, Global.MOD_ID + ":salt_fission_vessel");
@ -222,7 +219,6 @@ public class NCTiles {
GameRegistry.registerTileEntity(TileSaltFissionHeater.LiquidHelium.class, Global.MOD_ID + ":salt_fission_heater_" + MetaEnums.CoolantHeaterType2.LIQUID_HELIUM.getName()); GameRegistry.registerTileEntity(TileSaltFissionHeater.LiquidHelium.class, Global.MOD_ID + ":salt_fission_heater_" + MetaEnums.CoolantHeaterType2.LIQUID_HELIUM.getName());
GameRegistry.registerTileEntity(TileSaltFissionHeater.Enderium.class, Global.MOD_ID + ":salt_fission_heater_" + MetaEnums.CoolantHeaterType2.ENDERIUM.getName()); GameRegistry.registerTileEntity(TileSaltFissionHeater.Enderium.class, Global.MOD_ID + ":salt_fission_heater_" + MetaEnums.CoolantHeaterType2.ENDERIUM.getName());
GameRegistry.registerTileEntity(TileSaltFissionHeater.Cryotheum.class, Global.MOD_ID + ":salt_fission_heater_" + MetaEnums.CoolantHeaterType2.CRYOTHEUM.getName()); GameRegistry.registerTileEntity(TileSaltFissionHeater.Cryotheum.class, Global.MOD_ID + ":salt_fission_heater_" + MetaEnums.CoolantHeaterType2.CRYOTHEUM.getName());
GameRegistry.registerTileEntity(CTRegistration.TileHeater.class, Global.MOD_ID + ":salt_fission_heater_ct");
GameRegistry.registerTileEntity(TileHeatExchangerController.class, Global.MOD_ID + ":heat_exchanger_controller"); GameRegistry.registerTileEntity(TileHeatExchangerController.class, Global.MOD_ID + ":heat_exchanger_controller");
GameRegistry.registerTileEntity(TileHeatExchangerCasing.class, Global.MOD_ID + ":heat_exchanger_casing"); GameRegistry.registerTileEntity(TileHeatExchangerCasing.class, Global.MOD_ID + ":heat_exchanger_casing");
@ -242,14 +238,17 @@ public class NCTiles {
GameRegistry.registerTileEntity(TileTurbineCasing.class, Global.MOD_ID + ":turbine_casing"); GameRegistry.registerTileEntity(TileTurbineCasing.class, Global.MOD_ID + ":turbine_casing");
GameRegistry.registerTileEntity(TileTurbineGlass.class, Global.MOD_ID + ":turbine_glass"); GameRegistry.registerTileEntity(TileTurbineGlass.class, Global.MOD_ID + ":turbine_glass");
GameRegistry.registerTileEntity(TileTurbineRotorShaft.class, Global.MOD_ID + ":turbine_rotor_shaft"); GameRegistry.registerTileEntity(TileTurbineRotorShaft.class, Global.MOD_ID + ":turbine_rotor_shaft");
GameRegistry.registerTileEntity(TileTurbineRotorBlade.class, Global.MOD_ID + ":turbine_rotor_blade");
GameRegistry.registerTileEntity(TileTurbineRotorBlade.class, Global.MOD_ID + ":turbine_rotor_blade_");
GameRegistry.registerTileEntity(TileTurbineRotorBlade.Steel.class, Global.MOD_ID + ":turbine_rotor_blade_" + TurbineRotorBladeType.STEEL.toString()); GameRegistry.registerTileEntity(TileTurbineRotorBlade.Steel.class, Global.MOD_ID + ":turbine_rotor_blade_" + TurbineRotorBladeType.STEEL.toString());
GameRegistry.registerTileEntity(TileTurbineRotorBlade.Extreme.class, Global.MOD_ID + ":turbine_rotor_blade_" + TurbineRotorBladeType.EXTREME.toString()); GameRegistry.registerTileEntity(TileTurbineRotorBlade.Extreme.class, Global.MOD_ID + ":turbine_rotor_blade_" + TurbineRotorBladeType.EXTREME.toString());
GameRegistry.registerTileEntity(TileTurbineRotorBlade.SicSicCMC.class, Global.MOD_ID + ":turbine_rotor_blade_" + TurbineRotorBladeType.SIC_SIC_CMC.toString()); GameRegistry.registerTileEntity(TileTurbineRotorBlade.SicSicCMC.class, Global.MOD_ID + ":turbine_rotor_blade_" + TurbineRotorBladeType.SIC_SIC_CMC.toString());
GameRegistry.registerTileEntity(CTRegistration.TileBlade.class, Global.MOD_ID + ":turbine_rotor_blade_ct");
GameRegistry.registerTileEntity(TileTurbineRotorStator.class, Global.MOD_ID + ":turbine_rotor_stator"); GameRegistry.registerTileEntity(TileTurbineRotorStator.class, Global.MOD_ID + ":turbine_rotor_stator_");
GameRegistry.registerTileEntity(CTRegistration.TileStator.class, Global.MOD_ID + ":turbine_rotor_stator_ct"); GameRegistry.registerTileEntity(TileTurbineRotorStator.Standard.class, Global.MOD_ID + ":turbine_rotor_stator_standard");
GameRegistry.registerTileEntity(TileTurbineRotorBearing.class, Global.MOD_ID + ":turbine_rotor_bearing"); GameRegistry.registerTileEntity(TileTurbineRotorBearing.class, Global.MOD_ID + ":turbine_rotor_bearing");
GameRegistry.registerTileEntity(TileTurbineDynamoCoil.class, Global.MOD_ID + ":turbine_dynamo_coil"); GameRegistry.registerTileEntity(TileTurbineDynamoCoil.class, Global.MOD_ID + ":turbine_dynamo_coil");
GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Magnesium.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.MAGNESIUM.toString()); GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Magnesium.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.MAGNESIUM.toString());
GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Beryllium.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.BERYLLIUM.toString()); GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Beryllium.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.BERYLLIUM.toString());
@ -257,7 +256,7 @@ public class NCTiles {
GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Gold.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.GOLD.toString()); GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Gold.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.GOLD.toString());
GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Copper.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.COPPER.toString()); GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Copper.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.COPPER.toString());
GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Silver.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.SILVER.toString()); GameRegistry.registerTileEntity(TileTurbineDynamoCoil.Silver.class, Global.MOD_ID + ":turbine_dynamo_coil_" + TurbineDynamoCoilType.SILVER.toString());
GameRegistry.registerTileEntity(CTRegistration.TileCoil.class, Global.MOD_ID + ":turbine_dynamo_coil_ct");
GameRegistry.registerTileEntity(TileTurbineCoilConnector.class, Global.MOD_ID + ":turbine_coil_connector"); GameRegistry.registerTileEntity(TileTurbineCoilConnector.class, Global.MOD_ID + ":turbine_coil_connector");
GameRegistry.registerTileEntity(TileTurbineInlet.class, Global.MOD_ID + ":turbine_inlet"); GameRegistry.registerTileEntity(TileTurbineInlet.class, Global.MOD_ID + ":turbine_inlet");
GameRegistry.registerTileEntity(TileTurbineOutlet.class, Global.MOD_ID + ":turbine_outlet"); GameRegistry.registerTileEntity(TileTurbineOutlet.class, Global.MOD_ID + ":turbine_outlet");
@ -285,17 +284,8 @@ public class NCTiles {
GameRegistry.registerTileEntity(TileBattery.LithiumIonBatteryDU.class, Global.MOD_ID + ":lithium_ion_battery_du"); GameRegistry.registerTileEntity(TileBattery.LithiumIonBatteryDU.class, Global.MOD_ID + ":lithium_ion_battery_du");
GameRegistry.registerTileEntity(TileBattery.LithiumIonBatteryElite.class, Global.MOD_ID + ":lithium_ion_battery_elite"); GameRegistry.registerTileEntity(TileBattery.LithiumIonBatteryElite.class, Global.MOD_ID + ":lithium_ion_battery_elite");
// GameRegistry.registerTileEntity(TileBuffer.class, Global.MOD_ID +
// ":buffer");
GameRegistry.registerTileEntity(TileBin.class, Global.MOD_ID + ":bin"); GameRegistry.registerTileEntity(TileBin.class, Global.MOD_ID + ":bin");
// GameRegistry.registerTileEntity(TilePassive.FusionElectromagnet.class,
// Global.MOD_ID + ":fusion_electromagnet");
// GameRegistry.registerTileEntity(TilePassive.AcceleratorElectromagnet.class,
// Global.MOD_ID + ":accelerator_electromagnet");
// GameRegistry.registerTileEntity(TilePassive.ElectromagnetSupercooler.class,
// Global.MOD_ID + ":electromagnet_supercooler");
GameRegistry.registerTileEntity(TilePassive.CobblestoneGenerator.class, Global.MOD_ID + ":cobblestone_generator"); GameRegistry.registerTileEntity(TilePassive.CobblestoneGenerator.class, Global.MOD_ID + ":cobblestone_generator");
GameRegistry.registerTileEntity(TilePassive.CobblestoneGeneratorCompact.class, Global.MOD_ID + ":cobblestone_generator_compact"); GameRegistry.registerTileEntity(TilePassive.CobblestoneGeneratorCompact.class, Global.MOD_ID + ":cobblestone_generator_compact");
GameRegistry.registerTileEntity(TilePassive.CobblestoneGeneratorDense.class, Global.MOD_ID + ":cobblestone_generator_dense"); GameRegistry.registerTileEntity(TilePassive.CobblestoneGeneratorDense.class, Global.MOD_ID + ":cobblestone_generator_dense");

View File

@ -54,13 +54,6 @@ public class CTRegistration {
public static final List<RegistrationInfo> INFO_LIST = new ArrayList<>(); public static final List<RegistrationInfo> INFO_LIST = new ArrayList<>();
public static class TileSink extends TileSolidFissionSink {
public TileSink(String sinkName, int coolingRate, String ruleID) {
super(sinkName, coolingRate, ruleID);
}
}
@ZenMethod @ZenMethod
public static void registerFissionSink(String sinkID, int cooling, String rule) { public static void registerFissionSink(String sinkID, int cooling, String rule) {
@ -68,7 +61,7 @@ public class CTRegistration {
new BlockFissionPart() { new BlockFissionPart() {
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileSink(sinkID, cooling, sinkID + "_sink"); return new TileSolidFissionSink(sinkID, cooling, sinkID + "_sink");
} }
@Override @Override
@ -84,28 +77,14 @@ public class CTRegistration {
INFO_LIST.add(new FissionSinkRegistrationInfo(sink, sinkID, cooling, rule)); INFO_LIST.add(new FissionSinkRegistrationInfo(sink, sinkID, cooling, rule));
} }
public static class TileHeaterPort extends TileFissionHeaterPort {
public TileHeaterPort(String coolantName) {
super(coolantName);
}
}
public static class TileHeater extends TileSaltFissionHeater {
public TileHeater(String heaterName, String coolantName) {
super(heaterName, coolantName);
}
}
@ZenMethod @ZenMethod
public static void registerFissionHeater(String heaterID, String fluidInput, int inputAmount, String fluidOutput, int outputAmount, int cooling, String rule) { public static void registerFissionHeater(String heaterID, String fluidInput, int inputAmount, String fluidOutput, int outputAmount, int cooling, String rule) {
Block port = NCBlocks.withName( Block port = NCBlocks.withName(
new BlockFissionFluidPort(TileHeaterPort.class, 303) { new BlockFissionFluidPort(TileFissionHeaterPort.class, 303) {
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileHeaterPort(fluidInput); return new TileFissionHeaterPort(fluidInput);
} }
}, },
"fission_heater_port_" + heaterID); "fission_heater_port_" + heaterID);
@ -114,7 +93,7 @@ public class CTRegistration {
new BlockFissionPart() { new BlockFissionPart() {
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileHeater(heaterID, fluidInput); return new TileSaltFissionHeater(heaterID, fluidInput);
} }
@Override @Override
@ -153,13 +132,6 @@ public class CTRegistration {
INFO_LIST.add(new FissionHeaterRegistrationInfo(heater, heaterID, fluidInput, inputAmount, fluidOutput, outputAmount, cooling, rule)); INFO_LIST.add(new FissionHeaterRegistrationInfo(heater, heaterID, fluidInput, inputAmount, fluidOutput, outputAmount, cooling, rule));
} }
public static class TileCoil extends TileTurbineDynamoCoil {
public TileCoil(String partName, double conductivity, String ruleID) {
super(partName, conductivity, ruleID);
}
}
@ZenMethod @ZenMethod
public static void registerTurbineCoil(String coilID, double conductivity, String rule) { public static void registerTurbineCoil(String coilID, double conductivity, String rule) {
@ -167,7 +139,7 @@ public class CTRegistration {
new BlockTurbinePart() { new BlockTurbinePart() {
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileCoil(coilID, conductivity, coilID + "_coil"); return new TileTurbineDynamoCoil(coilID, conductivity, coilID + "_coil");
} }
@Override @Override
@ -183,21 +155,6 @@ public class CTRegistration {
INFO_LIST.add(new TurbineCoilRegistrationInfo(coil, coilID, conductivity, rule)); INFO_LIST.add(new TurbineCoilRegistrationInfo(coil, coilID, conductivity, rule));
} }
public static class TileBlade extends TileTurbineRotorBlade {
final Block bladeBlock;
public TileBlade(IRotorBladeType bladeType, Block bladeBlock) {
super(bladeType);
this.bladeBlock = bladeBlock;
}
@Override
public IBlockState getRenderState() {
return bladeBlock.getDefaultState().withProperty(TurbineRotorBladeUtil.DIR, dir);
}
}
@ZenMethod @ZenMethod
public static void registerTurbineBlade(String bladeID, double efficiency, double expansionCoefficient) { public static void registerTurbineBlade(String bladeID, double efficiency, double expansionCoefficient) {
@ -224,7 +181,7 @@ public class CTRegistration {
new BlockTurbineRotorBlade(null) { new BlockTurbineRotorBlade(null) {
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileBlade(bladeType, this); return new TileTurbineRotorBlade(bladeType);
} }
}, },
"turbine_rotor_blade_" + bladeID); "turbine_rotor_blade_" + bladeID);
@ -232,26 +189,6 @@ public class CTRegistration {
INFO_LIST.add(new TurbineBladeRegistrationInfo(blade, efficiency, expansionCoefficient)); INFO_LIST.add(new TurbineBladeRegistrationInfo(blade, efficiency, expansionCoefficient));
} }
public static class TileStator extends TileTurbineRotorStator {
final Block bladeBlock;
public TileStator(IRotorStatorType statorType, Block bladeBlock) {
super(statorType);
this.bladeBlock = bladeBlock;
}
@Override
public IRotorBladeType getBladeType() {
return statorType;
}
@Override
public IBlockState getRenderState() {
return bladeBlock.getDefaultState().withProperty(TurbineRotorBladeUtil.DIR, dir);
}
}
@ZenMethod @ZenMethod
public static void registerTurbineStator(String statorID, double expansionCoefficient) { public static void registerTurbineStator(String statorID, double expansionCoefficient) {
@ -273,7 +210,7 @@ public class CTRegistration {
new BlockTurbineRotorStator() { new BlockTurbineRotorStator() {
@Override @Override
public TileEntity createNewTileEntity(World world, int metadata) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileBlade(statorType, this); return new TileTurbineRotorStator(statorType);
} }
}, },
"turbine_rotor_stator_" + statorID); "turbine_rotor_stator_" + statorID);

View File

@ -2,21 +2,41 @@ package nc.item;
import static nc.config.NCConfig.quantum_angle_precision; import static nc.config.NCConfig.quantum_angle_precision;
import java.util.LinkedList;
import java.util.List;
import nc.tile.IMultitoolLogic; import nc.tile.IMultitoolLogic;
import nc.util.*; import nc.util.Lang;
import nc.util.NCMath;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.ActionResult;
import net.minecraft.util.math.*; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemMultitool extends NCItem { public class ItemMultitool extends NCItem {
/** List of all multitool right-click logic. Earlier entries are prioritised! */
public static final List<MultitoolRightClickLogic> MULTITOOL_RIGHT_CLICK_LOGIC = new LinkedList<>();
public ItemMultitool(String... tooltip) { public ItemMultitool(String... tooltip) {
super(tooltip); super(tooltip);
maxStackSize = 1;
}
@SideOnly(Side.CLIENT)
public boolean isFull3D() {
return true;
} }
public static boolean isMultitool(ItemStack stack) { public static boolean isMultitool(ItemStack stack) {
@ -60,28 +80,12 @@ public class ItemMultitool extends NCItem {
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());
} }
if (!world.isRemote && isMultitool(stack)) { if (!world.isRemote && isMultitool(stack)) {
NBTTagCompound nbt = stack.getTagCompound(); for (MultitoolRightClickLogic logic : MULTITOOL_RIGHT_CLICK_LOGIC) {
if (!player.isSneaking() && nbt.getString("gateMode").equals("angle")) { ActionResult<ItemStack> result = logic.onRightClick(this, world, player, hand, stack);
double angle = NCMath.roundTo(player.rotationYaw + 360D, 360D / quantum_angle_precision) % 360D; if (result != null) {
nbt.setDouble("gateAngle", angle); return result;
player.sendMessage(new TextComponentString(Lang.localise("info.nuclearcraft.multitool.quantum_computer.tool_set_angle", NCMath.decimalPlaces(angle, 5))));
return actionResult(true, stack);
}
else if (player.isSneaking() && !nbt.isEmpty() && !nbt.getBoolean("multitoolUsed")) {
RayTraceResult raytraceresult = rayTrace(world, player, false);
if (raytraceresult == null || raytraceresult.typeOfHit != RayTraceResult.Type.BLOCK) {
return actionResult(false, stack);
}
BlockPos pos = raytraceresult.getBlockPos();
TileEntity tile = world.getTileEntity(pos);
if (!(tile instanceof IMultitoolLogic)) {
clearNBT(stack);
player.sendMessage(new TextComponentString(Lang.localise("info.nuclearcraft.multitool.clear_info")));
return actionResult(true, stack);
} }
} }
stack.getTagCompound().removeTag("multitoolUsed");
} }
return super.onItemRightClick(world, player, hand); return super.onItemRightClick(world, player, hand);
} }
@ -91,4 +95,55 @@ public class ItemMultitool extends NCItem {
// return world.getTileEntity(pos) instanceof IMultitoolLogic; // return world.getTileEntity(pos) instanceof IMultitoolLogic;
return false; return false;
} }
public abstract static class MultitoolRightClickLogic {
public abstract ActionResult<ItemStack> onRightClick(ItemMultitool itemMultitool, World world, EntityPlayer player, EnumHand hand, ItemStack heldItem);
}
public static void registerRightClickLogic() {
MULTITOOL_RIGHT_CLICK_LOGIC.add(new MultitoolRightClickLogic() {
public ActionResult<ItemStack> onRightClick(ItemMultitool itemMultitool, World world, EntityPlayer player, EnumHand hand, ItemStack heldItem) {
NBTTagCompound nbt = heldItem.getTagCompound();
if (!player.isSneaking() && nbt.getString("gateMode").equals("angle")) {
double angle = NCMath.roundTo(player.rotationYaw + 360D, 360D / quantum_angle_precision) % 360D;
nbt.setDouble("gateAngle", angle);
player.sendMessage(new TextComponentString(Lang.localise("info.nuclearcraft.multitool.quantum_computer.tool_set_angle", NCMath.decimalPlaces(angle, 5))));
return itemMultitool.actionResult(true, heldItem);
}
return null;
}
});
MULTITOOL_RIGHT_CLICK_LOGIC.add(new MultitoolRightClickLogic() {
public ActionResult<ItemStack> onRightClick(ItemMultitool itemMultitool, World world, EntityPlayer player, EnumHand hand, ItemStack heldItem) {
NBTTagCompound nbt = heldItem.getTagCompound();
if (player.isSneaking() && !nbt.isEmpty() && !nbt.getBoolean("multitoolUsed")) {
RayTraceResult raytraceresult = itemMultitool.rayTrace(world, player, false);
if (raytraceresult == null || raytraceresult.typeOfHit != RayTraceResult.Type.BLOCK) {
return itemMultitool.actionResult(false, heldItem);
}
BlockPos pos = raytraceresult.getBlockPos();
TileEntity tile = world.getTileEntity(pos);
if (!(tile instanceof IMultitoolLogic)) {
clearNBT(heldItem);
player.sendMessage(new TextComponentString(Lang.localise("info.nuclearcraft.multitool.clear_info")));
return itemMultitool.actionResult(true, heldItem);
}
}
return null;
}
});
MULTITOOL_RIGHT_CLICK_LOGIC.add(new MultitoolRightClickLogic() {
public ActionResult<ItemStack> onRightClick(ItemMultitool itemMultitool, World world, EntityPlayer player, EnumHand hand, ItemStack heldItem) {
heldItem.getTagCompound().removeTag("multitoolUsed");
return null;
}
});
}
} }

View File

@ -42,13 +42,13 @@ public abstract class Multiblock<T extends ITileMultiblockPart, PACKET extends M
// Disassembled -> Assembled; Assembled -> Disassembled OR Paused; Paused -> // Disassembled -> Assembled; Assembled -> Disassembled OR Paused; Paused ->
// Assembled // Assembled
protected enum AssemblyState { public enum AssemblyState {
Disassembled, Disassembled,
Assembled, Assembled,
Paused Paused
} }
protected AssemblyState assemblyState; public AssemblyState assemblyState;
protected ObjectOpenHashSet<ITileMultiblockPart> connectedParts; protected ObjectOpenHashSet<ITileMultiblockPart> connectedParts;
@ -1147,8 +1147,9 @@ public abstract class Multiblock<T extends ITileMultiblockPart, PACKET extends M
BlockPos rc = this.getReferenceCoord(); BlockPos rc = this.getReferenceCoord();
if (this.WORLD != null && rc != null) { if (WORLD != null && rc != null) {
WorldHelper.notifyBlockUpdate(this.WORLD, rc, null, null); IBlockState state = WORLD.getBlockState(rc);
WORLD.notifyBlockUpdate(rc, state, state, 3);
} }
} }

View File

@ -25,31 +25,6 @@ public final class WorldHelper {
return position.getZ() >> 4; return position.getZ() >> 4;
} }
/**
* force a block update at the given position
*
* @param world
* the world to update
* @param position
* the position of the block begin updated
* @param oldState
* the old state of the block begin updated. if null, the current state will be retrieved from the world
* @param newState
* the new state for the block begin updated. if null, the final value of oldState will be used
*/
public static void notifyBlockUpdate(World world, BlockPos position, IBlockState oldState, IBlockState newState) {
if (null == oldState) {
oldState = world.getBlockState(position);
}
if (null == newState) {
newState = oldState;
}
world.notifyBlockUpdate(position, oldState, newState, 3);
}
public static long getChunkXZHashFromBlock(int blockX, int blockZ) { public static long getChunkXZHashFromBlock(int blockX, int blockZ) {
return ChunkPos.asLong(WorldHelper.getChunkXFromBlock(blockX), WorldHelper.getChunkZFromBlock(blockZ)); return ChunkPos.asLong(WorldHelper.getChunkXFromBlock(blockX), WorldHelper.getChunkZFromBlock(blockZ));
} }

View File

@ -139,6 +139,7 @@ public class BatteryMultiblock extends Multiblock<TileBattery, MultiblockUpdateP
if (shouldUpdate) { if (shouldUpdate) {
for (TileBattery battery : getParts(TileBattery.class)) { for (TileBattery battery : getParts(TileBattery.class)) {
battery.markDirty(); battery.markDirty();
battery.updateComparatorOutputLevel();
} }
} }
return shouldUpdate; return shouldUpdate;

View File

@ -1,27 +1,34 @@
package nc.multiblock.battery.block; package nc.multiblock.battery.block;
import nc.block.property.ISidedEnergy; import nc.block.property.ISidedEnergy;
import nc.block.tile.IDynamicState;
import nc.block.tile.INBTDrop; import nc.block.tile.INBTDrop;
import nc.item.ItemMultitool; import nc.item.ItemMultitool;
import nc.multiblock.battery.*; import nc.multiblock.battery.BatteryMultiblock;
import nc.multiblock.battery.BatteryType;
import nc.multiblock.battery.tile.TileBattery; import nc.multiblock.battery.tile.TileBattery;
import nc.multiblock.block.BlockMultiblockPart; import nc.multiblock.block.BlockMultiblockPart;
import nc.tab.NCTabs; import nc.tab.NCTabs;
import nc.tile.internal.energy.*; import nc.tile.internal.energy.EnergyConnection;
import nc.util.*; import nc.tile.internal.energy.EnergyStorage;
import nc.util.Lang;
import nc.util.UnitHelper;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockBattery extends BlockMultiblockPart implements ISidedEnergy, INBTDrop { public class BlockBattery extends BlockMultiblockPart implements IDynamicState, ISidedEnergy, INBTDrop {
private final BatteryType type; private final BatteryType type;

View File

@ -238,11 +238,11 @@ public class FissionReactor extends CuboidalMultiblock<IFissionPart, FissionUpda
isReactorOn = isAssembled() && logic.isReactorOn(); isReactorOn = isAssembled() && logic.isReactorOn();
if (isReactorOn != wasReactorOn) { if (isReactorOn != wasReactorOn) {
if (controller != null) { if (controller != null) {
controller.updateBlockState(isReactorOn); controller.setActivity(isReactorOn);
sendUpdateToAllPlayers(); sendUpdateToAllPlayers();
} }
for (TileFissionMonitor monitor : getParts(TileFissionMonitor.class)) { for (TileFissionMonitor monitor : getParts(TileFissionMonitor.class)) {
monitor.updateBlockState(isReactorOn); monitor.setActivity(isReactorOn);
} }
} }
} }

View File

@ -1,21 +1,29 @@
package nc.multiblock.fission.block; package nc.multiblock.fission.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.item.ItemMultitool; import nc.item.ItemMultitool;
import nc.multiblock.fission.*; import nc.multiblock.fission.FissionCluster;
import nc.multiblock.fission.tile.*; import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.tile.IFissionComponent;
import nc.multiblock.fission.tile.TileFissionMonitor;
import nc.render.BlockHighlightTracker; import nc.render.BlockHighlightTracker;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.*; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFissionMonitor extends BlockFissionPart { public class BlockFissionMonitor extends BlockFissionPart implements IActivatable {
public BlockFissionMonitor() { public BlockFissionMonitor() {
super(); super();
@ -88,15 +96,4 @@ public class BlockFissionMonitor extends BlockFissionPart {
} }
return rightClickOnPart(world, pos, player, hand, facing, true); return rightClickOnPart(world, pos, player, hand, facing, true);
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() instanceof BlockFissionMonitor) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -1,37 +1,47 @@
package nc.multiblock.fission.block; package nc.multiblock.fission.block;
import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL; import static nc.block.property.BlockProperties.FACING_ALL;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.multiblock.fission.tile.TileFissionPowerPort; import nc.multiblock.fission.tile.TileFissionPowerPort;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFissionPowerPort extends BlockFissionPart { public class BlockFissionPowerPort extends BlockFissionPart implements IActivatable {
public BlockFissionPowerPort() { public BlockFissionPowerPort() {
super(); super();
setDefaultState(blockState.getBaseState().withProperty(FACING_ALL, EnumFacing.NORTH)); setDefaultState(blockState.getBaseState().withProperty(FACING_ALL, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)));
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, FACING_ALL); return new BlockStateContainer(this, FACING_ALL, ACTIVE);
} }
@Override @Override
public IBlockState getStateFromMeta(int meta) { public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(FACING_ALL, EnumFacing.byIndex(meta)); EnumFacing enumfacing = EnumFacing.byIndex(meta & 7);
return getDefaultState().withProperty(FACING_ALL, enumfacing).withProperty(ACTIVE, Boolean.valueOf((meta & 8) > 0));
} }
@Override @Override
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
return state.getValue(FACING_ALL).getIndex(); int i = state.getValue(FACING_ALL).getIndex();
if (state.getValue(ACTIVE).booleanValue()) {
i |= 8;
}
return i;
} }
@Override @Override
@ -41,7 +51,7 @@ public class BlockFissionPowerPort extends BlockFissionPart {
@Override @Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
return getDefaultState().withProperty(FACING_ALL, EnumFacing.getDirectionFromEntityLiving(pos, placer)); return getDefaultState().withProperty(FACING_ALL, EnumFacing.getDirectionFromEntityLiving(pos, placer)).withProperty(ACTIVE, Boolean.valueOf(false));
} }
@Override @Override

View File

@ -2,21 +2,28 @@ package nc.multiblock.fission.block;
import static nc.block.property.BlockProperties.ACTIVE; import static nc.block.property.BlockProperties.ACTIVE;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.enumm.MetaEnums; import nc.enumm.MetaEnums;
import nc.multiblock.fission.tile.TileFissionShield; import nc.multiblock.fission.tile.TileFissionShield;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.*; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockFissionShield extends BlockFissionMetaPart<MetaEnums.NeutronShieldType> { public class BlockFissionShield extends BlockFissionMetaPart<MetaEnums.NeutronShieldType> implements IActivatable {
public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.NeutronShieldType.class); public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.NeutronShieldType.class);
@ -74,15 +81,6 @@ public class BlockFissionShield extends BlockFissionMetaPart<MetaEnums.NeutronSh
return rightClickOnPart(world, pos, player, hand, facing); return rightClickOnPart(world, pos, player, hand, facing);
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() instanceof BlockFissionShield && isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
// Rendering // Rendering
@Override @Override

View File

@ -1,26 +1,34 @@
package nc.multiblock.fission.block; package nc.multiblock.fission.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.enumm.MetaEnums; import nc.enumm.MetaEnums;
import nc.multiblock.fission.tile.TileFissionSource; import nc.multiblock.fission.tile.TileFissionSource;
import nc.multiblock.fission.tile.TileFissionSource.PrimingTargetInfo; import nc.multiblock.fission.tile.TileFissionSource.PrimingTargetInfo;
import nc.render.BlockHighlightTracker; import nc.render.BlockHighlightTracker;
import nc.util.*; import nc.util.BlockHelper;
import nc.util.Lang;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.*; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFissionSource extends BlockFissionMetaPart<MetaEnums.NeutronSourceType> { public class BlockFissionSource extends BlockFissionMetaPart<MetaEnums.NeutronSourceType> implements IActivatable {
public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.NeutronSourceType.class); public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.NeutronSourceType.class);
@ -109,13 +117,4 @@ public class BlockFissionSource extends BlockFissionMetaPart<MetaEnums.NeutronSo
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) { public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) {
return side != null; return side != null;
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
} }

View File

@ -1,18 +1,23 @@
package nc.multiblock.fission.block; package nc.multiblock.fission.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.multiblock.fission.tile.TileFissionVent; import nc.multiblock.fission.tile.TileFissionVent;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFissionVent extends BlockFissionPart { public class BlockFissionVent extends BlockFissionPart implements IActivatable {
public BlockFissionVent() { public BlockFissionVent() {
super(); super();
@ -65,15 +70,4 @@ public class BlockFissionVent extends BlockFissionPart {
} }
return rightClickOnPart(world, pos, player, hand, facing); return rightClickOnPart(world, pos, player, hand, facing);
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() instanceof BlockFissionVent) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -1,19 +1,25 @@
package nc.multiblock.fission.block.manager; package nc.multiblock.fission.block.manager;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.multiblock.fission.block.BlockFissionPart; import nc.multiblock.fission.block.BlockFissionPart;
import nc.multiblock.fission.tile.manager.*; import nc.multiblock.fission.tile.manager.IFissionManagerListener;
import nc.multiblock.fission.tile.manager.TileFissionManager;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public abstract class BlockFissionManager<MANAGER extends TileFissionManager<MANAGER, LISTENER>, LISTENER extends IFissionManagerListener<MANAGER, LISTENER>> extends BlockFissionPart { public abstract class BlockFissionManager<MANAGER extends TileFissionManager<MANAGER, LISTENER>, LISTENER extends IFissionManagerListener<MANAGER, LISTENER>> extends BlockFissionPart implements IActivatable {
protected final Class<MANAGER> managerClass; protected final Class<MANAGER> managerClass;
@ -65,15 +71,4 @@ public abstract class BlockFissionManager<MANAGER extends TileFissionManager<MAN
return rightClickOnPart(world, pos, player, hand, facing, false); return rightClickOnPart(world, pos, player, hand, facing, false);
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() instanceof BlockFissionManager) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -1,11 +1,13 @@
package nc.multiblock.fission.block.port; package nc.multiblock.fission.block.port;
import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.AXIS_ALL; import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.enumm.MetaEnums; import nc.enumm.MetaEnums;
import nc.multiblock.fission.salt.tile.TileSaltFissionHeater; import nc.multiblock.fission.salt.tile.TileSaltFissionHeater;
import nc.multiblock.fission.tile.port.TileFissionHeaterPort; import nc.multiblock.fission.tile.port.TileFissionHeaterPort;
import nc.tile.internal.fluid.TankSorption;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.*; import net.minecraft.block.state.*;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,6 +15,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockFissionHeaterPort extends BlockFissionFluidMetaPort<TileFissionHeaterPort, TileSaltFissionHeater, MetaEnums.CoolantHeaterType> { public class BlockFissionHeaterPort extends BlockFissionFluidMetaPort<TileFissionHeaterPort, TileSaltFissionHeater, MetaEnums.CoolantHeaterType> {
@ -24,7 +28,11 @@ public class BlockFissionHeaterPort extends BlockFissionFluidMetaPort<TileFissio
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE, AXIS_ALL); return new BlockStateContainer(this, TYPE, AXIS_ALL, ACTIVE);
}
public boolean getActualStateActive(TileFissionHeaterPort port) {
return port.getTankSorption(EnumFacing.DOWN, 0) != TankSorption.IN;
} }
@Override @Override

View File

@ -1,11 +1,13 @@
package nc.multiblock.fission.block.port; package nc.multiblock.fission.block.port;
import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.AXIS_ALL; import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.enumm.MetaEnums; import nc.enumm.MetaEnums;
import nc.multiblock.fission.salt.tile.TileSaltFissionHeater; import nc.multiblock.fission.salt.tile.TileSaltFissionHeater;
import nc.multiblock.fission.tile.port.TileFissionHeaterPort; import nc.multiblock.fission.tile.port.TileFissionHeaterPort;
import nc.tile.internal.fluid.TankSorption;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.*; import net.minecraft.block.state.*;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -13,6 +15,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockFissionHeaterPort2 extends BlockFissionFluidMetaPort<TileFissionHeaterPort, TileSaltFissionHeater, MetaEnums.CoolantHeaterType2> { public class BlockFissionHeaterPort2 extends BlockFissionFluidMetaPort<TileFissionHeaterPort, TileSaltFissionHeater, MetaEnums.CoolantHeaterType2> {
@ -24,7 +28,11 @@ public class BlockFissionHeaterPort2 extends BlockFissionFluidMetaPort<TileFissi
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE, AXIS_ALL); return new BlockStateContainer(this, TYPE, AXIS_ALL, ACTIVE);
}
public boolean getActualStateActive(TileFissionHeaterPort port) {
return port.getTankSorption(EnumFacing.DOWN, 0) != TankSorption.IN;
} }
@Override @Override

View File

@ -1,28 +1,38 @@
package nc.multiblock.fission.block.port; package nc.multiblock.fission.block.port;
import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.AXIS_ALL; import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.enumm.IBlockMetaEnum; import nc.enumm.IBlockMetaEnum;
import nc.multiblock.fission.block.BlockFissionMetaPart; import nc.multiblock.fission.block.BlockFissionMetaPart;
import nc.multiblock.fission.tile.port.*; import nc.multiblock.fission.tile.port.IFissionPortTarget;
import nc.multiblock.fission.tile.port.TileFissionPort;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BlockFissionMetaPort<PORT extends TileFissionPort<PORT, TARGET>, TARGET extends IFissionPortTarget<PORT, TARGET>, T extends Enum<T> & IStringSerializable & IBlockMetaEnum> extends BlockFissionMetaPart<T> { public abstract class BlockFissionMetaPort<PORT extends TileFissionPort<PORT, TARGET>, TARGET extends IFissionPortTarget<PORT, TARGET>, T extends Enum<T> & IStringSerializable & IBlockMetaEnum> extends BlockFissionMetaPart<T> implements IActivatable {
protected final Class<PORT> portClass; protected final Class<PORT> portClass;
public BlockFissionMetaPort(Class<PORT> portClass, Class<T> enumm, PropertyEnum<T> property) { public BlockFissionMetaPort(Class<PORT> portClass, Class<T> enumm, PropertyEnum<T> property) {
super(enumm, property); super(enumm, property);
this.portClass = portClass; this.portClass = portClass;
setDefaultState(getDefaultState().withProperty(AXIS_ALL, EnumFacing.Axis.Z)); setDefaultState(getDefaultState().withProperty(AXIS_ALL, EnumFacing.Axis.Z).withProperty(ACTIVE, Boolean.valueOf(false)));
} }
@Override @Override
@ -31,11 +41,19 @@ public abstract class BlockFissionMetaPort<PORT extends TileFissionPort<PORT, TA
if (portClass.isInstance(tile)) { if (portClass.isInstance(tile)) {
PORT port = (PORT) tile; PORT port = (PORT) tile;
EnumFacing facing = port.getPartPosition().getFacing(); EnumFacing facing = port.getPartPosition().getFacing();
return state.withProperty(AXIS_ALL, facing != null ? facing.getAxis() : port.axis); return state.withProperty(AXIS_ALL, facing != null ? facing.getAxis() : port.axis).withProperty(ACTIVE, getActualStateActive(port));
} }
return state; return state;
} }
public abstract boolean getActualStateActive(PORT port);
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override @Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
return getStateFromMeta(meta).withProperty(AXIS_ALL, EnumFacing.getDirectionFromEntityLiving(pos, placer).getAxis()); return getStateFromMeta(meta).withProperty(AXIS_ALL, EnumFacing.getDirectionFromEntityLiving(pos, placer).getAxis());

View File

@ -1,39 +1,58 @@
package nc.multiblock.fission.block.port; package nc.multiblock.fission.block.port;
import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.AXIS_ALL; import static nc.block.property.BlockProperties.AXIS_ALL;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.multiblock.fission.block.BlockFissionPart; import nc.multiblock.fission.block.BlockFissionPart;
import nc.multiblock.fission.tile.port.*; import nc.multiblock.fission.tile.port.IFissionPortTarget;
import nc.multiblock.fission.tile.port.TileFissionPort;
import nc.util.PosHelper; import nc.util.PosHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BlockFissionPort<PORT extends TileFissionPort<PORT, TARGET>, TARGET extends IFissionPortTarget<PORT, TARGET>> extends BlockFissionPart { public abstract class BlockFissionPort<PORT extends TileFissionPort<PORT, TARGET>, TARGET extends IFissionPortTarget<PORT, TARGET>> extends BlockFissionPart implements IActivatable {
protected final Class<PORT> portClass; protected final Class<PORT> portClass;
public BlockFissionPort(Class<PORT> portClass) { public BlockFissionPort(Class<PORT> portClass) {
super(); super();
this.portClass = portClass; this.portClass = portClass;
setDefaultState(blockState.getBaseState().withProperty(AXIS_ALL, EnumFacing.Axis.Z)); setDefaultState(blockState.getBaseState().withProperty(AXIS_ALL, EnumFacing.Axis.Z).withProperty(ACTIVE, Boolean.valueOf(false)));
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, AXIS_ALL); return new BlockStateContainer(this, AXIS_ALL, ACTIVE);
} }
@Override @Override
public IBlockState getStateFromMeta(int meta) { public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(AXIS_ALL, PosHelper.AXES[meta]); EnumFacing.Axis axis = PosHelper.AXES[meta & 3];
return getDefaultState().withProperty(AXIS_ALL, axis).withProperty(ACTIVE, Boolean.valueOf((meta & 4) > 0));
} }
@Override @Override
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
return state.getValue(AXIS_ALL).ordinal(); int i = state.getValue(AXIS_ALL).ordinal();
if (state.getValue(ACTIVE).booleanValue()) {
i |= 4;
}
return i;
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
} }
@Override @Override

View File

@ -385,7 +385,8 @@ public class MoltenSaltFissionLogic extends FissionReactorLogic {
@Override @Override
public boolean isShieldActiveModerator(TileFissionShield shield, boolean activeModeratorPos) { public boolean isShieldActiveModerator(TileFissionShield shield, boolean activeModeratorPos) {
return activeModeratorPos; //return activeModeratorPos;
return super.isShieldActiveModerator(shield, activeModeratorPos);
} }
@Override @Override

View File

@ -1,20 +1,25 @@
package nc.multiblock.fission.salt.block; package nc.multiblock.fission.salt.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.multiblock.fission.block.BlockFissionPart; import nc.multiblock.fission.block.BlockFissionPart;
import nc.multiblock.fission.salt.tile.TileSaltFissionController; import nc.multiblock.fission.salt.tile.TileSaltFissionController;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockSaltFissionController extends BlockFissionPart { public class BlockSaltFissionController extends BlockFissionPart implements IActivatable {
public BlockSaltFissionController() { public BlockSaltFissionController() {
super(); super();
@ -78,15 +83,4 @@ public class BlockSaltFissionController extends BlockFissionPart {
} }
return rightClickOnPart(world, pos, player, hand, facing, true); return rightClickOnPart(world, pos, player, hand, facing, true);
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() instanceof BlockSaltFissionController) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -5,18 +5,23 @@ import nc.enumm.MetaEnums;
import nc.multiblock.fission.FissionReactor; import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.block.BlockFissionMetaPart; import nc.multiblock.fission.block.BlockFissionMetaPart;
import nc.multiblock.fission.salt.tile.TileSaltFissionHeater; import nc.multiblock.fission.salt.tile.TileSaltFissionHeater;
import nc.util.*; import nc.util.FluidStackHelper;
import nc.util.Lang;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.*; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.*; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public class BlockSaltFissionHeater extends BlockFissionMetaPart<MetaEnums.CoolantHeaterType> /* implements ISidedProperty< SaltFissionHeaterSetting> */ { public class BlockSaltFissionHeater extends BlockFissionMetaPart<MetaEnums.CoolantHeaterType> {
public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.CoolantHeaterType.class); public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.CoolantHeaterType.class);
@ -26,7 +31,6 @@ public class BlockSaltFissionHeater extends BlockFissionMetaPart<MetaEnums.Coola
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
// return new BlockStateContainer(this, TYPE, DOWN, UP, NORTH, SOUTH, WEST, EAST);
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);
} }

View File

@ -5,18 +5,23 @@ import nc.enumm.MetaEnums;
import nc.multiblock.fission.FissionReactor; import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.block.BlockFissionMetaPart; import nc.multiblock.fission.block.BlockFissionMetaPart;
import nc.multiblock.fission.salt.tile.TileSaltFissionHeater; import nc.multiblock.fission.salt.tile.TileSaltFissionHeater;
import nc.util.*; import nc.util.FluidStackHelper;
import nc.util.Lang;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.*; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.*; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public class BlockSaltFissionHeater2 extends BlockFissionMetaPart<MetaEnums.CoolantHeaterType2> /* implements ISidedProperty< SaltFissionHeaterSetting> */ { public class BlockSaltFissionHeater2 extends BlockFissionMetaPart<MetaEnums.CoolantHeaterType2> {
public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.CoolantHeaterType2.class); public final static PropertyEnum TYPE = PropertyEnum.create("type", MetaEnums.CoolantHeaterType2.class);
@ -26,8 +31,6 @@ public class BlockSaltFissionHeater2 extends BlockFissionMetaPart<MetaEnums.Cool
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
// return new BlockStateContainer(this, TYPE, DOWN, UP, NORTH, SOUTH,
// WEST, EAST);
return new BlockStateContainer(this, TYPE); return new BlockStateContainer(this, TYPE);
} }

View File

@ -60,14 +60,6 @@ public class TileSaltFissionController extends TileFissionPart implements IFissi
} }
} }
@Override
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockSaltFissionController) {
((BlockSaltFissionController) getBlockType()).setState(isActive, this);
world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
@Override @Override
public void doMeltdown() { public void doMeltdown() {
IBlockState corium = RegistryHelper.getBlock(Global.MOD_ID + ":fluid_corium").getDefaultState(); IBlockState corium = RegistryHelper.getBlock(Global.MOD_ID + ":fluid_corium").getDefaultState();

View File

@ -3,34 +3,52 @@ package nc.multiblock.fission.salt.tile;
import static nc.config.NCConfig.enable_mek_gas; import static nc.config.NCConfig.enable_mek_gas;
import static nc.init.NCCoolantFluids.COOLANTS; import static nc.init.NCCoolantFluids.COOLANTS;
import static nc.recipe.NCRecipes.coolant_heater; import static nc.recipe.NCRecipes.coolant_heater;
import static nc.util.PosHelper.DEFAULT_NON;
import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME; import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import nc.ModCheck; import nc.ModCheck;
import nc.multiblock.PlacementRule; import nc.multiblock.PlacementRule;
import nc.multiblock.cuboidal.CuboidalPartPositionType; import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.fission.*; import nc.multiblock.fission.FissionCluster;
import nc.multiblock.fission.FissionPlacement;
import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.salt.SaltFissionHeaterSetting; import nc.multiblock.fission.salt.SaltFissionHeaterSetting;
import nc.multiblock.fission.tile.*; import nc.multiblock.fission.tile.IFissionComponent;
import nc.multiblock.fission.tile.IFissionCoolingComponent;
import nc.multiblock.fission.tile.IFissionFuelComponent.ModeratorBlockInfo; import nc.multiblock.fission.tile.IFissionFuelComponent.ModeratorBlockInfo;
import nc.multiblock.fission.tile.port.*; import nc.multiblock.fission.tile.IFissionPart;
import nc.multiblock.fission.tile.TileFissionPart;
import nc.multiblock.fission.tile.port.IFissionPortTarget;
import nc.multiblock.fission.tile.port.TileFissionHeaterPort;
import nc.multiblock.network.SaltFissionHeaterUpdatePacket; import nc.multiblock.network.SaltFissionHeaterUpdatePacket;
import nc.recipe.*; import nc.recipe.AbstractRecipeHandler;
import nc.recipe.ProcessorRecipe;
import nc.recipe.RecipeInfo;
import nc.recipe.ingredient.IFluidIngredient; import nc.recipe.ingredient.IFluidIngredient;
import nc.tile.ITileGui; import nc.tile.ITileGui;
import nc.tile.fluid.*; import nc.tile.fluid.ITileFilteredFluid;
import nc.tile.internal.fluid.*; import nc.tile.fluid.ITileFluid;
import nc.tile.internal.fluid.FluidConnection;
import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.tile.processor.IFluidProcessor; import nc.tile.processor.IFluidProcessor;
import nc.util.GasHelper; import nc.util.CapabilityHelper;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -38,7 +56,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
public abstract class TileSaltFissionHeater extends TileFissionPart implements ITileFilteredFluid, ITileGui<SaltFissionHeaterUpdatePacket>, IFluidProcessor, IFissionCoolingComponent, IFissionPortTarget<TileFissionHeaterPort, TileSaltFissionHeater> { public class TileSaltFissionHeater extends TileFissionPart implements ITileFilteredFluid, ITileGui<SaltFissionHeaterUpdatePacket>, IFluidProcessor, IFissionCoolingComponent, IFissionPortTarget<TileFissionHeaterPort, TileSaltFissionHeater> {
protected final @Nonnull List<Tank> tanks; protected final @Nonnull List<Tank> tanks;
protected final @Nonnull List<Tank> filterTanks; protected final @Nonnull List<Tank> filterTanks;
@ -723,7 +741,7 @@ public abstract class TileSaltFissionHeater extends TileFissionPart implements I
public void toggleHeaterSetting(@Nonnull EnumFacing side) { public void toggleHeaterSetting(@Nonnull EnumFacing side) {
setHeaterSetting(side, getHeaterSetting(side).next()); setHeaterSetting(side, getHeaterSetting(side).next());
refreshFluidConnections(side); refreshFluidConnections(side);
markDirtyAndNotify(); markDirtyAndNotify(true);
} }
public void refreshFluidConnections(@Nonnull EnumFacing side) { public void refreshFluidConnections(@Nonnull EnumFacing side) {
@ -829,7 +847,6 @@ public abstract class TileSaltFissionHeater extends TileFissionPart implements I
@Override @Override
public void onFilterChanged(int slot) { public void onFilterChanged(int slot) {
/* if (!canModifyFilter(slot)) { getMultiblock().getLogic().refreshPorts(); } */
markDirty(); markDirty();
} }
@ -996,7 +1013,7 @@ public abstract class TileSaltFissionHeater extends TileFissionPart implements I
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -1010,7 +1027,7 @@ public abstract class TileSaltFissionHeater extends TileFissionPart implements I
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -1,41 +1,66 @@
package nc.multiblock.fission.salt.tile; package nc.multiblock.fission.salt.tile;
import static nc.config.NCConfig.*; import static nc.config.NCConfig.enable_mek_gas;
import static nc.recipe.NCRecipes.*; import static nc.config.NCConfig.fission_fuel_time_multiplier;
import static nc.util.PosHelper.DEFAULT_NON; import static nc.config.NCConfig.fission_meltdown_radiation_multiplier;
import static nc.recipe.NCRecipes.salt_fission;
import static nc.recipe.NCRecipes.salt_fission_valid_fluids;
import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME; import static nc.util.FluidStackHelper.INGOT_BLOCK_VOLUME;
import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.longs.*; import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import nc.*; import it.unimi.dsi.fastutil.longs.LongSet;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import nc.Global;
import nc.ModCheck;
import nc.capability.radiation.source.IRadiationSource; import nc.capability.radiation.source.IRadiationSource;
import nc.multiblock.cuboidal.CuboidalPartPositionType; import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.fission.*; import nc.multiblock.fission.FissionCluster;
import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.salt.SaltFissionVesselSetting; import nc.multiblock.fission.salt.SaltFissionVesselSetting;
import nc.multiblock.fission.tile.*; import nc.multiblock.fission.tile.IFissionComponent;
import nc.multiblock.fission.tile.port.*; import nc.multiblock.fission.tile.IFissionFluxSink;
import nc.multiblock.fission.tile.IFissionFuelComponent;
import nc.multiblock.fission.tile.TileFissionPart;
import nc.multiblock.fission.tile.port.IFissionPortTarget;
import nc.multiblock.fission.tile.port.TileFissionVesselPort;
import nc.multiblock.network.SaltFissionVesselUpdatePacket; import nc.multiblock.network.SaltFissionVesselUpdatePacket;
import nc.radiation.RadiationHelper; import nc.radiation.RadiationHelper;
import nc.recipe.*; import nc.recipe.AbstractRecipeHandler;
import nc.recipe.ProcessorRecipe;
import nc.recipe.RecipeInfo;
import nc.recipe.ingredient.IFluidIngredient; import nc.recipe.ingredient.IFluidIngredient;
import nc.tile.ITileGui; import nc.tile.ITileGui;
import nc.tile.fluid.*; import nc.tile.fluid.ITileFilteredFluid;
import nc.tile.fluid.ITileFluid;
import nc.tile.generator.IFluidGenerator; import nc.tile.generator.IFluidGenerator;
import nc.tile.internal.fluid.*; import nc.tile.internal.fluid.FluidConnection;
import nc.util.*; import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.util.CapabilityHelper;
import nc.util.RegistryHelper;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.*; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -703,7 +728,7 @@ public class TileSaltFissionVessel extends TileFissionPart implements ITileFilte
public void toggleVesselSetting(@Nonnull EnumFacing side) { public void toggleVesselSetting(@Nonnull EnumFacing side) {
setVesselSetting(side, getVesselSetting(side).next()); setVesselSetting(side, getVesselSetting(side).next());
refreshFluidConnections(side); refreshFluidConnections(side);
markDirtyAndNotify(); markDirtyAndNotify(true);
} }
public void refreshFluidConnections(@Nonnull EnumFacing side) { public void refreshFluidConnections(@Nonnull EnumFacing side) {
@ -822,7 +847,6 @@ public class TileSaltFissionVessel extends TileFissionPart implements ITileFilte
@Override @Override
public void onFilterChanged(int slot) { public void onFilterChanged(int slot) {
/* if (!canModifyFilter(slot)) { getMultiblock().getLogic().refreshPorts(); } */
markDirty(); markDirty();
} }
@ -994,7 +1018,7 @@ public class TileSaltFissionVessel extends TileFissionPart implements ITileFilte
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -1008,7 +1032,7 @@ public class TileSaltFissionVessel extends TileFissionPart implements ITileFilte
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -1,20 +1,25 @@
package nc.multiblock.fission.solid.block; package nc.multiblock.fission.solid.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.multiblock.fission.block.BlockFissionPart; import nc.multiblock.fission.block.BlockFissionPart;
import nc.multiblock.fission.solid.tile.TileSolidFissionController; import nc.multiblock.fission.solid.tile.TileSolidFissionController;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockSolidFissionController extends BlockFissionPart { public class BlockSolidFissionController extends BlockFissionPart implements IActivatable {
public BlockSolidFissionController() { public BlockSolidFissionController() {
super(); super();
@ -78,15 +83,4 @@ public class BlockSolidFissionController extends BlockFissionPart {
} }
return rightClickOnPart(world, pos, player, hand, facing, true); return rightClickOnPart(world, pos, player, hand, facing, true);
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() instanceof BlockSolidFissionController) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -795,7 +795,7 @@ public class TileSolidFissionCell extends TileFissionPart implements ITileFilter
public void toggleCellSetting(@Nonnull EnumFacing side) { public void toggleCellSetting(@Nonnull EnumFacing side) {
setCellSetting(side, getCellSetting(side).next()); setCellSetting(side, getCellSetting(side).next());
refreshInventoryConnections(side); refreshInventoryConnections(side);
markDirtyAndNotify(); markDirtyAndNotify(true);
} }
public void refreshInventoryConnections(@Nonnull EnumFacing side) { public void refreshInventoryConnections(@Nonnull EnumFacing side) {
@ -837,7 +837,6 @@ public class TileSolidFissionCell extends TileFissionPart implements ITileFilter
@Override @Override
public void onFilterChanged(int slot) { public void onFilterChanged(int slot) {
/* if (!canModifyFilter(slot)) { getMultiblock().getLogic().refreshPorts(); } */
markDirty(); markDirty();
} }

View File

@ -60,14 +60,6 @@ public class TileSolidFissionController extends TileFissionPart implements IFiss
} }
} }
@Override
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockSolidFissionController) {
((BlockSolidFissionController) getBlockType()).setState(isActive, this);
world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
@Override @Override
public void doMeltdown() { public void doMeltdown() {
IBlockState corium = RegistryHelper.getBlock(Global.MOD_ID + ":fluid_corium").getDefaultState(); IBlockState corium = RegistryHelper.getBlock(Global.MOD_ID + ":fluid_corium").getDefaultState();

View File

@ -12,7 +12,7 @@ import nc.multiblock.fission.tile.*;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
public abstract class TileSolidFissionSink extends TileFissionPart implements IFissionCoolingComponent { public class TileSolidFissionSink extends TileFissionPart implements IFissionCoolingComponent {
public String sinkName; public String sinkName;
public int coolingRate; public int coolingRate;

View File

@ -5,7 +5,5 @@ import nc.multiblock.tile.ILogicMultiblockController;
public interface IFissionController extends IFissionPart, ILogicMultiblockController<FissionReactor> { public interface IFissionController extends IFissionPart, ILogicMultiblockController<FissionReactor> {
public void updateBlockState(boolean isActive);
public void doMeltdown(); public void doMeltdown();
} }

View File

@ -273,7 +273,11 @@ public class TileFissionIrradiator extends TileFissionPart implements ITileFilte
@Override @Override
public void refreshActivity() { public void refreshActivity() {
boolean wasReady = readyToProcess(false);
canProcessInputs = canProcessInputs(); canProcessInputs = canProcessInputs();
if (getMultiblock() != null && !wasReady && readyToProcess(false)) {
getMultiblock().refreshFlag = true;
}
} }
@Override @Override
@ -574,7 +578,6 @@ public class TileFissionIrradiator extends TileFissionPart implements ITileFilte
@Override @Override
public void onFilterChanged(int slot) { public void onFilterChanged(int slot) {
/* if (!canModifyFilter(slot)) { getMultiblock().getLogic().refreshPorts(); } */
markDirty(); markDirty();
} }

View File

@ -36,9 +36,6 @@ public class TileFissionMonitor extends TileFissionPart {
@Override @Override
public void onMachineBroken() { public void onMachineBroken() {
super.onMachineBroken(); super.onMachineBroken();
// if (getWorld().isRemote) return;
// getWorld().setBlockState(getPos(),
// getWorld().getBlockState(getPos()), 2);
} }
@Override @Override
@ -46,13 +43,6 @@ public class TileFissionMonitor extends TileFissionPart {
return oldState.getBlock() != newState.getBlock(); return oldState.getBlock() != newState.getBlock();
} }
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockFissionMonitor) {
((BlockFissionMonitor) getBlockType()).setState(isActive, this);
world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
public BlockPos getComponentPos() { public BlockPos getComponentPos() {
return componentPos; return componentPos;
} }

View File

@ -1,30 +1,46 @@
package nc.multiblock.fission.tile; package nc.multiblock.fission.tile;
import static nc.block.property.BlockProperties.FACING_ALL; import static nc.block.property.BlockProperties.FACING_ALL;
import static nc.config.NCConfig.*; import static nc.config.NCConfig.enable_gtce_eu;
import static nc.config.NCConfig.rf_per_eu;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import gregtech.api.capability.*; import gregtech.api.capability.GregtechCapabilities;
import gregtech.api.capability.IEnergyContainer;
import ic2.api.energy.EnergyNet; import ic2.api.energy.EnergyNet;
import ic2.api.energy.tile.*; import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import nc.ModCheck; import nc.ModCheck;
import nc.multiblock.cuboidal.CuboidalPartPositionType; import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.fission.FissionReactor; import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.block.BlockFissionPowerPort;
import nc.multiblock.turbine.tile.TileTurbinePart; import nc.multiblock.turbine.tile.TileTurbinePart;
import nc.tile.energy.ITileEnergy; import nc.tile.energy.ITileEnergy;
import nc.tile.internal.energy.*; import nc.tile.internal.energy.EnergyConnection;
import nc.tile.internal.energy.EnergyStorage; import nc.tile.internal.energy.EnergyStorage;
import nc.tile.internal.energy.EnergyTileWrapper;
import nc.tile.internal.energy.EnergyTileWrapperGT;
import nc.tile.internal.fluid.TankSorption;
import nc.tile.passive.ITilePassive; import nc.tile.passive.ITilePassive;
import nc.util.EnergyHelper; import nc.util.EnergyHelper;
import nc.util.Lang;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.*; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.energy.*; import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.Optional;
@Optional.InterfaceList({@Optional.Interface(iface = "ic2.api.energy.tile.IEnergyTile", modid = "ic2"), @Optional.Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "ic2"), @Optional.Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "ic2")}) @Optional.InterfaceList({@Optional.Interface(iface = "ic2.api.energy.tile.IEnergyTile", modid = "ic2"), @Optional.Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "ic2"), @Optional.Interface(iface = "ic2.api.energy.tile.IEnergySource", modid = "ic2")})
@ -55,9 +71,6 @@ public class TileFissionPowerPort extends TileFissionPart implements ITileEnergy
@Override @Override
public void onMachineBroken() { public void onMachineBroken() {
super.onMachineBroken(); super.onMachineBroken();
// if (getWorld().isRemote) return;
// getWorld().setBlockState(getPos(),
// getWorld().getBlockState(getPos()), 2);
} }
@Override @Override
@ -68,8 +81,9 @@ public class TileFissionPowerPort extends TileFissionPart implements ITileEnergy
@Override @Override
public void update() { public void update() {
super.update(); super.update();
if (!world.isRemote) { EnumFacing facing = getPartPosition().getFacing();
pushEnergy(); if (!world.isRemote && facing != null && getEnergyStored() > 0 && getEnergyConnection(facing).canExtract()) {
pushEnergyToSide(facing);
} }
} }
@ -222,6 +236,41 @@ public class TileFissionPowerPort extends TileFissionPart implements ITileEnergy
} }
} }
@Override
public boolean hasConfigurableEnergyConnections() {
return true;
}
// IMultitoolLogic
@Override
public boolean onUseMultitool(ItemStack multitoolStack, EntityPlayer player, World world, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (player.isSneaking()) {
}
else {
if (getMultiblock() != null) {
if (getEnergyConnection(facing) != EnergyConnection.OUT) {
for (EnumFacing side : EnumFacing.VALUES) {
setEnergyConnection(EnergyConnection.OUT, side);
}
setActivity(false);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.port_toggle") + " " + TextFormatting.GOLD + Lang.localise("nc.block.fission_port_mode.output") + " " + TextFormatting.WHITE + Lang.localise("nc.block.port_toggle.mode")));
}
else {
for (EnumFacing side : EnumFacing.VALUES) {
setEnergyConnection(EnergyConnection.IN, side);
}
setActivity(true);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.port_toggle") + " " + TextFormatting.DARK_AQUA + Lang.localise("nc.block.fission_port_mode.input") + " " + TextFormatting.WHITE + Lang.localise("nc.block.port_toggle.mode")));
}
markDirtyAndNotify(true);
return true;
}
}
return super.onUseMultitool(multitoolStack, player, world, facing, hitX, hitY, hitZ);
}
// NBT // NBT
@Override @Override

View File

@ -230,7 +230,7 @@ public abstract class TileFissionShield extends TileFissionPart implements IFiss
isShielding = manager.isShieldingActive(); isShielding = manager.isShieldingActive();
if (wasShielding != isShielding) { if (wasShielding != isShielding) {
if (!world.isRemote) { if (!world.isRemote) {
updateBlockState(isShielding); setActivity(isShielding);
} }
return true; return true;
} }
@ -249,19 +249,12 @@ public abstract class TileFissionShield extends TileFissionPart implements IFiss
public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) { public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) {
boolean wasShielding = isShielding; boolean wasShielding = isShielding;
super.onBlockNeighborChanged(state, world, pos, fromPos); super.onBlockNeighborChanged(state, world, pos, fromPos);
updateBlockState(isShielding); setActivity(isShielding);
if (!world.isRemote && wasShielding != isShielding) { if (!world.isRemote && wasShielding != isShielding) {
getLogic().onShieldUpdated(this); getLogic().onShieldUpdated(this);
} }
} }
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockFissionShield) {
((BlockFissionShield) getBlockType()).setState(isActive, this);
// world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
// NBT // NBT
@Override @Override

View File

@ -97,19 +97,12 @@ public abstract class TileFissionSource extends TileFissionPart {
public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) { public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) {
boolean wasRedstonePowered = getIsRedstonePowered(); boolean wasRedstonePowered = getIsRedstonePowered();
super.onBlockNeighborChanged(state, world, pos, fromPos); super.onBlockNeighborChanged(state, world, pos, fromPos);
updateBlockState(getIsRedstonePowered()); setActivity(getIsRedstonePowered());
if (!world.isRemote && wasRedstonePowered != getIsRedstonePowered()) { if (!world.isRemote && wasRedstonePowered != getIsRedstonePowered()) {
getLogic().onSourceUpdated(this); getLogic().onSourceUpdated(this);
} }
} }
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockFissionSource) {
((BlockFissionSource) getBlockType()).setState(isActive, this);
// world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
public PrimingTargetInfo getPrimingTarget(boolean simulate) { public PrimingTargetInfo getPrimingTarget(boolean simulate) {
EnumFacing facing = getPartPosition().getFacing(); EnumFacing facing = getPartPosition().getFacing();
if (facing == null) { if (facing == null) {

View File

@ -3,9 +3,11 @@ package nc.multiblock.fission.tile;
import static nc.block.property.BlockProperties.FACING_ALL; import static nc.block.property.BlockProperties.FACING_ALL;
import static nc.config.NCConfig.enable_mek_gas; import static nc.config.NCConfig.enable_mek_gas;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -14,9 +16,15 @@ import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.fission.FissionReactor; import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.block.BlockFissionVent; import nc.multiblock.fission.block.BlockFissionVent;
import nc.tile.fluid.ITileFluid; import nc.tile.fluid.ITileFluid;
import nc.tile.internal.fluid.*; import nc.tile.internal.fluid.FluidConnection;
import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.tile.passive.ITilePassive; import nc.tile.passive.ITilePassive;
import nc.util.*; import nc.util.CapabilityHelper;
import nc.util.Lang;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -24,10 +32,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.*; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.*; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
public class TileFissionVent extends TileFissionPart implements ITileFluid { public class TileFissionVent extends TileFissionPart implements ITileFluid {
@ -57,16 +67,6 @@ public class TileFissionVent extends TileFissionPart implements ITileFluid {
@Override @Override
public void onMachineBroken() { public void onMachineBroken() {
super.onMachineBroken(); super.onMachineBroken();
// if (getWorld().isRemote) return;
// getWorld().setBlockState(getPos(),
// getWorld().getBlockState(getPos()), 2);
}
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockFissionVent) {
((BlockFissionVent) getBlockType()).setState(isActive, this);
// world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
} }
@Override @Override
@ -78,7 +78,7 @@ public class TileFissionVent extends TileFissionPart implements ITileFluid {
public void update() { public void update() {
super.update(); super.update();
EnumFacing facing = getPartPosition().getFacing(); EnumFacing facing = getPartPosition().getFacing();
if (!world.isRemote && !getTanks().get(1).isEmpty() && facing != null && getTankSorption(facing, 1).canDrain()) { if (!world.isRemote && facing != null && !getTanks().get(1).isEmpty() && getTankSorption(facing, 1).canDrain()) {
pushFluidToSide(facing); pushFluidToSide(facing);
} }
} }
@ -182,7 +182,7 @@ public class TileFissionVent extends TileFissionPart implements ITileFluid {
setTankSorption(side, 0, TankSorption.IN); setTankSorption(side, 0, TankSorption.IN);
setTankSorption(side, 1, TankSorption.NON); setTankSorption(side, 1, TankSorption.NON);
} }
updateBlockState(false); setActivity(false);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.vent_toggle") + " " + TextFormatting.DARK_AQUA + Lang.localise("nc.block.fission_vent_mode.input") + " " + TextFormatting.WHITE + Lang.localise("nc.block.vent_toggle.mode"))); player.sendMessage(new TextComponentString(Lang.localise("nc.block.vent_toggle") + " " + TextFormatting.DARK_AQUA + Lang.localise("nc.block.fission_vent_mode.input") + " " + TextFormatting.WHITE + Lang.localise("nc.block.vent_toggle.mode")));
} }
else { else {
@ -190,10 +190,10 @@ public class TileFissionVent extends TileFissionPart implements ITileFluid {
setTankSorption(side, 0, TankSorption.NON); setTankSorption(side, 0, TankSorption.NON);
setTankSorption(side, 1, TankSorption.OUT); setTankSorption(side, 1, TankSorption.OUT);
} }
updateBlockState(true); setActivity(true);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.vent_toggle") + " " + TextFormatting.RED + Lang.localise("nc.block.fission_vent_mode.output") + " " + TextFormatting.WHITE + Lang.localise("nc.block.vent_toggle.mode"))); player.sendMessage(new TextComponentString(Lang.localise("nc.block.vent_toggle") + " " + TextFormatting.RED + Lang.localise("nc.block.fission_vent_mode.output") + " " + TextFormatting.WHITE + Lang.localise("nc.block.vent_toggle.mode")));
} }
markDirtyAndNotify(); markDirtyAndNotify(true);
return true; return true;
} }
} }
@ -219,7 +219,7 @@ public class TileFissionVent extends TileFissionPart implements ITileFluid {
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -233,7 +233,7 @@ public class TileFissionVent extends TileFissionPart implements ITileFluid {
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -64,19 +64,12 @@ public class TileFissionShieldManager extends TileFissionManager<TileFissionShie
public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) { public void onBlockNeighborChanged(IBlockState state, World world, BlockPos pos, BlockPos fromPos) {
boolean wasShieldingActive = isShieldingActive(); boolean wasShieldingActive = isShieldingActive();
super.onBlockNeighborChanged(state, world, pos, fromPos); super.onBlockNeighborChanged(state, world, pos, fromPos);
updateBlockState(isShieldingActive()); setActivity(isShieldingActive());
if (!world.isRemote && wasShieldingActive != isShieldingActive()) { if (!world.isRemote && wasShieldingActive != isShieldingActive()) {
refreshListeners(false); refreshListeners(false);
} }
} }
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockFissionShieldManager) {
((BlockFissionShieldManager) getBlockType()).setState(isActive, this);
// world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
// IMultitoolLogic // IMultitoolLogic
@Override @Override
@ -93,7 +86,7 @@ public class TileFissionShieldManager extends TileFissionManager<TileFissionShie
shield.setManagerPos(pos); shield.setManagerPos(pos);
shield.refreshManager(); shield.refreshManager();
} }
markDirtyAndNotify(); markDirty();
getMultiblock().refreshFlag = true; getMultiblock().refreshFlag = true;
player.sendMessage(new TextComponentString(Lang.localise("info.nuclearcraft.multitool.fission.connect_shield_manager", listenerPosSet.size()))); player.sendMessage(new TextComponentString(Lang.localise("info.nuclearcraft.multitool.fission.connect_shield_manager", listenerPosSet.size())));
return true; return true;

View File

@ -3,19 +3,33 @@ package nc.multiblock.fission.tile.port;
import static nc.config.NCConfig.enable_mek_gas; import static nc.config.NCConfig.enable_mek_gas;
import static nc.util.PosHelper.DEFAULT_NON; import static nc.util.PosHelper.DEFAULT_NON;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import nc.ModCheck; import nc.ModCheck;
import nc.recipe.ProcessorRecipeHandler; import nc.recipe.ProcessorRecipeHandler;
import nc.tile.fluid.*; import nc.tile.fluid.ITileFilteredFluid;
import nc.tile.internal.fluid.*; import nc.tile.fluid.ITileFluid;
import nc.util.GasHelper; import nc.tile.internal.fluid.FluidConnection;
import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.util.CapabilityHelper;
import nc.util.Lang;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -43,6 +57,15 @@ public abstract class TileFissionFluidPort<PORT extends TileFissionFluidPort<POR
this.recipeHandler = recipeHandler; this.recipeHandler = recipeHandler;
} }
@Override
public void update() {
super.update();
EnumFacing facing = getPartPosition().getFacing();
if (!world.isRemote && facing != null && !getTanks().get(1).isEmpty() && getTankSorption(facing, 1).canDrain()) {
pushFluidToSide(facing);
}
}
@Override @Override
public void setInventoryStackLimit(int stackLimit) {} public void setInventoryStackLimit(int stackLimit) {}
@ -64,7 +87,6 @@ public abstract class TileFissionFluidPort<PORT extends TileFissionFluidPort<POR
@Override @Override
public void onFilterChanged(int tank) { public void onFilterChanged(int tank) {
/* if (!canModifyFilter(tank)) { getMultiblock().getLogic().refreshPorts(); } */
markDirty(); markDirty();
} }
@ -73,8 +95,6 @@ public abstract class TileFissionFluidPort<PORT extends TileFissionFluidPort<POR
return getFilterTanks().get(0).getFluidName().hashCode(); return getFilterTanks().get(0).getFluidName().hashCode();
} }
/* @Override public void markDirty() { super.markDirty(); } */
// Fluids // Fluids
@Override @Override
@ -136,6 +156,43 @@ public abstract class TileFissionFluidPort<PORT extends TileFissionFluidPort<POR
@Override @Override
public void setTankOutputSetting(int tankNumber, TankOutputSetting setting) {} public void setTankOutputSetting(int tankNumber, TankOutputSetting setting) {}
@Override
public boolean hasConfigurableFluidConnections() {
return true;
}
// IMultitoolLogic
@Override
public boolean onUseMultitool(ItemStack multitoolStack, EntityPlayer player, World world, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (player.isSneaking()) {
}
else {
if (getMultiblock() != null) {
if (getTankSorption(facing, 0) != TankSorption.IN) {
for (EnumFacing side : EnumFacing.VALUES) {
setTankSorption(side, 0, TankSorption.IN);
setTankSorption(side, 1, TankSorption.NON);
}
setActivity(false);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.port_toggle") + " " + TextFormatting.DARK_AQUA + Lang.localise("nc.block.fission_port_mode.input") + " " + TextFormatting.WHITE + Lang.localise("nc.block.port_toggle.mode")));
}
else {
for (EnumFacing side : EnumFacing.VALUES) {
setTankSorption(side, 0, TankSorption.NON);
setTankSorption(side, 1, TankSorption.OUT);
}
setActivity(true);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.port_toggle") + " " + TextFormatting.RED + Lang.localise("nc.block.fission_port_mode.output") + " " + TextFormatting.WHITE + Lang.localise("nc.block.port_toggle.mode")));
}
markDirtyAndNotify(true);
return true;
}
}
return super.onUseMultitool(multitoolStack, player, world, facing, hitX, hitY, hitZ);
}
// NBT // NBT
@Override @Override
@ -176,7 +233,7 @@ public abstract class TileFissionFluidPort<PORT extends TileFissionFluidPort<POR
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -190,7 +247,7 @@ public abstract class TileFissionFluidPort<PORT extends TileFissionFluidPort<POR
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -274,6 +274,11 @@ public class TileFissionHeaterPort extends TileFissionFluidPort<TileFissionHeate
return coolantName.hashCode(); return coolantName.hashCode();
} }
@Override
public boolean hasConfigurableFluidConnections() {
return true;
}
// Ticking // Ticking
@Override @Override

View File

@ -12,13 +12,20 @@ import com.google.common.collect.Lists;
import nc.Global; import nc.Global;
import nc.multiblock.fission.tile.port.internal.PortItemHandler; import nc.multiblock.fission.tile.port.internal.PortItemHandler;
import nc.recipe.ProcessorRecipeHandler; import nc.recipe.ProcessorRecipeHandler;
import nc.tile.internal.fluid.TankSorption;
import nc.tile.internal.inventory.*; import nc.tile.internal.inventory.*;
import nc.tile.inventory.*; import nc.tile.inventory.*;
import nc.util.Lang;
import nc.util.NBTHelper; import nc.util.NBTHelper;
import nc.util.NCUtil;
import net.minecraft.client.util.RecipeItemHelper; import net.minecraft.client.util.RecipeItemHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.*; import net.minecraftforge.items.*;
@ -41,6 +48,15 @@ public abstract class TileFissionItemPort<PORT extends TileFissionItemPort<PORT,
this.recipeHandler = recipeHandler; this.recipeHandler = recipeHandler;
} }
@Override
public void update() {
super.update();
EnumFacing facing = getPartPosition().getFacing();
if (!world.isRemote && facing != null && !getStackInSlot(1).isEmpty() && getItemSorption(facing, 1).canExtract()) {
pushStacksToSide(facing);
}
}
@Override @Override
public void setInventoryStackLimit(int stackLimit) { public void setInventoryStackLimit(int stackLimit) {
inventoryStackLimit = stackLimit; inventoryStackLimit = stackLimit;
@ -66,7 +82,6 @@ public abstract class TileFissionItemPort<PORT extends TileFissionItemPort<PORT,
@Override @Override
public void onFilterChanged(int slot) { public void onFilterChanged(int slot) {
/* if (!canModifyFilter(slot)) { getMultiblock().getLogic().refreshPorts(); } */
markDirty(); markDirty();
} }
@ -124,8 +139,6 @@ public abstract class TileFissionItemPort<PORT extends TileFissionItemPort<PORT,
} }
} }
/* @Override public void markDirty() { super.markDirty(); } */
@Override @Override
public boolean isItemValidForSlot(int slot, ItemStack stack) { public boolean isItemValidForSlot(int slot, ItemStack stack) {
if (stack.isEmpty() || slot >= recipeHandler.getItemInputSize()) { if (stack.isEmpty() || slot >= recipeHandler.getItemInputSize()) {
@ -186,6 +199,43 @@ public abstract class TileFissionItemPort<PORT extends TileFissionItemPort<PORT,
@Override @Override
public void setItemOutputSetting(int slot, ItemOutputSetting setting) {} public void setItemOutputSetting(int slot, ItemOutputSetting setting) {}
@Override
public boolean hasConfigurableInventoryConnections() {
return true;
}
// IMultitoolLogic
@Override
public boolean onUseMultitool(ItemStack multitoolStack, EntityPlayer player, World world, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (player.isSneaking()) {
}
else {
if (getMultiblock() != null) {
if (getItemSorption(facing, 0) != ItemSorption.IN) {
for (EnumFacing side : EnumFacing.VALUES) {
setItemSorption(side, 0, ItemSorption.IN);
setItemSorption(side, 1, ItemSorption.NON);
}
setActivity(false);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.port_toggle") + " " + TextFormatting.BLUE + Lang.localise("nc.block.fission_port_mode.input") + " " + TextFormatting.WHITE + Lang.localise("nc.block.port_toggle.mode")));
}
else {
for (EnumFacing side : EnumFacing.VALUES) {
setItemSorption(side, 0, ItemSorption.NON);
setItemSorption(side, 1, ItemSorption.OUT);
}
setActivity(true);
player.sendMessage(new TextComponentString(Lang.localise("nc.block.port_toggle") + " " + TextFormatting.GOLD + Lang.localise("nc.block.fission_port_mode.output") + " " + TextFormatting.WHITE + Lang.localise("nc.block.port_toggle.mode")));
}
markDirtyAndNotify(true);
return true;
}
}
return super.onUseMultitool(multitoolStack, player, world, facing, hitX, hitY, hitZ);
}
// NBT // NBT
@Override @Override

View File

@ -8,6 +8,8 @@ import javax.annotation.*;
import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.fastutil.objects.*;
import nc.multiblock.cuboidal.*; import nc.multiblock.cuboidal.*;
import nc.multiblock.fission.FissionReactor; import nc.multiblock.fission.FissionReactor;
import nc.multiblock.fission.block.port.BlockFissionMetaPort;
import nc.multiblock.fission.block.port.BlockFissionPort;
import nc.multiblock.fission.tile.TileFissionPart; import nc.multiblock.fission.tile.TileFissionPart;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -44,9 +46,6 @@ public abstract class TileFissionPort<PORT extends TileFissionPort<PORT, TARGET>
@Override @Override
public void onMachineBroken() { public void onMachineBroken() {
super.onMachineBroken(); super.onMachineBroken();
// TODO - temporary ports
/* if (!getWorld().isRemote && !DEFAULT_NON.equals(masterPortPos)) { PORT master = masterPort; clearMasterPort(); master.shiftStacks(this); } */
} }
@Override @Override

View File

@ -8,6 +8,7 @@ import nc.multiblock.fission.tile.port.TileFissionHeaterPort;
import nc.network.PacketHandler; import nc.network.PacketHandler;
import nc.network.gui.*; import nc.network.gui.*;
import nc.tile.internal.fluid.Tank; import nc.tile.internal.fluid.Tank;
import nc.util.Lang;
import nc.util.NCUtil; import nc.util.NCUtil;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@ -34,7 +35,7 @@ public class GuiFissionHeaterPort extends NCGui {
@Override @Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
int fontColor = port.getMultiblock() != null && port.getMultiblock().isReactorOn ? -1 : 15641088; int fontColor = port.getMultiblock() != null && port.getMultiblock().isReactorOn ? -1 : 15641088;
String s = port.getDisplayName().getUnformattedText(); String s = Lang.localise("gui.nc.container.fission_heater_port.name");
fontRenderer.drawString(s, xSize / 2 - fontRenderer.getStringWidth(s) / 2, 6, fontColor); fontRenderer.drawString(s, xSize / 2 - fontRenderer.getStringWidth(s) / 2, 6, fontColor);
} }

View File

@ -170,7 +170,7 @@ public class HeatExchanger extends CuboidalMultiblock<IHeatExchangerPart, HeatEx
protected void onMachineDisassembled() { protected void onMachineDisassembled() {
isHeatExchangerOn = false; isHeatExchangerOn = false;
if (controller != null) { if (controller != null) {
controller.updateBlockState(false); controller.setActivity(false);
} }
fractionOfTubesActive = efficiency = maxEfficiency = 0D; fractionOfTubesActive = efficiency = maxEfficiency = 0D;
} }
@ -223,7 +223,7 @@ public class HeatExchanger extends CuboidalMultiblock<IHeatExchangerPart, HeatEx
isHeatExchangerOn = (isRedstonePowered() || computerActivated) && isAssembled(); isHeatExchangerOn = (isRedstonePowered() || computerActivated) && isAssembled();
if (isHeatExchangerOn != oldIsHeatExchangerOn) { if (isHeatExchangerOn != oldIsHeatExchangerOn) {
if (controller != null) { if (controller != null) {
controller.updateBlockState(isHeatExchangerOn); controller.setActivity(isHeatExchangerOn);
sendUpdateToAllPlayers(); sendUpdateToAllPlayers();
} }
} }

View File

@ -1,22 +1,28 @@
package nc.multiblock.heatExchanger.block; package nc.multiblock.heatExchanger.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.init.NCBlocks; import nc.init.NCBlocks;
import nc.multiblock.heatExchanger.tile.TileCondenserController; import nc.multiblock.heatExchanger.tile.TileCondenserController;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCondenserController extends BlockHeatExchangerPart { public class BlockCondenserController extends BlockHeatExchangerPart implements IActivatable {
public BlockCondenserController() { public BlockCondenserController() {
super(); super();
@ -87,15 +93,4 @@ public class BlockCondenserController extends BlockHeatExchangerPart {
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) { public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) {
return side != null; return side != null;
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() == NCBlocks.condenser_controller) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -1,6 +1,7 @@
package nc.multiblock.heatExchanger.block; package nc.multiblock.heatExchanger.block;
import nc.block.property.*; import nc.block.property.*;
import nc.block.tile.IDynamicState;
import nc.item.ItemMultitool; import nc.item.ItemMultitool;
import nc.multiblock.heatExchanger.*; import nc.multiblock.heatExchanger.*;
import nc.multiblock.heatExchanger.tile.TileCondenserTube; import nc.multiblock.heatExchanger.tile.TileCondenserTube;
@ -16,7 +17,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.*; import net.minecraft.util.text.*;
import net.minecraft.world.*; import net.minecraft.world.*;
public class BlockCondenserTube extends BlockHeatExchangerPart implements ISidedProperty<HeatExchangerTubeSetting> { public class BlockCondenserTube extends BlockHeatExchangerPart implements IDynamicState, ISidedProperty<HeatExchangerTubeSetting> {
private static EnumFacing placementSide = null; private static EnumFacing placementSide = null;
@ -122,7 +123,7 @@ public class BlockCondenserTube extends BlockHeatExchangerPart implements ISided
TileCondenserTube other = (TileCondenserTube) otherTile; TileCondenserTube other = (TileCondenserTube) otherTile;
tube.setFluidConnections(FluidConnection.cloneArray(other.getFluidConnections())); tube.setFluidConnections(FluidConnection.cloneArray(other.getFluidConnections()));
tube.setTubeSettings(other.getTubeSettings().clone()); tube.setTubeSettings(other.getTubeSettings().clone());
tube.markDirtyAndNotify(); tube.markDirtyAndNotify(true);
} }
} }
} }

View File

@ -1,22 +1,28 @@
package nc.multiblock.heatExchanger.block; package nc.multiblock.heatExchanger.block;
import static nc.block.property.BlockProperties.*; import static nc.block.property.BlockProperties.ACTIVE;
import static nc.block.property.BlockProperties.FACING_ALL;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import nc.NuclearCraft; import nc.NuclearCraft;
import nc.block.tile.IActivatable;
import nc.block.tile.IDynamicState;
import nc.init.NCBlocks; import nc.init.NCBlocks;
import nc.multiblock.heatExchanger.tile.TileHeatExchangerController; import nc.multiblock.heatExchanger.tile.TileHeatExchangerController;
import nc.util.BlockHelper; import nc.util.BlockHelper;
import net.minecraft.block.state.*; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.*; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockHeatExchangerController extends BlockHeatExchangerPart { public class BlockHeatExchangerController extends BlockHeatExchangerPart implements IActivatable {
public BlockHeatExchangerController() { public BlockHeatExchangerController() {
super(); super();
@ -87,15 +93,4 @@ public class BlockHeatExchangerController extends BlockHeatExchangerPart {
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) { public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable EnumFacing side) {
return side != null; return side != null;
} }
public void setState(boolean isActive, TileEntity tile) {
World world = tile.getWorld();
BlockPos pos = tile.getPos();
IBlockState state = world.getBlockState(pos);
if (!world.isRemote && state.getBlock() == NCBlocks.heat_exchanger_controller) {
if (isActive != state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(ACTIVE, isActive), 2);
}
}
}
} }

View File

@ -1,6 +1,7 @@
package nc.multiblock.heatExchanger.block; package nc.multiblock.heatExchanger.block;
import nc.block.property.*; import nc.block.property.*;
import nc.block.tile.IDynamicState;
import nc.item.ItemMultitool; import nc.item.ItemMultitool;
import nc.multiblock.heatExchanger.*; import nc.multiblock.heatExchanger.*;
import nc.multiblock.heatExchanger.tile.TileHeatExchangerTube; import nc.multiblock.heatExchanger.tile.TileHeatExchangerTube;
@ -16,7 +17,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.*; import net.minecraft.util.text.*;
import net.minecraft.world.*; import net.minecraft.world.*;
public class BlockHeatExchangerTube extends BlockHeatExchangerPart implements ISidedProperty<HeatExchangerTubeSetting> { public class BlockHeatExchangerTube extends BlockHeatExchangerPart implements IDynamicState, ISidedProperty<HeatExchangerTubeSetting> {
private static EnumFacing placementSide = null; private static EnumFacing placementSide = null;
@ -122,7 +123,7 @@ public class BlockHeatExchangerTube extends BlockHeatExchangerPart implements IS
TileHeatExchangerTube other = (TileHeatExchangerTube) otherTile; TileHeatExchangerTube other = (TileHeatExchangerTube) otherTile;
tube.setFluidConnections(FluidConnection.cloneArray(other.getFluidConnections())); tube.setFluidConnections(FluidConnection.cloneArray(other.getFluidConnections()));
tube.setTubeSettings(other.getTubeSettings().clone()); tube.setTubeSettings(other.getTubeSettings().clone());
tube.markDirtyAndNotify(); tube.markDirtyAndNotify(true);
} }
} }
} }

View File

@ -5,5 +5,4 @@ import nc.multiblock.tile.ILogicMultiblockController;
public interface IHeatExchangerController extends IHeatExchangerPart, ILogicMultiblockController<HeatExchanger> { public interface IHeatExchangerController extends IHeatExchangerPart, ILogicMultiblockController<HeatExchanger> {
public void updateBlockState(boolean isActive);
} }

View File

@ -61,12 +61,4 @@ public class TileCondenserController extends TileHeatExchangerPart implements IH
public int[] weakSidesToCheck(World world, BlockPos pos) { public int[] weakSidesToCheck(World world, BlockPos pos) {
return new int[] {2, 3, 4, 5}; return new int[] {2, 3, 4, 5};
} }
@Override
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockCondenserController) {
((BlockCondenserController) getBlockType()).setState(isActive, this);
world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
} }

View File

@ -1,25 +1,37 @@
package nc.multiblock.heatExchanger.tile; package nc.multiblock.heatExchanger.tile;
import static nc.config.NCConfig.enable_mek_gas; import static nc.config.NCConfig.enable_mek_gas;
import static nc.recipe.NCRecipes.*; import static nc.recipe.NCRecipes.condenser;
import static nc.recipe.NCRecipes.condenser_valid_fluids;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import nc.ModCheck; import nc.ModCheck;
import nc.multiblock.cuboidal.CuboidalPartPositionType; import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.heatExchanger.*; import nc.multiblock.heatExchanger.HeatExchanger;
import nc.recipe.*; import nc.multiblock.heatExchanger.HeatExchangerTubeSetting;
import nc.multiblock.heatExchanger.HeatExchangerTubeType;
import nc.recipe.AbstractRecipeHandler;
import nc.recipe.ProcessorRecipe;
import nc.recipe.RecipeInfo;
import nc.recipe.ingredient.IFluidIngredient; import nc.recipe.ingredient.IFluidIngredient;
import nc.tile.fluid.ITileFluid; import nc.tile.fluid.ITileFluid;
import nc.tile.internal.fluid.*; import nc.tile.internal.fluid.FluidConnection;
import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.tile.passive.ITilePassive; import nc.tile.passive.ITilePassive;
import nc.tile.processor.IFluidProcessor; import nc.tile.processor.IFluidProcessor;
import nc.util.GasHelper; import nc.util.CapabilityHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -28,7 +40,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.capability.*; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
public class TileCondenserTube extends TileHeatExchangerPart implements IFluidProcessor { public class TileCondenserTube extends TileHeatExchangerPart implements IFluidProcessor {
@ -387,7 +400,7 @@ public class TileCondenserTube extends TileHeatExchangerPart implements IFluidPr
public void toggleTubeSetting(@Nonnull EnumFacing side) { public void toggleTubeSetting(@Nonnull EnumFacing side) {
setTubeSetting(side, getTubeSetting(side).next()); setTubeSetting(side, getTubeSetting(side).next());
refreshFluidConnections(side); refreshFluidConnections(side);
markDirtyAndNotify(); markDirtyAndNotify(true);
} }
public void refreshFluidConnections(@Nonnull EnumFacing side) { public void refreshFluidConnections(@Nonnull EnumFacing side) {
@ -602,7 +615,7 @@ public class TileCondenserTube extends TileHeatExchangerPart implements IFluidPr
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -616,7 +629,7 @@ public class TileCondenserTube extends TileHeatExchangerPart implements IFluidPr
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -61,12 +61,4 @@ public class TileHeatExchangerController extends TileHeatExchangerPart implement
public int[] weakSidesToCheck(World world, BlockPos pos) { public int[] weakSidesToCheck(World world, BlockPos pos) {
return new int[] {2, 3, 4, 5}; return new int[] {2, 3, 4, 5};
} }
@Override
public void updateBlockState(boolean isActive) {
if (getBlockType() instanceof BlockHeatExchangerController) {
((BlockHeatExchangerController) getBlockType()).setState(isActive, this);
world.notifyNeighborsOfStateChange(pos, getBlockType(), true);
}
}
} }

View File

@ -1,31 +1,44 @@
package nc.multiblock.heatExchanger.tile; package nc.multiblock.heatExchanger.tile;
import static nc.config.NCConfig.enable_mek_gas; import static nc.config.NCConfig.enable_mek_gas;
import static nc.recipe.NCRecipes.*; import static nc.recipe.NCRecipes.heat_exchanger;
import static nc.recipe.NCRecipes.heat_exchanger_valid_fluids;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import nc.ModCheck; import nc.ModCheck;
import nc.multiblock.cuboidal.CuboidalPartPositionType; import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.heatExchanger.*; import nc.multiblock.heatExchanger.HeatExchanger;
import nc.recipe.*; import nc.multiblock.heatExchanger.HeatExchangerTubeSetting;
import nc.multiblock.heatExchanger.HeatExchangerTubeType;
import nc.recipe.AbstractRecipeHandler;
import nc.recipe.ProcessorRecipe;
import nc.recipe.RecipeInfo;
import nc.recipe.ingredient.IFluidIngredient; import nc.recipe.ingredient.IFluidIngredient;
import nc.tile.fluid.ITileFluid; import nc.tile.fluid.ITileFluid;
import nc.tile.internal.fluid.*; import nc.tile.internal.fluid.FluidConnection;
import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.tile.passive.ITilePassive; import nc.tile.passive.ITilePassive;
import nc.tile.processor.IFluidProcessor; import nc.tile.processor.IFluidProcessor;
import nc.util.GasHelper; import nc.util.CapabilityHelper;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.*; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
public class TileHeatExchangerTube extends TileHeatExchangerPart implements IFluidProcessor { public class TileHeatExchangerTube extends TileHeatExchangerPart implements IFluidProcessor {
@ -417,7 +430,7 @@ public class TileHeatExchangerTube extends TileHeatExchangerPart implements IFlu
setTubeSetting(side, getTubeSetting(side).next()); setTubeSetting(side, getTubeSetting(side).next());
refreshFluidConnections(side); refreshFluidConnections(side);
updateFlowDir(); updateFlowDir();
markDirtyAndNotify(); markDirtyAndNotify(true);
} }
public void refreshFluidConnections(@Nonnull EnumFacing side) { public void refreshFluidConnections(@Nonnull EnumFacing side) {
@ -657,7 +670,7 @@ public class TileHeatExchangerTube extends TileHeatExchangerPart implements IFlu
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -671,7 +684,7 @@ public class TileHeatExchangerTube extends TileHeatExchangerPart implements IFlu
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -1,20 +1,28 @@
package nc.multiblock.heatExchanger.tile; package nc.multiblock.heatExchanger.tile;
import static nc.block.property.BlockProperties.AXIS_ALL; import static nc.block.property.BlockProperties.AXIS_ALL;
import static nc.config.NCConfig.*; import static nc.config.NCConfig.enable_mek_gas;
import static nc.config.NCConfig.machine_update_rate;
import java.util.List; import java.util.List;
import javax.annotation.*; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import nc.ModCheck; import nc.ModCheck;
import nc.multiblock.cuboidal.CuboidalPartPositionType; import nc.multiblock.cuboidal.CuboidalPartPositionType;
import nc.multiblock.heatExchanger.*; import nc.multiblock.heatExchanger.HeatExchanger;
import nc.multiblock.heatExchanger.HeatExchangerTubeSetting;
import nc.tile.fluid.ITileFluid; import nc.tile.fluid.ITileFluid;
import nc.tile.internal.fluid.*; import nc.tile.internal.fluid.FluidConnection;
import nc.util.GasHelper; import nc.tile.internal.fluid.FluidTileWrapper;
import nc.tile.internal.fluid.GasTileWrapper;
import nc.tile.internal.fluid.Tank;
import nc.tile.internal.fluid.TankOutputSetting;
import nc.tile.internal.fluid.TankSorption;
import nc.util.CapabilityHelper;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -175,7 +183,7 @@ public class TileHeatExchangerVent extends TileHeatExchangerPart implements ITil
@Override @Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) { public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing side) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == GasHelper.GAS_HANDLER_CAPABILITY) { if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || ModCheck.mekanismLoaded() && enable_mek_gas && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
return !getTanks().isEmpty() && hasFluidSideCapability(side); return !getTanks().isEmpty() && hasFluidSideCapability(side);
} }
return super.hasCapability(capability, side); return super.hasCapability(capability, side);
@ -189,7 +197,7 @@ public class TileHeatExchangerVent extends TileHeatExchangerPart implements ITil
} }
return null; return null;
} }
else if (ModCheck.mekanismLoaded() && capability == GasHelper.GAS_HANDLER_CAPABILITY) { else if (ModCheck.mekanismLoaded() && capability == CapabilityHelper.GAS_HANDLER_CAPABILITY) {
if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) { if (enable_mek_gas && !getTanks().isEmpty() && hasFluidSideCapability(side)) {
return (T) getGasWrapper(); return (T) getGasWrapper();
} }

View File

@ -2,14 +2,20 @@ package nc.multiblock.network;
import javax.vecmath.Vector3f; import javax.vecmath.Vector3f;
import org.apache.commons.lang3.ArrayUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import nc.multiblock.Multiblock.AssemblyState;
import nc.multiblock.turbine.Turbine; import nc.multiblock.turbine.Turbine;
import nc.multiblock.turbine.tile.TileTurbineController; import nc.multiblock.turbine.tile.TileTurbineController;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class TurbineFormPacket extends MultiblockUpdatePacket { public class TurbineFormPacket extends MultiblockUpdatePacket {
public boolean nullArray; public AssemblyState assemblyState;
public EnumFacing flowDir;
public boolean nullData;
public BlockPos[] bladePosArray; public BlockPos[] bladePosArray;
public Vector3f[] renderPosArray; public Vector3f[] renderPosArray;
public float[] bladeAngleArray; public float[] bladeAngleArray;
@ -18,9 +24,19 @@ public class TurbineFormPacket extends MultiblockUpdatePacket {
messageValid = false; messageValid = false;
} }
public TurbineFormPacket(BlockPos pos, BlockPos[] bladePosArray, Vector3f[] renderPosArray, float[] bladeAngleArray) { public TurbineFormPacket(BlockPos pos, AssemblyState assemblyState, EnumFacing flowDir, BlockPos[] bladePosArray, Vector3f[] renderPosArray, float[] bladeAngleArray) {
this.pos = pos; this.pos = pos;
nullArray = bladePosArray == null || renderPosArray == null || bladeAngleArray == null; this.assemblyState = assemblyState;
this.flowDir = flowDir;
nullData = flowDir == null || bladePosArray == null || renderPosArray == null || bladeAngleArray == null;
if (!nullData && ArrayUtils.contains(bladePosArray, null)) {
nullData = true;
}
if (!nullData && ArrayUtils.contains(renderPosArray, null)) {
nullData = true;
}
this.bladePosArray = bladePosArray; this.bladePosArray = bladePosArray;
this.renderPosArray = renderPosArray; this.renderPosArray = renderPosArray;
this.bladeAngleArray = bladeAngleArray; this.bladeAngleArray = bladeAngleArray;
@ -31,8 +47,12 @@ public class TurbineFormPacket extends MultiblockUpdatePacket {
@Override @Override
public void readMessage(ByteBuf buf) { public void readMessage(ByteBuf buf) {
pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); pos = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
nullArray = buf.readBoolean(); byte b = buf.readByte();
if (!nullArray) { assemblyState = b == 0 ? AssemblyState.Assembled : (b == 1 ? AssemblyState.Disassembled : AssemblyState.Paused);
nullData = buf.readBoolean();
if (!nullData) {
flowDir = EnumFacing.byIndex(buf.readInt());
bladePosArray = new BlockPos[buf.readInt()]; bladePosArray = new BlockPos[buf.readInt()];
for (int i = 0; i < bladePosArray.length; i++) { for (int i = 0; i < bladePosArray.length; i++) {
bladePosArray[i] = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt()); bladePosArray[i] = new BlockPos(buf.readInt(), buf.readInt(), buf.readInt());
@ -53,8 +73,11 @@ public class TurbineFormPacket extends MultiblockUpdatePacket {
buf.writeInt(pos.getX()); buf.writeInt(pos.getX());
buf.writeInt(pos.getY()); buf.writeInt(pos.getY());
buf.writeInt(pos.getZ()); buf.writeInt(pos.getZ());
buf.writeBoolean(nullArray); buf.writeByte(assemblyState == AssemblyState.Assembled ? 0 : (assemblyState == AssemblyState.Disassembled ? 1 : 2));
if (!nullArray) {
buf.writeBoolean(nullData);
if (!nullData) {
buf.writeInt(flowDir.getIndex());
buf.writeInt(bladePosArray.length); buf.writeInt(bladePosArray.length);
for (BlockPos rotorPos : bladePosArray) { for (BlockPos rotorPos : bladePosArray) {
buf.writeInt(rotorPos.getX()); buf.writeInt(rotorPos.getX());

Some files were not shown because too many files have changed in this diff Show More