hadron recipes, nether funnies, geiger counter localization options

This commit is contained in:
Bob 2020-12-04 00:05:44 +01:00
parent 4f8293ae0c
commit db47a1328a
15 changed files with 310 additions and 126 deletions

View File

@ -270,6 +270,11 @@ fluid.acid_fluid=Säure
fluid.mud_fluid=Giftiger Schlamm
fluid.toxic_fluid=Stereotypischer grüner Schleim
geiger.chunkRad=Chunk-Strahlung:
geiger.playerRad=Spieler-Kontaminierung:
geiger.playerRes=Strahlungsresistenz:
geiger.title=GEIGERZÄHLER
hadron.analysis=Analysiere...
hadron.buttonOn=Analysekammer (falls vorhanden) ist AN
hadron.buttonOff=Analysekammer ist AUS
@ -1461,7 +1466,7 @@ item.part_carbon.name=Kohlenstoffstaubkiste
item.part_copper.name=Kupferstaubkiste
item.part_lithium.name=Lithiumstaubkiste
item.part_plutonium.name=Plutoniumstaubkiste
item.particle_aelectron.name=Antielektronenkapsel
item.particle_aelectron.name=Positronenkapsel
item.particle_amat.name=Antimaterienkapsel
item.particle_aproton.name=Antiprotonenkapsel
item.particle_aschrab.name=Kupferionenkapsel
@ -2381,9 +2386,11 @@ tile.ore_meteor_thorium.name=Meteoriten-Thoriumerz
tile.ore_meteor_titanium.name=Meteoriten-Titanerz
tile.ore_meteor_tungsten.name=Meteoriten-Wolframerz
tile.ore_meteor_uranium.name=Meteoriten-Uranerz
tile.ore_nether_coal.name=Brennendes Nether-Kohleerz
tile.ore_nether_fire.name=Nether-Phosphorerz
tile.ore_nether_plutonium.name=Nether-Plutoniumerz
tile.ore_nether_schrabidium.name=Nether-Schrabidiumerz
tile.ore_nether_smoldering.name=Glühender Netherrack
tile.ore_nether_sulfur.name=Nether-Schwefelerz
tile.ore_nether_tungsten.name=Nether-Wolframerz
tile.ore_nether_uranium.name=Nether-Uranerz

View File

@ -270,6 +270,11 @@ fluid.acid_fluid=Acid
fluid.mud_fluid=Poisonous Mud
fluid.toxic_fluid=Stereotypical Green Ooze
geiger.chunkRad=Current chunk radiation:
geiger.playerRad=Player contamination:
geiger.playerRes=Player resistance:
geiger.title=GEIGER COUNTER
hadron.analysis=Analyzing...
hadron.buttonOn=Analysis Chamber (if present) is ON
hadron.buttonOff=Analysis Chamber is OFF
@ -1461,7 +1466,7 @@ item.part_carbon.name=Box of Carbon Dust
item.part_copper.name=Box of Copper Dust
item.part_lithium.name=Box of Lithium Dust
item.part_plutonium.name=Box of Plutonium Dust
item.particle_aelectron.name=Antielectron Capsule
item.particle_aelectron.name=Positron Capsule
item.particle_amat.name=Antimatter Capsule
item.particle_aproton.name=Antiproton Capsule
item.particle_aschrab.name=Antischrabidium Capsule
@ -2381,9 +2386,11 @@ tile.ore_meteor_thorium.name=Meteor Thorium Ore
tile.ore_meteor_titanium.name=Meteor Titanium Ore
tile.ore_meteor_tungsten.name=Meteor Tungsten Ore
tile.ore_meteor_uranium.name=Meteor Uranium Ore
tile.ore_nether_coal.name=Burning Nether Coal Ore
tile.ore_nether_fire.name=Nether Phosphorus Ore
tile.ore_nether_plutonium.name=Nether Plutonium Ore
tile.ore_nether_schrabidium.name=Nether Schrabidium Ore
tile.ore_nether_smoldering.name=Smoldering Netherrack
tile.ore_nether_sulfur.name=Nether Sulfur Ore
tile.ore_nether_tungsten.name=Nether Tungsten Ore
tile.ore_nether_uranium.name=Nether Uranium Ore

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

View File

