uninteresting, barely relevant garbage

This commit is contained in:
Boblet 2021-08-10 14:04:35 +02:00
parent 5f272a906f
commit 3722844400
11 changed files with 273 additions and 3 deletions

View File

@ -35,6 +35,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
private float radEnv;
private float radBuf;
private int bombTimer;
private int contagion;
private List<ContaminationEffect> contamination = new ArrayList();
public HbmLivingProps(EntityLivingBase entity) {
@ -191,6 +192,15 @@ public class HbmLivingProps implements IExtendedEntityProperties {
public static void setTimer(EntityLivingBase entity, int bombTimer) {
getData(entity).bombTimer = bombTimer;
}
/// CONTAGION ///
public static int getContagion(EntityLivingBase entity) {
return getData(entity).contagion;
}
public static void setContagion(EntityLivingBase entity, int contageon) {
getData(entity).contagion = contageon;
}
@Override
public void init(Entity entity, World world) { }
@ -204,6 +214,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
props.setFloat("hfr_digamma", digamma);
props.setInteger("hfr_asbestos", asbestos);
props.setInteger("hfr_bomb", bombTimer);
props.setInteger("hfr_contagion", contagion);
props.setInteger("hfr_cont_count", this.contamination.size());
@ -224,6 +235,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
digamma = props.getFloat("hfr_digamma");
asbestos = props.getInteger("hfr_asbestos");
bombTimer = props.getInteger("hfr_bomb");
contagion = props.getInteger("hfr_contagion");
int cont = props.getInteger("hfr_cont_count");

View File

@ -20,13 +20,17 @@ import com.hbm.util.ContaminationUtil.HazardType;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@ -59,8 +63,9 @@ public class EntityEffectHandler {
}
}
}
handleContamination(entity);
handleContagion(entity);
handleRadiation(entity);
handleDigamma(entity);
}
@ -183,4 +188,104 @@ public class EntityEffectHandler {
}
}
}
private static void handleContagion(EntityLivingBase entity) {
World world = entity.worldObj;
if(!entity.worldObj.isRemote) {
Random rand = entity.getRNG();
int minute = 60 * 20;
int hour = 60 * minute;
int contagion = HbmLivingProps.getContagion(entity);
if(entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
int randSlot = rand.nextInt(player.inventory.mainInventory.length);
ItemStack stack = player.inventory.getStackInSlot(randSlot);
if(rand.nextInt(100) == 0) {
stack = player.inventory.armorItemInSlot(rand.nextInt(4));
}
//only affect unstackables (e.g. tools and armor) so that the NBT tag's stack restrictions isn't noticeable
if(stack != null && stack.getMaxStackSize() == 1) {
if(contagion > 0) {
if(!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setBoolean("ntmContagion", true);
} else {
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("ntmContagion")) {
HbmLivingProps.setContagion(player, 3 * hour);
}
}
}
}
if(contagion > 0) {
HbmLivingProps.setContagion(entity, contagion - 1);
//aerial transmission only happens once a second 5 minutes into the contagion
if(contagion < (2 * hour + 55 * minute) && contagion % 20 == 0) {
double range = entity.isWet() ? 16D : 2D; //avoid rain, just avoid it
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(entity, entity.boundingBox.expand(range, range, range));
for(Entity ent : list) {
if(ent instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) ent;
if(HbmLivingProps.getContagion(living) <= 0) {
HbmLivingProps.setContagion(living, 3 * hour);
}
}
if(ent instanceof EntityItem) {
ItemStack stack = ((EntityItem)ent).getEntityItem();
if(!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setBoolean("ntmContagion", true);
}
}
}
//one hour in, add rare and subtle screen fuckery
if(contagion < 2 * hour && rand.nextInt(1000) == 0) {
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 20, 0));
}
//two hours in, give 'em the full blast
if(contagion < 1 * hour && rand.nextInt(100) == 0) {
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 60, 0));
entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 300, 4));
}
//T-30 minutes, take damage every 20 seconds
if(contagion < 30 * minute && rand.nextInt(400) == 0) {
entity.attackEntityFrom(DamageSource.magic, 1F);
}
//T-5 minutes, take damage every 5 seconds
if(contagion < 5 * minute && rand.nextInt(100) == 0) {
entity.attackEntityFrom(DamageSource.magic, 2F);
}
//end of contagion, drop dead
if(contagion == 0) {
entity.attackEntityFrom(DamageSource.magic, 1000F);
}
}
}
}
}

