improved some missile recipes, cleaned up tom impact handling

This commit is contained in:
Boblet 2022-11-11 15:20:57 +01:00
parent d494df6ead
commit 3a784919fa
21 changed files with 499 additions and 340 deletions

View File

@ -2,24 +2,13 @@ package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.interfaces.Spaghetti;
import com.hbm.items.ModItems;
import com.hbm.main.ModEventHandler;
import com.hbm.potion.HbmPotion;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.hbm.saveddata.TomSaveData;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
@ -71,8 +60,10 @@ public class BlockDirt extends Block {
public void updateTick(World world, int x, int y, int z, Random rand) {
if(!world.isRemote) {
int light = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y + 1, z), (int) (world.getBlockLightValue(x, y + 1, z) * (1 - ModEventHandler.dust)));
if(light >= 9 && ModEventHandler.fire == 0) {
TomSaveData data = TomSaveData.forWorld(world);
int light = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y + 1, z), (int) (world.getBlockLightValue(x, y + 1, z) * (1 - data.dust)));
if(light >= 9 && data.fire == 0) {
world.setBlock(x, y, z, Blocks.grass);
}
}

View File

@ -73,9 +73,8 @@ public class EntityTomBlast extends Entity {
if(flag) {
this.setDead();
TomSaveData data = TomSaveData.forWorld(worldObj);
NBTTagCompound tag = data.getData();
tag.setBoolean("impact", true);
tag.setFloat("fire", 1);
data.impact = true;
data.fire = 1F;
data.markDirty();
}
}

View File