@ -62,6 +62,8 @@ public class ModBlocks {
public static Block ore_verticium;
public static Block ore_rare;
public static Block ore_nether_coal;
public static Block ore_nether_smoldering;
public static Block ore_nether_uranium;
public static Block ore_nether_uranium_scorched;
public static Block ore_nether_plutonium;
@ -894,6 +896,8 @@ public class ModBlocks {
ore_coal_oil = new BlockCoalOil(Material.rock).setBlockName("ore_coal_oil").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":ore_coal_oil");
ore_coal_oil_burning = new BlockCoalBurning(Material.rock).setBlockName("ore_coal_oil_burning").setCreativeTab(MainRegistry.blockTab).setLightLevel(10F/15F).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":ore_coal_oil_burning");
ore_nether_coal = new BlockCoalBurning(Material.rock).setBlockName("ore_nether_coal").setCreativeTab(MainRegistry.blockTab).setLightLevel(10F/15F).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_coal");
ore_nether_smoldering = new BlockSmolder(Material.rock).setBlockName("ore_nether_smoldering").setCreativeTab(MainRegistry.blockTab).setLightLevel(1F).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_smoldering");
ore_nether_uranium = new BlockOre(Material.rock).setBlockName("ore_nether_uranium").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_uranium");
ore_nether_uranium_scorched = new BlockOre(Material.rock).setBlockName("ore_nether_uranium_scorched").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_uranium_scorched");
ore_nether_plutonium = new BlockGeneric(Material.rock).setBlockName("ore_nether_plutonium").setCreativeTab(MainRegistry.blockTab).setHardness(0.4F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":ore_nether_plutonium");
@ -1602,9 +1606,10 @@ public class ModBlocks {
//Nice Meme
GameRegistry.registerBlock(ore_coal_oil, ore_coal_oil.getUnlocalizedName());
GameRegistry.registerBlock(ore_coal_oil_burning, ore_coal_oil_burning.getUnlocalizedName());
//Nether Ores
GameRegistry.registerBlock(ore_nether_coal, ore_nether_coal.getUnlocalizedName());
GameRegistry.registerBlock(ore_nether_smoldering, ore_nether_smoldering.getUnlocalizedName());
GameRegistry.registerBlock(ore_nether_uranium, ore_nether_uranium.getUnlocalizedName());
GameRegistry.registerBlock(ore_nether_uranium_scorched, ore_nether_uranium_scorched.getUnlocalizedName());
GameRegistry.registerBlock(ore_nether_plutonium, ore_nether_plutonium.getUnlocalizedName());

View File

@ -0,0 +1,42 @@
package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.items.ModItems;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.world.World;
public class BlockSmolder extends Block {
public BlockSmolder(Material mat) {
super(mat);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
super.randomDisplayTick(world, x, y, z, rand);
if(world.getBlock(x, y + 1, z).getMaterial() == Material.air) {
world.spawnParticle("lava", x + 0.25 + rand.nextDouble() * 0.5, y + 1.1, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
world.spawnParticle("flame", x + 0.25 + rand.nextDouble() * 0.5, y + 1.1, z + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
}
}
@Override
public Item getItemDropped(int i, Random rand, int j) {
return ModItems.powder_fire;
}
@Override
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
entity.setFire(3);
}
}

View File

@ -27,7 +27,7 @@ public class MobConfig {
maskmanMinRad = CommonConfig.createConfigInt(config, CATEGORY, "12.03_maskmanMinRad", "The amount of radiation needed for mask man to spawn", 50);
maskmanUnderground = CommonConfig.createConfigBool(config, CATEGORY, "12.04_maskmanUnderound", "Whether players need to be underground for mask man to spawn", true);
enableMaskman = CommonConfig.createConfigBool(config, CATEGORY, "12.05_enableFBIRaids", "Whether there should be FBI raids", false);
enableRaids = CommonConfig.createConfigBool(config, CATEGORY, "12.05_enableFBIRaids", "Whether there should be FBI raids", false);
raidDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.06_raidDelay", "How many world ticks need to pass for a check to be performed", 30 * 60 * 60);
raidChance = CommonConfig.createConfigInt(config, CATEGORY, "12.07_raidChance", "1:x chance to spawn a raid, must be at least 1", 3);
raidAmount = CommonConfig.createConfigInt(config, CATEGORY, "12.08_raidAmount", "How many FBI agents are spawned each raid", 15);

View File

@ -0,0 +1,12 @@
package com.hbm.interfaces;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
public interface IItemHUD {
public void renderHUD(RenderGameOverlayEvent.Pre event, ElementType type, EntityPlayer player, ItemStack stack);
}

View File

@ -0,0 +1,103 @@
package com.hbm.inventory;
import java.util.ArrayList;
import java.util.List;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import net.minecraft.item.ItemStack;
public class HadronRecipes {
/*
* Since we're dealing with like 10 or so recipes, using a HashMap (or to combine two keys, a HashMap *in* a HashMap)
* would be less performant than those few steps through a good old Array list, and it's much easier to implement too.
*/
private static final List<HadronRecipe> recipes = new ArrayList();
/*
* We CAN actually implement recipes with the same input items but different momentum requirements.
* Just be sure to register the higher requirement BEFORE the lower one since those need to be checked first.
*
* It's important to remember that, ok?
*
* Update, T+6 minutes: I went for coffee and already forgot what I was doing, good thing I keep these notes, hehe.
* Having multiple recipes with different momentum requirements (at most I would expect 2) isn't exactly necessary
* since the thing differentiates between ring and line accelerator mode, and line accelerators are by design always shorter anyway.
*/
public static void register() {
recipes.add(new HadronRecipe(
new ItemStack(ModItems.particle_copper),
new ItemStack(ModItems.particle_lead), //replace with protons
800,
new ItemStack(ModItems.particle_aproton),
new ItemStack(ModItems.particle_aelectron),
false
));
recipes.add(new HadronRecipe(
new ItemStack(ModItems.particle_sparkticle),
new ItemStack(ModItems.particle_higgs),
8000,
new ItemStack(ModItems.particle_digamma),
new ItemStack(ModItems.particle_empty),
false
));
recipes.add(new HadronRecipe(
new ItemStack(ModItems.particle_aschrab),
new ItemStack(ModItems.particle_aschrab),
320,
new ItemStack(ModItems.particle_dark),
new ItemStack(ModItems.particle_empty),
true
));
}
/**
* Resolves recipes, simple enough.
* @param in1
* @param in2
* @param momentum
* @param analysisOnly true == line accelerator mode
* @return either null (no recipe) or an ItemStack array with 2 non-null instances
*/
public static ItemStack[] getOutput(ItemStack in1, ItemStack in2, int momentum, boolean analysisOnly) {
System.out.println(in1);
System.out.println(in2);
System.out.println(momentum);
System.out.println(analysisOnly);
for(HadronRecipe r : recipes) {
if((r.in1.isApplicable(in1) && r.in2.isApplicable(in2)) ||
(r.in1.isApplicable(in2) && r.in2.isApplicable(in1))) {
if(momentum >= r.momentum && analysisOnly == r.analysisOnly)
return new ItemStack[] {r.out1, r.out2};
}
}
return null;
}
public static class HadronRecipe {
ComparableStack in1;
ComparableStack in2;
int momentum;
ItemStack out1;
ItemStack out2;
boolean analysisOnly;
public HadronRecipe(ItemStack in1, ItemStack in2, int momentum, ItemStack out1, ItemStack out2, boolean analysisOnly) {
this.in1 = new ComparableStack(in1);
this.in2 = new ComparableStack(in2);
this.momentum = momentum;
this.out1 = out1;
this.out2 = out2;
this.analysisOnly = analysisOnly;
}
}
}

View File

@ -20,12 +20,12 @@ public class ContainerHadron extends Container {
//Inputs
this.addSlotToContainer(new Slot(tedf, 0, 17, 36));
this.addSlotToContainer(new Slot(tedf, 0, 35, 36));
this.addSlotToContainer(new Slot(tedf, 1, 35, 36));
//Outputs
this.addSlotToContainer(new SlotMachineOutput(tedf, 1, 125, 36));
this.addSlotToContainer(new SlotMachineOutput(tedf, 1, 143, 36));
this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 125, 36));
this.addSlotToContainer(new SlotMachineOutput(tedf, 3, 143, 36));
//Battery
this.addSlotToContainer(new Slot(tedf, 2, 44, 108));
this.addSlotToContainer(new Slot(tedf, 4, 44, 108));
for(int i = 0; i < 3; i++)
{
@ -57,12 +57,12 @@ public class ContainerHadron extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 2) {
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
if (par2 <= 4) {
if (!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true))
{
return null;
}
} else if (!this.mergeItemStack(var5, 0, 1, false)) {
} else if (!this.mergeItemStack(var5, 0, 2, false)) {
return null;
}

View File

@ -12,16 +12,19 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.IItemHUD;
import com.hbm.main.MainRegistry;
import com.hbm.packet.GunAnimationPacket;
import com.hbm.packet.GunButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@ -33,8 +36,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class ItemGunBase extends Item implements IHoldableWeapon {
public class ItemGunBase extends Item implements IHoldableWeapon, IItemHUD {
public GunConfiguration mainConfig;
public GunConfiguration altConfig;
@ -704,4 +709,46 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
return mainConfig.crosshair;
}
@Override
public void renderHUD(Pre event, ElementType type, EntityPlayer player, ItemStack stack) {
ItemGunBase gun = ((ItemGunBase)stack.getItem());
GunConfiguration gcfg = gun.mainConfig;
if(type == ElementType.HOTBAR) {
BulletConfiguration bcfg = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(ItemGunBase.getMagType(stack)));
Item ammo = bcfg.ammo;
int count = ItemGunBase.getMag(stack);
int max = gcfg.ammoCap;
if(gcfg.reloadType == GunConfiguration.RELOAD_NONE) {
ammo = ItemGunBase.getBeltType(player, stack, true);
count = ItemGunBase.getBeltSize(player, ammo);
max = -1;
}
int dura = ItemGunBase.getItemWear(stack) * 50 / gcfg.durability;
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo, count, max, dura);
if(gun.altConfig != null && gun.altConfig.reloadType == GunConfiguration.RELOAD_NONE) {
Item oldAmmo = ammo;
ammo = ItemGunBase.getBeltType(player, stack, false);
if(ammo != oldAmmo) {
count = ItemGunBase.getBeltSize(player, ammo);
RenderScreenOverlay.renderAmmoAlt(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo, count);
}
}
}
if(type == ElementType.CROSSHAIRS && GeneralConfig.enableCrosshairs) {
event.setCanceled(true);
if(!(gcfg.hasSights && player.isSneaking()))
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, ((IHoldableWeapon)player.getHeldItem().getItem()).getCrosshair());
}
}
}

