i think i may have creeked my flow

This commit is contained in:
Boblet 2025-10-15 15:13:59 +02:00
parent 5fd64f5d8f
commit 4d6a92e015
24 changed files with 329 additions and 77 deletions

View File

@ -1,3 +1,15 @@
## Added
* Powered drill
* Gasoline-fueled mining drill with AoE
* Uses the gun system and therefore does not have configurable abilities
* Mining level of iron tools by default
* AoE, melee damage, reach and mining level can be upgraded with drill bits
* Mining speed and fuel used can be changed with engines (diesel, aviation, electric, turbo)
* Fortune can be added as mods (both mods do in fact stack)
* Not a precision tool, intended to be used alongside pickaxes instead of replacing them
* Despite this, sneaking allows the AoE to be disabled
* Unlike pickaxes, shows a preview for what area is to be mined
## Changed
* Updated russian and chinese localization
* VNT type explosions now track affected block positions when the explosion events fire, this should ensure compatibility with mods that rely on that
@ -20,11 +32,13 @@
* Conveyor inserters can now accept boxes directly instead of causing them to burst open
* Conveyor inserters now have a special rule when supplying an arc furnace where instead of trying a full stack and then one item, the first always failing and the last being too slow, they will supply the slot target amount instead
* Given the cycle delay and the lid's movement speed, the inserters should now be fast enough to fully supply a speed III arc furnace
* Skeletons can bow be gibbed by explosions, although it will spawn clean bone particles and omit the gore splash effect
* Skeletons can now be gibbed by explosions, although it will spawn clean bone particles and omit the gore splash effect
* Polymer power tools now only have AoE 1 instead of AoE 2
## Fixed
* Fixed the T-51b set not having radiation resistance
* Potentially fixed a crash on thermos-derived servers involving the flow control pumps
* Fixed crash caused when another tile entity replaces an RBMK component due to an unchecked cast
* Fixed constant cascading chunk gen caused by meteorites and flower patches
* Fixed garbage loot pool sometimes producing "stone wires"
* Fixed garbage loot pool sometimes producing "stone wires"
* Fixed mining lasers targeting blocks with the "gas" material

View File

