mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
casing delays for handheld guns, casing smoke, bugfixes
This commit is contained in:
parent
00e8675a15
commit
68eef7bc08
@ -206,7 +206,7 @@ public class WeaponRecipes {
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_dart.stackFromEnum(16, AmmoDart.GPS), new Object[] { "IPI", "ICI", "IPI", 'I', ModItems.plate_polymer, 'P', IRON.plate(), 'C', new ItemStack(ModItems.fluid_tank_lead_full, 1, Fluids.WATZ.getID()) });
|
||||
CraftingManager.addRecipeAuto(ModItems.ammo_dart.stackFromEnum(16, AmmoDart.NERF), new Object[] { "I", "I", 'I', ModItems.plate_polymer });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_45, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_44, 'P', ModItems.primer_44);
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_308, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_9);
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_762, 32), " I", "GC", " P", 'I', CU.ingot(), 'G', ANY_SMOKELESS.dust(), 'C', ModItems.casing_50, 'P', ModItems.primer_9);
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.assembly_luna, 4), new Object[] { " B ", "GCG", "GPG", 'B', ModItems.billet_u238, 'G', ModItems.powder_nitan_mix, 'C', ModItems.casing_50, 'P', ModItems.powder_power});
|
||||
|
||||
//Folly shells
|
||||
|
||||
@ -97,18 +97,22 @@ public class ExplosionNukeRayBatched {
|
||||
float y0 = (float) (posY + (vec.yCoord * i));
|
||||
float z0 = (float) (posZ + (vec.zCoord * i));
|
||||
|
||||
int iX = (int) Math.floor(x0);
|
||||
int iY = (int) Math.floor(y0);
|
||||
int iZ = (int) Math.floor(z0);
|
||||
|
||||
double fac = 100 - ((double) i) / ((double) length) * 100;
|
||||
fac *= 0.07D;
|
||||
|
||||
if(!world.getBlock((int)x0, (int)y0, (int)z0).getMaterial().isLiquid())
|
||||
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 7.5D - fac);
|
||||
if(!world.getBlock(iX, iY, iZ).getMaterial().isLiquid())
|
||||
res -= Math.pow(world.getBlock(iX, iY, iZ).getExplosionResistance(null), 7.5D - fac);
|
||||
//else
|
||||
// res -= Math.pow(Blocks.air.getExplosionResistance(null), 7.5D - fac); // air is 0, might want to raise that is necessary
|
||||
|
||||
if(res > 0 && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
|
||||
if(res > 0 && world.getBlock(iX, iY, iZ) != Blocks.air) {
|
||||
lastPos = new FloatTriplet(x0, y0, z0);
|
||||
//all-air chunks don't need to be buffered at all
|
||||
ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(((int) x0) >> 4, ((int) z0) >> 4);
|
||||
ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(iX >> 4, iZ >> 4);
|
||||
chunkCoords.add(chunkPos);
|
||||
}
|
||||
|
||||
@ -185,9 +189,9 @@ public class ExplosionNukeRayBatched {
|
||||
|
||||
boolean inChunk = false;
|
||||
for(int i = enter; i < vec.lengthVector(); i++) {
|
||||
int x0 = (int)(posX + pX * i);
|
||||
int y0 = (int)(posY + pY * i);
|
||||
int z0 = (int)(posZ + pZ * i);
|
||||
int x0 = (int) Math.floor(posX + pX * i);
|
||||
int y0 = (int) Math.floor(posY + pY * i);
|
||||
int z0 = (int) Math.floor(posZ + pZ * i);
|
||||
|
||||
if(x0 >> 4 != chunkX || z0 >> 4 != chunkZ) {
|
||||
if(inChunk) {
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
package com.hbm.handler.guncfg;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.projectile.EntityBulletBase;
|
||||
import com.hbm.handler.BulletConfigSyncingUtil;
|
||||
import com.hbm.handler.BulletConfiguration;
|
||||
import com.hbm.handler.CasingEjector;
|
||||
import com.hbm.handler.GunConfiguration;
|
||||
@ -42,13 +40,13 @@ public class Gun12GaugeFactory {
|
||||
private static final SpentCasing CASING12GAUGE;
|
||||
|
||||
static {
|
||||
EJECTOR_SPAS = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, 0, 0.5).setAngleRange(0.01F, 0.03F).setDelay(10);
|
||||
EJECTOR_SPAS_ALT = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, 0, 0.5).setAngleRange(0.01F, 0.03F).setDelay(10).setAmount(2);
|
||||
EJECTOR_SPAS = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, 0, 0.5).setAngleRange(0.01F, 0.03F).setDelay(12);
|
||||
EJECTOR_SPAS_ALT = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, 0, 0.5).setAngleRange(0.01F, 0.03F).setDelay(12).setAmount(2);
|
||||
EJECTOR_BENELLI = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.3, 1, 0).setAngleRange(0.01F, 0.03F);
|
||||
EJECTOR_UBOINIK = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, -0.3, 0.5).setAngleRange(0.01F, 0.03F);
|
||||
EJECTOR_SSG = new CasingEjector().setMotion(0.2, 0, -0.2).setOffset(0.8, 0, 0).setAngleRange(0.05F, 0.02F).setDelay(20).setAmount(2);
|
||||
|
||||
CASING12GAUGE = new SpentCasing(CasingType.SHOTGUN).setScale(1.5F).setBounceMotion(0.05F, 0.02F);
|
||||
CASING12GAUGE = new SpentCasing(CasingType.SHOTGUN).setScale(1.5F).setBounceMotion(0.05F, 0.02F).setupSmoke(0.5F, 0.5D, 60, 20);
|
||||
}
|
||||
|
||||
public static GunConfiguration getSpas12Config() {
|
||||
@ -222,7 +220,7 @@ public class Gun12GaugeFactory {
|
||||
bullet.dmgMax = 7;
|
||||
bullet.incendiary = 5;
|
||||
|
||||
bullet.spentCasing = CASING12GAUGE.clone().register("12GaInc").setColor(0xFF6329, SpentCasing.COLOR_CASE_12GA);
|
||||
bullet.spentCasing = CASING12GAUGE.clone().register("12GaInc").setColor(0xFF6329, SpentCasing.COLOR_CASE_12GA).setupSmoke(1F, 0.5D, 60, 40);
|
||||
|
||||
return bullet;
|
||||
}
|
||||
@ -309,7 +307,7 @@ public class Gun12GaugeFactory {
|
||||
bullet.dmgMax = 30F;
|
||||
bullet.maxAge = 0;
|
||||
|
||||
bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA);
|
||||
bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA).setupSmoke(1F, 0.5D, 60, 40);
|
||||
|
||||
bullet.bUpdate = new IBulletUpdateBehavior() {
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ public class Gun20GaugeFactory {
|
||||
|
||||
static {
|
||||
EJECTOR_SHOTGUN = new CasingEjector().setMotion(Vec3.createVectorHelper(-0.4, 0.95, 0)).setOffset(Vec3.createVectorHelper(-0.55, 0, 0.5)).setAngleRange(0.01F, 0.05F);
|
||||
CASING20GAUGE = new SpentCasing(CasingType.SHOTGUN).setScale(1.25F).setBounceMotion(0.01F, 0.05F);
|
||||
CASING20GAUGE = new SpentCasing(CasingType.SHOTGUN).setScale(1.25F).setBounceMotion(0.01F, 0.05F).setupSmoke(0.25F, 0.5D, 60, 20);
|
||||
}
|
||||
|
||||
public static GunConfiguration getShotgunConfig() {
|
||||
@ -267,7 +267,7 @@ public class Gun20GaugeFactory {
|
||||
bullet.wear = 15;
|
||||
bullet.incendiary = 5;
|
||||
|
||||
bullet.spentCasing = CASING20GAUGE.clone().register("20GaInc").setColor(0xFF6329, SpentCasing.COLOR_CASE_BRASS);
|
||||
bullet.spentCasing = CASING20GAUGE.clone().register("20GaInc").setColor(0xFF6329, SpentCasing.COLOR_CASE_BRASS).setupSmoke(1F, 0.5D, 60, 40);
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
@ -66,6 +66,8 @@ public class Gun4GaugeFactory {
|
||||
config.reloadType = GunConfiguration.RELOAD_SINGLE;
|
||||
config.allowsInfinity = true;
|
||||
config.hasSights = true;
|
||||
config.absoluteFOV = true;
|
||||
config.zoomFOV = 0.5F;
|
||||
config.crosshair = Crosshair.L_CIRCLE;
|
||||
config.reloadSound = GunConfiguration.RSOUND_SHOTGUN;
|
||||
|
||||
@ -104,6 +106,8 @@ public class Gun4GaugeFactory {
|
||||
config.firingSound = "hbm:weapon.sauergun";
|
||||
config.firingPitch = 1.0F;
|
||||
|
||||
config.ejector = EJECTOR_SHOTGUN.clone().setDelay(12);
|
||||
|
||||
config.name = "sauer";
|
||||
config.manufacturer = EnumGunManufacturer.CUBE;
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ public class Gun50AEFactory {
|
||||
|
||||
static {
|
||||
EJECTOR_PISTOL = new CasingEjector().setMotion(-0.3, 0.7, 0).setOffset(-0.5, 0, 0.5).setAngleRange(0.01F, 0.03F);
|
||||
CASING50AE = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F).setBounceMotion(0.01F, 0.03F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
CASING50AE = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F).setBounceMotion(0.01F, 0.03F).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(0.25F, 0.5D, 60, 20);
|
||||
}
|
||||
|
||||
public static GunConfiguration getBaseConfig() {
|
||||
|
||||
@ -45,8 +45,8 @@ public class Gun50BMGFactory {
|
||||
static {
|
||||
EJECTOR_BMG = new CasingEjector().setMotion(-0.35, 0.9, 0).setOffset(-0.45, -0.2, 0.35).setAngleRange(0.01F, 0.05F);
|
||||
EJECTOR_SNIPER = new CasingEjector().setMotion(-2, 0.15, 0).setOffset(-0.45, -0.2, 0.35).setAngleRange(0.02F, 0.05F);
|
||||
CASING50BMG = new SpentCasing(CasingType.BOTTLENECK).setScale(3F).setBounceMotion(0.01F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
CASINGLUNA = new SpentCasing(CasingType.BOTTLENECK).setScale(4F).setBounceMotion(0.02F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
CASING50BMG = new SpentCasing(CasingType.BOTTLENECK).setScale(3F).setBounceMotion(0.01F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(0.125F, 0.5D, 60, 20);
|
||||
CASINGLUNA = new SpentCasing(CasingType.BOTTLENECK).setScale(4F).setBounceMotion(0.02F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(0.125F, 0.5D, 60, 30);
|
||||
}
|
||||
|
||||
public static GunConfiguration getCalamityConfig() {
|
||||
|
||||
@ -38,7 +38,7 @@ public class Gun556mmFactory {
|
||||
|
||||
static {
|
||||
EJECTOR_RIFLE = new CasingEjector().setMotion(-0.35, 0.6, 0).setOffset(-0.35, 0, 0.35).setAngleRange(0.01F, 0.03F);
|
||||
EJECTOR_GRENADE = new CasingEjector().setAngleRange(0.02F, 0.03F);
|
||||
EJECTOR_GRENADE = new CasingEjector().setAngleRange(0.02F, 0.03F).setDelay(30);
|
||||
CASING556 = new SpentCasing(CasingType.BOTTLENECK).setScale(1.25F).setBounceMotion(0.01F, 0.03F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ public class Gun5mmFactory {
|
||||
|
||||
static {
|
||||
EJECTOR_MINIGUN = new CasingEjector().setMotion(-0.4, 0.1, 0).setOffset(-0.35, -0.2, 0.35).setAngleRange(0.01F, 0.03F).setAmount(5);
|
||||
CASING5MM = new SpentCasing(CasingType.STRAIGHT).setScale(1.25F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
CASING5MM = new SpentCasing(CasingType.STRAIGHT).setScale(1.25F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS).setMaxAge(100);
|
||||
}
|
||||
|
||||
public static GunConfiguration getMinigunConfig() {
|
||||
|
||||
@ -14,7 +14,7 @@ public class GunCannonFactory {
|
||||
protected static SpentCasing CASINNG240MM;
|
||||
|
||||
static {
|
||||
CASINNG240MM = new SpentCasing(CasingType.BOTTLENECK).setScale(7.5F).setBounceMotion(0.02F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS);
|
||||
CASINNG240MM = new SpentCasing(CasingType.BOTTLENECK).setScale(7.5F).setBounceMotion(0.02F, 0.05F).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(1F, 0.5D, 60, 20);
|
||||
}
|
||||
|
||||
public static BulletConfiguration getShellConfig() {
|
||||
|
||||
@ -11,7 +11,7 @@ public class GunDGKFactory {
|
||||
public static final SpentCasing CASINGDGK;
|
||||
|
||||
static {
|
||||
CASINGDGK = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS).setMaxAge(60); //3 instead of 12 seconds
|
||||
CASINGDGK = new SpentCasing(CasingType.STRAIGHT).setScale(1.5F).setBounceMotion(0.05F, 0.02F).setColor(SpentCasing.COLOR_CASE_BRASS).setupSmoke(0.02F, 0.5D, 60, 20).setMaxAge(60); //3 instead of 12 seconds
|
||||
}
|
||||
|
||||
public static BulletConfiguration getDGKConfig() {
|
||||
|
||||
@ -23,7 +23,7 @@ public class GunGrenadeFactory {
|
||||
|
||||
static {
|
||||
EJECTOR_LAUNCHER = new CasingEjector().setAngleRange(0.02F, 0.03F).setAfterReload();
|
||||
CASING40MM = new SpentCasing(CasingType.STRAIGHT).setScale(4F, 4F, 3F).setBounceMotion(0.02F, 0.03F).setColor(0x777777);
|
||||
CASING40MM = new SpentCasing(CasingType.STRAIGHT).setScale(4F, 4F, 3F).setBounceMotion(0.02F, 0.03F).setColor(0x777777).setupSmoke(1F, 0.5D, 60, 40);
|
||||
}
|
||||
|
||||
public static GunConfiguration getHK69Config() {
|
||||
|
||||
@ -8,7 +8,6 @@ import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
import com.hbm.items.ItemEnums.EnumBriquetteType;
|
||||
import com.hbm.items.ItemAmmoEnums;
|
||||
import com.hbm.items.ItemAmmoEnums.Ammo357Magnum;
|
||||
import com.hbm.items.ItemAmmoEnums.Ammo556mm;
|
||||
import com.hbm.items.ItemAmmoEnums.AmmoLunaticSniper;
|
||||
@ -106,7 +105,7 @@ public class PressRecipes {
|
||||
makeRecipe(StampType.C50, new ComparableStack(ModItems.assembly_calamity), ModItems.ammo_50bmg);
|
||||
makeRecipe(StampType.C50, new ComparableStack(ModItems.assembly_actionexpress), ModItems.ammo_50ae);
|
||||
makeRecipe(StampType.C50, new ComparableStack(ModItems.assembly_luna), ModItems.ammo_luna_sniper.stackFromEnum(AmmoLunaticSniper.SABOT));
|
||||
makeRecipe(StampType.C50, new ComparableStack(ModItems.assembly_308), ModItems.ammo_762);
|
||||
makeRecipe(StampType.C50, new ComparableStack(ModItems.assembly_762), ModItems.ammo_762);
|
||||
}
|
||||
|
||||
public static void makeRecipe(StampType type, AStack in, Item out) {
|
||||
|
||||
@ -603,7 +603,7 @@ public class ModItems {
|
||||
public static Item assembly_nopip;
|
||||
public static Item assembly_smg;
|
||||
public static Item assembly_556;
|
||||
public static Item assembly_308;
|
||||
public static Item assembly_762;
|
||||
public static Item assembly_45;
|
||||
public static Item assembly_uzi;
|
||||
public static Item assembly_actionexpress;
|
||||
@ -3267,7 +3267,7 @@ public class ModItems {
|
||||
assembly_nopip = new Item().setUnlocalizedName("assembly_nopip").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_nopip");
|
||||
assembly_smg = new Item().setUnlocalizedName("assembly_smg").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_smg");
|
||||
assembly_556 = new Item().setUnlocalizedName("assembly_556").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_556");
|
||||
assembly_308 = new Item().setUnlocalizedName("assembly_308").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_308");
|
||||
assembly_762 = new Item().setUnlocalizedName("assembly_762").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_762");
|
||||
assembly_45 = new Item().setUnlocalizedName("assembly_45").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_45");
|
||||
assembly_uzi = new Item().setUnlocalizedName("assembly_uzi").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_uzi");
|
||||
assembly_actionexpress = new Item().setUnlocalizedName("assembly_actionexpress").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":assembly_actionexpress");
|
||||
@ -3489,7 +3489,7 @@ public class ModItems {
|
||||
iv_xp_empty = new ItemSimpleConsumable().setUseActionServer((stack, user) -> {
|
||||
if(user.experienceTotal >= 100) {
|
||||
ItemSimpleConsumable.giveSoundAndDecrement(stack, user, "hbm:item.syringe", new ItemStack(ModItems.iv_xp));
|
||||
EnchantmentUtil.setExperience(user, user.experienceTotal - 100);
|
||||
EnchantmentUtil.setExperience(user, EnchantmentUtil.getTotalExperience(user) - 100);
|
||||
}
|
||||
}).setUnlocalizedName("iv_xp_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":iv_xp_empty");
|
||||
|
||||
@ -6504,7 +6504,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(assembly_nopip, assembly_nopip.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_smg, assembly_smg.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_556, assembly_556.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_308, assembly_308.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_762, assembly_762.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_45, assembly_45.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_uzi, assembly_uzi.getUnlocalizedName());
|
||||
GameRegistry.registerItem(assembly_lacunae, assembly_lacunae.getUnlocalizedName());
|
||||
|
||||
@ -9,13 +9,13 @@ import com.hbm.items.ModItems;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ItemFluidIcon extends Item {
|
||||
|
||||
@ -71,8 +71,9 @@ public class ItemFluidIcon extends Item {
|
||||
return stack.getTagCompound().getInteger("fill");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
String s = (I18n.format(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim();
|
||||
String s = (StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim();
|
||||
|
||||
if(s != null) {
|
||||
return s;
|
||||
@ -81,27 +82,6 @@ public class ItemFluidIcon extends Item {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override
|
||||
*
|
||||
* @SideOnly(Side.CLIENT) public boolean requiresMultipleRenderPasses() {
|
||||
* return true; }
|
||||
*
|
||||
* @Override
|
||||
*
|
||||
* @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister
|
||||
* p_94581_1_) { super.registerIcons(p_94581_1_);
|
||||
*
|
||||
* this.overlayIcon =
|
||||
* p_94581_1_.registerIcon("hbm:fluid_identifier_overlay"); }
|
||||
*
|
||||
* @Override
|
||||
*
|
||||
* @SideOnly(Side.CLIENT) public IIcon getIconFromDamageForRenderPass(int
|
||||
* p_77618_1_, int p_77618_2_) { return p_77618_2_ == 1 ? this.overlayIcon :
|
||||
* super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); }
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int p_82790_2_) {
|
||||
|
||||
@ -173,7 +173,7 @@ public class ItemAmmoArty extends Item {
|
||||
return "item." + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
|
||||
}
|
||||
|
||||
protected static SpentCasing SIXTEEN_INCH_CASE = new SpentCasing(CasingType.STRAIGHT).setScale(15F, 15F, 10F);
|
||||
protected static SpentCasing SIXTEEN_INCH_CASE = new SpentCasing(CasingType.STRAIGHT).setScale(15F, 15F, 10F).setupSmoke(1F, 1D, 200, 60).setMaxAge(300);
|
||||
|
||||
public abstract class ArtilleryShell {
|
||||
|
||||
|
||||
@ -17,9 +17,11 @@ import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.items.IEquipReceiver;
|
||||
import com.hbm.lib.HbmCollection;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.GunAnimationPacket;
|
||||
import com.hbm.packet.GunButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.render.anim.BusAnimation;
|
||||
import com.hbm.render.anim.HbmAnimations.AnimType;
|
||||
import com.hbm.render.util.RenderScreenOverlay;
|
||||
@ -28,6 +30,7 @@ import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -144,6 +147,20 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
if(getIsReloading(stack) && isCurrentItem) {
|
||||
reload2(stack, world, player);
|
||||
}
|
||||
|
||||
BulletConfiguration queued = getCasing(stack);
|
||||
int timer = getCasingTimer(stack);
|
||||
|
||||
if(queued != null && timer > 0) {
|
||||
|
||||
timer--;
|
||||
|
||||
if(timer <= 0) {
|
||||
trySpawnCasing(player, mainConfig.ejector, queued, stack);
|
||||
}
|
||||
|
||||
setCasingTimer(stack, timer);
|
||||
}
|
||||
}
|
||||
|
||||
//whether or not the gun can shoot in its current state
|
||||
@ -212,7 +229,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
world.playSoundAtEntity(player, mainConfig.firingSound, 1.0F, mainConfig.firingPitch);
|
||||
|
||||
if(mainConfig.ejector != null && !mainConfig.ejector.getAfterReload())
|
||||
trySpawnCasing(player, mainConfig.ejector, config, stack);
|
||||
queueCasing(player, mainConfig.ejector, config, stack);
|
||||
}
|
||||
|
||||
//unlike fire(), being called does not automatically imply success, some things may still have to be handled before spawning the projectile
|
||||
@ -246,7 +263,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
world.playSoundAtEntity(player, altConfig.firingSound, 1.0F, altConfig.firingPitch);
|
||||
|
||||
if(altConfig.ejector != null)
|
||||
trySpawnCasing(player, altConfig.ejector, config, stack);
|
||||
queueCasing(player, altConfig.ejector, config, stack);
|
||||
}
|
||||
|
||||
//spawns the actual projectile, can be overridden to change projectile entity
|
||||
@ -331,7 +348,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
world.playSoundAtEntity(player, mainConfig.reloadSound, 1.0F, 1.0F);
|
||||
|
||||
if(mainConfig.ejector != null && mainConfig.ejector.getAfterReload())
|
||||
trySpawnCasing(player, mainConfig.ejector, prevCfg, stack);
|
||||
queueCasing(player, mainConfig.ejector, prevCfg, stack);
|
||||
|
||||
InventoryUtil.tryConsumeAStack(player.inventory.mainInventory, 0, player.inventory.mainInventory.length, ammo);
|
||||
} else {
|
||||
@ -621,6 +638,24 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
return readNBT(stack, "magazineType");
|
||||
}
|
||||
|
||||
/// queued casing for ejection ///
|
||||
public static void setCasing(ItemStack stack, BulletConfiguration bullet) {
|
||||
writeNBT(stack, "casing", BulletConfigSyncingUtil.getKey(bullet));
|
||||
}
|
||||
|
||||
public static BulletConfiguration getCasing(ItemStack stack) {
|
||||
return BulletConfigSyncingUtil.pullConfig(readNBT(stack, "casing"));
|
||||
}
|
||||
|
||||
/// timer for ejecting casing ///
|
||||
public static void setCasingTimer(ItemStack stack, int i) {
|
||||
writeNBT(stack, "casingTimer", i);
|
||||
}
|
||||
|
||||
public static int getCasingTimer(ItemStack stack) {
|
||||
return readNBT(stack, "casingTimer");
|
||||
}
|
||||
|
||||
/// NBT utility ///
|
||||
public static void writeNBT(ItemStack stack, String key, int value) {
|
||||
|
||||
@ -707,6 +742,18 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
}
|
||||
}
|
||||
|
||||
protected static void queueCasing(Entity entity, CasingEjector ejector, BulletConfiguration bullet, ItemStack stack) {
|
||||
|
||||
if(ejector == null || bullet == null || bullet.spentCasing == null) return;
|
||||
|
||||
if(ejector.getDelay() <= 0) {
|
||||
trySpawnCasing(entity, ejector, bullet, stack);
|
||||
} else {
|
||||
setCasing(stack, bullet);
|
||||
setCasingTimer(stack, ejector.getDelay());
|
||||
}
|
||||
}
|
||||
|
||||
protected static void trySpawnCasing(Entity entity, CasingEjector ejector, BulletConfiguration bullet, ItemStack stack) {
|
||||
|
||||
if(ejector == null) return; //abort if the gun can't eject bullets at all
|
||||
@ -715,15 +762,11 @@ public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD, IEqu
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "casing");
|
||||
data.setDouble("posX", entity.posX);
|
||||
data.setDouble("posY", entity.posY + entity.getEyeHeight());
|
||||
data.setDouble("posZ", entity.posZ);
|
||||
data.setFloat("pitch", (float) Math.toRadians(entity.rotationPitch));
|
||||
data.setFloat("yaw", (float) Math.toRadians(entity.rotationYaw));
|
||||
data.setBoolean("crouched", entity.isSneaking());
|
||||
data.setString("name", bullet.spentCasing.getName());
|
||||
data.setInteger("ej", ejector.getId());
|
||||
//TODO: use packets
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 50));
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import java.util.Random;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
@ -28,15 +29,18 @@ import net.minecraft.world.World;
|
||||
public class ParticleSpentCasing extends EntityFX {
|
||||
|
||||
public static final Random rand = new Random();
|
||||
private static float dScale = 0.05F, smokeJitter = 0.025F, smokeAccel = 0.5F;
|
||||
private static byte maxSmokeGen = 60, maxSmokeLife = 120;
|
||||
private static float dScale = 0.05F, smokeJitter = 0.001F;
|
||||
|
||||
private int maxSmokeGen = 120;
|
||||
private double smokeLift = 0.5D;
|
||||
private int nodeLife = 30;
|
||||
|
||||
private final List<Pair<Vec3, Double>> smokeNodes = new ArrayList();
|
||||
|
||||
private final TextureManager textureManager;
|
||||
|
||||
private final SpentCasing config;
|
||||
private boolean smoke;
|
||||
private boolean isSmoking;
|
||||
|
||||
private float momentumPitch, momentumYaw;
|
||||
private boolean onGroundPreviously = false;
|
||||
@ -49,12 +53,19 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
this.momentumYaw = momentumYaw;
|
||||
this.config = config;
|
||||
|
||||
particleMaxAge = config.getMaxAge();
|
||||
smoke = rand.nextFloat() < config.getSmokeChance();
|
||||
this.particleMaxAge = config.getMaxAge();
|
||||
this.isSmoking = rand.nextFloat() < config.getSmokeChance();
|
||||
this.maxSmokeGen = config.getSmokeDuration();
|
||||
this.smokeLift = config.getSmokeLift();
|
||||
this.nodeLife = config.getSmokeNodeLife();
|
||||
|
||||
this.prevPosX = x;
|
||||
this.prevPosY = y;
|
||||
this.prevPosZ = z;
|
||||
|
||||
motionX = mx;
|
||||
motionY = my;
|
||||
motionZ = mz;
|
||||
this.motionX = mx;
|
||||
this.motionY = my;
|
||||
this.motionZ = mz;
|
||||
|
||||
particleGravity = 8F;
|
||||
|
||||
@ -88,55 +99,65 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
onGroundPreviously = false;
|
||||
}
|
||||
|
||||
if (particleAge > maxSmokeLife && !smokeNodes.isEmpty())
|
||||
if(particleAge > maxSmokeGen && !smokeNodes.isEmpty())
|
||||
smokeNodes.clear();
|
||||
|
||||
if(smoke && particleAge <= maxSmokeLife) {
|
||||
|
||||
//motion-based smoke changes were moved to rendering (to account for interp in realtime)
|
||||
if(isSmoking && particleAge <= maxSmokeGen) {
|
||||
|
||||
for(Pair<Vec3, Double> pair : smokeNodes) {
|
||||
final Vec3 node = pair.getKey();
|
||||
Vec3 node = pair.getKey();
|
||||
|
||||
node.xCoord += rand.nextGaussian() * smokeJitter;
|
||||
node.zCoord += rand.nextGaussian() * smokeJitter;
|
||||
node.yCoord += smokeLift * dScale;
|
||||
|
||||
pair.value = Math.max(0, pair.value - (1D / (double) nodeLife));
|
||||
}
|
||||
|
||||
if(particleAge < maxSmokeGen || inWater) {
|
||||
final double alpha = (particleAge / 20d);
|
||||
smokeNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(0, 0, 0), alpha));
|
||||
smokeNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(0, 0, 0), smokeNodes.isEmpty() ? 0.0D : 1D));
|
||||
}
|
||||
}
|
||||
|
||||
prevRotationPitch = rotationPitch;
|
||||
prevRotationYaw = rotationYaw;
|
||||
|
||||
// if (motionY > gravity && !onGround)
|
||||
// motionY += gravity;
|
||||
// if (motionY < -0.75)
|
||||
// motionY = -0.75;
|
||||
|
||||
if(onGround)
|
||||
if(onGround) {
|
||||
rotationPitch = 0;
|
||||
else {
|
||||
} else {
|
||||
rotationPitch += momentumPitch;
|
||||
rotationYaw += momentumYaw;
|
||||
}
|
||||
}
|
||||
|
||||
/** Used for frame-perfect translation of smoke */
|
||||
private boolean setupDeltas = false;
|
||||
private double prevRenderX;
|
||||
private double prevRenderY;
|
||||
private double prevRenderZ;
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tessellator, float interp, float x, float y, float z, float tx, float tz) {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
double pX = prevPosX + (posX - prevPosX) * interp;
|
||||
double pY = prevPosY + (posY - prevPosY) * interp;
|
||||
double pZ = prevPosZ + (posZ - prevPosZ) * interp;
|
||||
|
||||
if(!setupDeltas) {
|
||||
prevRenderX = pX;
|
||||
prevRenderY = pY;
|
||||
prevRenderZ = pZ;
|
||||
setupDeltas = true;
|
||||
}
|
||||
|
||||
int brightness = worldObj.getLightBrightnessForSkyBlocks(MathHelper.floor_double(pX), MathHelper.floor_double(pY), MathHelper.floor_double(pZ), 0);
|
||||
int lX = brightness % 65536;
|
||||
int lY = brightness / 65536;
|
||||
@ -149,7 +170,7 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)interp;
|
||||
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
|
||||
|
||||
GL11.glTranslated(pX - dX, pY - dY - this.height / 4, pZ - dZ);
|
||||
GL11.glTranslated(pX - dX, pY - dY - this.height / 4 + config.getScaleY() * 0.01, pZ - dZ);
|
||||
|
||||
GL11.glScalef(dScale, dScale, dScale);
|
||||
|
||||
@ -169,31 +190,59 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(pX - dX, pY - dY - this.height / 4, pZ - dZ);
|
||||
//GL11.glScalef(dScale, dScale, dScale);
|
||||
//GL11.glScalef(config.getScaleX(), config.getScaleY(), config.getScaleZ());
|
||||
|
||||
/*if(!smokeNodes.isEmpty()) {
|
||||
if(!smokeNodes.isEmpty()) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
|
||||
float scale = config.getScaleX() * 0.5F * dScale;
|
||||
Vec3 vec = Vec3.createVectorHelper(scale, 0, 0);
|
||||
float yaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * interp;
|
||||
vec.rotateAroundY((float) Math.toRadians(-yaw));
|
||||
|
||||
double deltaX = prevRenderX - pX;
|
||||
double deltaY = prevRenderY - pY;
|
||||
double deltaZ = prevRenderZ - pZ;
|
||||
|
||||
for(Pair<Vec3, Double> pair : smokeNodes) {
|
||||
Vec3 pos = pair.getKey();
|
||||
double mult = 1D;
|
||||
pos.xCoord += deltaX * mult;
|
||||
pos.yCoord += deltaY * mult;
|
||||
pos.zCoord += deltaZ * mult;
|
||||
}
|
||||
|
||||
for(int i = 0; i < smokeNodes.size() - 1; i++) {
|
||||
final Pair<Vec3, Double> node = smokeNodes.get(i), past = smokeNodes.get(i + 1);
|
||||
final Vec3 nodeLoc = node.getKey(), pastLoc = past.getKey();
|
||||
final float nodeAlpha = node.getValue().floatValue(), pastAlpha = past.getValue().floatValue(), scale = config.getScaleX();
|
||||
float nodeAlpha = node.getValue().floatValue();
|
||||
float pastAlpha = past.getValue().floatValue();
|
||||
|
||||
double timeAlpha = 1D - (double) particleAge / (double) maxSmokeGen;
|
||||
nodeAlpha *= timeAlpha;
|
||||
pastAlpha *= timeAlpha;
|
||||
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, nodeAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, 0F);
|
||||
tessellator.addVertex(nodeLoc.xCoord + scale, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.addVertex(nodeLoc.xCoord + vec.xCoord, nodeLoc.yCoord, nodeLoc.zCoord + vec.zCoord);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, 0F);
|
||||
tessellator.addVertex(pastLoc.xCoord + scale, pastLoc.yCoord, pastLoc.zCoord);
|
||||
tessellator.addVertex(pastLoc.xCoord + vec.xCoord, pastLoc.yCoord, pastLoc.zCoord + vec.zCoord);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, pastAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord, pastLoc.zCoord);
|
||||
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, nodeAlpha);
|
||||
tessellator.addVertex(nodeLoc.xCoord, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, 0F);
|
||||
tessellator.addVertex(nodeLoc.xCoord - scale, nodeLoc.yCoord, nodeLoc.zCoord);
|
||||
tessellator.addVertex(nodeLoc.xCoord - vec.xCoord, nodeLoc.yCoord, nodeLoc.zCoord - vec.zCoord);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, 0F);
|
||||
tessellator.addVertex(pastLoc.xCoord - scale, pastLoc.yCoord, pastLoc.zCoord);
|
||||
tessellator.addVertex(pastLoc.xCoord - vec.xCoord, pastLoc.yCoord, pastLoc.zCoord - vec.zCoord);
|
||||
tessellator.setColorRGBA_F(1F, 1F, 1F, pastAlpha);
|
||||
tessellator.addVertex(pastLoc.xCoord, pastLoc.yCoord, pastLoc.zCoord);
|
||||
}
|
||||
@ -201,16 +250,22 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1F);
|
||||
}*/
|
||||
}
|
||||
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
prevRenderX = pX;
|
||||
prevRenderY = pY;
|
||||
prevRenderZ = pZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -39,6 +39,9 @@ public class SpentCasing implements Cloneable {
|
||||
private CasingType type;
|
||||
private String bounceSound;
|
||||
private float smokeChance;
|
||||
private int smokeDuration;
|
||||
private double smokeLift;
|
||||
private int smokeNodeLife;
|
||||
private float bounceYaw = 0F;
|
||||
private float bouncePitch = 0F;
|
||||
private int maxAge = 240;
|
||||
@ -79,8 +82,11 @@ public class SpentCasing implements Cloneable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpentCasing setupSmoke(float chance, float lift, float duration) {
|
||||
public SpentCasing setupSmoke(float chance, double lift, int duration, int nodeLife) {
|
||||
this.smokeChance = chance;
|
||||
this.smokeDuration = duration;
|
||||
this.smokeLift = lift;
|
||||
this.smokeNodeLife = nodeLife;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -110,6 +116,9 @@ public class SpentCasing implements Cloneable {
|
||||
public float getBounceYaw() { return this.bounceYaw; }
|
||||
public float getBouncePitch() { return this.bouncePitch; }
|
||||
public int getMaxAge() { return this.maxAge; }
|
||||
public int getSmokeDuration() { return this.smokeDuration; }
|
||||
public double getSmokeLift() { return this.smokeLift; }
|
||||
public int getSmokeNodeLife() { return this.smokeNodeLife; }
|
||||
|
||||
@Override
|
||||
public SpentCasing clone() {
|
||||
|
||||
@ -348,6 +348,8 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
|
||||
|
||||
for(EntityItem item : items) {
|
||||
|
||||
if(item.isDead) continue;
|
||||
|
||||
if(nullifier && bad.contains(item.getEntityItem().getItem())) {
|
||||
item.setDead();
|
||||
continue;
|
||||
|
||||
@ -218,7 +218,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
|
||||
@Override
|
||||
public int casingDelay() {
|
||||
return 5;
|
||||
return 7;
|
||||
}
|
||||
|
||||
protected void updateConnections() {
|
||||
@ -404,7 +404,7 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
}
|
||||
}
|
||||
|
||||
protected static CasingEjector ejector = new CasingEjector().setMotion(0, 1.2, 0.5).setAngleRange(0.1F, 0.1F);
|
||||
protected static CasingEjector ejector = new CasingEjector().setMotion(0, 0.4, -1.2).setAngleRange(0.1F, 0.1F);
|
||||
|
||||
@Override
|
||||
protected CasingEjector getEjector() {
|
||||
@ -461,6 +461,24 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
|
||||
nbt.setShort("mode", this.mode);
|
||||
}
|
||||
|
||||
protected void spawnCasing() {
|
||||
|
||||
if(cachedCasingConfig == null) return;
|
||||
CasingEjector ej = getEjector();
|
||||
|
||||
Vec3 spawn = this.getCasingSpawnPos();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "casing");
|
||||
data.setFloat("pitch", (float) 0);
|
||||
data.setFloat("yaw", (float) rotationYaw);
|
||||
data.setBoolean("crouched", false);
|
||||
data.setString("name", cachedCasingConfig.getName());
|
||||
if(ej != null) data.setInteger("ej", ej.getId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, spawn.xCoord, spawn.yCoord, spawn.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
|
||||
cachedCasingConfig = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
@ -863,7 +863,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
|
||||
Vec3 spawn = this.getCasingSpawnPos();
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "casing");
|
||||
data.setFloat("pitch", (float) rotationPitch);
|
||||
data.setFloat("pitch", (float) -rotationPitch);
|
||||
data.setFloat("yaw", (float) rotationYaw);
|
||||
data.setBoolean("crouched", false);
|
||||
data.setString("name", cachedCasingConfig.getName());
|
||||
|
||||
@ -75,42 +75,56 @@ public class EnchantmentUtil {
|
||||
* @param player
|
||||
* @param xp
|
||||
*/
|
||||
public static void addExperience(EntityPlayer player, int xp, boolean silent) {
|
||||
|
||||
int j = Integer.MAX_VALUE - player.experienceTotal;
|
||||
public static void addExperience(EntityPlayer player, int xp, boolean silent) {
|
||||
|
||||
if(xp > j) {
|
||||
xp = j;
|
||||
}
|
||||
int j = Integer.MAX_VALUE - player.experienceTotal;
|
||||
|
||||
player.experience += (float)xp / (float)player.xpBarCap();
|
||||
if(xp > j) {
|
||||
xp = j;
|
||||
}
|
||||
|
||||
for(player.experienceTotal += xp; player.experience >= 1.0F; player.experience /= (float)player.xpBarCap()) {
|
||||
player.experience = (player.experience - 1.0F) * (float)player.xpBarCap();
|
||||
|
||||
if(silent)
|
||||
addExperienceLevelSilent(player, 1);
|
||||
else
|
||||
player.addExperienceLevel(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setExperience(EntityPlayer player, int xp) {
|
||||
|
||||
player.experienceLevel = 0;
|
||||
player.experience = 0.0F;
|
||||
player.experienceTotal = 0;
|
||||
|
||||
addExperience(player, xp, true);
|
||||
}
|
||||
|
||||
public static void addExperienceLevelSilent(EntityPlayer player, int level) {
|
||||
player.experienceLevel += level;
|
||||
player.experience += (float) xp / (float) player.xpBarCap();
|
||||
|
||||
if (player.experienceLevel < 0) {
|
||||
player.experienceLevel = 0;
|
||||
player.experience = 0.0F;
|
||||
player.experienceTotal = 0;
|
||||
}
|
||||
}
|
||||
for(player.experienceTotal += xp; player.experience >= 1.0F; player.experience /= (float) player.xpBarCap()) {
|
||||
player.experience = (player.experience - 1.0F) * (float) player.xpBarCap();
|
||||
|
||||
if(silent)
|
||||
addExperienceLevelSilent(player, 1);
|
||||
else
|
||||
player.addExperienceLevel(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setExperience(EntityPlayer player, int xp) {
|
||||
|
||||
player.experienceLevel = 0;
|
||||
player.experience = 0.0F;
|
||||
player.experienceTotal = 0;
|
||||
|
||||
addExperience(player, xp, true);
|
||||
}
|
||||
|
||||
public static void addExperienceLevelSilent(EntityPlayer player, int level) {
|
||||
player.experienceLevel += level;
|
||||
|
||||
if(player.experienceLevel < 0) {
|
||||
player.experienceLevel = 0;
|
||||
player.experience = 0.0F;
|
||||
player.experienceTotal = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** Fun fact: experienceTotal lies and has no actual purpose other than misleading people! */
|
||||
public static int getTotalExperience(EntityPlayer player) {
|
||||
int xp = 0;
|
||||
|
||||
/* count only completed levels */
|
||||
for(int i = 0; i < player.experienceLevel; i++) {
|
||||
xp += xpBarCap(i);
|
||||
}
|
||||
|
||||
xp += xpBarCap(player.experienceLevel) * player.experience;
|
||||
|
||||
return xp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,8 +12,8 @@ public class Tuple {
|
||||
|
||||
public static class Pair<X,Y> {
|
||||
|
||||
X key;
|
||||
Y value;
|
||||
public X key;
|
||||
public Y value; //because fuck you
|
||||
|
||||
public Pair(X x, Y y) {
|
||||
this.key = x;
|
||||
|
||||
@ -22,7 +22,7 @@ import net.minecraft.world.gen.structure.StructureStart;
|
||||
public class MapGenNTMFeatures extends MapGenStructure {
|
||||
|
||||
//BiomeDictionary could be /very/ useful, since it automatically sorts *all* biomes into predefined categories
|
||||
private static List biomelist = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.ocean, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.deepOcean});
|
||||
private static List biomelist;
|
||||
/** Maximum distance between structures */
|
||||
private int maxDistanceBetweenScatteredFeatures;
|
||||
/** Minimum distance between structures */
|
||||
@ -64,6 +64,11 @@ public class MapGenNTMFeatures extends MapGenStructure {
|
||||
|
||||
if(k == i1 && l == j1) {
|
||||
BiomeGenBase biomegenbase = this.worldObj.getWorldChunkManager().getBiomeGenAt(k * 16 + 8, l * 16 + 8);
|
||||
|
||||
if(biomelist == null) {
|
||||
biomelist = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.ocean, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.deepOcean});
|
||||
}
|
||||
|
||||
Iterator iterator = biomelist.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user