Skip to content

Commit

Permalink
flixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Feb 5, 2025
1 parent d4d5340 commit bd59ae5
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 19 deletions.
17 changes: 2 additions & 15 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
## Changed
* Changed PA power draw penalties from x5 to x10
* Particles will now crash instantly if the dipole has both penalties in effect (underspeed + undersized ring)
* This means that undersized accelerators require appropriate tier coils, and overtiered accelerators (i.e. high coils for low velocities) need to meet the size requirement
* Accelerators where both penalties take effect are usually tiny ones with single tier coils (usually the highest tier required) which are lame
* DNT nano suit helmets now require quantum circuits instead of bismuth ones
* Made particle capsules more expensive
* Since invalid recipes no longer void containers, this shouldn't really be a huge deal
* Both quadrupoles and dipoles now have a power cap of 2.5MHE
* RFCs now use 250kHE per pass (instead of 100k)
* Heavy water extraction now has a NEI handler

## Fixed
* Fixed particle detector not consuming power
* Fixed empty capsules not being recoverable from the color coded slots on the particle source
* Fixed particle detector nor charging from batteries
* Fixed items being annihilated when shift clicking them into the particle source
* Fixed packet optimization not allowing packets to be sent when the day night cycle is halted
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.items.ModItems;
import com.hbm.tileentity.machine.albion.TileEntityPASource;
import com.hbm.util.InventoryUtil;

import api.hbm.energymk2.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -59,9 +60,9 @@ public ItemStack transferStackInSlot(EntityPlayer player, int index) {
} else {

if(rStack.getItem() instanceof IBatteryItem || rStack.getItem() == ModItems.battery_creative) {
if(!this.mergeItemStack(stack, 0, 1, false)) return null;
if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 0, 1, false)) return null;
} else {
if(!this.mergeItemStack(stack, 1, 3, false)) return null;
if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 1, 3, false)) return null;
}
}

Expand Down
119 changes: 119 additions & 0 deletions src/main/java/com/hbm/items/ItemCustomLore.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hbm.items;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

Expand All @@ -14,6 +15,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;

