From 6af3e1c0665830bc4fe6770afc4e86e2cb324f40 Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 3 Nov 2021 23:38:10 +0100 Subject: [PATCH] fixed some tom relatedstuff --- .../com/hbm/blocks/generic/BlockBobble.java | 22 ++++++++++- .../hbm/inventory/recipes/MachineRecipes.java | 1 + .../java/com/hbm/main/ModEventHandler.java | 39 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hbm/blocks/generic/BlockBobble.java b/src/main/java/com/hbm/blocks/generic/BlockBobble.java index 944eb9a39..0248fda75 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockBobble.java +++ b/src/main/java/com/hbm/blocks/generic/BlockBobble.java @@ -1,8 +1,14 @@ package com.hbm.blocks.generic; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -36,9 +42,21 @@ public class BlockBobble extends BlockContainer { } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - int meta = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + + for(int i = 0; i < BobbleType.values().length; i++) + list.add(new ItemStack(item, 1, i)); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { + int meta = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; world.setBlockMetadataWithNotify(x, y, z, meta, 2); + + TileEntityBobble bobble = (TileEntityBobble) world.getTileEntity(x, y, z); + bobble.type = BobbleType.values()[stack.getItemDamage() % BobbleType.values().length]; + bobble.markDirty(); } @Override diff --git a/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java b/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java index 9e21295b5..7d8d5725b 100644 --- a/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/MachineRecipes.java @@ -2029,6 +2029,7 @@ public class MachineRecipes { break; case HELIUM3: output[0] = new FluidStack(1000, FluidType.HELIUM3); + break; case OSMIRIDIUM_DEATH: output[0] = new FluidStack(1000, FluidType.DEATH); break; diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index ac090ea69..767ca2f50 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -35,6 +35,7 @@ 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.items.IEquipReceiver; import com.hbm.items.ModItems; import com.hbm.items.armor.ArmorFSB; @@ -108,11 +109,13 @@ 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; @@ -712,6 +715,37 @@ public class ModEventHandler { @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 && GeneralConfig.enableRads) { @@ -734,6 +768,11 @@ 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;