i lied, get fucked

This commit is contained in:
Bob 2025-08-31 12:08:19 +02:00
parent 4fba0fc42a
commit 53d1323604
22 changed files with 2765 additions and 33 deletions

View File

@ -205,6 +205,7 @@ public class EntityMappings {
addEntity(EntityFallingBlockNT.class, "entity_falling_block_nt", 1000);
addEntity(EntityBoatRubber.class, "entity_rubber_boat", 250, false);
addEntity(EntityMissileStealth.class, "entity_missile_stealth", 1000);
addEntity(EntityCoin.class, "entity_coin", 1000);
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);

View File

@ -2,14 +2,19 @@ package com.hbm.entity.projectile;
import java.util.List;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
@ -144,9 +149,30 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa
if(!this.worldObj.isRemote && this.doesImpactEntities()) {
Entity hitEntity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.headingX, this.headingY, this.headingZ).expand(1.0D, 1.0D, 1.0D));
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.headingX, this.headingY, this.headingZ).expand(1.0D, 1.0D, 1.0D));
double nearest = 0.0D;
MovingObjectPosition nonPenImpact = null;
MovingObjectPosition coinHit = null;
double closestCoin = 0;
EntityCoin hitCoin = null;
for(Entity entity : list) {
if(entity.isDead) continue;
if(entity instanceof EntityCoin) {
double hitbox = 0.3F;
AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox);
MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos);
if(hitMop != null) {
double dist = pos.distanceTo(hitMop.hitVec);
if(closestCoin == 0 || dist < closestCoin) {
closestCoin = dist;
hitCoin = (EntityCoin) entity;
coinHit = hitMop;
}
}
}
}
for(int j = 0; j < list.size(); ++j) {
Entity entity = (Entity) list.get(j);
@ -158,13 +184,14 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa
if(hitMop != null) {
double dist = pos.distanceTo(hitMop.hitVec);
// if penetration is enabled, run impact for all intersecting entities
if(this.doesPenetrate()) {
this.onImpact(new MovingObjectPosition(entity, hitMop.hitVec));
if(hitCoin == null || dist < closestCoin) {
this.onImpact(new MovingObjectPosition(entity, hitMop.hitVec));
}
} else {
double dist = pos.distanceTo(hitMop.hitVec);
if(dist < nearest || nearest == 0.0D) {
hitEntity = entity;
nearest = dist;
@ -179,6 +206,86 @@ public class EntityBulletBeamBase extends Entity implements IEntityAdditionalSpa
if(!this.doesPenetrate() && hitEntity != null) {
mop = new MovingObjectPosition(hitEntity, nonPenImpact.hitVec);
}
if(hitCoin != null) {
Vec3 vec = Vec3.createVectorHelper(coinHit.hitVec.xCoord - posX, coinHit.hitVec.yCoord - posY, coinHit.hitVec.zCoord - posZ);
this.beamLength = vec.lengthVector();
double range = 50;
List<Entity> targets = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord, coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord).expand(range, range, range));
Entity nearestCoin = null;
Entity nearestPlayer = null;
Entity nearestMob = null;
Entity nearestOther = null;
double coinDist = 0;
double playerDist = 0;
double mobDist = 0;
double otherDist = 0;
hitCoin.setDead();
// well i mean we could just uuse a single var for all variants and then overwrite stuff
// when we run into things with higher priority. however i can't be assed fuck off
for(Entity entity : targets) {
if(entity == this.getThrower()) continue;
if(entity.isDead) continue;
double dist = entity.getDistanceToEntity(hitCoin);
if(dist > range) continue;
if(entity instanceof EntityCoin) {
if(coinDist == 0 || dist < coinDist) {
coinDist = dist;
nearestCoin = entity;
}
} else if(entity instanceof EntityPlayer) {
if(playerDist == 0 || dist < playerDist) {
playerDist = dist;
nearestPlayer = entity;
}
} else if(entity instanceof EntityMob) {
if(mobDist == 0 || dist < mobDist) {
mobDist = dist;
nearestMob = entity;
}
} else if(entity instanceof EntityLivingBase) {
if(otherDist == 0 || dist < otherDist) {
otherDist = dist;
nearestOther = entity;
}
}
}
// ternary of shame
Entity target = nearestCoin != null ? nearestCoin :
nearestPlayer != null ? nearestPlayer :
nearestMob != null ? nearestMob :
nearestOther != null ? nearestOther : null;
if(target != null) {
EntityBulletBeamBase newBeam = new EntityBulletBeamBase(hitCoin.getThrower() != null ? hitCoin.getThrower() : this.thrower, this.config, this.damage * 1.25F);
newBeam.setPosition(coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord);
Vec3 delta = Vec3.createVectorHelper(target.posX - newBeam.posX, (target.posY + target.height / 2D) - newBeam.posY, target.posZ - newBeam.posZ);
newBeam.setRotationsFromVector(delta);
newBeam.performHitscanExternal(delta.lengthVector());
worldObj.spawnEntityInWorld(newBeam);
} else {
EntityBulletBeamBase newBeam = new EntityBulletBeamBase(hitCoin.getThrower() != null ? hitCoin.getThrower() : this.thrower, this.config, this.damage * 1.25F);
newBeam.setPosition(coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord);
newBeam.setRotationsFromVector(Vec3.createVectorHelper(rand.nextGaussian() * 0.5, -1, rand.nextGaussian() * 0.5));
newBeam.performHitscanExternal(100);
worldObj.spawnEntityInWorld(newBeam);
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "largeexplode");
data.setFloat("size", 1.5F);
data.setByte("count", (byte)1);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord), new TargetPoint(worldObj.provider.dimensionId, coinHit.hitVec.xCoord, coinHit.hitVec.yCoord, coinHit.hitVec.zCoord, 100));
return;
}
}
if(mop != null) {

View File

@ -0,0 +1,51 @@
package com.hbm.entity.projectile;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityCoin extends EntityThrowableInterp {
public EntityCoin(World world) {
super(world);
this.setSize(1F, 1F);
this.yOffset = 0.5F;
}
@Override
public void onUpdate() {
super.onUpdate();
}
public void setPosition(double x, double y, double z) {
this.posX = x;
this.posY = y;
this.posZ = z;
float f = this.width / 2.0F;
this.boundingBox.setBounds(x - f, y - this.yOffset + this.ySize, z - f, x + f, y - this.yOffset + this.ySize + this.height, z + f);
}
@Override
protected void onImpact(MovingObjectPosition mop) {
if(mop.typeOfHit == mop.typeOfHit.BLOCK) this.setDead();
}
@Override
protected float getAirDrag() {
return 1F;
}
@Override
public double getGravityVelocity() {
return 0.02D;
}
@Override
public boolean canBeCollidedWith() {
return true;
}
@Override
public boolean canAttackWithItem() {
return true;
}
}

View File

@ -1,7 +1,6 @@
package com.hbm.handler.ae2;
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
import com.hbm.tileentity.TileEntityProxyCombo;
import cpw.mods.fml.common.Optional;
@ -14,47 +13,47 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import net.minecraft.item.ItemStack;
@Optional.InterfaceList({@Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2")})
@Optional.InterfaceList({ @Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2") })
public class ArcFurnaceLargeMEInventory implements IMEInventory<IAEItemStack> {
private TileEntityMachineArcFurnaceLarge afl;
private TileEntityMachineArcFurnaceLarge afl;
public ArcFurnaceLargeMEInventory(TileEntityMachineArcFurnaceLarge afl) {
this.afl = afl;
}
public ArcFurnaceLargeMEInventory(TileEntityMachineArcFurnaceLarge afl) {
this.afl = afl;
}
@Override
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) {
ItemStack is = input.getItemStack();
is = afl.distributeInput(is, type == Actionable.MODULATE);
@Override
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) {
ItemStack is = input.getItemStack();
is = afl.distributeInput(is, type == Actionable.MODULATE);
if(is == null) return null;
return AEApi.instance().storage().createItemStack(is);
}
return AEApi.instance().storage().createItemStack(is);
}
@Override
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) {
@Override
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) {
ItemStack is = request.getItemStack();
is = afl.collectRequested(is, mode == Actionable.MODULATE);
if(is == null) return null;
return AEApi.instance().storage().createItemStack(is);
}
}
@Override
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
ItemStack is;
@Override
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
ItemStack is;
for(int i = 0; i < 25; i++) {
is = afl.getAvailableItemFromSlot(i);
if(is != null) out.add(AEApi.instance().storage().createItemStack(is));
if(is != null)
out.add(AEApi.instance().storage().createItemStack(is));
}
return out;
}
@Override
public StorageChannel getChannel() {
return StorageChannel.ITEMS;
}
return out;
}
@Override
public StorageChannel getChannel() {
return StorageChannel.ITEMS;
}
}