@ -130,7 +130,6 @@ public class FluidPump extends BlockContainer implements INBTBlockTransformable,
return INBTBlockTransformable.transformMetaDeco(meta, coordBaseMode);
}
@SideOnly(Side.CLIENT)
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public static class TileEntityFluidPump extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IControlReceiver, SimpleComponent, CompatHandler.OCComponent {
@ -348,6 +347,7 @@ public class FluidPump extends BlockContainer implements INBTBlockTransformable,
}
}
@SideOnly(Side.CLIENT)
public static class GUIPump extends GuiScreen {
protected final TileEntityFluidPump pump;

View File

@ -49,7 +49,7 @@ public class ContainerWeaponTable extends Container {
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
super.onPickupFromSlot(player, stack);
XWeaponModManager.install(
stack, index,
mods.getStackInSlot(0),
@ -91,7 +91,7 @@ public class ContainerWeaponTable extends Container {
if(stack != null && stack.getItem() instanceof ItemGunBaseNT) {
int configs = ((ItemGunBaseNT) stack.getItem()).getConfigCount();
if(configs < button) return null;
XWeaponModManager.install(
stack, this.index,
mods.getStackInSlot(0),
@ -197,19 +197,16 @@ public class ContainerWeaponTable extends Container {
public void putStack(ItemStack stack) {
super.putStack(stack);
refreshInstalledMods();
XWeaponModManager.onInstallStack(gun.getStackInSlot(0), stack, index);
}
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
super.onPickupFromSlot(player, stack);
refreshInstalledMods();
XWeaponModManager.onUninstallStack(gun.getStackInSlot(0), stack, index);
}
public void refreshInstalledMods() {
if(gun.getStackInSlot(0) == null) return;
XWeaponModManager.uninstall(gun.getStackInSlot(0), index);
XWeaponModManager.install(
gun.getStackInSlot(0), index,
mods.getStackInSlot(0),

View File

@ -4549,15 +4549,15 @@ public class ModItems {
.addAbility(IWeaponAbility.STUN, 2).setUnlocalizedName("elec_sword").setTextureName(RefStrings.MODID + ":elec_sword_anim");
elec_pickaxe = new ItemToolAbilityPower(6F, 0, MainRegistry.tMatElec, EnumToolType.PICKAXE, 500000, 1000, 100)
.addAbility(IToolAreaAbility.HAMMER, 1)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
.addAbility(IToolAreaAbility.HAMMER, 0)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
.addAbility(IToolAreaAbility.RECURSION, 2)
.addAbility(IToolHarvestAbility.SILK, 0)
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("elec_pickaxe").setTextureName(RefStrings.MODID + ":elec_drill_anim");
elec_axe = new ItemToolAbilityPower(10F, 0, MainRegistry.tMatElec, EnumToolType.AXE, 500000, 1000, 100)
.addAbility(IToolAreaAbility.HAMMER, 1)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
.addAbility(IToolAreaAbility.HAMMER, 0)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
.addAbility(IToolAreaAbility.RECURSION, 2)
.addAbility(IToolHarvestAbility.SILK, 0)
.addAbility(IToolHarvestAbility.LUCK, 1)
@ -4565,8 +4565,8 @@ public class ModItems {
.addAbility(IWeaponAbility.BEHEADER, 0).setShears().setUnlocalizedName("elec_axe").setTextureName(RefStrings.MODID + ":elec_chainsaw_anim");
elec_shovel = new ItemToolAbilityPower(5F, 0, MainRegistry.tMatElec, EnumToolType.SHOVEL, 500000, 1000, 100)
.addAbility(IToolAreaAbility.HAMMER, 1)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
.addAbility(IToolAreaAbility.HAMMER, 0)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 0)
.addAbility(IToolAreaAbility.RECURSION, 2)
.addAbility(IToolHarvestAbility.SILK, 0)
.addAbility(IToolHarvestAbility.LUCK, 1).setUnlocalizedName("elec_shovel").setTextureName(RefStrings.MODID + ":elec_shovel_anim");
@ -4677,7 +4677,7 @@ public class ModItems {
.addAbility(IToolHarvestAbility.LUCK, 1)
.addAbility(IToolAreaAbility.HAMMER, 1)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 1)
.addAbility(IToolAreaAbility.RECURSION, 2).setUnlocalizedName("drax").setTextureName(RefStrings.MODID + ":drax");
.addAbility(IToolAreaAbility.RECURSION, 2).setUnlocalizedName("drax").setCreativeTab(null).setTextureName(RefStrings.MODID + ":drax");
drax_mk2 = new ItemToolAbilityPower(15F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 1000000000, 250000, 7500)
.addAbility(IToolHarvestAbility.SMELTER, 0)
.addAbility(IToolHarvestAbility.SHREDDER, 0)
@ -4685,7 +4685,7 @@ public class ModItems {
.addAbility(IToolHarvestAbility.LUCK, 2)
.addAbility(IToolAreaAbility.HAMMER, 2)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 2)
.addAbility(IToolAreaAbility.RECURSION, 4).setUnlocalizedName("drax_mk2").setTextureName(RefStrings.MODID + ":drax_mk2");
.addAbility(IToolAreaAbility.RECURSION, 4).setUnlocalizedName("drax_mk2").setCreativeTab(null).setTextureName(RefStrings.MODID + ":drax_mk2");
drax_mk3 = new ItemToolAbilityPower(20F, -0.05, MainRegistry.tMatElec, EnumToolType.MINER, 2500000000L, 500000, 10000)
.addAbility(IToolHarvestAbility.SMELTER, 0)
.addAbility(IToolHarvestAbility.SHREDDER, 0)
@ -4695,7 +4695,7 @@ public class ModItems {
.addAbility(IToolHarvestAbility.LUCK, 3)
.addAbility(IToolAreaAbility.HAMMER, 3)
.addAbility(IToolAreaAbility.HAMMER_FLAT, 3)
.addAbility(IToolAreaAbility.RECURSION, 5).setUnlocalizedName("drax_mk3").setTextureName(RefStrings.MODID + ":drax_mk3");
.addAbility(IToolAreaAbility.RECURSION, 5).setUnlocalizedName("drax_mk3").setCreativeTab(null).setTextureName(RefStrings.MODID + ":drax_mk3");
ToolMaterial matBismuth = EnumHelper.addToolMaterial("HBM_BISMUTH", 4, 0, 50F, 0.0F, 200).setRepairItem(new ItemStack(ModItems.ingot_bismuth));
bismuth_pickaxe = new ItemToolAbility(15F, 0, matBismuth, EnumToolType.MINER)

View File

@ -169,6 +169,7 @@ public class GunFactory {
NICKEL, DOUBLOONS,
DRILL_HSS, DRILL_WEAPONSTEEL, DRILL_TCALLOY, DRILL_SATURNITE,
ENGINE_DIESEL, ENGINE_AVIATION, ENGINE_ELECTRIC, ENGINE_TURBO,
MAGNET, SIFTER, CANISTERS
}
public static enum EnumModCaliber {

View File

@ -3,6 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.blocks.ICustomBlockHighlight;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
@ -23,13 +24,17 @@ import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.util.EntityDamageUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.server.S28PacketEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
@ -88,7 +93,7 @@ public class XFactoryDrill {
}
int ammoToUse = 10;
if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_ENGINE_ELECTRIC)) ammoToUse = 500; // that's 2,000 operations
if(XWeaponModManager.hasUpgrade(stack, 0, XWeaponModManager.ID_ENGINE_ELECTRIC)) ammoToUse = 1_000; // that's 1,000 operations
mag.useUpAmmo(stack, ctx.inventory, ammoToUse);
if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index), ctx.config.getDurability(stack)));
}
@ -140,4 +145,37 @@ public class XFactoryDrill {
return null;
};
/**
* Called by the ModEventHandlerRenderer if the held item is a drill, cancels the tooltip so we an replace it with this.
* Should probably make an interface for stuff like this
* @param player
* @param drill
* @param interp
*/
@SideOnly(Side.CLIENT)
public static void drawBlockHighlight(EntityPlayer player, ItemStack drill, float interp) {
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(player, getModdableReach(drill, 5.0D));
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp;
double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp;
double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp;
ICustomBlockHighlight.setup();
int aoe = player.isSneaking() ? 0 : getModdableAoE(drill, 1);
float exp = 0.002F;
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
RenderGlobal.drawOutlinedBoundingBox(aabb.expand(exp, exp, exp).getOffsetBoundingBox(mop.blockX - dX, mop.blockY - dY, mop.blockZ - dZ), aoe > 0 ? -1 : 0x800000);
if(aoe > 0) {
aabb = AxisAlignedBB.getBoundingBox(-aoe, -aoe, -aoe, 1 + aoe, 1 + aoe, 1 + aoe);
RenderGlobal.drawOutlinedBoundingBox(aabb.expand(exp, exp, exp).getOffsetBoundingBox(mop.blockX - dX, mop.blockY - dY, mop.blockZ - dZ), 0x800000);
}
ICustomBlockHighlight.cleanup();
}
}
}

View File

@ -6,6 +6,7 @@ import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.factory.XFactoryDrill;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineElectricEngine;
import com.hbm.items.weapon.sedna.mags.MagazineLiquidEngine;
import api.hbm.energymk2.IBatteryItem;
@ -32,7 +33,13 @@ public class ItemGunDrill extends ItemGunBaseNT implements IFillableItem, IBatte
@Override
public boolean acceptsFluid(FluidType type, ItemStack stack) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
return mag instanceof MagazineLiquidEngine;
if(mag instanceof MagazineLiquidEngine) {
MagazineLiquidEngine engine = (MagazineLiquidEngine) mag;
for(FluidType acc : engine.acceptedTypes) if(type == acc) return true;
}
return false;
}
@Override
@ -72,12 +79,60 @@ public class ItemGunDrill extends ItemGunBaseNT implements IFillableItem, IBatte
return 0;
}
// TBI
@Override public void chargeBattery(ItemStack stack, long i) { }
@Override public void setCharge(ItemStack stack, long i) { }
@Override public void dischargeBattery(ItemStack stack, long i) { }
@Override public long getCharge(ItemStack stack) { return 0; }
@Override public long getMaxCharge(ItemStack stack) { return 0; }
@Override public long getChargeRate() { return 0; }
@Override
public void chargeBattery(ItemStack stack, long i) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(mag instanceof MagazineElectricEngine) {
MagazineElectricEngine engine = (MagazineElectricEngine) mag;
engine.setAmount(stack, Math.min(engine.capacity, engine.getAmount(stack, null) + (int) i));
}
}
@Override
public void setCharge(ItemStack stack, long i) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(mag instanceof MagazineElectricEngine) {
MagazineElectricEngine engine = (MagazineElectricEngine) mag;
engine.setAmount(stack, (int) i);
}
}
@Override
public void dischargeBattery(ItemStack stack, long i) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(mag instanceof MagazineElectricEngine) {
MagazineElectricEngine engine = (MagazineElectricEngine) mag;
engine.setAmount(stack, Math.max(0, engine.getAmount(stack, null) - (int) i));
}
}
@Override
public long getCharge(ItemStack stack) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(mag instanceof MagazineElectricEngine) {
MagazineElectricEngine engine = (MagazineElectricEngine) mag;
return engine.getAmount(stack, null);
}
return 0;
}
@Override
public long getMaxCharge(ItemStack stack) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(mag instanceof MagazineElectricEngine) {
MagazineElectricEngine engine = (MagazineElectricEngine) mag;
return engine.getCapacity(stack);
}
return 0;
}
@Override public long getChargeRate() { return 50_000; }
@Override public long getDischargeRate() { return 0; }
}