@ -1,12 +1,12 @@
package com.hbm.handler;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ModEventHandler;
import com.hbm.saveddata.TomSaveData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
@ -18,7 +18,6 @@ import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.ChunkProviderServer;
import net.minecraftforge.common.util.ForgeDirection;
public class ImpactWorldHandler {
@ -50,10 +49,12 @@ public class ImpactWorldHandler {
int Z = coord.getCenterZPosition() - 8 + z;
int Y = world.getHeightValue(X, Z) - world.rand.nextInt(Math.max(1, world.getHeightValue(X, Z)));
if(TomSaveData.dust > 0) {
TomSaveData data = TomSaveData.forWorld(world);
if(data.dust > 0) {
die(world, X, Y, Z);
}
if(TomSaveData.fire > 0 || ModEventHandler.fire > 0) {
if(data.fire > 0) {
burn(world, X, Y, Z);
}
}
@ -64,8 +65,9 @@ public class ImpactWorldHandler {
/// Plants die without sufficient light.
public static void die(World world, int x, int y, int z) {
int light = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y + 1, z), (int) (world.getBlockLightValue(x, y + 1, z) * (1 - ModEventHandler.dust)));
TomSaveData data = TomSaveData.forWorld(world);
int light = Math.max(world.getSavedLightValue(EnumSkyBlock.Block, x, y + 1, z), (int) (world.getBlockLightValue(x, y + 1, z) * (1 - data.dust)));
if(light < 4) {
if(world.getBlock(x, y, z) == Blocks.grass) {
@ -98,4 +100,27 @@ public class ImpactWorldHandler {
world.setBlock(x, y, z, Blocks.dirt);
}
}
public static World lastSyncWorld = null;
public static float fire = 0F;
public static float dust = 0F;
public static boolean impact = false;
@SideOnly(Side.CLIENT)
public static float getFireForClient(World world) {
if(world != lastSyncWorld) return 0F;
return fire;
}
@SideOnly(Side.CLIENT)
public static float getDustForClient(World world) {
if(world != lastSyncWorld) return 0F;
return dust;
}
@SideOnly(Side.CLIENT)
public static boolean getImpactForClient(World world) {
if(world != lastSyncWorld) return false;
return impact;
}
}

View File

@ -178,7 +178,7 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModItems.dysfunctional_reactor, 1), new AStack[] {new OreDictStack(STEEL.plate(), 15), new OreDictStack(PB.ingot(), 5), new ComparableStack(ModItems.rod_quad_empty, 10), new OreDictStack("dyeBrown", 3), },200);
makeRecipe(new ComparableStack(ModItems.missile_assembly, 1), new AStack[] {new ComparableStack(ModItems.hull_small_steel, 1), new ComparableStack(ModItems.hull_small_aluminium, 4), new OreDictStack(STEEL.ingot(), 2), new OreDictStack(TI.plate(), 6), new ComparableStack(ModItems.wire_aluminium, 6), new ComparableStack(ModItems.canister_full, 3, Fluids.KEROSENE.getID()), new ComparableStack(ModItems.circuit_targeting_tier1, 1), },200);
makeRecipe(new ComparableStack(ModItems.missile_carrier, 1), new AStack[] {new ComparableStack(ModItems.fluid_barrel_full, 16, Fluids.KEROSENE.getID()), new ComparableStack(ModItems.thruster_medium, 4), new ComparableStack(ModItems.thruster_large, 1), new ComparableStack(ModItems.hull_big_titanium, 6), new ComparableStack(ModItems.hull_big_steel, 2), new ComparableStack(ModItems.hull_small_aluminium, 12), new OreDictStack(TI.plate(), 24), new ComparableStack(ModItems.plate_polymer, 128), new ComparableStack(ModBlocks.det_cord, 8), new ComparableStack(ModItems.circuit_targeting_tier3, 12), new ComparableStack(ModItems.circuit_targeting_tier4, 3), },4800);
makeRecipe(new ComparableStack(ModItems.warhead_generic_small, 1), new AStack[] {new OreDictStack(TI.plate(), 5), new OreDictStack(STEEL.plate(), 3), new OreDictStack(ANY_HIGHEXPLOSIVE.ingot(), 2), },100);
makeRecipe(new ComparableStack(ModItems.warhead_generic_small, 1), new AStack[] {new OreDictStack(TI.plate(), 5), new OreDictStack(STEEL.plate(), 3), new ComparableStack(Blocks.tnt, 2), },100);
makeRecipe(new ComparableStack(ModItems.warhead_generic_medium, 1), new AStack[] {new OreDictStack(TI.plate(), 8), new OreDictStack(STEEL.plate(), 5), new OreDictStack(ANY_HIGHEXPLOSIVE.ingot(), 4), },150);
makeRecipe(new ComparableStack(ModItems.warhead_generic_large, 1), new AStack[] {new OreDictStack(TI.plate(), 15), new OreDictStack(STEEL.plate(), 8), new OreDictStack(ANY_HIGHEXPLOSIVE.ingot(), 8), },200);
makeRecipe(new ComparableStack(ModItems.warhead_incendiary_small, 1), new AStack[] {new ComparableStack(ModItems.warhead_generic_small, 1), new OreDictStack(P_RED.dust(), 4), },100);
@ -195,13 +195,13 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModItems.warhead_volcano, 1), new AStack[] {new OreDictStack(TI.plate(), 24), new OreDictStack(STEEL.plate(), 16), new ComparableStack(ModBlocks.det_nuke, 3), new OreDictStack(U238.block(), 24), new ComparableStack(ModItems.circuit_tantalium, 5) }, 600);
makeRecipe(new ComparableStack(ModItems.warhead_thermo_endo, 1), new AStack[] {new ComparableStack(ModBlocks.therm_endo, 2), new OreDictStack(TI.plate(), 12), new OreDictStack(STEEL.plate(), 6), },300);
makeRecipe(new ComparableStack(ModItems.warhead_thermo_exo, 1), new AStack[] {new ComparableStack(ModBlocks.therm_exo, 2), new OreDictStack(TI.plate(), 12), new OreDictStack(STEEL.plate(), 6), },300);
makeRecipe(new ComparableStack(ModItems.fuel_tank_small, 1), new AStack[] {new ComparableStack(ModItems.canister_full, 4, Fluids.KEROSENE.getID()), new OreDictStack(TI.plate(), 6), new OreDictStack(STEEL.plate(), 2), },100);
makeRecipe(new ComparableStack(ModItems.fuel_tank_small, 1), new AStack[] {new ComparableStack(ModItems.canister_full, 6, Fluids.ETHANOL.getID()), new OreDictStack(TI.plate(), 6), new OreDictStack(STEEL.plate(), 2), },100);
makeRecipe(new ComparableStack(ModItems.fuel_tank_medium, 1), new AStack[] {new ComparableStack(ModItems.canister_full, 12, Fluids.KEROSENE.getID()), new OreDictStack(TI.plate(), 12), new OreDictStack(STEEL.plate(), 4), },150);
makeRecipe(new ComparableStack(ModItems.fuel_tank_large, 1), new AStack[] {new ComparableStack(ModItems.canister_full, 36, Fluids.KEROSENE.getID()), new OreDictStack(TI.plate(), 24), new OreDictStack(STEEL.plate(), 8), },200);
makeRecipe(new ComparableStack(ModItems.thruster_small, 1), new AStack[] {new OreDictStack(STEEL.plate(), 2), new ComparableStack(ModItems.hull_small_steel, 2), new ComparableStack(ModItems.wire_aluminium, 4), },100);
makeRecipe(new ComparableStack(ModItems.thruster_medium, 1), new AStack[] {new ComparableStack(ModItems.thruster_small, 1), new OreDictStack(STEEL.plate(), 2), new ComparableStack(ModItems.hull_small_steel, 1), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.wire_copper, 4), },150);
makeRecipe(new ComparableStack(ModItems.thruster_large, 1), new AStack[] {new ComparableStack(ModItems.thruster_medium, 1), new OreDictStack(STEEL.plate(), 4), new ComparableStack(ModItems.hull_big_steel, 2), new ComparableStack(ModItems.wire_red_copper, 4), },200);
makeRecipe(new ComparableStack(ModItems.thruster_nuclear, 1), new AStack[] {new ComparableStack(ModItems.thruster_large, 1), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModBlocks.deco_pipe_quad, 3), new ComparableStack(ModItems.board_copper, 6), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit_targeting_tier4, 2), new ComparableStack(ModBlocks.reactor_research, 1), },600);
makeRecipe(new ComparableStack(ModItems.thruster_small, 1), new AStack[] {new OreDictStack(STEEL.plate(), 4), new OreDictStack(W.ingot(), 4), new ComparableStack(ModItems.wire_aluminium, 4), },100);
makeRecipe(new ComparableStack(ModItems.thruster_medium, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new OreDictStack(W.ingot(), 8), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.wire_copper, 16), },150);
makeRecipe(new ComparableStack(ModItems.thruster_large, 1), new AStack[] {new OreDictStack(DURA.ingot(), 16), new OreDictStack(W.ingot(), 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.wire_gold, 32), new ComparableStack(ModItems.circuit_red_copper, 1), },200);
makeRecipe(new ComparableStack(ModItems.thruster_nuclear, 1), new AStack[] {new OreDictStack(DURA.ingot(), 32), new OreDictStack(B.ingot(), 8), new OreDictStack(PB.plate(), 16), new ComparableStack(ModItems.pipes_steel), new ComparableStack(ModItems.circuit_gold, 1) },600);
makeRecipe(new ComparableStack(ModItems.sat_base, 1), new AStack[] {new ComparableStack(ModItems.thruster_large, 1), new OreDictStack(STEEL.plate(), 6), new ComparableStack(ModItems.plate_desh, 4), new ComparableStack(ModItems.hull_big_titanium, 3), new ComparableStack(ModItems.fluid_barrel_full, 1, Fluids.KEROSENE.getID()), new ComparableStack(ModItems.photo_panel, 24), new ComparableStack(ModItems.board_copper, 12), new ComparableStack(ModItems.circuit_gold, 6), new ComparableStack(ModItems.battery_lithium_cell_6, 1), },500);
makeRecipe(new ComparableStack(ModItems.sat_head_mapper, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 4), new OreDictStack(STEEL.plate(), 6), new ComparableStack(ModItems.hull_small_steel, 3), new ComparableStack(ModItems.plate_desh, 2), new ComparableStack(ModItems.circuit_gold, 2), new OreDictStack(RUBBER.ingot(), 12), new OreDictStack(REDSTONE.dust(), 6), new ComparableStack(Items.diamond, 1), new ComparableStack(Blocks.glass_pane, 6), },400);
makeRecipe(new ComparableStack(ModItems.sat_head_scanner, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 6), new OreDictStack(TI.plate(), 32), new ComparableStack(ModItems.plate_desh, 6), new ComparableStack(ModItems.magnetron, 6), new ComparableStack(ModItems.coil_advanced_torus, 2), new ComparableStack(ModItems.circuit_gold, 6), new OreDictStack(RUBBER.ingot(), 6), new ComparableStack(Items.diamond, 1), },400);