View File

@ -796,6 +796,7 @@ public class ModItems {
public static Item syringe_metal_psycho;
public static Item syringe_metal_super;
public static Item syringe_taint;
public static Item syringe_mkunicorn;
public static Item radaway;
public static Item radaway_strong;
public static Item radaway_flush;
@ -3112,6 +3113,7 @@ public class ModItems {
syringe_metal_psycho = new ItemSyringe().setUnlocalizedName("syringe_metal_psycho").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_metal_psycho");
syringe_metal_super = new ItemSyringe().setUnlocalizedName("syringe_metal_super").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_metal_super");
syringe_taint = new ItemSyringe().setUnlocalizedName("syringe_taint").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_taint");
syringe_mkunicorn = new ItemSyringe().setUnlocalizedName("syringe_mkunicorn").setFull3D().setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":syringe_mkunicorn");
med_bag = new ItemSyringe().setUnlocalizedName("med_bag").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":med_bag");
radaway = new ItemSyringe().setUnlocalizedName("radaway").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":radaway");
radaway_strong = new ItemSyringe().setUnlocalizedName("radaway_strong").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":radaway_strong");
@ -7137,6 +7139,7 @@ public class ModItems {
GameRegistry.registerItem(syringe_metal_psycho, syringe_metal_psycho.getUnlocalizedName());
GameRegistry.registerItem(syringe_metal_super, syringe_metal_super.getUnlocalizedName());
GameRegistry.registerItem(syringe_taint, syringe_taint.getUnlocalizedName());
GameRegistry.registerItem(syringe_mkunicorn, syringe_mkunicorn.getUnlocalizedName());
GameRegistry.registerItem(med_bag, med_bag.getUnlocalizedName());
GameRegistry.registerItem(radaway, radaway.getUnlocalizedName());
GameRegistry.registerItem(radaway_strong, radaway_strong.getUnlocalizedName());

View File

@ -5,6 +5,7 @@ import java.util.Random;
import com.hbm.config.VersatileConfig;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.ArmorModHandler;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IPartiallyFillable;
@ -24,6 +25,7 @@ import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemSyringe extends Item {
@ -547,6 +549,12 @@ public class ItemSyringe extends Item {
}
}
if(this == ModItems.syringe_mkunicorn) {
if(!world.isRemote) {
HbmLivingProps.setContagion(entity, 3 * 60 * 60 * 20);;
}
}
return false;
}
@ -608,5 +616,9 @@ public class ItemSyringe extends Item {
if(this == ModItems.gun_kit_2) {
list.add("Repairs all weapons in hotbar by 50%");
}
if(this == ModItems.syringe_mkunicorn) {
list.add(EnumChatFormatting.RED + "?");
}
}
}

View File