View File

@ -42,7 +42,7 @@ public class MagazineElectricEngine implements IMagazine {
@Override public void reloadAction(ItemStack stack, IInventory inventory) { }
@Override public SpentCasing getCasing(ItemStack stack, IInventory inventory) { return null; }
@Override public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) { return new ItemStack(ModItems.battery_creative); }
@Override public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) { return new ItemStack(ModItems.battery_generic); }
@Override public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player) { return BobMathUtil.getShortNumber(getAmount(stack, player.inventory)) + "/" + BobMathUtil.getShortNumber(this.capacity) + "HE"; }
@Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); }

View File

@ -4,13 +4,10 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineBelt;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleTypeBase;
import net.minecraft.item.ItemStack;
@ -60,15 +57,6 @@ public class WeaponModCaliber extends WeaponModBase {
}
/* adding or removing a caliber mod annihilates the loaded rounds */
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
public void clearMag(ItemStack stack, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
IMagazine mag = gun.getConfig(stack, index).getReceivers(stack)[0].getMagazine(stack);
if(mag instanceof MagazineSingleTypeBase) {
MagazineSingleTypeBase mstb = (MagazineSingleTypeBase) mag;
mstb.setAmount(stack, 0);
}
}
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
}

View File

@ -0,0 +1,42 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.MagazineElectricEngine;
import com.hbm.items.weapon.sedna.mags.MagazineLiquidEngine;
import net.minecraft.item.ItemStack;
public class WeaponModCanisters extends WeaponModBase {
protected static MagazineLiquidEngine DUMMY_LIQUID = new MagazineLiquidEngine(0, 0);
protected static MagazineElectricEngine DUMMY_ELECTRIC = new MagazineElectricEngine(0, 0);
public WeaponModCanisters(int id) {
super(id, "CANISTERS");
this.setPriority(PRIORITY_MULT_FINAL);
}
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
if(key == Receiver.O_MAGAZINE) {
if(base instanceof MagazineLiquidEngine) {
MagazineLiquidEngine original = (MagazineLiquidEngine) base;
DUMMY_LIQUID.acceptedTypes = original.acceptedTypes;
DUMMY_LIQUID.capacity = original.capacity * 3;
DUMMY_LIQUID.index = original.index;
return (T) DUMMY_LIQUID;
}
if(base instanceof MagazineElectricEngine) {
MagazineElectricEngine original = (MagazineElectricEngine) base;
DUMMY_ELECTRIC.capacity = original.capacity * 3;
DUMMY_ELECTRIC.index = original.index;
return (T) DUMMY_ELECTRIC;
}
}
return base;
}
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
}