public class ItemCustomLore extends Item {

Expand Down Expand Up @@ -104,4 +106,121 @@ public Item setUnlocalizedName(String uloc) {
setTextureName(RefStrings.MODID + ':' + uloc);
return super.setUnlocalizedName(uloc);
}

@Override
public String getItemStackDisplayName(ItemStack stack) {
if(stack.getItem() == ModItems.undefined && stack.getItemDamage() != 99) return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();

return name.getResult();
}

public static String[] names = new String[] {
"THE DEFAULT", "NEXT ONE", "ANOTHER ONE", "NON-STANDARD NAME", "AMBIGUOUS TITLE", "SHORT"
};

public static Random rand = new Random();
public static int currentIndex = 0;
public static ScramblingName name = new ScramblingName(names[0]);

public static void updateSystem() {
name.updateTick(names);
}

/**
* A surprise tool we need for later
* @author hbm
*/
public static class ScramblingName {

public String previous;
public String next;
public String[] previousFrags;
public String[] nextFrags;
public String[] frags;
public int[] mask;
public int age = 0;

public ScramblingName(String init) {
previous = next = init;
frags = init.split("");
mask = new int[frags.length];
previousFrags = chop(previous, frags.length);
nextFrags = chop(next, frags.length);
}

public String getResult() {
return String.join("", frags);
}

public void updateTick(String[] nextNames) {
age++;
try {
//pick new name
if(age % 200 == 0) nextName(nextNames);
//run substitution
if(age % 5 == 0) scramble();
} catch(Exception ex) { }
}

public void nextName(String[] nextNames) {
if(nextNames.length < 2) return;

this.previous = this.next;

String initial = next;
//keep choosing new names until it's different
while(initial.equals(next)) {
next = nextNames[rand.nextInt(nextNames.length)];
}

//frag setup
int length = Math.min(previous.length(), next.length());
this.previousFrags = chop(previous, length);
this.frags = chop(previous, length);
this.nextFrags = chop(next, length);
mask = new int[length];
}

public void scramble() {

//all fragments that haven't been substituted
List<Integer> indices = new ArrayList();

for(int i = 0; i < mask.length; i++) {
int m = mask[i];
//mask 0 means not yet processed
if(m == 0) indices.add(i);
//mask 1-5 means obfuscated
if(m > 0 && m <= 5) mask[i]++;
//mask >5 means replaced
if(m > 5) frags[i] = nextFrags[i];
}

//if there's at least one index listed, start processing
if(!indices.isEmpty()) {
int toSwitch = indices.get(rand.nextInt(indices.size()));
mask[toSwitch] = 1;
frags[toSwitch] = EnumChatFormatting.OBFUSCATED + previousFrags[toSwitch] + EnumChatFormatting.RESET;
}
}

public String[] chop(String name, int parts) {
if(parts == name.length()) return name.split("");

double index = 0;
double incrementPerStep = (double) name.length() / (double) parts;
List<String> slices = new ArrayList();

for(int i = 0; i < parts; i++) {
int end = (i == parts - 1) ? name.length() : (int) (index + incrementPerStep);
slices.add(name.substring((int) index, end));
index += incrementPerStep;
}

String[] chop = slices.toArray(new String[parts]);
//System.out.println("Chopped " + name + " into " + parts + " pieces: " + chop);

return chop;
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/hbm/items/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,7 @@ public static void mainRegistry()
public static Item gun_hangman;
public static Item gun_bolter;
public static Item gun_folly;
public static Item gun_aberrator;
public static Item gun_double_barrel;
public static Item gun_double_barrel_sacred_dragon;

Expand Down Expand Up @@ -6493,6 +6494,7 @@ private static void registerItem() {
GameRegistry.registerItem(gun_hangman, gun_hangman.getUnlocalizedName());
GameRegistry.registerItem(gun_bolter, gun_bolter.getUnlocalizedName());
GameRegistry.registerItem(gun_folly, gun_folly.getUnlocalizedName());
GameRegistry.registerItem(gun_aberrator, gun_aberrator.getUnlocalizedName());
GameRegistry.registerItem(gun_double_barrel, gun_double_barrel.getUnlocalizedName());
GameRegistry.registerItem(gun_double_barrel_sacred_dragon, gun_double_barrel_sacred_dragon.getUnlocalizedName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static void init() {
XFactoryFolly.init();
XFactoryTurret.init();
XFactory10ga.init();
XFactory35800.init();

/// PROXY BULLSHIT ///
MainRegistry.proxy.registerGunCfg();
Expand Down Expand Up @@ -124,6 +125,7 @@ public Enum[] getOrder() {

public static enum EnumAmmoSecret {
FOLLY_SM, FOLLY_NUKE,
M44_EQUESTRIAN, G12_EQUESTRIAN, BMG50_EQUESTRIAN
M44_EQUESTRIAN, G12_EQUESTRIAN, BMG50_EQUESTRIAN,
P35_800
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1278,4 +1278,11 @@ public class Orchestras {
if(timer == 2) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 1F);
}
};

public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ABERRATOR = (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);
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.hbm.items.weapon.sedna.factory;

import java.util.function.BiFunction;

import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass;

import net.minecraft.item.ItemStack;

public class XFactory35800 {

public static BulletConfig p35800;

public static void init() {

p35800 = new BulletConfig().setItem(EnumAmmoSecret.P35_800).setupDamageClass(DamageClass.LASER).setBeam().setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);

ModItems.gun_aberrator = new ItemGunBaseNT(WeaponQuality.SECRET, new GunConfig()
.dura(2_000).draw(10).inspect(26).reloadSequential(true).crosshair(Crosshair.CIRCLE)
.rec(new Receiver(0)
.dmg(50F).delay(8).reload(44).jam(36).sound("hbm:weapon.fire.laser", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 24).addConfigs(p35800))
.offset(0.75, -0.0625 * 1.5, -0.1875)
.setupStandardFire())
.setupStandardConfiguration()
.anim(LAMBDA_ABERRATOR).orchestra(Orchestras.ORCHESTRA_ABERRATOR)
).setUnlocalizedName("gun_aberrator");
}

@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_ABERRATOR = (stack, type) -> {
return null;
};
}
3 changes: 3 additions & 0 deletions src/main/java/com/hbm/main/ModEventHandlerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.hbm.inventory.gui.GUIArmorTable;
import com.hbm.inventory.gui.GUIScreenPreview;
import com.hbm.inventory.gui.GUIScreenWikiRender;
import com.hbm.items.ItemCustomLore;
import com.hbm.items.ModItems;
import com.hbm.items.armor.*;
import com.hbm.items.machine.ItemDepletedFuel;
Expand Down Expand Up @@ -1389,6 +1390,8 @@ public void worldTick(WorldTickEvent event) {
client.sendQueue.addToSendQueue(new C0CPacketInput(client.moveStrafing, client.moveForward, client.movementInput.jump, client.movementInput.sneak));
}
}

if(event.phase == event.phase.END) ItemCustomLore.updateSystem();
}

@SubscribeEvent
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hbm/tileentity/TileEntityLoadedBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void networkPackNT(int range) {
// In my testing, this can be reliably reproduced with a full fluid barrel, for instance.
// I think it might be fixable by doing something with getDescriptionPacket() and onDataPacket(),
// but this sidesteps the problem for the mean time.
if(preBuf.equals(lastPackedBuf) && this.worldObj.getWorldTime() % 20 != 0) return;
if(preBuf.equals(lastPackedBuf) && this.worldObj.getTotalWorldTime() % 20 != 0) return;

this.lastPackedBuf = preBuf.copy();

Expand Down

0 comments on commit bd59ae5

Please sign in to comment.