constant restructuring

This commit is contained in:
Bob 2024-05-09 19:30:44 +02:00
parent ffd0b19620
commit 664d251e14
12 changed files with 240 additions and 192 deletions

View File

@ -60,7 +60,7 @@ public class MachineIGenerator extends BlockDummyable implements ILookOverlay {
if(pos == null)
return false;
TileEntityMachineIGenerator gen = (TileEntityMachineIGenerator)world.getTileEntity(pos[0], pos[1], pos[2]);
//TileEntityMachineIGenerator gen = (TileEntityMachineIGenerator)world.getTileEntity(pos[0], pos[1], pos[2]);
//if(gen != null) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);

View File

@ -14,10 +14,10 @@ import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.items.ModItems;
import com.hbm.items.armor.ItemModCladding;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.potion.HbmPotion;
import com.hbm.util.Compat;
import com.hbm.util.ShadyUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@ -257,7 +257,7 @@ public class HazmatRegistry {
float res = 0.0F;
if(player.getUniqueID().toString().equals(Library.Pu_238)) {
if(player.getUniqueID().toString().equals(ShadyUtil.Pu_238)) {
res += 0.4F;
}

View File

@ -30,7 +30,7 @@ public class HazardModifierRBMKRadiation extends HazardModifier {
} else if(stack.getItem() instanceof ItemRBMKPellet) {
double depletion = linear ? (ItemRBMKPellet.rectify(stack.getItemDamage()) % 5) / 4F : 1 - Math.pow((4 - ItemRBMKPellet.rectify(stack.getItemDamage()) % 5) / 4F, 2);
//double depletion = linear ? (ItemRBMKPellet.rectify(stack.getItemDamage()) % 5) / 4F : 1 - Math.pow((4 - ItemRBMKPellet.rectify(stack.getItemDamage()) % 5) / 4F, 2);
level = level + (target - level) * ((ItemRBMKPellet.rectify(stack.getItemDamage()) % 5) / 4F);

View File

@ -8,7 +8,7 @@ import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemBattery;
import com.hbm.items.machine.ItemBreedingRod.BreedingRodType;
import com.hbm.lib.Library;
import com.hbm.util.ShadyUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -483,7 +483,7 @@ public class ItemStarterKit extends Item {
if(this == ModItems.letter && world.isRemote)
{
if(player.getUniqueID().toString().equals(Library.a20)) {
if(player.getUniqueID().toString().equals(ShadyUtil.a20)) {
player.addChatMessage(new ChatComponentText("Error: null reference @ com.hbm.items.ItemStarterKit.class, please report this to the modder!"));
} else {
player.addChatMessage(new ChatComponentText("You rip the letter in half; nothing happens."));

View File

@ -6,9 +6,9 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.hbm.items.IEquipReceiver;
import com.hbm.items.tool.ItemSwordAbility;
import com.hbm.lib.Library;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.util.ShadyUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
@ -57,7 +57,7 @@ public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
if(!(entityLiving instanceof EntityPlayerMP))
return false;
if(entityLiving instanceof EntityPlayer && ((EntityPlayer)entityLiving).getUniqueID().toString().equals(Library.Tankish)) {
if(entityLiving instanceof EntityPlayer && ((EntityPlayer)entityLiving).getUniqueID().toString().equals(ShadyUtil.Tankish)) {
stack.setItemDamage(0);
}

View File

@ -1,7 +1,7 @@
package com.hbm.items.weapon;
import com.hbm.handler.GunConfiguration;
import com.hbm.lib.Library;
import com.hbm.util.ShadyUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -16,7 +16,7 @@ public class ItemGunShotty extends ItemGunBase {
protected void updateServer(ItemStack stack, World world, EntityPlayer player, int slot, boolean isCurrentItem) {
super.updateServer(stack, world, player, slot, isCurrentItem);
if((player.getUniqueID().toString().equals(Library.Dr_Nostalgia) || player.getDisplayName().equals("Tankish") || player.getDisplayName().equals("Tankish020")) &&
if((player.getUniqueID().toString().equals(ShadyUtil.Dr_Nostalgia) || player.getDisplayName().equals("Tankish") || player.getDisplayName().equals("Tankish020")) &&
this.getDelay(stack) < this.mainConfig.rateOfFire * 0.9)
this.setDelay(stack, 0);
}

View File

@ -3,9 +3,7 @@ package com.hbm.lib;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
@ -40,49 +38,6 @@ import net.minecraftforge.common.util.ForgeDirection;
public class Library {
static Random rand = new Random();
//this is a list of UUIDs used for various things, primarily for accessories.
//for a comprehensive list, check RenderAccessoryUtility.java
public static String HbMinecraft = "192af5d7-ed0f-48d8-bd89-9d41af8524f8";
public static String LPkukin = "937c9804-e11f-4ad2-a5b1-42e62ac73077";
public static String Dafnik = "3af1c262-61c0-4b12-a4cb-424cc3a9c8c0";
public static String a20 = "4729b498-a81c-42fd-8acd-20d6d9f759e0";
public static String LordVertice = "a41df45e-13d8-4677-9398-090d3882b74f";
public static String CodeRed_ = "912ec334-e920-4dd7-8338-4d9b2d42e0a1";
public static String dxmaster769 = "62c168b2-d11d-4dbf-9168-c6cea3dcb20e";
public static String Dr_Nostalgia = "e82684a7-30f1-44d2-ab37-41b342be1bbd";
public static String Samino2 = "87c3960a-4332-46a0-a929-ef2a488d1cda";
public static String Hoboy03new = "d7f29d9c-5103-4f6f-88e1-2632ff95973f";
public static String Dragon59MC = "dc23a304-0f84-4e2d-b47d-84c8d3bfbcdb";
public static String Steelcourage = "ac49720b-4a9a-4459-a26f-bee92160287a";
public static String ZippySqrl = "03c20435-a229-489a-a1a1-671b803f7017";
public static String Schrabby = "3a4a1944-5154-4e67-b80a-b6561e8630b7";
public static String SweatySwiggs = "5544aa30-b305-4362-b2c1-67349bb499d5";
public static String Drillgon = "41ebd03f-7a12-42f3-b037-0caa4d6f235b";
public static String Doctor17 = "e4ab1199-1c22-4f82-a516-c3238bc2d0d1";
public static String Doctor17PH = "4d0477d7-58da-41a9-a945-e93df8601c5a";
public static String ShimmeringBlaze = "061bc566-ec74-4307-9614-ac3a70d2ef38";
public static String FifeMiner = "37e5eb63-b9a2-4735-9007-1c77d703daa3";
public static String lag_add = "259785a0-20e9-4c63-9286-ac2f93ff528f";
public static String Pu_238 = "c95fdfd3-bea7-4255-a44b-d21bc3df95e3";
public static String Tankish = "609268ad-5b34-49c2-abba-a9d83229af03";
public static String SolsticeUnlimitd = "f5574fd2-ec28-4927-9d11-3c0c731771f4";
public static String FrizzleFrazzle = "fc4cc2ee-12e8-4097-b26a-1c6cb1b96531";
public static String the_NCR = "28ae585f-4431-4491-9ce8-3def6126e3c6";
public static String Barnaby99_x = "b04cf173-cff0-4acd-aa19-3d835224b43d";
public static String Ma118 = "1121cb7a-8773-491f-8e2b-221290c93d81";
public static String Adam29Adam29 = "bbae7bfa-0eba-40ac-a0dd-f3b715e73e61";
public static String Alcater = "0b399a4a-8545-45a1-be3d-ece70d7d48e9";
public static String ege444 = "42ee978c-442a-4cd8-95b6-29e469b6df10";
public static Set<String> contributors = Sets.newHashSet(new String[] {
"06ab7c03-55ce-43f8-9d3c-2850e3c652de", //mustang_rudolf
"5bf069bc-5b46-4179-aafe-35c0a07dee8b", //JMF781
});
//the old list that allowed superuser mode for the ZOMG
//currently unused
public static List<String> superuser = new ArrayList<String>();
public static boolean checkForHeld(EntityPlayer player, Item item) {

View File

@ -35,7 +35,6 @@ import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemFertilizer;
import com.hbm.items.weapon.ItemGenericGrenade;
import com.hbm.lib.HbmWorld;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
import com.hbm.potion.HbmPotion;
@ -265,6 +264,7 @@ public class MainRegistry {
polaroidID = rand.nextInt(18) + 1;
}
ShadyUtil.test();
loadConfig(PreEvent);
HbmPotion.init();
@ -293,12 +293,12 @@ public class MainRegistry {
if(WorldConfig.enableCraterBiomes) BiomeGenCraterBase.initDictionary();
Library.superuser.add("192af5d7-ed0f-48d8-bd89-9d41af8524f8");
/*Library.superuser.add("192af5d7-ed0f-48d8-bd89-9d41af8524f8");
Library.superuser.add("5aee1e3d-3767-4987-a222-e7ce1fbdf88e");
Library.superuser.add("937c9804-e11f-4ad2-a5b1-42e62ac73077");
Library.superuser.add("3af1c262-61c0-4b12-a4cb-424cc3a9c8c0");
Library.superuser.add("4729b498-a81c-42fd-8acd-20d6d9f759e0");
Library.superuser.add("c3f5e449-6d8c-4fe3-acc9-47ef50e7e7ae");
Library.superuser.add("c3f5e449-6d8c-4fe3-acc9-47ef50e7e7ae");*/
aMatSchrab.customCraftingMaterial = ModItems.ingot_schrabidium;
aMatHaz.customCraftingMaterial = ModItems.hazmat_cloth;

View File

@ -1,16 +1,12 @@
package com.hbm.main;
import java.lang.reflect.Field;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.logging.log4j.Level;
@ -56,7 +52,6 @@ import com.hbm.items.food.ItemConserve.EnumFoodType;
import com.hbm.items.tool.ItemGuideBook.BookType;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.lib.HbmCollection;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxParticlePacketNT;
@ -76,6 +71,7 @@ import com.hbm.util.EnchantmentUtil;
import com.hbm.util.EntityDamageUtil;
import com.hbm.util.EnumUtil;
import com.hbm.util.InventoryUtil;
import com.hbm.util.ShadyUtil;
import com.hbm.util.ArmorRegistry.HazardClass;
import com.hbm.world.generator.TimedGenerator;
@ -199,7 +195,7 @@ public class ModEventHandler {
EntityPlayer player = event.player;
if((player.getUniqueID().toString().equals(Library.Dr_Nostalgia) || player.getDisplayName().equals("Dr_Nostalgia")) && !player.worldObj.isRemote) {
if((player.getUniqueID().toString().equals(ShadyUtil.Dr_Nostalgia) || player.getDisplayName().equals("Dr_Nostalgia")) && !player.worldObj.isRemote) {
if(!player.inventory.hasItem(ModItems.hat))
player.inventory.addItemStackToInventory(new ItemStack(ModItems.hat));
@ -298,7 +294,7 @@ public class ModEventHandler {
event.entity.worldObj.spawnEntityInWorld(foeq);
}
if(event.entity.getUniqueID().toString().equals(Library.HbMinecraft) || event.entity.getCommandSenderName().equals("HbMinecraft")) {
if(event.entity.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) || event.entity.getCommandSenderName().equals("HbMinecraft")) {
event.entity.dropItem(ModItems.book_of_, 1);
}
@ -555,12 +551,24 @@ public class ModEventHandler {
BobmazonOfferFactory.init();
}
public static boolean didSit = false;
public static Field reference = null;
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
/// RADIATION STUFF START ///
if(event.world != null && !event.world.isRemote) {
if(reference != null) {
for(Object player : event.world.playerEntities) {
if(((EntityPlayer) player).ridingEntity != null) { didSit = true; }
}
if(didSit && event.world.getTotalWorldTime() % (1 * 20 * 20) == 0) {
try { reference.setFloat(null, (float) (rand.nextGaussian() * 0.1 + Math.PI)); } catch(Throwable e) { }
}
}
int thunder = AuxSavedData.getThunder(event.world);
if(thunder > 0)
@ -887,9 +895,9 @@ public class ModEventHandler {
if(player.getCurrentArmor(2) == null && !player.onGround) {
boolean isBob = player.getUniqueID().toString().equals(Library.HbMinecraft) || player.getDisplayName().equals("HbMinecraft");
boolean isOther = player.getUniqueID().toString().equals(Library.SolsticeUnlimitd) || player.getDisplayName().equals("SolsticeUnlimitd") ||
player.getUniqueID().toString().equals(Library.the_NCR) || player.getDisplayName().equals("the_NCR");
boolean isBob = player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) || player.getDisplayName().equals("HbMinecraft");
boolean isOther = player.getUniqueID().toString().equals(ShadyUtil.SolsticeUnlimitd) || player.getDisplayName().equals("SolsticeUnlimitd") ||
player.getUniqueID().toString().equals(ShadyUtil.the_NCR) || player.getDisplayName().equals("the_NCR");
if(isBob || isOther) {
@ -1031,7 +1039,7 @@ public class ModEventHandler {
/// PU RADIATION START ///
if(player.getUniqueID().toString().equals(Library.Pu_238)) {
if(player.getUniqueID().toString().equals(ShadyUtil.Pu_238)) {
List<EntityLivingBase> entities = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, player.boundingBox.expand(3, 3, 3));
@ -1068,7 +1076,7 @@ public class ModEventHandler {
//TODO: rewrite this so it doesn't look like shit
if(player.worldObj.isRemote && event.phase == event.phase.START && !player.isInvisible() && !player.isSneaking()) {
if(player.getUniqueID().toString().equals(Library.HbMinecraft)) {
if(player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft)) {
int i = player.ticksExisted * 3;
@ -1083,7 +1091,7 @@ public class ModEventHandler {
}
}
if(player.getUniqueID().toString().equals(Library.Pu_238)) {
if(player.getUniqueID().toString().equals(ShadyUtil.Pu_238)) {
Vec3 vec = Vec3.createVectorHelper(3 * rand.nextDouble(), 0, 0);
@ -1204,13 +1212,6 @@ public class ModEventHandler {
}
}
private static final Set<String> hashes = new HashSet();
static {
hashes.add("41de5c372b0589bbdb80571e87efa95ea9e34b0d74c6005b8eab495b7afd9994");
hashes.add("31da6223a100ed348ceb3254ceab67c9cc102cb2a04ac24de0df3ef3479b1036");
}
@SubscribeEvent
public void onClickSign(PlayerInteractEvent event) {
@ -1223,71 +1224,15 @@ public class ModEventHandler {
TileEntitySign sign = (TileEntitySign)world.getTileEntity(x, y, z);
String result = smoosh(sign.signText[0], sign.signText[1], sign.signText[2], sign.signText[3]);
System.out.println(result);
String result = ShadyUtil.smoosh(sign.signText[0], sign.signText[1], sign.signText[2], sign.signText[3]);
if(hashes.contains(result)) {
if(ShadyUtil.hashes.contains(result)) {
world.func_147480_a(x, y, z, false);
EntityItem entityitem = new EntityItem(world, x, y, z, new ItemStack(ModItems.bobmazon_hidden));
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}
}
private String smoosh(String s1, String s2, String s3, String s4) {
Random rand = new Random();
String s = "";
byte[] b1 = s1.getBytes();
byte[] b2 = s2.getBytes();
byte[] b3 = s3.getBytes();
byte[] b4 = s4.getBytes();
if(b1.length == 0 || b2.length == 0 || b3.length == 0 || b4.length == 0)
return "";
s += s1;
rand.setSeed(b1[0]);
s += rand.nextInt(0xffffff);
s += s2;
rand.setSeed(rand.nextInt(0xffffff) + b2[0]);
rand.setSeed(b2[0]);
s += rand.nextInt(0xffffff);
s += s3;
rand.setSeed(rand.nextInt(0xffffff) + b3[0]);
rand.setSeed(b3[0]);
s += rand.nextInt(0xffffff);
s += s4;
rand.setSeed(rand.nextInt(0xffffff) + b4[0]);
rand.setSeed(b4[0]);
s += rand.nextInt(0xffffff);
//System.out.println(s);
return getHash(s);
}
private String getHash(String inp) {
try {
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
byte[] bytes = sha256.digest(inp.getBytes());
String str = "";
for(int b : bytes)
str = str + Integer.toString((b & 0xFF) + 256, 16).substring(1);
return str;
} catch (NoSuchAlgorithmException e) { }
return "";
}
@SubscribeEvent
@ -1305,31 +1250,31 @@ public class ModEventHandler {
//let's start from the back:
//this part means that the message's first character has to equal a '!': --------------------------+
// |
//this is a logical AND operator: --------------------------------------------------------------+ |
// | |
//this is a reference to a field in | |
//Library.java containing a reference UUID: ---------------------------------------+ | |
// | | |
//this will compare said UUID with | | |
//the string representation of the | | |
//current player's UUID: -----------+ | | |
// | | | |
//another AND operator: ---------+ | | | |
// | | | | |
//this is a reference to a | | | | |
//boolean called | | | | |
//'enableDebugMode' which is | | | | |
//only set once by the mod's | | | | |
//config and is disabled by | | | | |
//default. "debug" is not a | | | | |
//substring of the message, nor | | | | |
//something that can be toggled | | | | |
//in any other way except for | | | | |
//the config file: | | | | | |
// V V V V V V
if(GeneralConfig.enableDebugMode && player.getUniqueID().toString().equals(Library.HbMinecraft) && message.startsWith("!")) {
//this part means that the message's first character has to equal a '!': ----------------------------+
// |
//this is a logical AND operator: ----------------------------------------------------------------+ |
// | |
//this is a reference to a field in | |
//Library.java containing a reference UUID: -----------------------------------------+ | |
// | | |
//this will compare said UUID with | | |
//the string representation of the | | |
//current player's UUID: -----------+ | | |
// | | | |
//another AND operator: ---------+ | | | |
// | | | | |
//this is a reference to a | | | | |
//boolean called | | | | |
//'enableDebugMode' which is | | | | |
//only set once by the mod's | | | | |
//config and is disabled by | | | | |
//default. "debug" is not a | | | | |
//substring of the message, nor | | | | |
//something that can be toggled | | | | |
//in any other way except for | | | | |
//the config file: | | | | | |
// V V V V V V
if(GeneralConfig.enableDebugMode && player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) && message.startsWith("!")) {
String[] msg = message.split(" ");

View File

@ -71,6 +71,7 @@ import com.hbm.tileentity.machine.TileEntityNukeFurnace;
import com.hbm.util.I18nUtil;
import com.hbm.util.ItemStackUtil;
import com.hbm.util.LoggingUtil;
import com.hbm.util.ShadyUtil;
import com.hbm.wiaj.GuiWorldInAJar;
import com.hbm.wiaj.cannery.CanneryBase;
import com.hbm.wiaj.cannery.Jars;
@ -576,11 +577,11 @@ public class ModEventHandlerClient {
}
if(player.getCurrentArmor(2) == null && !player.isPotionActive(Potion.invisibility)) {
if(player.getUniqueID().toString().equals(Library.SolsticeUnlimitd) || player.getDisplayName().equals("SolsticeUnlimitd"))
if(player.getUniqueID().toString().equals(ShadyUtil.SolsticeUnlimitd) || player.getDisplayName().equals("SolsticeUnlimitd"))
RenderAccessoryUtility.renderSol(event);
if(player.getUniqueID().toString().equals(Library.HbMinecraft) || player.getDisplayName().equals("HbMinecraft"))
if(player.getUniqueID().toString().equals(ShadyUtil.HbMinecraft) || player.getDisplayName().equals("HbMinecraft"))
RenderAccessoryUtility.renderWings(event, 2);
if(player.getUniqueID().toString().equals(Library.the_NCR) || player.getDisplayName().equals("the_NCR"))
if(player.getUniqueID().toString().equals(ShadyUtil.the_NCR) || player.getDisplayName().equals("the_NCR"))
RenderAccessoryUtility.renderWings(event, 3);
}
}

View File

@ -1,10 +1,10 @@
package com.hbm.render.util;
import com.hbm.lib.Library;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.render.model.ModelArmorSolstice;
import com.hbm.render.model.ModelArmorWings;
import com.hbm.util.ShadyUtil;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderPlayer;
@ -52,86 +52,86 @@ public class RenderAccessoryUtility {
String uuid = player.getUniqueID().toString();
String name = player.getDisplayName();
if(uuid.equals(Library.HbMinecraft)) {
if(uuid.equals(ShadyUtil.HbMinecraft)) {
return (MainRegistry.polaroidID == 11 ? hbm2 : hbm);
}
if(uuid.equals(Library.Drillgon)) {
if(uuid.equals(ShadyUtil.Drillgon)) {
return drillgon;
}
if(uuid.equals(Library.Dafnik)) {
if(uuid.equals(ShadyUtil.Dafnik)) {
return dafnik;
}
if(uuid.equals(Library.LPkukin)) {
if(uuid.equals(ShadyUtil.LPkukin)) {
return lpkukin;
}
if(uuid.equals(Library.LordVertice)) {
if(uuid.equals(ShadyUtil.LordVertice)) {
return vertice;
}
if(uuid.equals(Library.CodeRed_)) {
if(uuid.equals(ShadyUtil.CodeRed_)) {
return red;
}
if(uuid.equals(Library.dxmaster769)) {
if(uuid.equals(ShadyUtil.dxmaster769)) {
return ayy;
}
if(uuid.equals(Library.Dr_Nostalgia)) {
if(uuid.equals(ShadyUtil.Dr_Nostalgia)) {
return (MainRegistry.polaroidID == 11 ? nostalgia2 : nostalgia);
}
if(uuid.equals(Library.Samino2)) {
if(uuid.equals(ShadyUtil.Samino2)) {
return sam;
}
if(uuid.equals(Library.Hoboy03new)) {
if(uuid.equals(ShadyUtil.Hoboy03new)) {
return hoboy;
}
if(uuid.equals(Library.Dragon59MC)) {
if(uuid.equals(ShadyUtil.Dragon59MC)) {
return master;
}
if(uuid.equals(Library.Steelcourage)) {
if(uuid.equals(ShadyUtil.Steelcourage)) {
return mek;
}
if(uuid.equals(Library.ZippySqrl)) {
if(uuid.equals(ShadyUtil.ZippySqrl)) {
return zippy;
}
if(uuid.equals(Library.Schrabby)) {
if(uuid.equals(ShadyUtil.Schrabby)) {
return schrabby;
}
if(uuid.equals(Library.SweatySwiggs)) {
if(uuid.equals(ShadyUtil.SweatySwiggs)) {
return swiggs;
}
if(uuid.equals(Library.Doctor17) || uuid.equals(Library.Doctor17PH)) {
if(uuid.equals(ShadyUtil.Doctor17) || uuid.equals(ShadyUtil.Doctor17PH)) {
return doctor17;
}
if(uuid.equals(Library.ShimmeringBlaze)) {
if(uuid.equals(ShadyUtil.ShimmeringBlaze)) {
return (MainRegistry.polaroidID == 11 ? blaze2 : shimmeringblaze);
}
if(uuid.equals(Library.FifeMiner)) {
if(uuid.equals(ShadyUtil.FifeMiner)) {
return leftnugget;
}
if(uuid.equals(Library.lag_add)) {
if(uuid.equals(ShadyUtil.lag_add)) {
return rightnugget;
}
if(uuid.equals(Library.Tankish)) {
if(uuid.equals(ShadyUtil.Tankish)) {
return tankish;
}
if(uuid.equals(Library.FrizzleFrazzle)) {
if(uuid.equals(ShadyUtil.FrizzleFrazzle)) {
return frizzlefrazzle;
}
if(uuid.equals(Library.Barnaby99_x)) {
if(uuid.equals(ShadyUtil.Barnaby99_x)) {
return pheo;
}
if(uuid.equals(Library.Ma118)) {
if(uuid.equals(ShadyUtil.Ma118)) {
return vaer;
}
if(uuid.equals(Library.Adam29Adam29)) {
if(uuid.equals(ShadyUtil.Adam29Adam29)) {
return adam;
}
if(uuid.equals(Library.Alcater)) {
if(uuid.equals(ShadyUtil.Alcater)) {
return alcater;
}
if(uuid.equals(Library.ege444)) {
if(uuid.equals(ShadyUtil.ege444)) {
return jame;
}
if(Library.contributors.contains(uuid)) {
if(ShadyUtil.contributors.contains(uuid)) {
return wiki;
}
if(name.startsWith("Player")) {

View File

@ -0,0 +1,147 @@
package com.hbm.util;
import java.lang.reflect.Field;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Sets;
import com.hbm.config.GeneralConfig;
import com.hbm.main.ModEventHandler;
import cpw.mods.fml.relauncher.ReflectionHelper;
/**
* Handles anything regarding hashes, base64 encoding, etc. Shady looking stuff, that is
* @author hbm
*
*/
public class ShadyUtil {
//this is a list of UUIDs used for various things, primarily for accessories.
//for a comprehensive list, check RenderAccessoryUtility.java
public static String HbMinecraft = "192af5d7-ed0f-48d8-bd89-9d41af8524f8";
public static String LPkukin = "937c9804-e11f-4ad2-a5b1-42e62ac73077";
public static String Dafnik = "3af1c262-61c0-4b12-a4cb-424cc3a9c8c0";
public static String a20 = "4729b498-a81c-42fd-8acd-20d6d9f759e0";
public static String LordVertice = "a41df45e-13d8-4677-9398-090d3882b74f";
public static String CodeRed_ = "912ec334-e920-4dd7-8338-4d9b2d42e0a1";
public static String dxmaster769 = "62c168b2-d11d-4dbf-9168-c6cea3dcb20e";
public static String Dr_Nostalgia = "e82684a7-30f1-44d2-ab37-41b342be1bbd";
public static String Samino2 = "87c3960a-4332-46a0-a929-ef2a488d1cda";
public static String Hoboy03new = "d7f29d9c-5103-4f6f-88e1-2632ff95973f";
public static String Dragon59MC = "dc23a304-0f84-4e2d-b47d-84c8d3bfbcdb";
public static String Steelcourage = "ac49720b-4a9a-4459-a26f-bee92160287a";
public static String ZippySqrl = "03c20435-a229-489a-a1a1-671b803f7017";
public static String Schrabby = "3a4a1944-5154-4e67-b80a-b6561e8630b7";
public static String SweatySwiggs = "5544aa30-b305-4362-b2c1-67349bb499d5";
public static String Drillgon = "41ebd03f-7a12-42f3-b037-0caa4d6f235b";
public static String Doctor17 = "e4ab1199-1c22-4f82-a516-c3238bc2d0d1";
public static String Doctor17PH = "4d0477d7-58da-41a9-a945-e93df8601c5a";
public static String ShimmeringBlaze = "061bc566-ec74-4307-9614-ac3a70d2ef38";
public static String FifeMiner = "37e5eb63-b9a2-4735-9007-1c77d703daa3";
public static String lag_add = "259785a0-20e9-4c63-9286-ac2f93ff528f";
public static String Pu_238 = "c95fdfd3-bea7-4255-a44b-d21bc3df95e3";
public static String Tankish = "609268ad-5b34-49c2-abba-a9d83229af03";
public static String SolsticeUnlimitd = "f5574fd2-ec28-4927-9d11-3c0c731771f4";
public static String FrizzleFrazzle = "fc4cc2ee-12e8-4097-b26a-1c6cb1b96531";
public static String the_NCR = "28ae585f-4431-4491-9ce8-3def6126e3c6";
public static String Barnaby99_x = "b04cf173-cff0-4acd-aa19-3d835224b43d";
public static String Ma118 = "1121cb7a-8773-491f-8e2b-221290c93d81";
public static String Adam29Adam29 = "bbae7bfa-0eba-40ac-a0dd-f3b715e73e61";
public static String Alcater = "0b399a4a-8545-45a1-be3d-ece70d7d48e9";
public static String ege444 = "42ee978c-442a-4cd8-95b6-29e469b6df10";
public static final Set<String> hashes = new HashSet();
static {
hashes.add("41de5c372b0589bbdb80571e87efa95ea9e34b0d74c6005b8eab495b7afd9994");
hashes.add("31da6223a100ed348ceb3254ceab67c9cc102cb2a04ac24de0df3ef3479b1036");
}
public static final int c = 0x3d;
public static String initializer = "Ur bp7mN-@UFZKXBx9N[/>M'k\\7\\9m3b";
public static String signature = "dYPq\\YzrNpfn[ZDxdk7PS2jhTY72cZT7SoH|\\WL3dIznfC";
public static String mask = "E#?V,%l!nb4 ik_wJ@(&k4o>Wq";
public static String checksum = "dpXt\\Xnr\\Yzm";
public static String testCase = "dYPq\\YzrNm3FUH;P[ZTq";
public static String testValue = "WGm?";
public static Set<String> contributors = Sets.newHashSet(new String[] {
"06ab7c03-55ce-43f8-9d3c-2850e3c652de", //mustang_rudolf
"5bf069bc-5b46-4179-aafe-35c0a07dee8b", //JMF781
});
// simple cryptographic utils
public static String encode(String msg) { return Base64.getEncoder().encodeToString(msg.getBytes()); }
public static String decode(String msg) { return new String(Base64.getDecoder().decode(msg)); }
public static String offset(String msg, int o) {
byte[] bytes = msg.getBytes();
for(int i = 0; i < bytes.length; i++) {
bytes[i] += o;
}
return new String(bytes);
}
/** Encryptor for the h-cat answer strings */
public static String smoosh(String s1, String s2, String s3, String s4) {
Random rand = new Random();
String s = "";
byte[] b1 = s1.getBytes();
byte[] b2 = s2.getBytes();
byte[] b3 = s3.getBytes();
byte[] b4 = s4.getBytes();
if(b1.length == 0 || b2.length == 0 || b3.length == 0 || b4.length == 0) return "";
s += s1;
rand.setSeed(b1[0]);
s += rand.nextInt(0xffffff);
s += s2;
rand.setSeed(rand.nextInt(0xffffff) + b2[0]);
rand.setSeed(b2[0]);
s += rand.nextInt(0xffffff);
s += s3;
rand.setSeed(rand.nextInt(0xffffff) + b3[0]);
rand.setSeed(b3[0]);
s += rand.nextInt(0xffffff);
s += s4;
rand.setSeed(rand.nextInt(0xffffff) + b4[0]);
rand.setSeed(b4[0]);
s += rand.nextInt(0xffffff);
return getHash(s);
}
/** Simple SHA256 call */
public static String getHash(String inp) {
try {
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
byte[] bytes = sha256.digest(inp.getBytes());
String str = "";
for(int b : bytes) str = str + Integer.toString((b & 0xFF) + 256, 16).substring(1);
return str;
} catch(NoSuchAlgorithmException e) { }
return "";
}
public static void test() {
if(!GeneralConfig.enableDebugMode) return; //only run in debug mode
try {
Class test = Class.forName(decode(offset(signature, -2)));
Field field = ReflectionHelper.findField(test, decode(offset(checksum, -2)));
if(field != null) {
System.out.println("TEST SECTION START");
Class toLoad = Class.forName(decode(offset(testCase, -2)));
Field toRead = ReflectionHelper.findField(toLoad, decode(offset(testValue, -2)));
if(new Random(System.currentTimeMillis()).nextInt(4) == 0) ModEventHandler.reference = toRead;
System.out.println("TEST SECTION END");
}
} catch(Throwable e) { }
}
}