deploy surface-to-yellow-one missile

This commit is contained in:
Boblet 2025-05-23 13:40:48 +02:00
parent 4fc41c631d
commit 148ba19721
22 changed files with 1148 additions and 1682 deletions

View File

@ -6,5 +6,10 @@
* Area and block abilities can now be toggled independently from each other. For example, the vein miner ability can be combined with silk touch * Area and block abilities can now be toggled independently from each other. For example, the vein miner ability can be combined with silk touch
* Clicking on the same ability allows switching between levels * Clicking on the same ability allows switching between levels
* Updated textures for the armor and gun modification tables * Updated textures for the armor and gun modification tables
* Ported the fire extinguisher to the SEDNA gun system, eliminating the final remaining ItemGunBase gun
* Water extinguishers can now wash away foam blocks
## Fixed ## Fixed
* Conveyor ejectors should now correctly place items onto the back of splitters instead of on the output belts
* Fixed strand caster fluid gauges going out of bounds
* Fixed arc welder and soldering station not changing buffer size based on upgrade, preventing use of higher overdrive tiers

View File

@ -13,10 +13,6 @@ public class BulletConfigSyncingUtil {
public static int TEST_CONFIG = i++; public static int TEST_CONFIG = i++;
public static int FEXT_NORMAL = i++;
public static int FEXT_FOAM = i++;
public static int FEXT_SAND = i++;
public static int TURBINE = i++; public static int TURBINE = i++;
public static int MASKMAN_BULLET = i++; public static int MASKMAN_BULLET = i++;
@ -33,10 +29,6 @@ public class BulletConfigSyncingUtil {
public static void loadConfigsForSync() { public static void loadConfigsForSync() {
configSet.put(FEXT_NORMAL, GunEnergyFactory.getFextConfig());
configSet.put(FEXT_FOAM, GunEnergyFactory.getFextFoamConfig());
configSet.put(FEXT_SAND, GunEnergyFactory.getFextSandConfig());
configSet.put(TURBINE, GunEnergyFactory.getTurbineConfig()); configSet.put(TURBINE, GunEnergyFactory.getTurbineConfig());
configSet.put(MASKMAN_BULLET, GunNPCFactory.getMaskmanBullet()); configSet.put(MASKMAN_BULLET, GunNPCFactory.getMaskmanBullet());

View File

@ -17,6 +17,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
@Deprecated
public class BulletConfiguration implements Cloneable { public class BulletConfiguration implements Cloneable {
//what item this specific configuration consumes //what item this specific configuration consumes
@ -130,15 +131,12 @@ public class BulletConfiguration implements Cloneable {
public static final int STYLE_FOLLY = 5; public static final int STYLE_FOLLY = 5;
public static final int STYLE_ROCKET = 6; public static final int STYLE_ROCKET = 6;
public static final int STYLE_STINGER = 7; public static final int STYLE_STINGER = 7;
public static final int STYLE_NUKE = 8;
public static final int STYLE_MIRV = 9;
public static final int STYLE_GRENADE = 10; public static final int STYLE_GRENADE = 10;
public static final int STYLE_BF = 11; public static final int STYLE_BF = 11;
public static final int STYLE_ORB = 12; public static final int STYLE_ORB = 12;
public static final int STYLE_METEOR = 13; public static final int STYLE_METEOR = 13;
public static final int STYLE_APDS = 14; public static final int STYLE_APDS = 14;
public static final int STYLE_BLADE = 15; public static final int STYLE_BLADE = 15;
public static final int STYLE_BARREL = 16;
public static final int STYLE_TAU = 17; public static final int STYLE_TAU = 17;
public static final int STYLE_LEADBURSTER = 18; public static final int STYLE_LEADBURSTER = 18;
@ -174,13 +172,6 @@ public class BulletConfiguration implements Cloneable {
return this; return this;
} }
public BulletConfiguration setToGuided() {
this.bntUpdate = BulletConfigFactory.getLaserSteering();
this.doesRicochet = false;
return this;
}
public BulletConfiguration getChlorophyte() { public BulletConfiguration getChlorophyte() {
this.bntUpdate = BulletConfigFactory.getHomingBehavior(30, 180); this.bntUpdate = BulletConfigFactory.getHomingBehavior(30, 180);
this.bntHurt = BulletConfigFactory.getPenHomingBehavior(); this.bntHurt = BulletConfigFactory.getPenHomingBehavior();

View File

@ -12,6 +12,7 @@ import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@Deprecated
public class GunConfiguration implements Cloneable { public class GunConfiguration implements Cloneable {
/** /**
@ -46,10 +47,6 @@ public class GunConfiguration implements Cloneable {
public boolean isCentered; public boolean isCentered;
//texture overlay when sneaking //texture overlay when sneaking
public ResourceLocation scopeTexture; public ResourceLocation scopeTexture;
//whether the FOV multiplier should be absolute or multiplicative to other modifiers, multiplicative mode is experimental!
public boolean absoluteFOV = true;
//the target FOV/multiplied FOV modifier when sneaking
public float zoomFOV = 0.0F;
//duration of every animation cycle, used also for how quickly a burst fire rifle can fire //duration of every animation cycle, used also for how quickly a burst fire rifle can fire
public int firingDuration; public int firingDuration;
@ -123,9 +120,4 @@ public class GunConfiguration implements Cloneable {
public static final String RSOUND_GRENADE_NEW = "hbm:weapon.glReload"; public static final String RSOUND_GRENADE_NEW = "hbm:weapon.glReload";
public static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload"; public static final String RSOUND_FATMAN = "hbm:weapon.fatmanReload";
public GunConfiguration silenced() {
this.firingSound = "hbm:weapon.silencerShoot";
return this;
}
} }

View File

@ -7,7 +7,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.base.Functions;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -87,14 +86,10 @@ public class AvailableAbilities {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(List list) { public void addInformation(List list) {
List<Map.Entry<IBaseAbility, Integer>> toolAbilities = abilities.entrySet().stream().filter(entry -> List<Map.Entry<IBaseAbility, Integer>> toolAbilities = abilities.entrySet().stream()
(entry.getKey() instanceof IToolAreaAbility && entry.getKey() != IToolAreaAbility.NONE) || .filter(entry -> (entry.getKey() instanceof IToolAreaAbility && entry.getKey() != IToolAreaAbility.NONE)
(entry.getKey() instanceof IToolHarvestAbility && entry.getKey() != IToolHarvestAbility.NONE) || (entry.getKey() instanceof IToolHarvestAbility && entry.getKey() != IToolHarvestAbility.NONE))
).sorted( .sorted(Comparator.comparing(Map.Entry<IBaseAbility, Integer>::getKey).thenComparing(Map.Entry<IBaseAbility, Integer>::getValue)).collect(Collectors.toList());
Comparator
.comparing(Map.Entry<IBaseAbility, Integer>::getKey)
.thenComparing(Map.Entry<IBaseAbility, Integer>::getValue)
).collect(Collectors.toList());
if(!toolAbilities.isEmpty()) { if(!toolAbilities.isEmpty()) {
list.add("Abilities: "); list.add("Abilities: ");
@ -111,13 +106,8 @@ public class AvailableAbilities {
list.add("Alt-click to open customization GUI!"); list.add("Alt-click to open customization GUI!");
} }
List<Map.Entry<IBaseAbility, Integer>> weaponAbilities = abilities.entrySet().stream().filter(entry -> List<Map.Entry<IBaseAbility, Integer>> weaponAbilities = abilities.entrySet().stream().filter(entry -> (entry.getKey() instanceof IWeaponAbility && entry.getKey() != IWeaponAbility.NONE))
(entry.getKey() instanceof IWeaponAbility && entry.getKey() != IWeaponAbility.NONE) .sorted(Comparator.comparing(Map.Entry<IBaseAbility, Integer>::getKey).thenComparing(Map.Entry<IBaseAbility, Integer>::getValue)).collect(Collectors.toList());
).sorted(
Comparator
.comparing(Map.Entry<IBaseAbility, Integer>::getKey)
.thenComparing(Map.Entry<IBaseAbility, Integer>::getValue)
).collect(Collectors.toList());
if(!weaponAbilities.isEmpty()) { if(!weaponAbilities.isEmpty()) {
list.add("Weapon modifiers: "); list.add("Weapon modifiers: ");

View File

@ -10,17 +10,13 @@ import com.hbm.config.ToolConfig;
import com.hbm.explosion.ExplosionNT; import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNT.ExAttrib; import com.hbm.explosion.ExplosionNT.ExAttrib;
import com.hbm.handler.ThreeInts; import com.hbm.handler.ThreeInts;
import com.hbm.inventory.OreDictManager;
import com.hbm.items.tool.ItemToolAbility; import com.hbm.items.tool.ItemToolAbility;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public interface IToolAreaAbility extends IBaseAbility { public interface IToolAreaAbility extends IBaseAbility {
// Should call tool.breakExtraBlock on a bunch of blocks. // Should call tool.breakExtraBlock on a bunch of blocks.
@ -106,7 +102,8 @@ public interface IToolAreaAbility extends IBaseAbility {
return false; return false;
} }
private final List<ThreeInts> offsets = new ArrayList<ThreeInts>(3*3*3-1) {{ private final List<ThreeInts> offsets = new ArrayList<ThreeInts>(3 * 3 * 3 - 1) {
{
for(int dx = -1; dx <= 1; dx++) { for(int dx = -1; dx <= 1; dx++) {
for(int dy = -1; dy <= 1; dy++) { for(int dy = -1; dy <= 1; dy++) {
for(int dz = -1; dz <= 1; dz++) { for(int dz = -1; dz <= 1; dz++) {
@ -116,7 +113,8 @@ public interface IToolAreaAbility extends IBaseAbility {
} }
} }
} }
}}; }
};
private void recurse(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, ItemToolAbility tool, int depth, int radius) { private void recurse(World world, int x, int y, int z, int refX, int refY, int refZ, EntityPlayer player, ItemToolAbility tool, int depth, int radius) {
List<ThreeInts> shuffledOffsets = new ArrayList<>(offsets); List<ThreeInts> shuffledOffsets = new ArrayList<>(offsets);
@ -165,8 +163,10 @@ public interface IToolAreaAbility extends IBaseAbility {
} }
private boolean isSameBlock(Block b1, Block b2) { private boolean isSameBlock(Block b1, Block b2) {
if(b1 == b2) return true; if(b1 == b2)
if((b1 == Blocks.redstone_ore && b2 == Blocks.lit_redstone_ore) || (b1 == Blocks.lit_redstone_ore && b2 == Blocks.redstone_ore)) return true; return true;
if((b1 == Blocks.redstone_ore && b2 == Blocks.lit_redstone_ore) || (b1 == Blocks.lit_redstone_ore && b2 == Blocks.redstone_ore))
return true;
return false; return false;
} }

View File

@ -23,8 +23,8 @@ import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.world.World; import net.minecraft.world.World;
public interface IToolHarvestAbility extends IBaseAbility { public interface IToolHarvestAbility extends IBaseAbility {
public default void preHarvestAll(int level, World world, EntityPlayer player) {}
public default void preHarvestAll(int level, World world, EntityPlayer player) { }
public default void postHarvestAll(int level, World world, EntityPlayer player) { } public default void postHarvestAll(int level, World world, EntityPlayer player) { }
// You must call harvestBlock to actually break the block. // You must call harvestBlock to actually break the block.
@ -85,7 +85,8 @@ public interface IToolHarvestAbility extends IBaseAbility {
public void postHarvestAll(int level, World world, EntityPlayer player) { public void postHarvestAll(int level, World world, EntityPlayer player) {
// ToC-ToU mismatch should be impossible // ToC-ToU mismatch should be impossible
// because both calls happen on the same tick. // because both calls happen on the same tick.
// Even if can be forced somehow, the player doesn't gain any benefit from it. // Even if can be forced somehow, the player doesn't gain any
// benefit from it.
ItemStack stack = player.getHeldItem(); ItemStack stack = player.getHeldItem();
EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch); EnchantmentUtil.removeEnchantment(stack, Enchantment.silkTouch);
} }
@ -129,7 +130,8 @@ public interface IToolHarvestAbility extends IBaseAbility {
public void postHarvestAll(int level, World world, EntityPlayer player) { public void postHarvestAll(int level, World world, EntityPlayer player) {
// ToC-ToU mismatch should be impossible // ToC-ToU mismatch should be impossible
// because both calls happen on the same tick. // because both calls happen on the same tick.
// Even if can be forced somehow, the player doesn't gain any benefit from it. // Even if can be forced somehow, the player doesn't gain any
// benefit from it.
ItemStack stack = player.getHeldItem(); ItemStack stack = player.getHeldItem();
EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune); EnchantmentUtil.removeEnchantment(stack, Enchantment.fortune);
} }

View File

@ -4,7 +4,6 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockBobble.BobbleType; import com.hbm.blocks.generic.BlockBobble.BobbleType;
import com.hbm.handler.threading.PacketThreading; import com.hbm.handler.threading.PacketThreading;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.potion.HbmPotion; import com.hbm.potion.HbmPotion;
import com.hbm.util.ContaminationUtil; import com.hbm.util.ContaminationUtil;
@ -53,7 +52,8 @@ public interface IWeaponAbility extends IBaseAbility {
} }
@Override @Override
public void onHit(int level, World world, EntityPlayer player, Entity victim, Item tool) {} public void onHit(int level, World world, EntityPlayer player, Entity victim, Item tool) {
}
}; };
public static final IWeaponAbility RADIATION = new IWeaponAbility() { public static final IWeaponAbility RADIATION = new IWeaponAbility() {
@ -115,9 +115,11 @@ public interface IWeaponAbility extends IBaseAbility {
if(victim instanceof EntityLivingBase) { if(victim instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) victim; EntityLivingBase living = (EntityLivingBase) victim;
if(living.getHealth() <= 0) return; if(living.getHealth() <= 0)
return;
living.setHealth(living.getHealth() - amount); living.setHealth(living.getHealth() - amount);
if(living.getHealth() <= 0) living.onDeath(DamageSource.magic); if(living.getHealth() <= 0)
living.onDeath(DamageSource.magic);
player.heal(amount); player.heal(amount);
} }
} }
@ -270,7 +272,8 @@ public interface IWeaponAbility extends IBaseAbility {
data.setDouble("motion", 0.1D); data.setDouble("motion", 0.1D);
data.setString("mode", "blockdust"); data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block)); data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, living.posX, living.posY + living.height * 0.5, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50)); PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, living.posX, living.posY + living.height * 0.5, living.posZ),
new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
} }
world.playSoundEffect(living.posX, living.posY + living.height * 0.5, living.posZ, "hbm:weapon.chainsaw", 0.5F, 1.0F); world.playSoundEffect(living.posX, living.posY + living.height * 0.5, living.posZ, "hbm:weapon.chainsaw", 0.5F, 1.0F);

View File

@ -12,7 +12,8 @@ public class ToolPreset {
public IToolHarvestAbility harvestAbility = IToolHarvestAbility.NONE; public IToolHarvestAbility harvestAbility = IToolHarvestAbility.NONE;
public int harvestAbilityLevel = 0; public int harvestAbilityLevel = 0;
public ToolPreset() {} public ToolPreset() {
}
public ToolPreset(IToolAreaAbility areaAbility, IToolHarvestAbility harvestAbility) { public ToolPreset(IToolAreaAbility areaAbility, IToolHarvestAbility harvestAbility) {
this.areaAbility = areaAbility; this.areaAbility = areaAbility;

View File

@ -4,26 +4,11 @@ import java.util.List;
import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.*; import com.hbm.entity.projectile.EntityBulletBaseNT.*;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.explosion.ExplosionNukeSmall.MukeParams;
import com.hbm.handler.BulletConfiguration; import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.lib.Library;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorRegistry;
import com.hbm.util.ArmorRegistry.HazardClass;
import com.hbm.util.BobMathUtil; import com.hbm.util.BobMathUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
public class BulletConfigFactory { public class BulletConfigFactory {
@ -57,37 +42,6 @@ public class BulletConfigFactory {
return bullet; return bullet;
} }
public static BulletConfiguration standardPistolConfig() {
BulletConfiguration bullet = standardBulletConfig();
bullet.style = BulletConfiguration.STYLE_PISTOL;
bullet.plink = BulletConfiguration.PLINK_BULLET;
return bullet;
}
public static BulletConfiguration standardBuckshotConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 5.0F;
bullet.spread = defaultSpread * 10F;
bullet.wear = 10;
bullet.bulletsMin = 6;
bullet.bulletsMax = 8;
bullet.gravity = 0D;
bullet.maxAge = 100;
bullet.doesRicochet = true;
bullet.ricochetAngle = 5;
bullet.HBRC = 10;
bullet.LBRC = 95;
bullet.bounceMod = 0.8;
bullet.doesPenetrate = false;
bullet.doesBreakGlass = true;
bullet.style = BulletConfiguration.STYLE_PELLET;
bullet.plink = BulletConfiguration.PLINK_BULLET;
bullet.leadChance = 10;
return bullet;
}
public static BulletConfiguration standardRocketConfig() { public static BulletConfiguration standardRocketConfig() {
@ -141,218 +95,6 @@ public class BulletConfigFactory {
return bullet; return bullet;
} }
public static BulletConfiguration standardShellConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 3.0F;
bullet.spread = defaultSpread;
bullet.wear = 10;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.gravity = 0.005D;
bullet.maxAge = 300;
bullet.doesRicochet = true;
bullet.ricochetAngle = 10;
bullet.HBRC = 2;
bullet.LBRC = 100;
bullet.bounceMod = 0.8;
bullet.doesPenetrate = false;
bullet.doesBreakGlass = false;
bullet.style = BulletConfiguration.STYLE_GRENADE;
bullet.plink = BulletConfiguration.PLINK_GRENADE;
bullet.vPFX = "smoke";
return bullet;
}
public static BulletConfiguration standardNukeConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.velocity = 3.0F;
bullet.spread = defaultSpread;
bullet.wear = 10;
bullet.bulletsMin = 1;
bullet.bulletsMax = 1;
bullet.dmgMin = 1000;
bullet.dmgMax = 1000;
bullet.gravity = 0.025D;
bullet.maxAge = 300;
bullet.doesRicochet = false;
bullet.ricochetAngle = 0;
bullet.HBRC = 0;
bullet.LBRC = 0;
bullet.bounceMod = 1.0;
bullet.doesPenetrate = true;
bullet.doesBreakGlass = false;
bullet.style = BulletConfiguration.STYLE_NUKE;
bullet.plink = BulletConfiguration.PLINK_GRENADE;
return bullet;
}
/*
* Sizes:
* 0 - safe
* 1 - tot
* 2 - small
* 3 - medium
* 4 - big
*/
public static void nuclearExplosion(Entity entity, int x, int y, int z, MukeParams params) {
if(!entity.worldObj.isRemote) {
double posX = entity.posX;
double posY = entity.posY + 0.5;
double posZ = entity.posZ;
if(y >= 0) {
posX = x + 0.5;
posY = y + 1.5;
posZ = z + 0.5;
}
ExplosionNukeSmall.explode(entity.worldObj, posX, posY, posZ, params);
}
}
public static void makeFlechette(BulletConfiguration bullet) {
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
bulletnt.getStuck(x, y, z, sideHit);
};
}
public static IBulletImpactBehaviorNT getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) {
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
for(Entity e : hit) {
if(!Library.isObstructed(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, e.posX, e.posY + e.getEyeHeight(), e.posZ)) {
e.setFire(5);
if(e instanceof EntityLivingBase) {
PotionEffect eff = new PotionEffect(HbmPotion.phosphorus.id, duration, 0, true);
eff.getCurativeItems().clear();
((EntityLivingBase)e).addPotionEffect(eff);
}
}
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", count);
data.setDouble("motion", motion);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
if(bullet.worldObj.rand.nextFloat() < hazeChance) {
NBTTagCompound haze = new NBTTagCompound();
haze.setString("type", "haze");
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(haze, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 150));
}
}
};
return impact;
}
public static IBulletImpactBehaviorNT getGasEffect(final int radius, final int duration) {
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
for(Entity e : hit) {
if(!Library.isObstructed(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, e.posX, e.posY + e.getEyeHeight(), e.posZ)) {
if(e instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) e;
if(ArmorRegistry.hasAllProtection(entity, 3, HazardClass.GAS_LUNG))
continue;
PotionEffect eff0 = new PotionEffect(Potion.poison.id, duration, 2, true);
PotionEffect eff1 = new PotionEffect(Potion.digSlowdown.id, duration, 2, true);
PotionEffect eff2 = new PotionEffect(Potion.weakness.id, duration, 4, true);
PotionEffect eff3 = new PotionEffect(Potion.wither.id, (int)Math.ceil(duration * 0.1), 0, true);
eff0.getCurativeItems().clear();
eff1.getCurativeItems().clear();
eff2.getCurativeItems().clear();
eff3.getCurativeItems().clear();
entity.addPotionEffect(eff0);
entity.addPotionEffect(eff1);
entity.addPotionEffect(eff2);
entity.addPotionEffect(eff3);
}
}
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "cloud");
data.setInteger("count", 15);
data.setDouble("motion", 0.1D);
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
};
return impact;
}
public static IBulletUpdateBehaviorNT getLaserSteering() {
IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer))
return;
if(Vec3.createVectorHelper(bullet.posX - bullet.getThrower().posX, bullet.posY - bullet.getThrower().posY, bullet.posZ - bullet.getThrower().posZ).lengthVector() > 100)
return;
MovingObjectPosition mop = Library.rayTrace((EntityPlayer)bullet.getThrower(), 200, 1);
if(mop == null || mop.hitVec == null)
return;
Vec3 vec = Vec3.createVectorHelper(mop.hitVec.xCoord - bullet.posX, mop.hitVec.yCoord - bullet.posY, mop.hitVec.zCoord - bullet.posZ);
if(vec.lengthVector() < 3)
return;
vec = vec.normalize();
double speed = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ).lengthVector();
bullet.motionX = vec.xCoord * speed;
bullet.motionY = vec.yCoord * speed;
bullet.motionZ = vec.zCoord * speed;
}
};
return onUpdate;
}
public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) { public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) {
IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() { IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {

View File

@ -1,96 +0,0 @@
package com.hbm.handler.guncfg;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.handler.BulletConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.Ammo240Shell;
import com.hbm.items.ModItems;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
public class GunCannonFactory {
protected static SpentCasing CASINNG240MM;
static {
CASINNG240MM = new SpentCasing(CasingType.BOTTLENECK).setScale(7.5F).setBounceMotion(0.5F, 0.5F).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(1F, 0.5D, 60, 20);
}
public static BulletConfiguration getShellConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_shell.stackFromEnum(Ammo240Shell.STOCK));
bullet.dmgMin = 25;
bullet.dmgMax = 35;
bullet.explosive = 4F;
bullet.blockDamage = false;
bullet.spentCasing = CASINNG240MM.register("240MM"); //same instance everywhere, only register once
return bullet;
}
public static BulletConfiguration getShellExplosiveConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_shell.stackFromEnum(Ammo240Shell.EXPLOSIVE));
bullet.dmgMin = 35;
bullet.dmgMax = 45;
bullet.explosive = 4F;
bullet.blockDamage = true;
bullet.spentCasing = CASINNG240MM;
return bullet;
}
public static BulletConfiguration getShellAPConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_shell.stackFromEnum(Ammo240Shell.APFSDS_T));
bullet.dmgMin = 50;
bullet.dmgMax = 55;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_APDS;
bullet.spentCasing = CASINNG240MM;
return bullet;
}
public static BulletConfiguration getShellDUConfig() {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_shell.stackFromEnum(Ammo240Shell.APFSDS_DU));
bullet.dmgMin = 70;
bullet.dmgMax = 80;
bullet.doesPenetrate = true;
bullet.style = BulletConfiguration.STYLE_APDS;
bullet.spentCasing = CASINNG240MM;
return bullet;
}
public static BulletConfiguration getShellW9Config() {
BulletConfiguration bullet = BulletConfigFactory.standardShellConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_shell.stackFromEnum(Ammo240Shell.W9));
bullet.dmgMin = 100;
bullet.dmgMax = 150;
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
};
bullet.spentCasing = CASINNG240MM;
return bullet;
}
}

