Merge remote-tracking branch 'origin/master'

This commit is contained in:
Bob 2021-09-02 18:29:29 +02:00
commit cf0ad61bda
6 changed files with 136 additions and 37 deletions

View File

@ -24,6 +24,32 @@ minecraft {
runDir = "eclipse"
}
// A little hack to fix codechicken's crazy maven structure (at least in 1.7.10)
eclipse.classpath.file.whenMerged { cp ->
// Find all codechicken source jars
def srcent = cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-src.jar") }
// Remove them from classpath
cp.entries.removeAll srcent
// Map the source entries to their dev counterparts based on basename
Map<String, File> srcmap = new HashMap<String, File>()
srcent.forEach { entry ->
def file = new File(entry.path)
srcmap.put(file.getName().replace("-src.jar", "-dev.jar"), file)
}
// Create file reference factory
def fileref = new org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory()
// Find all codechicken development jars
cp.entries.findAll { entry -> entry.path.contains("codechicken") && entry.path.endsWith("-dev.jar") }.forEach { entry ->
File srcmapping = new File(entry.path) // Initialize the srcmapping from the dev jar path
srcmapping = srcmap.get(srcmapping.getName()) // Transform it using the sourcemap
entry.sourcePath = fileref.fromFile(srcmapping) // Set the source path
}
}
repositories {
maven {
name = 'ModMaven'
@ -33,8 +59,13 @@ repositories {
dependencies {
compile 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev'
compileOnly 'codechicken:CodeChickenCore:1.7.10-1.0.4.29:src'
compile 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev'
compileOnly 'codechicken:CodeChickenLib:1.7.10-1.1.3.140:src'
compile 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev'
compileOnly 'codechicken:NotEnoughItems:1.7.10-1.0.3.74:src'
}
processResources {

View File

@ -47,6 +47,8 @@ import com.hbm.tileentity.bomb.TileEntityNukeCustom.CustomNukeEntry;
import com.hbm.tileentity.bomb.TileEntityNukeCustom.EnumEntryType;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
import com.hbm.util.I18nUtil;
import com.hbm.util.ArmorRegistry;
import com.hbm.util.ArmorRegistry.HazardClass;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
@ -428,15 +430,23 @@ public class ModEventHandlerClient {
ItemStack stack = event.itemStack;
List<String> list = event.toolTip;
/// HAZMAT INFO ///
List<HazardClass> hazInfo = ArmorRegistry.armor.get(stack.getItem());
if(hazInfo != null) {
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("hazard.prot"));
for(HazardClass clazz : hazInfo) {
list.add(EnumChatFormatting.YELLOW + " " + I18nUtil.resolveKey(clazz.lang));
}
}
/// CLADDING (LEGACY) ///
double rad = HazmatRegistry.getResistance(stack);
rad = ((int)(rad * 1000)) / 1000D;
if(rad > 0) list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.radResistance", rad));
if(rad > 0)
list.add(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("trait.radResistance", rad));
/// CUSTOM NUKE ///
ComparableStack comp = new ComparableStack(stack).makeSingular();
CustomNukeEntry entry = TileEntityNukeCustom.entries.get(comp);
if(entry != null) {
@ -451,6 +461,7 @@ public class ModEventHandlerClient {
list.add(EnumChatFormatting.GOLD + "Adds multiplier " + entry.value + " to the custom nuke stage " + entry.type);
}
/// ARMOR MODS ///
if(stack.getItem() instanceof ItemArmor && ArmorModHandler.hasMods(stack)) {
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !(Minecraft.getMinecraft().currentScreen instanceof GUIArmorTable)) {
@ -474,7 +485,7 @@ public class ModEventHandlerClient {
}
}
}
}
}
private ResourceLocation ashes = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_ash.png");

View File

@ -0,0 +1,54 @@
package com.hbm.util;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
public class ArmorRegistry {
public static HashMap<Item, List<HazardClass>> armor = new HashMap();
public static void registerArmor(Item item, HazardClass... hazards) {
armor.put(item, Arrays.asList(hazards));
}
public static boolean hasProtection(EntityPlayer player, int slot, HazardClass clazz) {
if(ArmorUtil.checkArmorNull(player, slot))
return false;
List<HazardClass> list = armor.get(player.inventory.armorInventory[slot].getItem());
if(list == null)
return false;
return list.contains(clazz);
}
public static enum HazardClass {
GAS_CHLORINE("hazard.gasChlorine"),
GAS_MONOXIDE("hazard.gasMonoxide"),
GAS_INERT("hazard.gasInert"),
PARTICLE_COARSE("hazard.particleCoarse"),
PARTICLE_FINE("hazard.particleFine"),
BACTERIA("hazard.bacteria");
public final String lang;
private HazardClass(String lang) {
this.lang = lang;
}
}
public static enum ArmorClass {
MASK_FILTERED,
MASK_OXY,
GOGGLES,
HAZMAT_HEAT,
HAZMAT_RADIATION,
HAZMAT_BIO;
}
}

View File

@ -5,6 +5,7 @@ import com.hbm.handler.HazmatRegistry;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorRegistry.HazardClass;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.entity.player.EntityPlayer;
@ -14,43 +15,29 @@ import net.minecraft.item.ItemStack;
import net.minecraft.network.NetHandlerPlayServer;
public class ArmorUtil {
public static boolean checkArmor(EntityPlayer player, Item helmet, Item plate, Item legs, Item boots) {
if(player.inventory.armorInventory[0] != null &&
player.inventory.armorInventory[0].getItem() == boots &&
player.inventory.armorInventory[1] != null &&
player.inventory.armorInventory[1].getItem() == legs &&
player.inventory.armorInventory[2] != null &&
player.inventory.armorInventory[2].getItem() == plate &&
player.inventory.armorInventory[3] != null &&
player.inventory.armorInventory[3].getItem() == helmet)
{
return true;
}
return false;
public static void register() {
ArmorRegistry.registerArmor(ModItems.gas_mask, HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_CHLORINE);
ArmorRegistry.registerArmor(ModItems.gas_mask_m65, HazardClass.PARTICLE_COARSE, HazardClass.PARTICLE_FINE, HazardClass.GAS_CHLORINE);
ArmorRegistry.registerArmor(ModItems.gas_mask_mono, HazardClass.PARTICLE_COARSE, HazardClass.GAS_MONOXIDE);
}
public static boolean checkArmorPiece(EntityPlayer player, Item armor, int slot)
{
if(player.inventory.armorInventory[slot] != null &&
player.inventory.armorInventory[slot].getItem() == armor)
{
return true;
public static boolean checkArmor(EntityPlayer player, Item... armor) {
for(int i = 0; i < 4; i++) {
if(!checkArmorPiece(player, armor[i], 3 - i))
return false;
}
return false;
return true;
}
public static boolean checkArmorNull(EntityPlayer player, int slot)
{
if(player.inventory.armorInventory[slot] == null)
{
return true;
}
return false;
public static boolean checkArmorPiece(EntityPlayer player, Item armor, int slot) {
return !checkArmorNull(player, slot) && player.inventory.armorInventory[slot].getItem() == armor;
}
public static boolean checkArmorNull(EntityPlayer player, int slot) {
return player.inventory.armorInventory[slot] == null;
}
public static void damageSuit(EntityPlayer player, int slot, int amount) {

View File

@ -390,6 +390,14 @@ hadron.noresult=Kein Ergebnis.
hadron.progress=Verarbeite...
hadron.success=Abgeschlossen!
hazard.prot=Schützt vor Gefahren:
hazard.bacteria=Bakterien / Aerosole
hazard.gasChlorine=Giftgas
hazard.gasInert=Träge Gase / Strickgas
hazard.gasMonoxide=Kohlenstoffmonoxid
hazard.particleCoarse=Partikel
hazard.particleFine=Feinstaub
hbm.key=NTM Hotkeys
hbm.key.toggleBack=Rucksack umschalten
hbm.key.toggleHUD=HUD umschalten

View File

@ -458,6 +458,14 @@ hadron.noresult=No Result.
hadron.progress=In Progress...
hadron.success=Completed!
hazard.prot=Protects against hazards:
hazard.bacteria=Bacteria / Aerosols
hazard.gasChlorine=Chemical Gas
hazard.gasInert=Inert Gas / Asphxiants
hazard.gasMonoxide=Carbon Monoxide
hazard.particleCoarse=Airborne Particles
hazard.particleFine=Particulates
hbm.key=NTM Hotkeys
hbm.key.toggleBack=Toggle Backpack
hbm.key.toggleHUD=Toggle HUD