View File

@ -0,0 +1,38 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.util.EnchantmentUtil;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
public class WeaponModDrillFortune extends WeaponModBase {
int addFortune = 0;
public WeaponModDrillFortune(int id, String slot, int fortune) {
super(id, slot);
this.setPriority(PRIORITY_ADDITIVE);
this.addFortune = fortune;
}
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
return base;
}
@Override
public void onInstall(ItemStack gun, ItemStack mod, int index) {
int fortuneLvl = EnchantmentUtil.getEnchantmentLevel(gun, Enchantment.fortune);
fortuneLvl += this.addFortune;
EnchantmentUtil.removeEnchantment(gun, Enchantment.fortune);
EnchantmentUtil.addEnchantment(gun, Enchantment.fortune, fortuneLvl);
}
@Override
public void onUninstall(ItemStack gun, ItemStack mod, int index) {
int fortuneLvl = EnchantmentUtil.getEnchantmentLevel(gun, Enchantment.fortune);
fortuneLvl -= this.addFortune;
EnchantmentUtil.removeEnchantment(gun, Enchantment.fortune);
if(fortuneLvl > 0) EnchantmentUtil.addEnchantment(gun, Enchantment.fortune, fortuneLvl);
}
}

View File

@ -1,7 +1,6 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineElectricEngine;
@ -36,12 +35,6 @@ public class WeaponModEngine extends WeaponModBase {
return base;
}
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); }
public void clearMag(ItemStack stack, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
IMagazine mag = gun.getConfig(stack, index).getReceivers(stack)[0].getMagazine(stack);
mag.setAmount(stack, 0);
}
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
}