View File

@ -1,317 +1,11 @@
package com.hbm.handler.guncfg; package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletImpactBehaviorNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletUpdateBehaviorNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration; import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.AmmoFireExt;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IRepairable;
import com.hbm.tileentity.IRepairable.EnumExtinguishType;
import com.hbm.util.CompatExternal;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class GunEnergyFactory { public class GunEnergyFactory {
public static GunConfiguration getExtConfig() {
GunConfiguration config = new GunConfiguration();
config.rateOfFire = 1;
config.roundsPerCycle = 1;
config.gunMode = GunConfiguration.MODE_NORMAL;
config.firingMode = GunConfiguration.FIRE_AUTO;
config.reloadDuration = 20;
config.reloadSoundEnd = false;
config.firingDuration = 0;
config.ammoCap = 300; //good for 15 seconds of continued spray
config.durability = 10000;
config.reloadType = GunConfiguration.RELOAD_FULL;
config.allowsInfinity = true;
config.crosshair = Crosshair.L_CIRCLE;
config.firingSound = "hbm:weapon.extinguisher";
config.reloadSound = "hbm:weapon.flamerReload";
config.name = "PROTEX Fire Exinguisher 6kg";
config.manufacturer = EnumGunManufacturer.GLORIA;
config.config = new ArrayList<Integer>();
config.config.add(BulletConfigSyncingUtil.FEXT_NORMAL);
config.config.add(BulletConfigSyncingUtil.FEXT_FOAM);
config.config.add(BulletConfigSyncingUtil.FEXT_SAND);
return config;
}
public static BulletConfiguration getFextConfig() {
BulletConfiguration bullet = new BulletConfiguration();
bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.WATER));
bullet.ammoCount = 300;
bullet.velocity = 0.75F;
bullet.spread = 0.025F;
bullet.wear = 1;
bullet.bulletsMin = 2;
bullet.bulletsMax = 3;
bullet.dmgMin = 0;
bullet.dmgMax = 0;
bullet.gravity = 0.04D;
bullet.maxAge = 100;
bullet.doesRicochet = false;
bullet.doesPenetrate = true;
bullet.doesBreakGlass = false;
bullet.style = BulletConfiguration.STYLE_NONE;
bullet.plink = BulletConfiguration.PLINK_NONE;
bullet.bntHurt = (bulletEntity, target) -> { target.extinguish(); };
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
if(!bullet.worldObj.isRemote) {
int ix = (int)Math.floor(bullet.posX);
int iy = (int)Math.floor(bullet.posY);
int iz = (int)Math.floor(bullet.posZ);
boolean fizz = false;
for(int i = -1; i <= 1; i++) {
for(int j = -1; j <= 1; j++) {
for(int k = -1; k <= 1; k++) {
if(bullet.worldObj.getBlock(ix + i, iy + j, iz + k) == Blocks.fire) {
bullet.worldObj.setBlock(ix + i, iy + j, iz + k, Blocks.air);
fizz = true;
}
}
}
}
TileEntity core = CompatExternal.getCoreFromPos(bullet.worldObj, ix, iy, iz);
if(core instanceof IRepairable) {
((IRepairable) core).tryExtinguish(bullet.worldObj, ix, iy, iz, EnumExtinguishType.WATER);
}
if(fizz)
bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
}
}
};
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(Blocks.water));
data.setDouble("posX", bullet.posX);
data.setDouble("posY", bullet.posY);
data.setDouble("posZ", bullet.posZ);
data.setDouble("mX", bullet.motionX + bullet.worldObj.rand.nextGaussian() * 0.05);
data.setDouble("mY", bullet.motionY - 0.2 + bullet.worldObj.rand.nextGaussian() * 0.05);
data.setDouble("mZ", bullet.motionZ + bullet.worldObj.rand.nextGaussian() * 0.05);
MainRegistry.proxy.effectNT(data);
} else {
int x = (int)Math.floor(bullet.posX);
int y = (int)Math.floor(bullet.posY);
int z = (int)Math.floor(bullet.posZ);
if(bullet.worldObj.getBlock(x, y, z) == ModBlocks.volcanic_lava_block && bullet.worldObj.getBlockMetadata(x, y, z) == 0) {
bullet.worldObj.setBlock(x, y, z, Blocks.obsidian);
bullet.setDead();
}
}
}
};
return bullet;
}
public static BulletConfiguration getFextFoamConfig() {
BulletConfiguration bullet = getFextConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.FOAM));
bullet.spread = 0.05F;
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
if(!bullet.worldObj.isRemote) {
int ix = (int)Math.floor(bullet.posX);
int iy = (int)Math.floor(bullet.posY);
int iz = (int)Math.floor(bullet.posZ);
boolean fizz = false;
for(int i = -1; i <= 1; i++) {
for(int j = -1; j <= 1; j++) {
for(int k = -1; k <= 1; k++) {
Block b = bullet.worldObj.getBlock(ix + i, iy + j, iz + k);
if(b.getMaterial() == Material.fire) {
bullet.worldObj.setBlock(ix + i, iy + j, iz + k, Blocks.air);
fizz = true;
}
}
}
}
Block b = bullet.worldObj.getBlock(ix, iy, iz);
TileEntity core = CompatExternal.getCoreFromPos(bullet.worldObj, ix, iy, iz);
if(core instanceof IRepairable) {
((IRepairable) core).tryExtinguish(bullet.worldObj, ix, iy, iz, EnumExtinguishType.FOAM);
return;
}
if(b.isReplaceable(bullet.worldObj, ix, iy, iz) && ModBlocks.foam_layer.canPlaceBlockAt(bullet.worldObj, ix, iy, iz)) {
if(b != ModBlocks.foam_layer) {
bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.foam_layer);
} else {
int meta = bullet.worldObj.getBlockMetadata(ix, iy, iz);
if(meta < 6)
bullet.worldObj.setBlockMetadataWithNotify(ix, iy, iz, meta + 1, 3);
else
bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.block_foam);
}
}
if(fizz)
bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
}
}
};
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(ModBlocks.block_foam));
data.setDouble("posX", bullet.posX);
data.setDouble("posY", bullet.posY);
data.setDouble("posZ", bullet.posZ);
data.setDouble("mX", bullet.motionX + bullet.worldObj.rand.nextGaussian() * 0.05);
data.setDouble("mY", bullet.motionY - 0.2 + bullet.worldObj.rand.nextGaussian() * 0.05);
data.setDouble("mZ", bullet.motionZ + bullet.worldObj.rand.nextGaussian() * 0.05);
MainRegistry.proxy.effectNT(data);
}
}
};
return bullet;
}
public static BulletConfiguration getFextSandConfig() {
BulletConfiguration bullet = getFextConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.SAND));
bullet.spread = 0.1F;
bullet.bntHurt = null; // does not extinguish entities
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
if(!bullet.worldObj.isRemote) {
int ix = (int)Math.floor(bullet.posX);
int iy = (int)Math.floor(bullet.posY);
int iz = (int)Math.floor(bullet.posZ);
Block b = bullet.worldObj.getBlock(ix, iy, iz);
TileEntity core = CompatExternal.getCoreFromPos(bullet.worldObj, ix, iy, iz);
if(core instanceof IRepairable) {
((IRepairable) core).tryExtinguish(bullet.worldObj, ix, iy, iz, EnumExtinguishType.SAND);
return;
}
if((b.isReplaceable(bullet.worldObj, ix, iy, iz) || b == ModBlocks.sand_boron_layer) && ModBlocks.sand_boron_layer.canPlaceBlockAt(bullet.worldObj, ix, iy, iz)) {
if(b != ModBlocks.sand_boron_layer) {
bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.sand_boron_layer);
} else {
int meta = bullet.worldObj.getBlockMetadata(ix, iy, iz);
if(meta < 6)
bullet.worldObj.setBlockMetadataWithNotify(ix, iy, iz, meta + 1, 3);
else
bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.sand_boron);
}
if(b.getMaterial() == Material.fire)
bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
}
}
}
};
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(ModBlocks.sand_boron));
data.setDouble("posX", bullet.posX);
data.setDouble("posY", bullet.posY);
data.setDouble("posZ", bullet.posZ);
data.setDouble("mX", bullet.motionX + bullet.worldObj.rand.nextGaussian() * 0.1);
data.setDouble("mY", bullet.motionY - 0.2 + bullet.worldObj.rand.nextGaussian() * 0.1);
data.setDouble("mZ", bullet.motionZ + bullet.worldObj.rand.nextGaussian() * 0.1);
MainRegistry.proxy.effectNT(data);
}
}
};
return bullet;
}
public static BulletConfiguration getTurbineConfig() { public static BulletConfiguration getTurbineConfig() {
BulletConfiguration bullet = new BulletConfiguration(); BulletConfiguration bullet = new BulletConfiguration();

View File

@ -6,7 +6,6 @@ import com.hbm.handler.BucketHandler;
import com.hbm.handler.ability.IToolAreaAbility; import com.hbm.handler.ability.IToolAreaAbility;
import com.hbm.handler.ability.IToolHarvestAbility; import com.hbm.handler.ability.IToolHarvestAbility;
import com.hbm.handler.ability.IWeaponAbility; import com.hbm.handler.ability.IWeaponAbility;
import com.hbm.handler.guncfg.*;
import com.hbm.interfaces.ICustomWarhead.SaltedFuel.HalfLifeType; import com.hbm.interfaces.ICustomWarhead.SaltedFuel.HalfLifeType;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.fluid.tank.FluidTank;
@ -3790,7 +3789,6 @@ public class ModItems {
gun_b92_ammo = new GunB92Cell().setUnlocalizedName("gun_b92_ammo").setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92_ammo_alt"); gun_b92_ammo = new GunB92Cell().setUnlocalizedName("gun_b92_ammo").setMaxStackSize(1).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92_ammo_alt");
gun_b92 = new GunB92().setUnlocalizedName("gun_b92").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92"); gun_b92 = new GunB92().setUnlocalizedName("gun_b92").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_b92");
gun_fireext = new ItemGunBase(GunEnergyFactory.getExtConfig()).setUnlocalizedName("gun_fireext").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_fireext");
ToolMaterial matCrucible = EnumHelper.addToolMaterial("CRUCIBLE", 10, 3, 50.0F, 100.0F, 0); ToolMaterial matCrucible = EnumHelper.addToolMaterial("CRUCIBLE", 10, 3, 50.0F, 100.0F, 0);
crucible = new ItemCrucible(5000, 1F, matCrucible).setUnlocalizedName("crucible").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":crucible"); crucible = new ItemCrucible(5000, 1F, matCrucible).setUnlocalizedName("crucible").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":crucible");
@ -6374,7 +6372,6 @@ public class ModItems {
//Guns //Guns
GameRegistry.registerItem(gun_b92, gun_b92.getUnlocalizedName()); GameRegistry.registerItem(gun_b92, gun_b92.getUnlocalizedName());
GameRegistry.registerItem(gun_fireext, gun_fireext.getUnlocalizedName());
GameRegistry.registerItem(crucible, crucible.getUnlocalizedName()); GameRegistry.registerItem(crucible, crucible.getUnlocalizedName());
GameRegistry.registerItem(gun_debug, gun_debug.getUnlocalizedName()); GameRegistry.registerItem(gun_debug, gun_debug.getUnlocalizedName());
@ -6440,6 +6437,7 @@ public class ModItems {
GameRegistry.registerItem(gun_double_barrel, gun_double_barrel.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_double_barrel_sacred_dragon, gun_double_barrel_sacred_dragon.getUnlocalizedName());
GameRegistry.registerItem(gun_fireext, gun_fireext.getUnlocalizedName());
GameRegistry.registerItem(gun_charge_thrower, gun_charge_thrower.getUnlocalizedName()); GameRegistry.registerItem(gun_charge_thrower, gun_charge_thrower.getUnlocalizedName());
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName()); GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());

