Machines now explode when they come in contact with rain.

This commit is contained in:
Modmuss50 2015-10-07 15:41:26 +01:00
parent cb6551c7ca
commit 75e2bd4733
3 changed files with 21 additions and 0 deletions

View file

@ -163,6 +163,8 @@ public class ConfigTechReborn {
public static boolean ShowChargeHud;
public static boolean useConnectedTextures;
public static boolean rainExplosions;
public static Configuration config;
private ConfigTechReborn(File configFile) {
@ -670,6 +672,9 @@ public class ConfigTechReborn {
useConnectedTextures = config.get(CATEGORY_INTEGRATION, StatCollector.translateToLocal("config.techreborn.connectTextures"),
true, StatCollector.translateToLocal("config.techreborn.connectTextures.tooltip")).getBoolean(true);
rainExplosions = config.get(CATEGORY_POWER, StatCollector.translateToLocal("config.techreborn.rainExplosions"),
true, StatCollector.translateToLocal("config.techreborn.rainExplosions.tooltip")).getBoolean(true);
//Integration
AllowBOPRecipes = config.get(CATEGORY_INTEGRATION, StatCollector.translateToLocal("config.techreborn.allowBopRecipes"),

View file

@ -4,23 +4,37 @@ import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver;
import net.minecraft.client.particle.EntityHugeExplodeFX;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.Explosion;
import net.minecraftforge.common.util.ForgeDirection;
import techreborn.api.power.IEnergyInterfaceTile;
import techreborn.tiles.TileMachineBase;
import java.util.Random;
/**
* This is done in a different class so the updateEntity can be striped for ic2 and this one will still get called.
*/
public abstract class RFProviderTile extends TileMachineBase implements IEnergyReceiver, IEnergyProvider, IEnergyInterfaceTile {
Random random = new Random();
@Override
public void updateEntity() {
super.updateEntity();
if (worldObj.isRemote) {
return;
}
if(worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && worldObj.isRaining() || worldObj.isThundering())
if (getEnergy() >= 1 && random.nextInt(160) == 0) {
Explosion explosion = new Explosion(this.worldObj, null, xCoord, yCoord, zCoord, getEnergy() < 100000? 2F : 4F);
explosion.isFlaming = true;
explosion.isSmoking = getEnergy() > 100000;
explosion.doExplosionA();
explosion.doExplosionB(false);
}
sendPower();
}

View file

@ -804,6 +804,8 @@ config.techreborn.enableEU=Enable EU support
config.techreborn.enableEU.tooltip= Enable EU support for all machines.
config.techreborn.connectTextures=Enable Connected textures
config.techreborn.connectTextures.tooltip= Enable Connected textures
config.techreborn.rainExplosions=Enable machine explosions when rain hits
config.techreborn.rainExplosions.tooltip= When this is enabled machines will explode when they come in contact with rain.
#ConfigGui
config.techreborn.category.general=General Configs