View File

@ -1476,7 +1476,7 @@ public class ModItems {
public static Item gun_aberrator_eott;
public static Item gun_double_barrel;
public static Item gun_double_barrel_sacred_dragon;
public static Item gun_n_i_4_n_i; // we GET THERE when we GET THERE
public static Item gun_n_i_4_n_i;
public static Item gun_charge_thrower;
@ -6400,6 +6400,7 @@ public class ModItems {
GameRegistry.registerItem(gun_aberrator_eott, gun_aberrator_eott.getUnlocalizedName());
GameRegistry.registerItem(gun_double_barrel, gun_double_barrel.getUnlocalizedName());
GameRegistry.registerItem(gun_double_barrel_sacred_dragon, gun_double_barrel_sacred_dragon.getUnlocalizedName());
GameRegistry.registerItem(gun_n_i_4_n_i, gun_n_i_4_n_i.getUnlocalizedName());
GameRegistry.registerItem(gun_fireext, gun_fireext.getUnlocalizedName());
GameRegistry.registerItem(gun_charge_thrower, gun_charge_thrower.getUnlocalizedName());

View File

@ -19,6 +19,7 @@ import com.hbm.items.IKeybindReceiver;
import com.hbm.items.armor.ArmorTrenchmaster;
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineInfinite;
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
@ -173,7 +174,9 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD, I
GunConfig config = getConfig(stack, i);
for(Receiver rec : config.getReceivers(stack)) {
IMagazine mag = rec.getMagazine(stack);
list.add(I18nUtil.resolveKey("gui.weapon.ammo") + ": " + mag.getIconForHUD(stack, player).getDisplayName() + " " + mag.reportAmmoStateForHUD(stack, player));
if(!(mag instanceof MagazineInfinite)) {
list.add(I18nUtil.resolveKey("gui.weapon.ammo") + ": " + mag.getIconForHUD(stack, player).getDisplayName() + " " + mag.reportAmmoStateForHUD(stack, player));
}
float dmg = rec.getBaseDamage(stack);
list.add(I18nUtil.resolveKey("gui.weapon.baseDamage") + ": " + FORMAT_DMG.format(dmg));
if(mag.getType(stack, player.inventory) instanceof BulletConfig) {

View File

@ -101,6 +101,7 @@ public class GunFactoryClient {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_double_barrel, new ItemRenderDoubleBarrel(ResourceManager.double_barrel_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_double_barrel_sacred_dragon, new ItemRenderDoubleBarrel(ResourceManager.double_barrel_sacred_dragon_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_charge_thrower, new ItemRenderChargeThrower());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_n_i_4_n_i, new ItemRenderNI4NI());
//PROJECTILES
ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
@ -226,6 +227,8 @@ public class GunFactoryClient {
p35800.setRendererBeam(LegoClient.RENDER_CRACKLE);
p35800_bl.setRendererBeam(LegoClient.RENDER_BLACK_LIGHTNING);
ni4ni_arc.setRendererBeam(LegoClient.RENDER_NI4NI_BOLT);
ct_hook.setRenderer(LegoClient.RENDER_CT_HOOK);
ct_mortar.setRenderer(LegoClient.RENDER_CT_MORTAR);

View File

@ -397,6 +397,25 @@ public class LegoClient {
GL11.glPopMatrix();
RenderArcFurnace.fullbright(false);
};
public static BiConsumer<EntityBulletBeamBase, Float> RENDER_NI4NI_BOLT = (bullet, interp) -> {
RenderArcFurnace.fullbright(true);
double age = MathHelper.clamp_double(1D - ((double) bullet.ticksExisted - 2 + interp) / (double) bullet.getBulletConfig().expires, 0, 1);
GL11.glPushMatrix();
GL11.glRotatef(180 - bullet.rotationYaw, 0, 1F, 0);
GL11.glRotatef(-bullet.rotationPitch - 90, 1F, 0, 0);
double scale = 5D;
GL11.glScaled(age * scale, 1, age * scale);
GL11.glTranslated(0, bullet.beamLength, 0);
GL11.glRotatef(-90, 0, 0, 1);
renderBulletStandard(Tessellator.instance, 0xAAD2E5, 0xffffff, bullet.beamLength, true);
GL11.glPopMatrix();
RenderArcFurnace.fullbright(false);
};
public static BiConsumer<EntityBulletBeamBase, Float> RENDER_LASER_RED = (bullet, interp) -> {
renderStandardLaser(bullet, interp, 0x80, 0x15, 0x15);

View File

@ -5,6 +5,7 @@ import java.util.function.BiFunction;
import java.util.function.Consumer;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.entity.projectile.EntityCoin;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
@ -14,7 +15,9 @@ import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.impl.ItemGunNI4NI;
import com.hbm.items.weapon.sedna.mags.MagazineBelt;
import com.hbm.items.weapon.sedna.mags.MagazineInfinite;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.main.MainRegistry;
import com.hbm.render.anim.BusAnimation;
@ -22,11 +25,13 @@ import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass;
import com.hbm.util.Vec3NT;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
@ -41,6 +46,8 @@ public class XFactoryAccelerator {
public static BulletConfig coil_tungsten;
public static BulletConfig coil_ferrouranium;
public static BulletConfig ni4ni_arc;
public static Consumer<Entity> LAMBDA_UPDATE_TUNGSTEN = (entity) -> {breakInPath(entity, 1.25F); };
public static Consumer<Entity> LAMBDA_UPDATE_FERRO = (entity) -> { breakInPath(entity, 2.5F); };
@ -89,6 +96,9 @@ public class XFactoryAccelerator {
.setOnUpdate(LAMBDA_UPDATE_TUNGSTEN);
coil_ferrouranium = new BulletConfig().setItem(EnumAmmo.COIL_FERROURANIUM).setVel(7.5F).setLife(50).setDoesPenetrate(true).setDamageFalloffByPen(false).setSpectral(true)
.setOnUpdate(LAMBDA_UPDATE_FERRO);
ni4ni_arc = new BulletConfig().setupDamageClass(DamageClass.PHYSICAL).setBeam().setLife(5).setThresholdNegation(10F).setArmorPiercing(0.2F).setRenderRotations(false).setDoesPenetrate(false)
.setOnBeamImpact(BulletConfig.LAMBDA_BEAM_HIT);
tauChargeMag.addConfigs(tau_uranium_charge);
@ -118,6 +128,18 @@ public class XFactoryAccelerator {
.setupStandardConfiguration()
.anim(LAMBDA_COILGUN_ANIMS).orchestra(Orchestras.ORCHESTRA_COILGUN)
).setUnlocalizedName("gun_coilgun");
ModItems.gun_n_i_4_n_i = new ItemGunNI4NI(WeaponQuality.SPECIAL, new GunConfig()
.dura(0).draw(5).inspect(39).crosshair(Crosshair.CIRCLE)
.rec(new Receiver(0)
.dmg(35F).delay(10).sound("hbm:weapon.coilgunShoot", 1.0F, 1.0F)
.mag(new MagazineInfinite(ni4ni_arc))
.offset(0.75, -0.0625, -0.1875D)
.setupStandardFire().fire(Lego.LAMBDA_NOWEAR_FIRE))
.setupStandardConfiguration()
.ps(LAMBDA_NI4NI_SECONDARY_PRESS)
.anim(LAMBDA_NI4NI_ANIMS).orchestra(Orchestras.ORCHESTRA_COILGUN)
).setUnlocalizedName("gun_n_i_4_n_i");
}
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TAU_PRIMARY_RELEASE = (stack, ctx) -> {
@ -163,6 +185,27 @@ public class XFactoryAccelerator {
}
};
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_NI4NI_SECONDARY_PRESS = (stack, ctx) -> {
if(ctx.getPlayer() == null) return;
EntityPlayer player = ctx.getPlayer();
if(ItemGunNI4NI.getCoinCount(stack) > 0) {
Vec3NT vec = new Vec3NT(player.getLookVec()).multiply(0.8D);
EntityCoin coin = new EntityCoin(player.worldObj);
coin.setPosition(player.posX, player.posY + player.getEyeHeight() - coin.yOffset - 0.125, player.posZ);
coin.motionX = vec.xCoord;
coin.motionY = vec.yCoord + 0.5;
coin.motionZ = vec.zCoord;
coin.rotationYaw = player.rotationYaw;
coin.setThrower(player);
player.worldObj.spawnEntityInWorld(coin);
player.worldObj.playSoundAtEntity(player, "random.orb", 1.0F, 1F + player.getRNG().nextFloat() * 0.25F);
ItemGunNI4NI.setCoinCount(stack, ItemGunNI4NI.getCoinCount(stack) - 1);
}
};
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_TAU = (stack, ctx) -> { };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_RECOIL_COILGUN = (stack, ctx) -> {
@ -196,4 +239,20 @@ public class XFactoryAccelerator {
if(type == AnimType.RELOAD) return new BusAnimation().addBus("RELOAD", new BusAnimationSequence().addPos(1, 0, 0, 250).addPos(1, 0, 0, 500).addPos(0, 0, 0, 250));
return null;
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_NI4NI_ANIMS = (stack, type) -> {
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-360 * 2, 0, 0, 500));
case CYCLE:
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence().addPos(aiming ? -5 : -30, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 150, IType.SIN_FULL))
.addBus("DRUM", new BusAnimationSequence().hold(50).addPos(0, 0, 120, 300, IType.SIN_FULL));
case INSPECT: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(-360 * 3, 0, 0, 750).hold(100).addPos(0, 0, 0, 750));
}
return null;
};
}

View File

@ -0,0 +1,110 @@
package com.hbm.items.weapon.sedna.impl;
import java.util.List;
import com.hbm.items.ICustomizable;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.util.ChatBuilder;
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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class ItemGunNI4NI extends ItemGunBaseNT implements ICustomizable {
public ItemGunNI4NI(WeaponQuality quality, GunConfig... cfg) {
super(quality, cfg);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isHeld) {
super.onUpdate(stack, world, entity, slot, isHeld);
if(!world.isRemote) {
if(this.getCoinCount(stack) < 4) {
this.setCoinCharge(stack, this.getCoinCharge(stack) + 1);
if(this.getCoinCharge(stack) >= 80) {
this.setCoinCharge(stack, 0);
int newCount = this.getCoinCount(stack) + 1;
this.setCoinCount(stack, newCount);
if(isHeld) {
world.playSoundAtEntity(entity, "hbm:item.techBoop", 1.0F, 1.25F + newCount * 0.125F);
}
}
}
}
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
list.add("Now, don't get the wrong idea.");
list.add("I " + EnumChatFormatting.RED + "fucking hate " + EnumChatFormatting.GRAY + "this game.");
list.add("I didn't do this for you, I did it for sea.");
super.addInformation(stack, player, list, ext);
}
@Override
public void customize(EntityPlayer player, ItemStack stack, String... args) {
if(args.length == 0) {
resetColors(stack);
player.addChatComponentMessage(ChatBuilder.start("Colors reset!").color(EnumChatFormatting.GREEN).flush());
return;
}
if(args.length != 3) {
resetColors(stack);
player.addChatComponentMessage(ChatBuilder.start("Requires three hexadecimal colors!").color(EnumChatFormatting.RED).flush());
return;
}
try {
int dark = Integer.parseInt(args[0], 16);
int light = Integer.parseInt(args[1], 16);
int grip = Integer.parseInt(args[2], 16);
if(dark < 0 || dark > 0xffffff || light < 0 || light > 0xffffff || grip < 0 || grip > 0xffffff) {
player.addChatComponentMessage(ChatBuilder.start("Colors must range from 0 to FFFFFF!").color(EnumChatFormatting.RED).flush());
return;
}
setColors(stack, dark, light, grip);
player.addChatComponentMessage(ChatBuilder.start("Colors set!").color(EnumChatFormatting.GREEN).flush());
} catch(Throwable ex) {
player.addChatComponentMessage(ChatBuilder.start(ex.getLocalizedMessage()).color(EnumChatFormatting.RED).flush());
}
}
public static void resetColors(ItemStack stack) {
if(!stack.hasTagCompound()) return;
stack.stackTagCompound.removeTag("colors");
}
public static void setColors(ItemStack stack, int dark, int light, int grip) {
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
stack.stackTagCompound.setIntArray("colors", new int[] {dark, light, grip});
}
public static int[] getColors(ItemStack stack) {
if(!stack.hasTagCompound() || !stack.stackTagCompound.hasKey("colors")) return null;
int[] colors = stack.stackTagCompound.getIntArray("colors");
if(colors.length != 3) return null;
return colors;
}
public static final String KEY_COIN_COUNT = "coincount";
public static final String KEY_COIN_CHARGE = "coincharge";
public static int getCoinCount(ItemStack stack) { return getValueInt(stack, KEY_COIN_COUNT); }
public static void setCoinCount(ItemStack stack, int value) { setValueInt(stack, KEY_COIN_COUNT, value); }
public static int getCoinCharge(ItemStack stack) { return getValueInt(stack, KEY_COIN_CHARGE); }
public static void setCoinCharge(ItemStack stack, int value) { setValueInt(stack, KEY_COIN_CHARGE, value); }
}

View File

@ -0,0 +1,39 @@
package com.hbm.items.weapon.sedna.mags;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.particle.SpentCasing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class MagazineInfinite implements IMagazine {
public BulletConfig type;
public MagazineInfinite(BulletConfig type) {
this.type = type;
}
@Override
public Object getType(ItemStack stack, IInventory inventory) {
return this.type;
}
@Override public void setType(ItemStack stack, Object type) { }
@Override public int getCapacity(ItemStack stack) { return 9999; }
@Override public int getAmount(ItemStack stack, IInventory inventory) { return 9999; }
@Override public void setAmount(ItemStack stack, int amount) { }
@Override public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) { }
@Override public boolean canReload(ItemStack stack, IInventory inventory) { return false; }
@Override public void initNewType(ItemStack stack, IInventory inventory) { }
@Override public void reloadAction(ItemStack stack, IInventory inventory) { }
@Override public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) { return new ItemStack(ModItems.nothing); }
@Override public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player) { return ""; }
@Override public SpentCasing getCasing(ItemStack stack, IInventory inventory) { return this.type.casing; }
@Override public void setAmountBeforeReload(ItemStack stack, int amount) { }
@Override public int getAmountBeforeReload(ItemStack stack) { return 9999; }
@Override public void setAmountAfterReload(ItemStack stack, int amount) { }
@Override public int getAmountAfterReload(ItemStack stack) { return 9999; }
}

View File

@ -619,6 +619,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityArtilleryRocket.class, new RenderArtilleryRocket());
RenderingRegistry.registerEntityRenderingHandler(EntityCog.class, new RenderCog());
RenderingRegistry.registerEntityRenderingHandler(EntitySawblade.class, new RenderSawblade());
RenderingRegistry.registerEntityRenderingHandler(EntityCoin.class, new RenderCoin());
RenderingRegistry.registerEntityRenderingHandler(EntityChemical.class, new RenderChemical());
RenderingRegistry.registerEntityRenderingHandler(EntityMist.class, new RenderMist());
RenderingRegistry.registerEntityRenderingHandler(EntityFireLingering.class, new RenderMist());