View File

@ -59,6 +59,7 @@ import com.hbm.entity.mob.siege.*;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
import com.hbm.handler.HbmKeybinds;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.items.ModItems;
import com.hbm.particle.*;
@ -81,6 +82,7 @@ import com.hbm.render.util.RenderInfoSystem;
import com.hbm.render.util.RenderInfoSystem.InfoEntry;
import com.hbm.render.util.RenderOverhead;
import com.hbm.render.util.RenderOverhead.Marker;
import com.hbm.saveddata.TomSaveData;
import com.hbm.sound.AudioWrapper;
import com.hbm.sound.AudioWrapperClient;
import com.hbm.sound.AudioWrapperClientStartStop;
@ -1888,5 +1890,20 @@ public class ClientProxy extends ServerProxy {
}
return list;
}
@Override
public float getImpactDust(World world) {
return ImpactWorldHandler.getDustForClient(world);
}
@Override
public float getImpactFire(World world) {
return ImpactWorldHandler.getFireForClient(world);
}
@Override
public boolean getImpact(World world) {
return ImpactWorldHandler.getImpactForClient(world);
}
}

View File

@ -822,6 +822,10 @@ public class MainRegistry {
MinecraftForge.EVENT_BUS.register(commonHandler);
MinecraftForge.TERRAIN_GEN_BUS.register(commonHandler);
MinecraftForge.ORE_GEN_BUS.register(commonHandler);
ModEventHandlerImpact impactHandler = new ModEventHandlerImpact();
FMLCommonHandler.instance().bus().register(impactHandler);
MinecraftForge.EVENT_BUS.register(impactHandler);
OreDictManager oreMan = new OreDictManager();
MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent

View File

@ -35,7 +35,6 @@ import com.hbm.handler.EntityEffectHandler;
import com.hbm.hazard.HazardSystem;
import com.hbm.interfaces.IBomb;
import com.hbm.handler.HTTPHandler;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.handler.SiegeOrchestrator;
import com.hbm.items.IEquipReceiver;
import com.hbm.items.ModItems;
@ -52,18 +51,16 @@ import com.hbm.lib.ModDamageSource;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PermaSyncPacket;
import com.hbm.packet.PlayerInformPacket;
import com.hbm.potion.HbmPotion;
import com.hbm.saveddata.AuxSavedData;
import com.hbm.saveddata.TomSaveData;
import com.hbm.util.ArmorUtil;
import com.hbm.util.ContaminationUtil;
import com.hbm.util.EnchantmentUtil;
import com.hbm.util.EntityDamageUtil;
import com.hbm.world.WorldProviderNTM;
import com.hbm.world.generator.TimedGenerator;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
@ -73,12 +70,6 @@ import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockLog;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@ -94,7 +85,6 @@ import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityMooshroom;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.event.ClickEvent;
@ -110,17 +100,12 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.FoodStats;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.AnvilUpdateEvent;
@ -140,22 +125,13 @@ import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
import net.minecraftforge.event.terraingen.BiomeEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
import net.minecraftforge.event.world.WorldEvent;
public class ModEventHandler {
//////////////////////////////////////////
private static Random rand = new Random();
public static float dust;
public static float fire;
public static boolean impact;
//////////////////////////////////////////
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
@ -543,210 +519,14 @@ public class ModEventHandler {
HazardSystem.updateLivingInventory(event.entityLiving);
}
}
//TODO: move all of this into its own event handler
/// TOM STUFF ///
/// TOM STUFF ///
/// TOM STUFF ///
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onLoad(WorldEvent.Load event) {
DimensionManager.unregisterProviderType(0);
DimensionManager.registerProviderType(0, WorldProviderNTM.class, true);
BobmazonOfferFactory.init();
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onUnload(WorldEvent.Unload event) {
// We don't want Tom's impact data transferring between worlds.
TomSaveData data = TomSaveData.forWorld(event.world);
this.fire = 0;
this.dust = 0;
this.impact = false;
data.fire = 0;
data.dust = 0;
data.impact = false;
}
@SubscribeEvent
public void extinction(EntityJoinWorldEvent event) {
if(impact == true) {
if(!(event.entity instanceof EntityPlayer) && event.entity instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) event.entity;
if(event.world.provider.dimensionId == 0) {
if(event.entity.height >= 0.85f || event.entity.width >= 0.85f && event.entity.ticksExisted < 20 && !(event.entity instanceof EntityWaterMob) && !living.isChild()) {
event.setCanceled(true);
}
}
if(event.entity instanceof EntityWaterMob && event.entity.ticksExisted < 20) {
Random rand = new Random();
if(rand.nextInt(9) != 0) {
event.setCanceled(true);
}
}
}
}
}
@SubscribeEvent
public void villages(BiomeEvent.GetVillageBlockID event) {
Block b = event.original;
Material mat = event.original.getMaterial();
if(event.biome == null) {
return;
}
if(impact == true) {
if(mat == Material.wood || mat == Material.glass || b == Blocks.ladder || b instanceof BlockCrops ||
b == Blocks.chest || b instanceof BlockDoor || mat == Material.cloth || mat == Material.water) {
event.replacement = Blocks.air;
} else if(b == Blocks.cobblestone || b == Blocks.stonebrick) {
if(rand.nextInt(3) == 1) {
event.replacement = Blocks.gravel;
}
} else if(b == Blocks.sandstone) {
if(rand.nextInt(3) == 1) {
event.replacement = Blocks.sand;
}
} else if(b == Blocks.farmland) {
event.replacement = Blocks.dirt;
}
}
if(event.replacement != null) {
event.setResult(Result.DENY);
}
}
@SubscribeEvent
public void postImpactGeneration(BiomeEvent event) {
/// Disables post-impact surface replacement for superflat worlds
/// because they are retarded and crash with a NullPointerException if
/// you try to look for biome-specific blocks.
if(event.biome != null) {
if(event.biome.topBlock != null) {
if(event.biome.topBlock == Blocks.grass) {
if(impact == true && (dust > 0 || fire > 0)) {
// if(dust > 0 || fire > 0)
// {
final Block newtop = ModBlocks.impact_dirt;
event.biome.topBlock = newtop;
/*
* } else { event.biome.topBlock=Blocks.grass; }
*/
} else {
event.biome.topBlock = Blocks.grass;
}
}
}
}
}
@SubscribeEvent
public void postImpactDecoration(DecorateBiomeEvent.Decorate event) {
if(impact == true) {
EventType type = event.type;
if(dust > 0 || fire > 0) {
if(type == event.type.TREE || type == event.type.BIG_SHROOM || type == event.type.GRASS || type == event.type.REED || type == event.type.FLOWERS || type == event.type.DEAD_BUSH
|| type == event.type.CACTUS || type == event.type.PUMPKIN || type == event.type.LILYPAD) {
event.setResult(Result.DENY);
}
} else if(dust == 0 && fire == 0) {
if(type == event.type.TREE || type == event.type.BIG_SHROOM || type == event.type.CACTUS) {
if(event.world.rand.nextInt(9) == 0) {
event.setResult(Result.DEFAULT);
} else {
event.setResult(Result.DENY);
}
}
if(type == event.type.GRASS || type == event.type.REED) {
event.setResult(Result.DEFAULT);
}
}
} else {
event.setResult(Result.DEFAULT);
}
}
@SubscribeEvent
public void populateChunk(PopulateChunkEvent.Post event) {
if(impact == true) {
Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ);
for(ExtendedBlockStorage storage : chunk.getBlockStorageArray()) {
if(storage != null) {
for(int x = 0; x < 16; ++x) {
for(int y = 0; y < 16; ++y) {
for(int z = 0; z < 16; ++z) {
if(dust > 0.25 || fire > 0) {
if(storage.getBlockByExtId(x, y, z) == Blocks.grass) {
storage.func_150818_a(x, y, z, ModBlocks.impact_dirt);
} else if(storage.getBlockByExtId(x, y, z) instanceof BlockLog) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z) instanceof BlockLeaves) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z).getMaterial() == Material.leaves) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z).getMaterial() == Material.plants) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z) instanceof BlockBush) {
storage.func_150818_a(x, y, z, Blocks.air);
}
}
}
}
}
}
}
}
}
/// TOM STUFF ///
/// TOM STUFF ///
/// TOM STUFF ///
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
/// TOM IMPACT START///
if(event.world != null && !event.world.isRemote && event.phase == Phase.START) {
float settle = 1F / 14400000F; /// 600 days to completely clear all
/// dust.
float cool = 1F / 24000F;/// One MC day between initial impact and
/// total darkness.
ImpactWorldHandler.impactEffects(event.world);
TomSaveData data = TomSaveData.forWorld(event.world);
NBTTagCompound tag = data.getData();
float atmosphericDust = tag.getFloat("dust");
float firestorm = tag.getFloat("fire");
boolean hasImpacted = tag.getBoolean("impact");
data.impact = hasImpacted;
if(atmosphericDust > 0 && firestorm == 0) {
tag.setFloat("dust", Math.max(0, atmosphericDust - settle));
data.markDirty();
data.dust = atmosphericDust;
}
if(firestorm > 0) {
tag.setFloat("fire", Math.max(0, (firestorm - cool)));
tag.setFloat("dust", Math.min(1, (atmosphericDust + cool)));
data.markDirty();
data.fire = firestorm;
data.dust = atmosphericDust;
}
dust = data.dust;
fire = data.fire;
impact = data.impact;
}
/// TOM IMPACT END///
/// RADIATION STUFF START ///
if(event.world != null && !event.world.isRemote) {
@ -770,11 +550,6 @@ public class ModEventHandler {
//effect for radiation
EntityLivingBase entity = (EntityLivingBase) e;
if(entity.worldObj.provider.dimensionId == 0 && fire > 0 && dust < 0.75f && event.world.getSavedLightValue(EnumSkyBlock.Sky, (int) entity.posX, (int) entity.posY, (int) entity.posZ) > 7) {
entity.setFire(10);
entity.attackEntityFrom(DamageSource.onFire, 2);
}
if(entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode)
continue;
@ -1204,6 +979,10 @@ public class ModEventHandler {
/// NEW ITEM SYS START ///
HazardSystem.updatePlayerInventory(player);
/// NEW ITEM SYS END ///
/// SYNC START ///
if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new PermaSyncPacket((EntityPlayerMP) player), (EntityPlayerMP) player);
/// SYNC END ///
}
//TODO: rewrite this so it doesn't look like shit

View File

@ -19,6 +19,7 @@ import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.ArmorModHandler;
import com.hbm.handler.HTTPHandler;
import com.hbm.handler.HazmatRegistry;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.hazard.HazardSystem;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.IItemHUD;
@ -807,8 +808,9 @@ public class ModEventHandlerClient {
IRenderHandler sky = world.provider.getSkyRenderer();
if(ModEventHandler.dust > 0 || ModEventHandler.fire > 0) {
if(ImpactWorldHandler.getDustForClient(world) > 0 || ImpactWorldHandler.getFireForClient(world) > 0) {
//using a chainloader isn't necessary since none of the sky effects should render anyway
if(!(sky instanceof RenderNTMSkyboxImpact)) {
world.provider.setSkyRenderer(new RenderNTMSkyboxImpact());
}

View File

@ -0,0 +1,260 @@
package com.hbm.main;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.saveddata.TomSaveData;
import com.hbm.world.WorldProviderNTM;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockLog;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.terraingen.BiomeEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
import net.minecraftforge.event.world.WorldEvent;
public class ModEventHandlerImpact {
//////////////////////////////////////////
private static Random rand = new Random();
//////////////////////////////////////////
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
if(event.world != null && !event.world.isRemote && event.phase == Phase.START) {
float settle = 1F / 14400000F; // 600 days to completely clear all dust.
float cool = 1F / 24000F; // One MC day between initial impact and total darkness.
ImpactWorldHandler.impactEffects(event.world);
TomSaveData data = TomSaveData.forWorld(event.world);
if(data.dust > 0 && data.fire == 0) {
data.dust = Math.max(0, data.dust - settle);
data.markDirty();
}
if(data.fire > 0) {
data.fire = Math.max(0, (data.fire - cool));
data.dust = Math.min(1, (data.dust + cool));
data.markDirty();
}
if(!event.world.loadedEntityList.isEmpty()) {
List<Object> oList = new ArrayList<Object>();
oList.addAll(event.world.loadedEntityList);
for(Object e : oList) {
if(e instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) e;
if(entity.worldObj.provider.dimensionId == 0 && data.fire > 0 && data.dust < 0.75f &&
event.world.getSavedLightValue(EnumSkyBlock.Sky, (int) entity.posX, (int) entity.posY, (int) entity.posZ) > 7) {
entity.setFire(5);
entity.attackEntityFrom(DamageSource.onFire, 2);
}
}
}
}
}
}
//data is always pooled out of the perWorld save data so resetting values isn't needed
/*@SubscribeEvent(priority = EventPriority.LOWEST)
public void onUnload(WorldEvent.Unload event) {
// We don't want Tom's impact data transferring between worlds.
TomSaveData data = TomSaveData.forWorld(event.world);
this.fire = 0;
this.dust = 0;
this.impact = false;
data.fire = 0;
data.dust = 0;
data.impact = false;
}*/
@SubscribeEvent
public void extinction(EntityJoinWorldEvent event) {
TomSaveData data = TomSaveData.forWorld(event.world);
if(data.impact) {
if(!(event.entity instanceof EntityPlayer) && event.entity instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) event.entity;
if(event.world.provider.dimensionId == 0) {
if(event.entity.height >= 0.85f || event.entity.width >= 0.85f && event.entity.ticksExisted < 20 && !(event.entity instanceof EntityWaterMob) && !living.isChild()) {
event.setCanceled(true);
}
}
if(event.entity instanceof EntityWaterMob && event.entity.ticksExisted < 20) {
Random rand = new Random();
if(rand.nextInt(9) != 0) {
event.setCanceled(true);
}
}
}
}
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onLoad(WorldEvent.Load event) {
DimensionManager.unregisterProviderType(0);
DimensionManager.registerProviderType(0, WorldProviderNTM.class, true);
}
@SubscribeEvent
public void modifyVillageGen(BiomeEvent.GetVillageBlockID event) {
Block b = event.original;
Material mat = event.original.getMaterial();
TomSaveData data = TomSaveData.getLastCachedOrNull();
if(event.biome == null) {
return;
}
if(data.impact) {
if(mat == Material.wood || mat == Material.glass || b == Blocks.ladder || b instanceof BlockCrops ||
b == Blocks.chest || b instanceof BlockDoor || mat == Material.cloth || mat == Material.water) {
event.replacement = Blocks.air;
} else if(b == Blocks.cobblestone || b == Blocks.stonebrick) {
if(rand.nextInt(3) == 1) {
event.replacement = Blocks.gravel;
}
} else if(b == Blocks.sandstone) {
if(rand.nextInt(3) == 1) {
event.replacement = Blocks.sand;
}
} else if(b == Blocks.farmland) {
event.replacement = Blocks.dirt;
}
}
if(event.replacement != null) {
event.setResult(Result.DENY);
}
}
@SubscribeEvent
public void postImpactGeneration(BiomeEvent event) {
/// Disables post-impact surface replacement for superflat worlds
/// because they are retarded and crash with a NullPointerException if
/// you try to look for biome-specific blocks.
TomSaveData data = TomSaveData.getLastCachedOrNull(); //despite forcing the data, we cannot rule out canceling events or custom firing shenanigans
if(data != null && event.biome != null) {
if(event.biome.topBlock != null) {
if(event.biome.topBlock == Blocks.grass) {
if(data.impact && (data.dust > 0 || data.fire > 0)) {
event.biome.topBlock = ModBlocks.impact_dirt;
} else {
event.biome.topBlock = Blocks.grass;
}
}
}
}
}
@SubscribeEvent
public void postImpactDecoration(DecorateBiomeEvent.Decorate event) {
TomSaveData data = TomSaveData.forWorld(event.world);
if(data.impact) {
EventType type = event.type;
if(data.dust > 0 || data.fire > 0) {
if(type == event.type.TREE || type == event.type.BIG_SHROOM || type == event.type.GRASS || type == event.type.REED || type == event.type.FLOWERS || type == event.type.DEAD_BUSH
|| type == event.type.CACTUS || type == event.type.PUMPKIN || type == event.type.LILYPAD) {
event.setResult(Result.DENY);
}
} else if(data.dust == 0 && data.fire == 0) {
if(type == event.type.TREE || type == event.type.BIG_SHROOM || type == event.type.CACTUS) {
if(event.world.rand.nextInt(9) == 0) {
event.setResult(Result.DEFAULT);
} else {
event.setResult(Result.DENY);
}
}
if(type == event.type.GRASS || type == event.type.REED) {
event.setResult(Result.DEFAULT);
}
}
} else {
event.setResult(Result.DEFAULT);
}
}
@SubscribeEvent
public void populateChunkPre(PopulateChunkEvent.Pre event) {
TomSaveData.forWorld(event.world); /* forces the data to be cached so it is accurate by the time ModEventHandlerImpact#modifyVillageGen is called. */
}
@SubscribeEvent
public void populateChunkPost(PopulateChunkEvent.Post event) {
TomSaveData data = TomSaveData.forWorld(event.world);
if(data.impact) {
Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ);
for(ExtendedBlockStorage storage : chunk.getBlockStorageArray()) {
if(storage != null) {
for(int x = 0; x < 16; ++x) {
for(int y = 0; y < 16; ++y) {
for(int z = 0; z < 16; ++z) {
if(data.dust > 0.25 || data.fire > 0) {
if(storage.getBlockByExtId(x, y, z) == Blocks.grass) {
storage.func_150818_a(x, y, z, ModBlocks.impact_dirt);
} else if(storage.getBlockByExtId(x, y, z) instanceof BlockLog) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z) instanceof BlockLeaves) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z).getMaterial() == Material.leaves) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z).getMaterial() == Material.plants) {
storage.func_150818_a(x, y, z, Blocks.air);
} else if(storage.getBlockByExtId(x, y, z) instanceof BlockBush) {
storage.func_150818_a(x, y, z, Blocks.air);
}
}
}
}
}
}
}
}
}
}