View File

@ -38,4 +38,7 @@ public class WeaponModStackMag extends WeaponModBase {
}
return base;
}
@Override public void onInstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
@Override public void onUninstall(ItemStack gun, ItemStack mod, int index) { XWeaponModManager.changedMagState(); }
}

View File

@ -11,6 +11,7 @@ import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.factory.XFactory9mm;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModCaliber;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModGeneric;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModSpecial;
@ -27,6 +28,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
/**
* The mod manager operates by scraping upgrades from a gun, then iterating over them and evaluating the given value, passing the modified value to successive mods.
@ -155,12 +157,15 @@ public class XWeaponModManager {
new WeaponModDefinition(EnumModSpecial.DRILL_HSS).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_HSS).damage(1.25F).dt(3F).pierce(0.15F).harvest(ToolMaterial.EMERALD.ordinal()));
new WeaponModDefinition(EnumModSpecial.DRILL_WEAPONSTEEL).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_WSTEEL).damage(1.5F).dt(5F).pierce(0.2F).aoe(2).harvest(ToolMaterial.EMERALD.ordinal()));
new WeaponModDefinition(EnumModSpecial.DRILL_TCALLOY).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_TCALLOY).damage(2F).dt(7.5F).pierce(0.2F).reach(1.5).aoe(2).harvest(ToolMaterial.EMERALD.ordinal() + 1));
new WeaponModDefinition(EnumModSpecial.DRILL_SATURNITE).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_SATURN).damage(3F).dt(10F).pierce(0.25F).reach(2).aoe(2).harvest(ToolMaterial.EMERALD.ordinal() + 2));
new WeaponModDefinition(EnumModSpecial.DRILL_TCALLOY).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_TCALLOY).damage(2F).dt(7.5F).pierce(0.2F).reach(2).aoe(3).harvest(ToolMaterial.EMERALD.ordinal() + 1));
new WeaponModDefinition(EnumModSpecial.DRILL_SATURNITE).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrill(ID_DRILL_SATURN).damage(3F).dt(10F).pierce(0.25F).reach(2).aoe(3).harvest(ToolMaterial.EMERALD.ordinal() + 2));
new WeaponModDefinition(EnumModSpecial.ENGINE_DIESEL).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_DIESEL).mag(WeaponModEngine.ENGINE_DIESEL).delay(15));
new WeaponModDefinition(EnumModSpecial.ENGINE_AVIATION).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_AVIATION).mag(WeaponModEngine.ENGINE_AVIATION).delay(10));
new WeaponModDefinition(EnumModSpecial.ENGINE_ELECTRIC).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_ELECTRIC).mag(WeaponModEngine.ENGINE_ELECTRIC).delay(15));
new WeaponModDefinition(EnumModSpecial.ENGINE_TURBO).addMod(new Item[] {ModItems.gun_drill}, new WeaponModEngine(ID_ENGINE_TURBO).mag(WeaponModEngine.ENGINE_TURBO).delay(2));
new WeaponModDefinition(EnumModSpecial.MAGNET).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrillFortune(230, "MAGNET", 2));
new WeaponModDefinition(EnumModSpecial.SIFTER).addMod(new Item[] {ModItems.gun_drill}, new WeaponModDrillFortune(231, "SIFTER", 1));
new WeaponModDefinition(EnumModSpecial.CANISTERS).addMod(new Item[] {ModItems.gun_drill}, new WeaponModCanisters(232));
BulletConfig[] p9 = new BulletConfig[] {XFactory9mm.p9_sp, XFactory9mm.p9_fmj, XFactory9mm.p9_jhp, XFactory9mm.p9_ap};
BulletConfig[] p45 = new BulletConfig[] {XFactory45.p45_sp, XFactory45.p45_fmj, XFactory45.p45_jhp, XFactory45.p45_ap, XFactory45.p45_du};
@ -249,8 +254,51 @@ public class XWeaponModManager {
return false;
}
/** Installs the supplied mods to the gun */
private static Object prevMagType;
private static int prevMagCount;
private static boolean changedMagState = false;
public static void changedMagState() {
changedMagState = true;
}
/** Saves the state on receiver 0 so that if the mag changes through upgrading, the state may potentially be restored, if compatible */
private static void saveMagState(ItemStack stack, int cfg) {
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, cfg).getReceivers(stack)[0].getMagazine(stack);
prevMagType = mag.getType(stack, null);
prevMagCount = mag.getAmount(stack, null);
}
/*
* TODO: as soon as there's guns that use more receivers, handle those as well
* arising problem: assume there's three receivers, 0, 1, 2, and receiver 1 is removed by pulling a weapon mod.
* the previous states of receivers 0 and 2 would need to be mapped to the new receivers 0 and 1.
* proposed solution: order can be expected the same, simply check both arrays side by side and skip an index on either
* one if that one's type doesn't match. there may be edge cases where this doesn't work, especially with a ton of
* receivers, but for a common case of an SMG + GL this should work just fine
*/
private static void restoreMagState(ItemStack stack, int cfg) {
if(!changedMagState) return;
changedMagState = false;
IMagazine mag = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, cfg).getReceivers(stack)[0].getMagazine(stack);
if(mag.getType(stack, null) == prevMagType) {
mag.setAmount(stack, MathHelper.clamp_int(prevMagCount, 0, mag.getCapacity(stack)));
} else {
mag.setAmount(stack, 0);
}
}
/**
* Saves the mag state on receiver 0, uninstalls all existing mods to ensure there's no double install calls,
* then installs the mods. If a mag state change has been reported, the mag on receiver 0 is validated,
* i.e. if the type is still the same, the amount is restored, otherwise the mag is cleared.
*/
public static void install(ItemStack stack, int cfg, ItemStack... mods) {
saveMagState(stack, cfg);
// we need to always clear things, so existing mods aren't installed twice, i.e. enchantment levels applied twice
uninstall(stack, cfg);
List<IWeaponMod> toInstall = new ArrayList();
ComparableStack gun = new ComparableStack(stack);
@ -260,8 +308,9 @@ public class XWeaponModManager {
WeaponModDefinition def = stackToMod.get(comp);
if(def != null) {
IWeaponMod forGun = def.modByGun.get(gun);
if(forGun != null) toInstall.add(forGun); //since this code only runs for upgrading, we can just indexOf because who cares
else {
if(forGun != null) {
toInstall.add(forGun); //since this code only runs for upgrading, we can just indexOf because who cares
} else {
forGun = def.modByGun.get(null);
if(forGun != null) toInstall.add(forGun);
}
@ -271,13 +320,21 @@ public class XWeaponModManager {
toInstall.sort(modSorter);
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
int[] modIds = new int[toInstall.size()];
for(int i = 0; i < modIds.length; i++) modIds[i] = idToMod.inverse().get(toInstall.get(i));
for(int i = 0; i < modIds.length; i++) {
IWeaponMod mod = toInstall.get(i);
modIds[i] = idToMod.inverse().get(mod);
onInstallStack(stack, modToStack.get(mod), cfg);
}
stack.stackTagCompound.setIntArray(KEY_MOD_LIST + cfg, modIds);
restoreMagState(stack, cfg);
}
/** Wipes all mods from the gun */
public static void uninstall(ItemStack stack, int cfg) {
if(stack.hasTagCompound()) {
if(stack != null && stack.hasTagCompound()) {
for(ItemStack mod : getUpgradeItems(stack, cfg)) {
XWeaponModManager.onUninstallStack(stack, mod, cfg);
}
stack.stackTagCompound.removeTag(KEY_MOD_LIST + cfg);
//no need to clean up empty stackTagCompound because gun NBT is never empty anyway
}

View File

@ -5,9 +5,11 @@ import com.hbm.config.ClientConfig;
import com.hbm.config.RadiationConfig;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.ModItems;
import com.hbm.items.armor.IArmorDisableModel;
import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.factory.XFactoryDrill;
import com.hbm.packet.PermaSyncHandler;
import com.hbm.render.item.weapon.sedna.ItemRenderWeaponBase;
import com.hbm.render.model.ModelMan;
@ -409,6 +411,14 @@ public class ModEventHandlerRenderer {
@SubscribeEvent
public void onDrawHighlight(DrawBlockHighlightEvent event) {
EntityPlayer player = MainRegistry.proxy.me();
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_drill) {
XFactoryDrill.drawBlockHighlight(player, player.getHeldItem(), event.partialTicks);
event.setCanceled(true);
return;
}
MovingObjectPosition mop = event.target;
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {

View File

@ -425,7 +425,7 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen
}
private boolean canBreak(Block block, int x, int y, int z) {
return !block.isAir(worldObj, x, y, z) && block.getBlockHardness(worldObj, x, y, z) >= 0 && !block.getMaterial().isLiquid() && block != Blocks.bedrock;
return !block.isAir(worldObj, x, y, z) && block.getMaterial() != ModBlocks.materialGas && block.getBlockHardness(worldObj, x, y, z) >= 0 && !block.getMaterial().isLiquid() && block != Blocks.bedrock;
}
public int getRange() {

View File

@ -13,7 +13,6 @@ public class EnchantmentUtil {
* @param level
*/
public static void addEnchantment(ItemStack stack, Enchantment enchantment, int level) {
stack.addEnchantment(enchantment, level);
}
@ -24,8 +23,7 @@ public class EnchantmentUtil {
*/
public static void removeEnchantment(ItemStack stack, Enchantment enchantment) {
if(stack.getEnchantmentTagList() == null)
return;
if(stack.getEnchantmentTagList() == null) return;
int i = 0;
for( ; i < stack.getEnchantmentTagList().tagCount(); i++) {
@ -40,20 +38,31 @@ public class EnchantmentUtil {
stack.getTagCompound().removeTag("ench");
}
public static int getEnchantmentLevel(ItemStack stack, Enchantment enchantment) {
if(stack.getEnchantmentTagList() == null) return 0;
for(int i = 0; i < stack.getEnchantmentTagList().tagCount(); i++) {
if(stack.getEnchantmentTagList().getCompoundTagAt(i).getShort("id") == enchantment.effectId)
return stack.getEnchantmentTagList().getCompoundTagAt(i).getShort("lvl");
}
return 0;
}
/**
* Returns the size of the XP bar for the given level
* @param level
* @return
*/
public static int xpBarCap(int level) {
return level >= 30 ? 62 + (level - 30) * 7 : (level >= 15 ? 17 + (level - 15) * 3 : 17);
}
/**
*
* @param targetXp
* @return
*/
public static int xpBarCap(int level) {
return level >= 30 ? 62 + (level - 30) * 7 : (level >= 15 ? 17 + (level - 15) * 3 : 17);
}
/**
*
* @param targetXp
* @return
*/
public static int getLevelForExperience(int xp) {
int level = 0;

View File

@ -497,6 +497,7 @@ public class EntityDamageUtil {
}
public static Vec3 getPosition(EntityPlayer player) {
return Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
boolean client = player.yOffset != 0; // shitty hack to account for the weird offset rules i couldn't really work around otherwise
return Vec3.createVectorHelper(player.posX, player.posY + (client ? 0 : player.getEyeHeight()), player.posZ);
}
}

View File

@ -1909,9 +1909,9 @@ item.door_metal.name=Metalltür
item.door_office.name=Bürotür
item.door_red.name=Rote Tür
item.dosimeter.name=Dosimeter
item.drax.name=Terra-Bohrer
item.drax_mk2.name=Gehärteter Terra-Bohrer
item.drax_mk3.name=Schrabidischer Terra-Bohrer
item.drax.name=Terra-Bohrer (LEGACY)
item.drax_mk2.name=Gehärteter Terra-Bohrer (LEGACY)
item.drax_mk3.name=Schrabidischer Terra-Bohrer (LEGACY)
item.drillbit_desh.name=Desh-Bohrspitze
item.drillbit_desh_diamond.name=Desh-Bohrspitze (Diamantbeschichtung)
item.drillbit_ferro.name=Ferrouran-Bohrspitze
@ -3658,6 +3658,7 @@ item.weapon_mod_generic.tcalloy_dura.name=Langlebige Legierungsteile
item.weapon_mod_generic.wsteel_damage.name=Optimierter Waffenstahl-Verschluss
item.weapon_mod_generic.wsteel_dura.name=Langlebige Waffenstahl-Teile
item.weapon_mod_special.bayonet.name=Bayonet
item.weapon_mod_special.canisters.name=Motorisierter Bohrer - Zusätzliche Kanister
item.weapon_mod_special.choke.name=Choke
item.weapon_mod_special.doubloons.name=Zwei Golddublonen
item.weapon_mod_special.drill_hss.name=Motorisierter Bohrer - Schnellarbeitsstahl-Bohrkopf
@ -3674,9 +3675,11 @@ item.weapon_mod_special.greasegun.name=Grease Gun Modernisierungskit
item.weapon_mod_special.las_auto.name=Lasergewehr - Autommatischer Verschluss
item.weapon_mod_special.las_capacitor.name=Lasergewehr - Erweiterter Kondensator
item.weapon_mod_special.las_shotgun.name=Lasergewehr - Strahlteiler
item.weapon_mod_special.magnet.name=Motorisierter Bohrer - Elektromagnet
item.weapon_mod_special.nickel.name=10 Cent
item.weapon_mod_special.saw.name=Bügelsäge
item.weapon_mod_special.scope.name=Ziehlvorrichtung
item.weapon_mod_special.sifter.name=Motorisierter Bohrer - Sieb
item.weapon_mod_special.silencer.name=Schalldämpfer
item.weapon_mod_special.skin_saturnite.name=Saturnit-Skin
item.weapon_mod_special.slowdown.name=Rädergetriebe

View File

@ -2725,9 +2725,9 @@ item.door_metal.name=Metal Door
item.door_office.name=Office Door
item.door_red.name=Red Door
item.dosimeter.name=Dosimeter
item.drax.name=Terra Drill
item.drax_mk2.name=Hardened Terra Drill
item.drax_mk3.name=Schrabidic Terra Drill
item.drax.name=Terra Drill (LEGACY)
item.drax_mk2.name=Hardened Terra Drill (LEGACY)
item.drax_mk3.name=Schrabidic Terra Drill (LEGACY)
item.drillbit_desh.name=Desh Drillbit
item.drillbit_desh_diamond.name=Desh Drillbit (Diamond-Tipped)
item.drillbit_ferro.name=Ferrouranium Drillbit
@ -4805,6 +4805,7 @@ item.weapon_mod_generic.tcalloy_dura.name=High-Durability Resistant Alloy Parts
item.weapon_mod_generic.wsteel_damage.name=Optimized Weapon Steel Receiver
item.weapon_mod_generic.wsteel_dura.name=High-Durability Weapon Steel Parts
item.weapon_mod_special.bayonet.name=Bayonet
item.weapon_mod_special.canisters.name=Powered Drill - Extension Canisters
item.weapon_mod_special.choke.name=Choke
item.weapon_mod_special.doubloons.name=Two Gold Doubloons
item.weapon_mod_special.drill_hss.name=Powered Drill - High-Speed Steel Drillbit
@ -4821,9 +4822,11 @@ item.weapon_mod_special.greasegun.name=Grease Gun Modernization Kit
item.weapon_mod_special.las_auto.name=Laser Rifle Automatic Receiver
item.weapon_mod_special.las_capacitor.name=Laser Rifle Extended Capacitor
item.weapon_mod_special.las_shotgun.name=Laser Rifle Beam Splitter
item.weapon_mod_special.magnet.name=Powered Drill - Electromagnet
item.weapon_mod_special.nickel.name=Two Nickels
item.weapon_mod_special.saw.name=Hacksaw
item.weapon_mod_special.scope.name=Scope
item.weapon_mod_special.sifter.name=Powered Drill - Sifter
item.weapon_mod_special.silencer.name=Silencer
item.weapon_mod_special.skin_saturnite.name=Saturnite Skin
item.weapon_mod_special.slowdown.name=Gear Train

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B