View File

@ -907,6 +907,7 @@ public class ResourceManager {
public static final IModelCustom aberrator = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/aberrator.obj")).asVBO();
public static final IModelCustom mas36 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/mas36.obj")).asVBO();
public static final IModelCustom charge_thrower = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/charge_thrower.obj")).asVBO();
public static final IModelCustom n_i_4_n_i = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/n_i_4_n_i.obj")).asVBO();
public static final HashMap<String, BusAnimation> spas_12_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/spas12.json"));
public static final HashMap<String, BusAnimation> congolake_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/congolake.json"));
@ -1044,6 +1045,8 @@ public class ResourceManager {
public static final ResourceLocation charge_thrower_hook_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/charge_thrower_hook.png");
public static final ResourceLocation charge_thrower_mortar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/charge_thrower_mortar.png");
public static final ResourceLocation charge_thrower_rocket_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/charge_thrower_rocket.png");
public static final ResourceLocation n_i_4_n_i_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/n_i_4_n_i.png");
public static final ResourceLocation n_i_4_n_i_greyscale_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/n_i_4_n_i_greyscale.png");
public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png");

View File

@ -0,0 +1,39 @@
package com.hbm.render.entity.projectile;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import com.hbm.render.loader.HFRWavefrontObject;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelCustom;
public class RenderCoin extends Render {
public static final IModelCustom coin = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/trinkets/chip.obj")).asVBO();
public static final ResourceLocation coin_tex = new ResourceLocation(RefStrings.MODID, "textures/models/trinkets/chip_gold.png");
@Override
public void doRender(Entity coin, double x, double y, double z, float f0, float f1) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotatef(coin.prevRotationYaw + (coin.rotationYaw - coin.prevRotationYaw) * f1 - 90.0F, 0.0F, -1.0F, 0.0F);
GL11.glRotated((coin.ticksExisted + f1) * 45, 0, 0, 1);
double scale = 0.125D;
GL11.glScaled(scale, scale, scale);
this.bindEntityTexture(coin);
this.coin.renderAll();
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return coin_tex;
}
}

View File

@ -0,0 +1,189 @@
package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.impl.ItemGunNI4NI;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.tileentity.RenderArcFurnace;
import com.hbm.util.ColorUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
public class ItemRenderNI4NI extends ItemRenderWeaponBase {
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }
@Override
public float getViewFOV(ItemStack stack, float fov) {
float aimingProgress = ItemGunBaseNT.prevAimingProgress + (ItemGunBaseNT.aimingProgress - ItemGunBaseNT.prevAimingProgress) * interp;
return fov * (1 - aimingProgress * 0.33F);
}
@Override
public void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 1);
float offset = 0.8F;
standardAimingTransform(stack,
-1.0F * offset, -1F * offset, 1F * offset,
0, -5 / 8D, 0.125);
}
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
int[] color = ItemGunNI4NI.getColors(stack);
int dark = 0xffffff;
int light = 0xffffff;
int grip = 0xffffff;
if(color != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.n_i_4_n_i_greyscale_tex);
dark = color[0];
light = color[1];
grip = color[2];
} else {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.n_i_4_n_i_tex);
}
double scale = 0.3125D;
GL11.glScaled(scale, scale, scale);
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
double[] drum = HbmAnimations.getRelevantTransformation("DRUM");
GL11.glTranslated(0, 0, -2.25);
GL11.glRotated(equip[0], 1, 0, 0);
GL11.glTranslated(0, 0, 2.25);
GL11.glTranslated(0, -1, -6);
GL11.glRotated(recoil[0], 1, 0, 0);
GL11.glTranslated(0, 1, 6);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
GL11.glColor3f(ColorUtil.fr(dark), ColorUtil.fg(dark), ColorUtil.fb(dark));
ResourceManager.n_i_4_n_i.renderPart("FrameDark");
GL11.glColor3f(ColorUtil.fr(grip), ColorUtil.fg(grip), ColorUtil.fb(grip));
ResourceManager.n_i_4_n_i.renderPart("Grip");
GL11.glColor3f(ColorUtil.fr(light), ColorUtil.fg(light), ColorUtil.fb(light));
ResourceManager.n_i_4_n_i.renderPart("FrameLight");
GL11.glPushMatrix();
GL11.glTranslated(0, 1.1875D, 0);
GL11.glRotated(drum[2], 0, 0, 1);
GL11.glTranslated(0, -1.1875D, 0);
ResourceManager.n_i_4_n_i.renderPart("Cylinder");
RenderArcFurnace.fullbright(true);
GL11.glColor3f(1F, 1F, 1F);
ResourceManager.n_i_4_n_i.renderPart("CylinderHighlights");
RenderArcFurnace.fullbright(false);
GL11.glPopMatrix();
RenderArcFurnace.fullbright(true);
ResourceManager.n_i_4_n_i.renderPart("Barrel");
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0F, 1F, 0F);
int coinCount = ItemGunNI4NI.getCoinCount(stack);
if(coinCount > 3) ResourceManager.n_i_4_n_i.renderPart("Coin1");
if(coinCount > 2) ResourceManager.n_i_4_n_i.renderPart("Coin2");
if(coinCount > 1) ResourceManager.n_i_4_n_i.renderPart("Coin3");
if(coinCount > 0) ResourceManager.n_i_4_n_i.renderPart("Coin4");
GL11.glEnable(GL11.GL_TEXTURE_2D);
RenderArcFurnace.fullbright(false);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(0, 0.75, 4);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
GL11.glScaled(0.125, 0.125, 0.125);
this.renderLaserFlash(gun.lastShot[0], 75, 7.5, 0xFFFFFF);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
@Override
public void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
GL11.glTranslated(0, 0.25, 3);
double scale = 1.5D;
GL11.glScaled(scale, scale, scale);
}
@Override
public void setupInv(ItemStack stack) {
super.setupInv(stack);
double scale = 2.5D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(0, 0, 0);
}
@Override
public void setupModTable(ItemStack stack) {
double scale = -15D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(90, 0, 1, 0);
GL11.glTranslated(0, -0.5, 0);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
GL11.glEnable(GL11.GL_ALPHA_TEST);
int[] color = ItemGunNI4NI.getColors(stack);
int dark = 0xffffff;
int light = 0xffffff;
int grip = 0xffffff;
if(color != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.n_i_4_n_i_greyscale_tex);
dark = color[0];
light = color[1];
grip = color[2];
} else {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.n_i_4_n_i_tex);
}
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glColor3f(ColorUtil.fr(light), ColorUtil.fg(light), ColorUtil.fb(light));
ResourceManager.n_i_4_n_i.renderPart("FrameLight");
ResourceManager.n_i_4_n_i.renderPart("Cylinder");
GL11.glColor3f(ColorUtil.fr(grip), ColorUtil.fg(grip), ColorUtil.fb(grip));
ResourceManager.n_i_4_n_i.renderPart("Grip");
GL11.glColor3f(ColorUtil.fr(dark), ColorUtil.fg(dark), ColorUtil.fb(dark));
ResourceManager.n_i_4_n_i.renderPart("FrameDark");
GL11.glColor3f(1F, 1F, 1F);
RenderArcFurnace.fullbright(true);
ResourceManager.n_i_4_n_i.renderPart("CylinderHighlights");
ResourceManager.n_i_4_n_i.renderPart("Barrel");
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0F, 1F, 0F);
ResourceManager.n_i_4_n_i.renderPart("Coin1");
ResourceManager.n_i_4_n_i.renderPart("Coin2");
ResourceManager.n_i_4_n_i.renderPart("Coin3");
ResourceManager.n_i_4_n_i.renderPart("Coin4");
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
RenderArcFurnace.fullbright(false);
GL11.glShadeModel(GL11.GL_FLAT);
}
}