View File

@ -3,10 +3,8 @@ package com.hbm.main;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ICustomBlockHighlight;
import com.hbm.blocks.generic.BlockAshes;
import com.hbm.items.armor.IArmorDisableModel;
import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart;
import com.hbm.lib.RefStrings;
import com.hbm.potion.HbmPotion;
import com.hbm.render.model.ModelMan;
@ -24,7 +22,6 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
@ -252,7 +249,7 @@ public class ModEventHandlerRenderer {
}
}
private ResourceLocation ashes = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_ash.png");
//private ResourceLocation ashes = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_ash.png");
public static int currentBrightness = 0;
public static int lastBrightness = 0;

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.saveddata.TomSaveData;
import com.hbm.sound.AudioWrapper;
import com.hbm.sound.nt.ISoundSourceTE;
import com.hbm.sound.nt.SoundWrapper;
@ -75,4 +76,16 @@ public class ServerProxy {
list.add(stack);
return list;
}
public float getImpactDust(World world) {
return TomSaveData.forWorld(world).dust;
}
public float getImpactFire(World world) {
return TomSaveData.forWorld(world).fire;
}
public boolean getImpact(World world) {
return TomSaveData.forWorld(world).impact;
}
}

View File

@ -0,0 +1,36 @@
package com.hbm.packet;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.saveddata.TomSaveData;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
/**
* Utility for permanently synchronizing values every tick with a player in the given context of a world.
* Uses the Byte Buffer directly instead of NBT to cut back on unnecessary data.
* @author hbm
*/
public class PermaSyncHandler {
public static void writePacket(ByteBuf buf, World world, EntityPlayerMP player) {
/// TOM IMPACT DATA ///
TomSaveData data = TomSaveData.forWorld(world);
buf.writeFloat(data.fire);
buf.writeFloat(data.dust);
buf.writeBoolean(data.impact);
/// TOM IMPACT DATA ///
}
public static void readPacket(ByteBuf buf, World world, EntityPlayerMP player) {
/// TOM IMPACT DATA ///
ImpactWorldHandler.lastSyncWorld = player.worldObj;
ImpactWorldHandler.fire = buf.readFloat();
ImpactWorldHandler.dust = buf.readFloat();
ImpactWorldHandler.impact = buf.readBoolean();
/// TOM IMPACT DATA ///
}
}

