this is the last fucking refactor PR

This commit is contained in:
Boblet 2025-04-09 11:53:16 +02:00
parent 1282e525da
commit 98bc692d29
4 changed files with 30 additions and 22 deletions

View File

@ -38,3 +38,4 @@
* Fixed dupe regarding the toolbox
* Fixed dummies with no OC components taking up a ton of component slots
* Fixed infested glyphids spawning maggots also on the clientside, creating unkillable ghosts
* Fixed top left column not being selectable in the RBMK console

View File

@ -134,7 +134,7 @@ public class GUIRBMKConsole extends GuiScreen {
int index = ((mouseX - bX - guiLeft) / size + (mouseY - bY - guiTop) / size * 15);
if(index > 0 && index < selection.length && console.columns[index] != null) {
if(index >= 0 && index < selection.length && console.columns[index] != null) {
this.selection[index] = !this.selection[index];
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.75F + (this.selection[index] ? 0.25F : 0.0F)));

View File

@ -31,17 +31,12 @@ import net.minecraft.util.ResourceLocation;
// clientonly...
public class ArmorModel extends ItemArmor {
@SideOnly(Side.CLIENT)
private static final ModelGoggles modelGoggles = new ModelGoggles();
@SideOnly(Side.CLIENT)
private static final ModelHat modelHat = new ModelHat(0);
@SideOnly(Side.CLIENT)
private static final ModelCloak modelCloak = new ModelCloak();
@SideOnly(Side.CLIENT) private ModelGoggles modelGoggles;
@SideOnly(Side.CLIENT) private ModelHat modelHat;
@SideOnly(Side.CLIENT) private ModelCloak modelCloak;
@SideOnly(Side.CLIENT)
private static final ResourceLocation[] gogglesBlurs = IntStream.range(0, 6)
.mapToObj(i -> new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_goggles_" + i + ".png"))
.toArray(ResourceLocation[]::new);
private ResourceLocation[] gogglesBlurs;
public ArmorModel(ArmorMaterial armorMaterial, int armorType) {
super(armorMaterial, 0, armorType);
@ -52,16 +47,19 @@ public class ArmorModel extends ItemArmor {
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
if(this == ModItems.goggles) {
if(armorSlot == 0) {
if(modelGoggles == null) modelGoggles = new ModelGoggles();
return modelGoggles;
}
}
if(this == ModItems.hat) {
if(armorSlot == 0) {
if(modelHat == null) modelHat = new ModelHat(0);
return modelHat;
}
}
if(this == ModItems.cape_radiation || this == ModItems.cape_gasmask || this == ModItems.cape_schrabidium || this == ModItems.cape_hidden) {
if(armorSlot == 1) {
if(modelCloak == null) modelCloak = new ModelCloak();
return modelCloak;
}
}
@ -95,6 +93,10 @@ public class ArmorModel extends ItemArmor {
if(this != ModItems.goggles && this != ModItems.hazmat_helmet_red && this != ModItems.hazmat_helmet_grey)
return;
if(gogglesBlurs == null) gogglesBlurs = IntStream.range(0, 6)
.mapToObj(i -> new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_goggles_" + i + ".png"))
.toArray(ResourceLocation[]::new);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_ALPHA_TEST);
@ -124,15 +126,8 @@ public class ArmorModel extends ItemArmor {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
if(this == ModItems.cape_radiation) {
list.add("Avalible for everyone");
}
if(this == ModItems.cape_gasmask) {
list.add("Avalible for everyone");
}
if(this == ModItems.cape_schrabidium) {
list.add("Avalible for everyone");
}
if(this == ModItems.cape_radiation) list.add("Avalible for everyone");
if(this == ModItems.cape_gasmask) list.add("Avalible for everyone");
if(this == ModItems.cape_schrabidium) list.add("Avalible for everyone");
}
}

View File

@ -5,6 +5,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Random;
import com.hbm.tileentity.network.TileEntityPneumoTube;
import com.hbm.uninos.NodeNet;
@ -24,6 +25,7 @@ public class PneumaticNetwork extends NodeNet {
public static final byte RECEIVE_ROBIN = 0;
public static final byte RECEIVE_RANDOM = 1;
public Random rand = new Random();
public int nextReceiver = 0;
protected static int timeout = 1_000;
@ -42,6 +44,11 @@ public class PneumaticNetwork extends NodeNet {
public boolean send(IInventory source, TileEntityPneumoTube tube, ForgeDirection dir, int sendOrder, int receiveOrder) {
// turns out there may be a short time window where the cleanup hasn't happened yet, but chunkloading has already caused tiles to go invalid
// so we just run it again here, just to be sure.
long timestamp = System.currentTimeMillis();
receivers.entrySet().removeIf(x -> { return (timestamp - x.getValue().getValue() > timeout) || NodeNet.isBadLink(x.getKey()); });
if(receivers.isEmpty()) return false;
int[] slotAccess;
@ -65,7 +72,12 @@ public class PneumaticNetwork extends NodeNet {
receiverList.sort(comparator);
int index = nextReceiver % receivers.size();
Entry<IInventory, Pair<ForgeDirection, Long>> chosenReceiverEntry = receiverList.get(index);
Entry<IInventory, Pair<ForgeDirection, Long>> chosenReceiverEntry = null;
if(receiveOrder == RECEIVE_ROBIN) chosenReceiverEntry = receiverList.get(index);
if(receiveOrder == RECEIVE_RANDOM) chosenReceiverEntry = receiverList.get(rand.nextInt(receiverList.size()));
if(chosenReceiverEntry == null) return false;
//TBI - the painful part