@ -77,6 +77,7 @@ import com.hbm.tileentity.turret.*;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class ClientProxy extends ServerProxy {
@ -575,7 +576,9 @@ public class ClientProxy extends ServerProxy {
@Override
public void registerRenderInfo()
{
MinecraftForge.EVENT_BUS.register(new ModEventHandlerClient());
ModEventHandlerClient handler = new ModEventHandlerClient();
MinecraftForge.EVENT_BUS.register(handler);
FMLCommonHandler.instance().bus().register(handler);
AdvancedModelLoader.registerModelHandler(new HmfModelLoader());

View File

@ -109,6 +109,7 @@ import net.minecraftforge.event.entity.EntityEvent.EnteringChunk;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
@ -382,6 +383,27 @@ public class ModEventHandler {
}
}
@SubscribeEvent
public void onLivingDrop(LivingDropsEvent event) {
if(!event.entityLiving.worldObj.isRemote) {
boolean contaminated = HbmLivingProps.getContagion(event.entityLiving) > 0;
if(contaminated) {
for(EntityItem item : event.drops) {
ItemStack stack = item.getEntityItem();
if(!stack.hasTagCompound()) {
stack.stackTagCompound = new NBTTagCompound();
}
stack.stackTagCompound.setBoolean("ntmContagion", true);
}
}
}
}
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
@ -678,6 +700,9 @@ public class ModEventHandler {
EntityLivingBase e = event.entityLiving;
if(HbmLivingProps.getContagion(e) > 0)
event.ammount *= 2F;
for(int i = 1; i < 5; i++) {
ItemStack armor = e.getEquipmentInSlot(i);

View File

@ -36,6 +36,7 @@ import com.hbm.render.util.RenderAccessoryUtility;
import com.hbm.render.util.RenderOverhead;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.render.util.SoyuzPronter;
import com.hbm.render.world.RenderNTMSkybox;
import com.hbm.sound.MovingSoundChopper;
import com.hbm.sound.MovingSoundChopperMine;
import com.hbm.sound.MovingSoundCrashing;
@ -52,6 +53,8 @@ import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@ -72,7 +75,9 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderSurface;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
@ -541,6 +546,26 @@ public class ModEventHandlerClient {
GL11.glPopMatrix();
}
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onClientTickLast(ClientTickEvent event) {
if(event.phase == Phase.START) {
World world = Minecraft.getMinecraft().theWorld;
if(world != null && world.provider instanceof WorldProviderSurface && !RenderNTMSkybox.didLastRender) {
IRenderHandler sky = world.provider.getSkyRenderer();
if(!(sky instanceof RenderNTMSkybox)) {
world.provider.setSkyRenderer(new RenderNTMSkybox(sky));
}
}
RenderNTMSkybox.didLastRender = false;
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderWorldLastEvent(RenderWorldLastEvent event) {
@ -633,7 +658,7 @@ public class ModEventHandlerClient {
private static final ResourceLocation digammaStar = new ResourceLocation("hbm:textures/misc/star_digamma.png");
@SideOnly(Side.CLIENT)
@SubscribeEvent
//@SubscribeEvent
public void onRenderDigammaStar(RenderWorldLastEvent event) {
World world = Minecraft.getMinecraft().theWorld;

View File

@ -0,0 +1,83 @@
package com.hbm.render.world;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
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 RenderNTMSkybox extends IRenderHandler { //why an abstract class uses the I-prefix is beyond me but ok, alright, whatever
/*
* To get the terrain render order right, making a sky rendering handler is absolutely necessary. Turns out MC can only handle one of these, so what do we do?
* We make out own renderer, grab any existing renderers that are already occupying the slot, doing what is effectively chainloading while adding our own garbage.
* If somebody does the exact same thing as we do we might be screwed due to increasingly long recursive loops but we can fix that too, no worries.
*/
private IRenderHandler parent;
private static final ResourceLocation digammaStar = new ResourceLocation("hbm:textures/misc/star_digamma.png");
/*
* If the skybox was rendered successfully in the last tick (even from other mods' skyboxes chainloading this one) then we don't need to add it again
*/
public static boolean didLastRender = false;
public RenderNTMSkybox(IRenderHandler parent) {
this.parent = parent;
}
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
GL11.glPushMatrix();
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 1, 1, 0);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(140.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-40.0F, 0.0F, 0.0F, 1.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(digammaStar);
float var12 = 2.5F;
double dist = 150D;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-var12, dist, -var12, 0.0D, 0.0D);
tessellator.addVertexWithUV(var12, dist, -var12, 0.0D, 1.0D);
tessellator.addVertexWithUV(var12, dist, var12, 1.0D, 1.0D);
tessellator.addVertexWithUV(-var12, dist, var12, 1.0D, 0.0D);
tessellator.draw();
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPopMatrix();
didLastRender = true;
if(parent != null) {
parent.render(partialTicks, world, mc);
} else{
RenderGlobal rg = Minecraft.getMinecraft().renderGlobal;
world.provider.setSkyRenderer(null);
//rg.renderSky(partialTicks);
world.provider.setSkyRenderer(this);
}
}
}

View File

@ -2357,6 +2357,7 @@ item.syringe_metal_medx.name=Med-X
item.syringe_metal_psycho.name=Psycho
item.syringe_metal_stimpak.name=Stimpak
item.syringe_metal_super.name=Super Stimpak
item.syringe_mkunicorn.name=MKUNICORN
item.syringe_poison.name=Giftspritze
item.syringe_taint.name=Wässrige Schmutzinjektion
item.t45_boots.name=T45-Powerrüstungsstiefel

View File

@ -2423,6 +2423,7 @@ item.syringe_metal_medx.name=Med-X
item.syringe_metal_psycho.name=Psycho
item.syringe_metal_stimpak.name=Stimpak
item.syringe_metal_super.name=Super Stimpak
item.syringe_mkunicorn.name=MKUNICORN
item.syringe_poison.name=Poisonous Injection
item.syringe_taint.name=Watery Taint Injection
item.t45_boots.name=T45 Power Armor Boots

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B