View File

@ -0,0 +1,45 @@
package com.hbm.packet;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
public class PermaSyncPacket implements IMessage {
EntityPlayerMP player; //server only, for writing
ByteBuf out; //client only, for reading
public PermaSyncPacket() { }
public PermaSyncPacket(EntityPlayerMP player) {
this.player = player;
}
@Override
public void toBytes(ByteBuf buf) {
PermaSyncHandler.writePacket(buf, player.worldObj, player);
}
@Override
public void fromBytes(ByteBuf buf) {
this.out = buf;
}
public static class Handler implements IMessageHandler<PermaSyncPacket, IMessage> {
@Override
public IMessage onMessage(PermaSyncPacket m, MessageContext ctx) {
try {
EntityPlayerMP player = m.player;
if(player != null) PermaSyncHandler.readPacket(m.out, player.worldObj, player);
} catch(Exception x) { }
return null;
}
}
}

View File

@ -11,7 +11,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.IRenderHandler;
public class RenderNTMSkyboxChainloader extends IRenderHandler { //why an abstract class uses the I-prefix is beyond me but ok, alright, whatever

View File

@ -3,24 +3,18 @@ package com.hbm.render.world;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProviderSurface;
import net.minecraftforge.client.IRenderHandler;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.main.ModEventHandler;
import com.hbm.handler.ImpactWorldHandler;
import java.util.Random;
@ -87,7 +81,7 @@ public class RenderNTMSkyboxImpact extends IRenderHandler {
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
float atmosphericDust = ModEventHandler.dust;
float atmosphericDust = ImpactWorldHandler.getDustForClient(world);
GL11.glDisable(GL11.GL_TEXTURE_2D);
Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);

View File

@ -1,56 +1,53 @@
package com.hbm.saveddata;
import java.util.Iterator;
import com.hbm.lib.RefStrings;
import com.hbm.main.ModEventHandler;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.village.Village;
import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData;
import net.minecraft.world.storage.MapStorage;
public class TomSaveData extends WorldSavedData {
final static String key = "impactData";
public static float dust;
public static float fire;
public static boolean impact;
public final static String key = "impactData";
public float dust;
public float fire;
public boolean impact;
private static TomSaveData lastCachedUnsafe = null;
public static TomSaveData forWorld(World world) {
TomSaveData result = (TomSaveData)world.perWorldStorage.loadData(TomSaveData.class, "impactData");
if (result == null) {
world.perWorldStorage.setData(key, new TomSaveData(key));
result = (TomSaveData)world.perWorldStorage.loadData(TomSaveData.class, "impactData");
}
return result;
}
/* no caching for data per world needed, minecraft's save structure already does that! call forWorld as much as you want. */
public static TomSaveData forWorld(World world) {
TomSaveData result = (TomSaveData) world.perWorldStorage.loadData(TomSaveData.class, "impactData");
private NBTTagCompound data = new NBTTagCompound();
if(result == null) {
world.perWorldStorage.setData(key, new TomSaveData(key));
result = (TomSaveData) world.perWorldStorage.loadData(TomSaveData.class, "impactData");
}
lastCachedUnsafe = result;
return result;
}
/**
* Certain biome events do not have access to a world instance (very very bad), in those cases we have to rely on a possibly incorrect cached result.
* However, due to the world gen invoking TomSaveData.forWorld() quite a lot, it is safe to say that in most cases, we do end up with the correct result.
*/
public static TomSaveData getLastCachedOrNull() {
return lastCachedUnsafe;
}
public TomSaveData(String tagName) {
super(tagName);
}
public TomSaveData(String tagName) {
super(tagName);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
data = compound.getCompoundTag(key);
this.dust = compound.getFloat("dust");
this.fire = compound.getFloat("fire");
this.impact = compound.getBoolean("impact");
ModEventHandler.dust = this.dust;
ModEventHandler.fire = this.fire;
ModEventHandler.impact = this.impact;
}
@Override
public void readFromNBT(NBTTagCompound compound) {
this.dust = compound.getFloat("dust");
this.fire = compound.getFloat("fire");
this.impact = compound.getBoolean("impact");
}
@Override
public void writeToNBT(NBTTagCompound compound) {
compound.setTag(key, data);
}
public NBTTagCompound getData() {
return data;
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
nbt.setFloat("dust", dust);
nbt.setFloat("fire", fire);
nbt.setBoolean("impact", impact);
}
}

View File

@ -9,7 +9,9 @@ import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.main.ModEventHandler;
import com.hbm.main.ModEventHandlerImpact;
import api.hbm.fluid.IFluidStandardTransceiver;
import net.minecraft.nbt.NBTTagCompound;
@ -49,7 +51,7 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I
int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord);
if(ModEventHandler.fire > 0 && light > 7) { // Make both steam and water evaporate during firestorms...
if(MainRegistry.proxy.getImpactFire(worldObj) > 0 && light > 7) { // Make both steam and water evaporate during firestorms...
tanks[1].setFill(tanks[1].getFill() - convert);
} else {
tanks[1].setFill(tanks[1].getFill() + convert);

View File

@ -20,6 +20,7 @@ import com.hbm.inventory.fluid.trait.FT_Heatable;
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep;
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
@ -32,6 +33,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.EnumSkyBlock;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IFluidSource, IFluidAcceptor, INBTPacketReceiver, IFluidStandardTransceiver, IConfigurableMachine {
@ -66,6 +68,11 @@ public class TileEntityHeatBoiler extends TileEntityLoadedBase implements IFluid
this.tryPullHeat();
int lastHeat = this.heat;
int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord);
if(light > 7 && MainRegistry.proxy.getImpactFire(worldObj) > 0) {
this.heat += ((maxHeat - heat) * 0.5D); //constantly heat up 50% of the remaining heat buffer for rampant but diminishing heating
}
data.setInteger("heat", lastHeat);
tanks[0].writeToNBT(data, "0");

View File

@ -15,6 +15,7 @@ import com.hbm.entity.projectile.EntityRBMKDebris;
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
import com.hbm.main.MainRegistry;
import com.hbm.main.ModEventHandler;
import com.hbm.main.ModEventHandlerImpact;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.NBTPacket;
import com.hbm.packet.PacketDispatcher;
@ -222,7 +223,7 @@ public abstract class TileEntityRBMKBase extends TileEntity implements INBTPacke
protected void coolPassively() {
if(ModEventHandler.fire > 0) {
if(MainRegistry.proxy.getImpactFire(worldObj) > 0) {
int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord);
if(heat < 20 + (480 * (light / 15))) {
this.heat += this.passiveCooling() * 2;

View File

@ -11,7 +11,8 @@ import com.hbm.inventory.fluid.trait.FT_Corrosive;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.Library;
import com.hbm.main.ModEventHandler;
import com.hbm.main.MainRegistry;
import com.hbm.main.ModEventHandlerImpact;
import com.hbm.tileentity.IPersistentNBT;
import com.hbm.tileentity.TileEntityMachineBase;
@ -119,7 +120,7 @@ public class TileEntityBarrel extends TileEntityMachineBase implements IFluidAcc
}
//For when Tom's firestorm hits a barrel full of water
if(tank.getTankType() == Fluids.WATER && ModEventHandler.fire > 0) {
if(tank.getTankType() == Fluids.WATER && MainRegistry.proxy.getImpactFire(worldObj) > 0) {
int light = this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, this.xCoord, this.yCoord, this.zCoord);
if(light > 7) {

View File

@ -1,24 +1,14 @@
package com.hbm.world;
import com.hbm.main.ModEventHandler;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldProviderSurface;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IRenderHandler;
public class WorldProviderNTM extends WorldProviderSurface {
@ -38,7 +28,7 @@ public class WorldProviderNTM extends WorldProviderSurface {
float f2 = 0.4F;
float f3 = MathHelper.cos(par1 * (float) Math.PI * 2.0F) - 0.0F;
float f4 = -0.0F;
float dust = ModEventHandler.dust;
float dust = MainRegistry.proxy.getImpactDust(worldObj);
if(f3 >= f4 - f2 && f3 <= f4 + f2) {
float f5 = (f3 - f4) / f2 * 0.5F + 0.5F;
@ -58,7 +48,7 @@ public class WorldProviderNTM extends WorldProviderSurface {
@SideOnly(Side.CLIENT)
public float getStarBrightness(float par1) {
float starBr = worldObj.getStarBrightnessBody(par1);
float dust = ModEventHandler.dust;
float dust = MainRegistry.proxy.getImpactDust(worldObj);
float f1 = worldObj.getCelestialAngle(par1);
float f2 = 1.0F - (MathHelper.cos(f1 * (float) Math.PI * 2.0F) * 2.0F + 0.25F);
@ -75,14 +65,14 @@ public class WorldProviderNTM extends WorldProviderSurface {
@Override
@SideOnly(Side.CLIENT)
public float getSunBrightness(float par1) {
float dust = ModEventHandler.dust;
float dust = ImpactWorldHandler.getDustForClient(MainRegistry.proxy.me().worldObj);
float sunBr = worldObj.getSunBrightnessFactor(par1);
return (sunBr * 0.8F + 0.2F) * (1 - dust);
}
@Override
public boolean isDaytime() {
float dust = ModEventHandler.dust;
float dust = MainRegistry.proxy.getImpactDust(worldObj);
if(dust >= 0.75F) {
return false;
@ -92,7 +82,7 @@ public class WorldProviderNTM extends WorldProviderSurface {
@Override
public float getSunBrightnessFactor(float par1) {
float dust = ModEventHandler.dust;
float dust = MainRegistry.proxy.getImpactDust(worldObj);
float sunBr = worldObj.getSunBrightnessFactor(par1);
float dimSun = sunBr * (1 - dust);
return dimSun;
@ -105,8 +95,8 @@ public class WorldProviderNTM extends WorldProviderSurface {
@Override
public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) {
Vec3 fog = super.getFogColor(p_76562_1_, p_76562_2_);
float dust = ModEventHandler.dust;
float fire = ModEventHandler.fire;
float dust = MainRegistry.proxy.getImpactDust(worldObj);
float fire = MainRegistry.proxy.getImpactFire(worldObj);
float f3 = (float) fog.xCoord;
float f4 = (float) fog.yCoord * (1 - (dust * 0.5F));
@ -122,8 +112,8 @@ public class WorldProviderNTM extends WorldProviderSurface {
@SideOnly(Side.CLIENT)
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) {
Vec3 sky = super.getSkyColor(cameraEntity, partialTicks);
float dust = ModEventHandler.dust;
float fire = ModEventHandler.fire;
float dust = MainRegistry.proxy.getImpactDust(worldObj);
float fire = MainRegistry.proxy.getImpactFire(worldObj);
float f4;
float f5;
@ -145,7 +135,7 @@ public class WorldProviderNTM extends WorldProviderSurface {
@SideOnly(Side.CLIENT)
public Vec3 drawClouds(float partialTicks) {
Vec3 clouds = super.drawClouds(partialTicks);
float dust = ModEventHandler.dust;
float dust = MainRegistry.proxy.getImpactDust(worldObj);;
float f3 = (float) clouds.xCoord;
float f4 = (float) clouds.yCoord;
float f5 = (float) clouds.zCoord;