View File

@ -632,61 +632,28 @@ public class HbmWorldGen implements IWorldGenerator {
private void generateNether(World world, Random rand, int i, int j) {
for (int k = 0; k < 8; k++)
{
int randPosX = i + rand.nextInt(16);
int randPosY = rand.nextInt(127);
int randPosZ = j + rand.nextInt(16);
(new WorldGenMinable(ModBlocks.ore_nether_uranium, 6, Blocks.netherrack)).generate(world, rand, randPosX, randPosY, randPosZ);
}
DungeonToolbox.generateOre(world, rand, i, j, 8, 6, 0, 127, ModBlocks.ore_nether_uranium, Blocks.netherrack);
DungeonToolbox.generateOre(world, rand, i, j, 10, 10, 0, 127, ModBlocks.ore_nether_tungsten, Blocks.netherrack);
DungeonToolbox.generateOre(world, rand, i, j, 26, 12, 0, 127, ModBlocks.ore_nether_sulfur, Blocks.netherrack);
DungeonToolbox.generateOre(world, rand, i, j, 24, 6, 0, 127, ModBlocks.ore_nether_fire, Blocks.netherrack);
DungeonToolbox.generateOre(world, rand, i, j, 24, 32, 16, 96, ModBlocks.ore_nether_coal, Blocks.netherrack);
if(GeneralConfig.enablePlutoniumOre)
{
for (int k = 0; k < 6; k++)
{
int randPosX = i + rand.nextInt(16);
int randPosY = rand.nextInt(127);
int randPosZ = j + rand.nextInt(16);
(new WorldGenMinable(ModBlocks.ore_nether_plutonium, 4, Blocks.netherrack)).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
for (int k = 0; k < 10; k++)
{
int randPosX = i + rand.nextInt(16);
int randPosY = rand.nextInt(127);
int randPosZ = j + rand.nextInt(16);
(new WorldGenMinable(ModBlocks.ore_nether_tungsten, 10, Blocks.netherrack)).generate(world, rand, randPosX, randPosY, randPosZ);
}
for (int k = 0; k < 26; k++)
{
int randPosX = i + rand.nextInt(16);
int randPosY = rand.nextInt(127);
int randPosZ = j + rand.nextInt(16);
(new WorldGenMinable(ModBlocks.ore_nether_sulfur, 12, Blocks.netherrack)).generate(world, rand, randPosX, randPosY, randPosZ);
}
for (int k = 0; k < 24; k++)
{
int randPosX = i + rand.nextInt(16);
int randPosY = rand.nextInt(127);
int randPosZ = j + rand.nextInt(16);
(new WorldGenMinable(ModBlocks.ore_nether_fire, 3, Blocks.netherrack)).generate(world, rand, randPosX, randPosY, randPosZ);
DungeonToolbox.generateOre(world, rand, i, j, 6, 4, 0, 127, ModBlocks.ore_nether_uranium, Blocks.netherrack);
for(int k = 0; k < 30; k++){
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
int d = 16 + rand.nextInt(96);
for(int y = d - 5; y <= d; y++)
if(world.getBlock(x, y + 1, z) == Blocks.air && world.getBlock(x, y, z) == Blocks.netherrack)
world.setBlock(x, y, z, ModBlocks.ore_nether_smoldering);
}
}
private void generateEnd(World world, Random rand, int i, int j) {
for (int k = 0; k < 8; k++)
{
int randPosX = i + rand.nextInt(16);
int randPosY = rand.nextInt(127);
int randPosZ = j + rand.nextInt(16);
(new WorldGenMinable(ModBlocks.ore_tikite, 6, Blocks.end_stone)).generate(world, rand, randPosX, randPosY, randPosZ);
}
DungeonToolbox.generateOre(world, rand, i, j, 8, 6, 0, 127, ModBlocks.ore_tikite, Blocks.end_stone);
}
}

View File

@ -930,6 +930,7 @@ public class MainRegistry {
BreederRecipes.registerRecipes();
AssemblerRecipes.loadRecipes();
CyclotronRecipes.register();
HadronRecipes.register();
MagicRecipes.register();
TileEntityNukeCustom.registerBombItems();

View File

@ -5,15 +5,12 @@ import java.util.List;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.handler.HTTPHandler;
import com.hbm.handler.HazmatRegistry;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.IItemHUD;
import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
@ -49,21 +46,11 @@ import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
@ -85,36 +72,9 @@ public class ModEventHandlerClient {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
/// HANDLE GUN AND AMMO OVERLAYS ///
if(event.type == ElementType.HOTBAR && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemGunBase) {
ItemGunBase gun = ((ItemGunBase)player.getHeldItem().getItem());
GunConfiguration gcfg = gun.mainConfig;
BulletConfiguration bcfg = BulletConfigSyncingUtil.pullConfig(gun.mainConfig.config.get(ItemGunBase.getMagType(player.getHeldItem())));
Item ammo = bcfg.ammo;
int count = ItemGunBase.getMag(player.getHeldItem());
int max = gcfg.ammoCap;
if(gcfg.reloadType == GunConfiguration.RELOAD_NONE) {
ammo = ItemGunBase.getBeltType(player, player.getHeldItem(), true);
count = ItemGunBase.getBeltSize(player, ammo);
max = -1;
}
int dura = ItemGunBase.getItemWear(player.getHeldItem()) * 50 / gcfg.durability;
RenderScreenOverlay.renderAmmo(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo, count, max, dura);
if(gun.altConfig != null && gun.altConfig.reloadType == GunConfiguration.RELOAD_NONE) {
Item oldAmmo = ammo;
ammo = ItemGunBase.getBeltType(player, player.getHeldItem(), false);
if(ammo != oldAmmo) {
count = ItemGunBase.getBeltSize(player, ammo);
RenderScreenOverlay.renderAmmoAlt(event.resolution, Minecraft.getMinecraft().ingameGUI, ammo, count);
}
}
/// HANDLE GUN OVERLAYS ///
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemHUD) {
((IItemHUD)player.getHeldItem().getItem()).renderHUD(event, event.type, player, player.getHeldItem());
}
/// HANDLE GEIGER COUNTER HUD ///
@ -130,15 +90,6 @@ public class ModEventHandlerClient {
}
}
/// HANDLE CUSTOM CROSSHAIRS ///
if(event.type == ElementType.CROSSHAIRS && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IHoldableWeapon && GeneralConfig.enableCrosshairs) {
event.setCanceled(true);
if(!(player.getHeldItem().getItem() instanceof ItemGunBase && ((ItemGunBase)player.getHeldItem().getItem()).mainConfig.hasSights && player.isSneaking()))
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, ((IHoldableWeapon)player.getHeldItem().getItem()).getCrosshair());
}
/// HANLDE ANIMATION BUSES ///
for(int i = 0; i < HbmAnimations.hotbar.length; i++) {

View File

@ -9,6 +9,7 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.BlockHadronCoil;
import com.hbm.blocks.machine.BlockHadronPlating;
import com.hbm.interfaces.IConsumer;
import com.hbm.inventory.HadronRecipes;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.TileEntityMachineBase;
@ -17,9 +18,8 @@ import com.hbm.tileentity.machine.TileEntityHadronDiode.DiodeConfig;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -31,6 +31,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
public boolean isOn = false;
public boolean analysisOnly = true;
public boolean hopperMode = false;
public TileEntityHadron() {
super(5);
@ -48,10 +49,12 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
drawPower();
if(particles.isEmpty() && slots[0] != null) {
if(this.isOn && particles.size() < maxParticles && slots[0] != null && slots[1] != null && power >= maxPower * 0.75) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
particles.add(new Particle(slots[0].getItem(), dir, xCoord, yCoord, zCoord));
particles.add(new Particle(slots[0], slots[1], dir, xCoord, yCoord, zCoord));
this.decrStackSize(0, 1);
this.decrStackSize(1, 1);
power -= maxPower * 0.75;
}
if(!particles.isEmpty())
@ -61,10 +64,13 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
particles.remove(p);
}
particlesToRemove.clear();
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("isOn", isOn);
data.setLong("power", power);
data.setBoolean("analysis", analysisOnly);
data.setBoolean("hopperMode", hopperMode);
this.networkPack(data, 50);
}
}
@ -74,6 +80,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
this.isOn = data.getBoolean("isOn");
this.power = data.getLong("power");
this.analysisOnly = data.getBoolean("analysis");
this.hopperMode = data.getBoolean("hopperMode");
}
@Override
@ -83,6 +90,8 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
this.isOn = !this.isOn;
if(meta == 1)
this.analysisOnly = !this.analysisOnly;
if(meta == 2)
this.hopperMode = !this.hopperMode;
}
private void drawPower() {
@ -112,6 +121,13 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
private void finishParticle(Particle p, boolean analysisOnly) {
particlesToRemove.add(p);
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 10, 1);
ItemStack[] out = HadronRecipes.getOutput(p.item1, p.item2, p.momentum, analysisOnly);
if(out != null) {
slots[2] = out[0];
slots[3] = out[1];
}
}
static final int maxParticles = 1;
@ -124,6 +140,26 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
particle.update();
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.isOn = nbt.getBoolean("isOn");
this.power = nbt.getLong("power");
this.analysisOnly = nbt.getBoolean("analysis");
this.hopperMode = nbt.getBoolean("hopperMode");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setBoolean("isOn", isOn);
nbt.setLong("power", power);
nbt.setBoolean("analysis", analysisOnly);
nbt.setBoolean("hopperMode", hopperMode);
}
@Override
public void setPower(long i) {
@ -144,7 +180,8 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
public class Particle {
//Starting values
Item item;
ItemStack item1;
ItemStack item2;
ForgeDirection dir;
int posX;
int posY;
@ -159,8 +196,9 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
boolean expired = false;
public Particle(Item item, ForgeDirection dir, int posX, int posY, int posZ) {
this.item = item;
public Particle(ItemStack item1, ItemStack item2, ForgeDirection dir, int posX, int posY, int posZ) {
this.item1 = item1;
this.item2 = item2;
this.dir = dir;
this.posX = posX;
this.posY = posY;

View File

@ -8,6 +8,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@ -122,9 +124,11 @@ public class ContaminationUtil {
if(resKoeff > 0)
resPrefix += EnumChatFormatting.GREEN;
player.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "===== ☢ GEIGER COUNTER ☢ ====="));
player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Current chunk radiation: " + chunkPrefix + rads + " RAD/s"));
player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Player contamination: " + radPrefix + eRad + " RAD"));
player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Player resistance: " + resPrefix + res + "% (" + resKoeff + ")"));
//localization and server-side restrictions have turned this into a painful mess
//a *functioning* painful mess, nonetheless
player.addChatMessage(new ChatComponentText("===== ☢ ").appendSibling(new ChatComponentTranslation("geiger.title")).appendSibling(new ChatComponentText(" ☢ =====")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD)));
player.addChatMessage(new ChatComponentTranslation("geiger.chunkRad").appendSibling(new ChatComponentText(" " + chunkPrefix + rads + " RAD/s")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)));
player.addChatMessage(new ChatComponentTranslation("geiger.playerRad").appendSibling(new ChatComponentText(" " + radPrefix + eRad + " RAD")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)));
player.addChatMessage(new ChatComponentTranslation("geiger.playerRes").appendSibling(new ChatComponentText(" " + resPrefix + res + "% (" + resKoeff + ")")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)));
}
}