View File

@ -287,6 +287,7 @@ public class GunFactoryClient {
((ItemGunBaseNT) ModItems.gun_aberrator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_aberrator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_double_barrel) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_double_barrel) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_double_barrel_sacred_dragon) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_double_barrel_sacred_dragon) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_fireext) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_charge_thrower) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_charge_thrower) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR); ((ItemGunBaseNT) ModItems.gun_light_revolver_dani) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR);

View File

@ -1466,6 +1466,17 @@ public class Orchestras {
} }
}; };
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FIREEXT = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity;
if(entity.worldObj.isRemote) return;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pressureValve", 1F, 1F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CHARGE_THROWER = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CHARGE_THROWER = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
if(entity.worldObj.isRemote) return; if(entity.worldObj.isRemote) return;

View File

@ -25,24 +25,166 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.impl.ItemGunChargeThrower; import com.hbm.items.weapon.sedna.impl.ItemGunChargeThrower;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry;
import com.hbm.particle.helper.ExplosionCreator; import com.hbm.particle.helper.ExplosionCreator;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType; import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.tileentity.IRepairable;
import com.hbm.tileentity.IRepairable.EnumExtinguishType;
import com.hbm.util.CompatExternal;
import com.hbm.util.Vec3NT; 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.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.util.ForgeDirection;
public class XFactoryTool { public class XFactoryTool {
public static BulletConfig fext_water;
public static BulletConfig fext_foam;
public static BulletConfig fext_sand;
public static BulletConfig ct_hook; public static BulletConfig ct_hook;
public static BulletConfig ct_mortar; public static BulletConfig ct_mortar;
public static BulletConfig ct_mortar_charge; public static BulletConfig ct_mortar_charge;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_WATER_HIT = (bullet, mop) -> {
if(!bullet.worldObj.isRemote) {
int ix = mop.blockX;
int iy = mop.blockY;
int iz = mop.blockZ;
boolean fizz = false;
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) for(int k = -1; k <= 1; k++) {
Block block = bullet.worldObj.getBlock(ix + i, iy + j, iz + k);
if(block == Blocks.fire || block == ModBlocks.foam_layer || block == ModBlocks.block_foam) {
bullet.worldObj.setBlock(ix + i, iy + j, iz + k, Blocks.air);
fizz = true;
}
}
TileEntity core = CompatExternal.getCoreFromPos(bullet.worldObj, ix, iy, iz);
if(core instanceof IRepairable) ((IRepairable) core).tryExtinguish(bullet.worldObj, ix, iy, iz, EnumExtinguishType.WATER);
if(fizz) bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
bullet.setDead();
}
};
public static Consumer<Entity> LAMBDA_WATER_UPDATE = (bullet) -> {
if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(Blocks.water));
data.setDouble("posX", bullet.posX); data.setDouble("posY", bullet.posY); data.setDouble("posZ", bullet.posZ);
data.setDouble("mX", bullet.motionX + bullet.worldObj.rand.nextGaussian() * 0.05);
data.setDouble("mY", bullet.motionY - 0.2 + bullet.worldObj.rand.nextGaussian() * 0.05);
data.setDouble("mZ", bullet.motionZ + bullet.worldObj.rand.nextGaussian() * 0.05);
MainRegistry.proxy.effectNT(data);
} else {
int x = (int)Math.floor(bullet.posX);
int y = (int)Math.floor(bullet.posY);
int z = (int)Math.floor(bullet.posZ);
if(bullet.worldObj.getBlock(x, y, z) == ModBlocks.volcanic_lava_block && bullet.worldObj.getBlockMetadata(x, y, z) == 0) {
bullet.worldObj.setBlock(x, y, z, Blocks.obsidian);
bullet.setDead();
}
}
};
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_FOAM_HIT = (bullet, mop) -> {
if(!bullet.worldObj.isRemote) {
int ix = mop.blockX;
int iy = mop.blockY;
int iz = mop.blockZ;
boolean fizz = false;
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) for(int k = -1; k <= 1; k++) {
Block b = bullet.worldObj.getBlock(ix + i, iy + j, iz + k);
if(b.getMaterial() == Material.fire) {
bullet.worldObj.setBlock(ix + i, iy + j, iz + k, Blocks.air);
fizz = true;
}
}
TileEntity core = CompatExternal.getCoreFromPos(bullet.worldObj, ix, iy, iz);
if(core instanceof IRepairable) { ((IRepairable) core).tryExtinguish(bullet.worldObj, ix, iy, iz, EnumExtinguishType.FOAM); return; }
if(bullet.worldObj.rand.nextBoolean()) {
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
ix += dir.offsetX; iy += dir.offsetY; iz += dir.offsetZ;
}
Block b = bullet.worldObj.getBlock(ix, iy, iz);
if(b.isReplaceable(bullet.worldObj, ix, iy, iz) && ModBlocks.foam_layer.canPlaceBlockAt(bullet.worldObj, ix, iy, iz)) {
if(b != ModBlocks.foam_layer) {
bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.foam_layer);
} else {
int meta = bullet.worldObj.getBlockMetadata(ix, iy, iz);
if(meta < 6) bullet.worldObj.setBlockMetadataWithNotify(ix, iy, iz, meta + 1, 3);
else bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.block_foam);
}
}
if(fizz) bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
}
};
public static Consumer<Entity> LAMBDA_FOAM_UPDATE = (bullet) -> {
if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(ModBlocks.block_foam));
data.setDouble("posX", bullet.posX); data.setDouble("posY", bullet.posY); data.setDouble("posZ", bullet.posZ);
data.setDouble("mX", bullet.motionX + bullet.worldObj.rand.nextGaussian() * 0.1);
data.setDouble("mY", bullet.motionY - 0.2 + bullet.worldObj.rand.nextGaussian() * 0.1);
data.setDouble("mZ", bullet.motionZ + bullet.worldObj.rand.nextGaussian() * 0.1);
MainRegistry.proxy.effectNT(data);
}
};
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_SAND_HIT = (bullet, mop) -> {
if(!bullet.worldObj.isRemote) {
int ix = mop.blockX;
int iy = mop.blockY;
int iz = mop.blockZ;
TileEntity core = CompatExternal.getCoreFromPos(bullet.worldObj, ix, iy, iz);
if(core instanceof IRepairable) { ((IRepairable) core).tryExtinguish(bullet.worldObj, ix, iy, iz, EnumExtinguishType.SAND); return; }
if(bullet.worldObj.rand.nextBoolean()) {
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
ix += dir.offsetX; iy += dir.offsetY; iz += dir.offsetZ;
}
Block b = bullet.worldObj.getBlock(ix, iy, iz);
if((b.isReplaceable(bullet.worldObj, ix, iy, iz) || b == ModBlocks.sand_boron_layer) && ModBlocks.sand_boron_layer.canPlaceBlockAt(bullet.worldObj, ix, iy, iz)) {
if(b != ModBlocks.sand_boron_layer) {
bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.sand_boron_layer);
} else {
int meta = bullet.worldObj.getBlockMetadata(ix, iy, iz);
if(meta < 6) bullet.worldObj.setBlockMetadataWithNotify(ix, iy, iz, meta + 1, 3);
else bullet.worldObj.setBlock(ix, iy, iz, ModBlocks.sand_boron);
}
if(b.getMaterial() == Material.fire) bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "random.fizz", 1.0F, 1.5F + bullet.worldObj.rand.nextFloat() * 0.5F);
}
}
};
public static Consumer<Entity> LAMBDA_SAND_UPDATE = (bullet) -> {
if(bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(ModBlocks.sand_boron));
data.setDouble("posX", bullet.posX); data.setDouble("posY", bullet.posY); data.setDouble("posZ", bullet.posZ);
data.setDouble("mX", bullet.motionX + bullet.worldObj.rand.nextGaussian() * 0.1);
data.setDouble("mY", bullet.motionY - 0.2 + bullet.worldObj.rand.nextGaussian() * 0.1);
data.setDouble("mZ", bullet.motionZ + bullet.worldObj.rand.nextGaussian() * 0.1);
MainRegistry.proxy.effectNT(data);
}
};
public static Consumer<Entity> LAMBDA_SET_HOOK = (entity) -> { public static Consumer<Entity> LAMBDA_SET_HOOK = (entity) -> {
EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity; EntityBulletBaseMK4 bullet = (EntityBulletBaseMK4) entity;
if(!bullet.worldObj.isRemote && bullet.ticksExisted < 2 && bullet.getThrower() instanceof EntityPlayer) { if(!bullet.worldObj.isRemote && bullet.ticksExisted < 2 && bullet.getThrower() instanceof EntityPlayer) {
@ -88,6 +230,19 @@ public class XFactoryTool {
public static void init() { public static void init() {
fext_water = new BulletConfig().setItem(new ItemStack(ModItems.ammo_fireext, 1, 0)).setReloadCount(300).setLife(100).setVel(0.75F).setGrav(0.04D).setSpread(0.025F)
.setOnUpdate(LAMBDA_WATER_UPDATE)
.setOnEntityHit((bulletEntity, target) -> { if(target.entityHit != null) target.entityHit.extinguish(); })
.setOnRicochet(LAMBDA_WATER_HIT);
fext_foam = new BulletConfig().setItem(new ItemStack(ModItems.ammo_fireext, 1, 1)).setReloadCount(300).setLife(100).setVel(0.75F).setGrav(0.04D).setSpread(0.05F)
.setOnUpdate(LAMBDA_FOAM_UPDATE)
.setOnEntityHit((bulletEntity, target) -> { if(target.entityHit != null) target.entityHit.extinguish(); })
.setOnRicochet(LAMBDA_FOAM_HIT);
fext_sand = new BulletConfig().setItem(new ItemStack(ModItems.ammo_fireext, 1, 1)).setReloadCount(300).setLife(100).setVel(0.75F).setGrav(0.04D).setSpread(0.05F)
.setOnUpdate(LAMBDA_SAND_UPDATE)
.setOnEntityHit((bulletEntity, target) -> { if(target.entityHit != null) target.entityHit.extinguish(); })
.setOnRicochet(LAMBDA_SAND_HIT);
ct_hook = new BulletConfig().setItem(EnumAmmo.CT_HOOK).setRenderRotations(false).setLife(6_000).setVel(3F).setGrav(0.035D).setDoesPenetrate(true).setDamageFalloffByPen(false) ct_hook = new BulletConfig().setItem(EnumAmmo.CT_HOOK).setRenderRotations(false).setLife(6_000).setVel(3F).setGrav(0.035D).setDoesPenetrate(true).setDamageFalloffByPen(false)
.setOnUpdate(LAMBDA_SET_HOOK).setOnImpact(LAMBDA_HOOK); .setOnUpdate(LAMBDA_SET_HOOK).setOnImpact(LAMBDA_HOOK);
ct_mortar = new BulletConfig().setItem(EnumAmmo.CT_MORTAR).setDamage(2.5F).setLife(200).setVel(3F).setGrav(0.035D) ct_mortar = new BulletConfig().setItem(EnumAmmo.CT_MORTAR).setDamage(2.5F).setLife(200).setVel(3F).setGrav(0.035D)
@ -95,6 +250,17 @@ public class XFactoryTool {
ct_mortar_charge = new BulletConfig().setItem(EnumAmmo.CT_MORTAR_CHARGE).setDamage(5F).setLife(200).setVel(3F).setGrav(0.035D) ct_mortar_charge = new BulletConfig().setItem(EnumAmmo.CT_MORTAR_CHARGE).setDamage(5F).setLife(200).setVel(3F).setGrav(0.035D)
.setOnImpact(LAMBDA_MORTAR_CHARGE); .setOnImpact(LAMBDA_MORTAR_CHARGE);
ModItems.gun_fireext = new ItemGunBaseNT(WeaponQuality.UTILITY, new GunConfig()
.dura(5_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCLE)
.rec(new Receiver(0)
.dmg(0F).delay(1).dry(0).auto(true).spread(0F).spreadHipfire(0F).reload(20).jam(0).sound("hbm:weapon.extinguisher", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 300).addConfigs(fext_water, fext_foam, fext_sand))
.offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire())
.setupStandardConfiguration()
.orchestra(Orchestras.ORCHESTRA_FIREEXT)
).setUnlocalizedName("gun_fireext");
ModItems.gun_charge_thrower = new ItemGunChargeThrower(WeaponQuality.UTILITY, new GunConfig() ModItems.gun_charge_thrower = new ItemGunChargeThrower(WeaponQuality.UTILITY, new GunConfig()
.dura(3_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCUMFLEX) .dura(3_000).draw(10).inspect(55).reloadChangeType(true).hideCrosshair(false).crosshair(Crosshair.L_CIRCUMFLEX)
.rec(new Receiver(0) .rec(new Receiver(0)

View File

@ -491,27 +491,6 @@ public class ModEventHandlerClient {
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack held = player.getHeldItem(); ItemStack held = player.getHeldItem();
if(held == null) return;
if(!(held.getItem() instanceof ItemGunBase)) return;
GunConfiguration config = ((ItemGunBase) held.getItem()).mainConfig;
if(config == null) return;
if(config.zoomFOV == 0F || !player.isSneaking()) return;
if(config.absoluteFOV) {
event.newfov = config.zoomFOV;
} else {
event.newfov += config.zoomFOV;
}
}
@SubscribeEvent
public void setupNewFOV(FOVUpdateEvent event) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack held = player.getHeldItem();
if(held == null) return; if(held == null) return;
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED); IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(held, IItemRenderer.ItemRenderType.EQUIPPED);

View File

@ -2,9 +2,9 @@ package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.factory.XFactoryTool;
import com.hbm.items.weapon.ItemGunBase; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -41,15 +41,11 @@ public class ItemRenderFireExt implements IItemRenderer {
GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_CULL_FACE);
int magType = ItemGunBase.getMagType(item); ItemGunBaseNT gun = (ItemGunBaseNT) item.getItem();
int config = ((ItemGunBase)ModItems.gun_fireext).mainConfig.config.get(magType); IMagazine mag = gun.getConfig(item, 0).getReceivers(item)[0].getMagazine(item);
int ammo = BulletConfigSyncingUtil.pullConfig(config).ammo.meta; ResourceLocation tex = ResourceManager.fireext_tex;
ResourceLocation tex; if(mag.getType(item, null) == XFactoryTool.fext_foam) tex = ResourceManager.fireext_foam_tex;
switch (ammo) { if(mag.getType(item, null) == XFactoryTool.fext_sand) tex = ResourceManager.fireext_sand_tex;
case 0: tex = ResourceManager.fireext_foam_tex; break;
case 1: tex = ResourceManager.fireext_sand_tex; break;
default: tex = ResourceManager.fireext_tex; break;
}
Minecraft.getMinecraft().renderEngine.bindTexture(tex); Minecraft.getMinecraft().renderEngine.bindTexture(tex);
switch(type) { switch(type) {

View File

@ -99,7 +99,7 @@ public class TileEntityMachineArcWelder extends TileEntityMachineBase implements
this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3); this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3);
this.consumption = recipe.consumption + (recipe.consumption * redLevel) - (recipe.consumption * blueLevel / 6); this.consumption = recipe.consumption + (recipe.consumption * redLevel) - (recipe.consumption * blueLevel / 6);
this.consumption *= Math.pow(2, blackLevel); this.consumption *= Math.pow(2, blackLevel);
intendedMaxPower = recipe.consumption * 20; intendedMaxPower = consumption * 20;
if(canProcess(recipe)) { if(canProcess(recipe)) {
this.progress += (1 + blackLevel); this.progress += (1 + blackLevel);

View File

@ -105,7 +105,7 @@ public class TileEntityMachineSolderingStation extends TileEntityMachineBase imp
this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3); this.processTime = recipe.duration - (recipe.duration * redLevel / 6) + (recipe.duration * blueLevel / 3);
this.consumption = recipe.consumption + (recipe.consumption * redLevel) - (recipe.consumption * blueLevel / 6); this.consumption = recipe.consumption + (recipe.consumption * redLevel) - (recipe.consumption * blueLevel / 6);
this.consumption *= Math.pow(2, blackLevel); this.consumption *= Math.pow(2, blackLevel);
intendedMaxPower = recipe.consumption * 20; intendedMaxPower = consumption * 20;
if(canProcess(recipe)) { if(canProcess(recipe)) {
this.progress += (1 + blackLevel); this.progress += (1 + blackLevel);

View File

@ -11,7 +11,6 @@ import com.hbm.inventory.material.Mats;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMold; import com.hbm.items.machine.ItemMold;
import com.hbm.items.machine.ItemScraps; import com.hbm.items.machine.ItemScraps;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.util.fauxpointtwelve.DirPos; import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;