View File

@ -70,6 +70,30 @@ public class ColorUtil {
return 0xFFFFFF;
}
}
public static int ir(int color) {
return (color & 0xff0000) >> 16;
}
public static int ig(int color) {
return (color & 0x00ff00) >> 8;
}
public static int ib(int color) {
return (color & 0x0000ff) >> 0;
}
public static float fr(int color) {
return ir(color) / 255F;
}
public static float fg(int color) {
return ig(color) / 255F;
}
public static float fb(int color) {
return ib(color) / 255F;
}
@SideOnly(Side.CLIENT)
public static int getMedianBrightnessColorFromStack(ItemStack stack) {

View File

@ -2167,6 +2167,7 @@ item.gun_minigun.name=Minigun
item.gun_minigun_dual.name=Doppelete Miniguns
item.gun_minigun_lacunae.name=Lacunae
item.gun_missile_launcher.name=Raketenwerfer
item.gun_n_i_4_n_i.name=N I 4 N I
item.gun_pepperbox.name=Bündelrevolver
item.gun_panzerschreck.name=Panzerschreck
item.gun_quadro.name=Vierfachraketenwerfer

View File

@ -3009,6 +3009,7 @@ item.gun_minigun.name=Minigun
item.gun_minigun_dual.name=Dual Miniguns
item.gun_minigun_lacunae.name=Lacunae
item.gun_missile_launcher.name=Missile Launcher
item.gun_n_i_4_n_i.name=N I 4 N I
item.gun_pepperbox.name=Pepperbox
item.gun_panzerschreck.name=Panzerschreck
item.gun_quadro.name=Quad Rocket Launcher

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB