the better part of the hadron, mister FBI himself

This commit is contained in:
Bob 2020-11-29 17:58:10 +01:00
parent ea7fc0f9bd
commit e4c453b4c1
38 changed files with 667 additions and 43 deletions

View File

@ -1452,6 +1452,16 @@ 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_amat.name=Antimaterienkapsel
item.particle_aproton.name=Antiprotonenkapsel
item.particle_aschrab.name=Antischrabidiumkapseö
item.particle_dark.name=Dunkle Materien Kapsel
item.particle_empty.name=Leere Partikelkapsel
item.particle_higgs.name=Higgs Bosonen Kapsel
item.particle_muon.name=Myonenkapsel
item.particle_sparkticle.name=Sparktikelkapsel
item.particle_strange.name=Strange Quark Capsule
item.pedestal_steel.name=Stahlsockel
item.pellet_advanced.name=Fortgeschrittenes Watzaufwertugspellet
item.pellet_antimatter.name=Antimateriencluster

View File

@ -1452,6 +1452,16 @@ 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_amat.name=Antimatter Capsule
item.particle_aproton.name=Antiproton Capsule
item.particle_aschrab.name=Antischrabidium Capsule
item.particle_dark.name=Dark Matter Capsule
item.particle_empty.name=Empty Particle Capsule
item.particle_higgs.name=Higgs Boson Capsule
item.particle_muon.name=Muon Capsule
item.particle_sparkticle.name=Sparkticle Capsule
item.particle_strange.name=Strange Quark Capsule
item.pedestal_steel.name=Steel Pedestal
item.pellet_advanced.name=Advanced Watz Performance Improver
item.pellet_antimatter.name=Antimatter Cluster

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

View File

@ -3,9 +3,10 @@ package com.hbm.blocks.fluid;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.ArmorUtil;
import com.hbm.lib.ModDamageSource;
import com.hbm.lib.RefStrings;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View File

@ -1,9 +1,9 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.ArmorUtil;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

View File

@ -2,7 +2,8 @@ package com.hbm.blocks.generic;
import java.util.Random;
import com.hbm.handler.ArmorUtil;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View File

@ -46,12 +46,19 @@ public class BlockHadronAccess extends Block {
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
for(ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
System.out.println(d.name() + " " + d.getOpposite().name());
}
System.out.println(dir.name());
for(int i = 1; i < 3; i++) {
if(world.getBlock(x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i) == ModBlocks.hadron_core) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_hadron, world, x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i);
}
System.out.println(world.getBlock(x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i).getUnlocalizedName());
}
return true;

View File

@ -0,0 +1,19 @@
package com.hbm.entity.mob;
import com.hbm.items.ModItems;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class EntityFBI extends EntityZombie {
public EntityFBI(World p_i1745_1_) {
super(p_i1745_1_);
}
protected void addRandomArmor() {
super.addRandomArmor();
this.setCurrentItemOrArmor(0, new ItemStack(ModItems.gun_revolver_nopip));
}
}

View File

@ -35,9 +35,9 @@ import com.hbm.blocks.generic.RedBarrel;
import com.hbm.entity.grenade.EntityGrenadeTau;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.particle.EntityBSmokeFX;
import com.hbm.handler.ArmorUtil;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;

View File

@ -15,12 +15,12 @@ import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.explosion.ExplosionParticle;
import com.hbm.explosion.ExplosionParticleB;
import com.hbm.handler.ArmorUtil;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorUtil;
import com.hbm.util.BobMathUtil;
import cpw.mods.fml.relauncher.ReflectionHelper;

View File

@ -20,9 +20,9 @@ import com.hbm.entity.projectile.EntityRainbow;
import com.hbm.entity.projectile.EntityRocket;
import com.hbm.entity.projectile.EntityRubble;
import com.hbm.entity.projectile.EntitySchrab;
import com.hbm.handler.ArmorUtil;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;

View File

@ -32,7 +32,6 @@ import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityExplosiveBeam;
import com.hbm.entity.projectile.EntityMiniMIRV;
import com.hbm.entity.projectile.EntityMiniNuke;
import com.hbm.handler.ArmorUtil;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource;
import com.hbm.items.ModItems;
@ -40,6 +39,7 @@ import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.bomb.TileEntityTurretBase;
import com.hbm.util.ArmorUtil;
import cofh.api.energy.IEnergyProvider;

View File

@ -4,7 +4,8 @@ import java.util.HashSet;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.ArmorUtil;
import com.hbm.util.ArmorUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;

View File

@ -6,7 +6,6 @@ import java.util.Random;
import com.hbm.config.BombConfig;
import com.hbm.entity.particle.EntityBSmokeFX;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.ArmorUtil;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
@ -16,6 +15,7 @@ import com.hbm.lib.Library;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorUtil;
import com.hbm.util.BobMathUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;

View File

@ -66,5 +66,11 @@ public class GUIHadron extends GuiInfoContainer {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(hadron.isOn)
drawTexturedModalRect(guiLeft + 16, guiTop + 89, 206, 0, 18, 18);
if(hadron.analysisOnly)
drawTexturedModalRect(guiLeft + 142, guiTop + 89, 206, 18, 18, 18);
}
}

View File

@ -598,6 +598,18 @@ public class ModItems {
public static Item cell_sas3;
public static Item cell_antimatter;
public static Item cell_anti_schrabidium;
public static Item particle_empty;
public static Item particle_aproton;
public static Item particle_aelectron;
public static Item particle_amat;
public static Item particle_aschrab;
public static Item particle_higgs;
public static Item particle_muon;
public static Item particle_strange;
public static Item particle_dark;
public static Item particle_sparkticle;
public static Item pellet_antimatter;
public static Item singularity;
public static Item singularity_counter_resonant;
@ -2455,6 +2467,18 @@ public class ModItems {
cell_tritium = new ItemRadioactive(0.5F).setUnlocalizedName("cell_tritium").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.cell_empty).setTextureName(RefStrings.MODID + ":cell_tritium");
cell_sas3 = new ItemRadioactive(10F, false, true).setUnlocalizedName("cell_sas3").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.cell_empty).setTextureName(RefStrings.MODID + ":cell_sas3");
cell_anti_schrabidium = new ItemDrop().setUnlocalizedName("cell_anti_schrabidium").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.cell_empty).setTextureName(RefStrings.MODID + ":cell_anti_schrabidium");
particle_empty = new Item().setUnlocalizedName("particle_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":particle_empty");
particle_aproton = new Item().setUnlocalizedName("particle_aproton").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_aproton");
particle_aelectron = new Item().setUnlocalizedName("particle_aelectron").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_aelectron");
particle_amat = new Item().setUnlocalizedName("particle_amat").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_amat");
particle_aschrab = new Item().setUnlocalizedName("particle_aschrab").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_aschrab");
particle_higgs = new Item().setUnlocalizedName("particle_higgs").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_higgs");
particle_muon = new Item().setUnlocalizedName("particle_muon").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_muon");
particle_strange = new Item().setUnlocalizedName("particle_strange").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_strange");
particle_dark = new Item().setUnlocalizedName("particle_dark").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_dark");
particle_sparkticle = new Item().setUnlocalizedName("particle_sparkticle").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_sparkticle");
singularity = new ItemDrop().setUnlocalizedName("singularity").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.nuclear_waste).setTextureName(RefStrings.MODID + ":singularity");
singularity_counter_resonant = new ItemDrop().setUnlocalizedName("singularity_counter_resonant").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.nuclear_waste).setTextureName(RefStrings.MODID + ":singularity_alt");
singularity_super_heated = new ItemDrop().setUnlocalizedName("singularity_super_heated").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.nuclear_waste).setTextureName(RefStrings.MODID + ":singularity_5");
@ -4621,6 +4645,18 @@ public class ModItems {
GameRegistry.registerItem(cell_antimatter, cell_antimatter.getUnlocalizedName());
GameRegistry.registerItem(cell_anti_schrabidium, cell_anti_schrabidium.getUnlocalizedName());
//Particle Containers
GameRegistry.registerItem(particle_empty, particle_empty.getUnlocalizedName());
GameRegistry.registerItem(particle_aproton, particle_aproton.getUnlocalizedName());
GameRegistry.registerItem(particle_aelectron, particle_aelectron.getUnlocalizedName());
GameRegistry.registerItem(particle_amat, particle_amat.getUnlocalizedName());
GameRegistry.registerItem(particle_aschrab, particle_aschrab.getUnlocalizedName());
GameRegistry.registerItem(particle_higgs, particle_higgs.getUnlocalizedName());
GameRegistry.registerItem(particle_muon, particle_muon.getUnlocalizedName());
GameRegistry.registerItem(particle_strange, particle_strange.getUnlocalizedName());
GameRegistry.registerItem(particle_dark, particle_dark.getUnlocalizedName());
GameRegistry.registerItem(particle_sparkticle, particle_sparkticle.getUnlocalizedName());
//OMG how the hell is that even possible!?
GameRegistry.registerItem(singularity, singularity.getUnlocalizedName());
GameRegistry.registerItem(singularity_counter_resonant, singularity_counter_resonant.getUnlocalizedName());

View File

@ -9,9 +9,9 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import com.hbm.handler.ArmorUtil;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.util.ArmorUtil;
public class ArmorEuphemium extends ItemArmor {

View File

@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
public class ItemEnergy extends Item {
@ -29,6 +30,12 @@ public class ItemEnergy extends Item {
if (!world.isRemote)
{
if(player instanceof FakePlayer) {
world.newExplosion(player, player.posX, player.posY, player.posZ, 5F, true, true);
return super.onEaten(stack, world, player);
}
if(this == ModItems.can_smart)
{
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 30 * 20, 1));

View File

@ -3,9 +3,9 @@ package com.hbm.items.special;
import java.util.List;
import com.hbm.config.GeneralConfig;
import com.hbm.handler.ArmorUtil;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View File

@ -2,8 +2,8 @@ package com.hbm.items.special;
import java.util.List;
import com.hbm.handler.ArmorUtil;
import com.hbm.inventory.BreederRecipes;
import com.hbm.util.ArmorUtil;
import com.hbm.util.ContaminationUtil;
import net.minecraft.entity.Entity;

View File

@ -7,10 +7,10 @@ import com.google.common.collect.Multimap;
import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.entity.projectile.EntityRubble;
import com.hbm.handler.ArmorUtil;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;

View File

@ -455,6 +455,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityBOTPrimeBody.class, new RenderWormBody());
RenderingRegistry.registerEntityRenderingHandler(EntityDuck.class, new RenderDuck(new ModelChicken(), 0.3F));
RenderingRegistry.registerEntityRenderingHandler(EntityQuackos.class, new RenderQuacc(new ModelChicken(), 0.3F));
RenderingRegistry.registerEntityRenderingHandler(EntityFBI.class, new RenderFBI());
//"particles"
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));
@ -828,6 +829,31 @@ public class ClientProxy extends ServerProxy {
double mZ = data.getDouble("mZ");
world.spawnParticle(data.getString("mode"), x, y, z, mX, mY, mZ);
}
if("hadron".equals(type)) {
for(int i = 0; i < 30; i++) {
EntityFX fx = null;
if(i % 3 == 0) {
fx = new net.minecraft.client.particle.EntityReddustFX(world, x, y, z, 0.0F, 0.0F, 0.0F);
}
if(i % 3 == 1) {
fx = new net.minecraft.client.particle.EntityReddustFX(world, x, y, z, 0.01F, 0.01F, 1F);
}
if(i % 3 == 2) {
fx = new net.minecraft.client.particle.EntityReddustFX(world, x, y, z, 1F, 1F, 0.1F);
}
if(fx != null) {
fx.motionX = rand.nextGaussian() * 0.1;
fx.motionY = rand.nextGaussian() * 0.1;
fx.motionZ = rand.nextGaussian() * 0.1;
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
}
}
@Override

View File

@ -422,6 +422,8 @@ public class MainRegistry {
GameRegistry.registerTileEntity(TileEntityPlasmaStruct.class, "tileentity_plasma_struct");
GameRegistry.registerTileEntity(TileEntityMachineLargeTurbine.class, "tileentity_industrial_turbine");
GameRegistry.registerTileEntity(TileEntityHadronDiode.class, "tileentity_hadron_diode");
GameRegistry.registerTileEntity(TileEntityHadronPower.class, "tileentity_hadron_power");
GameRegistry.registerTileEntity(TileEntityHadron.class, "tileentity_hadron");
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
@ -582,6 +584,7 @@ public class MainRegistry {
EntityRegistry.registerGlobalEntityID(EntityMaskMan.class, "entity_mob_mask_man", EntityRegistry.findGlobalUniqueEntityId(), 0x818572, 0xC7C1B7);
EntityRegistry.registerGlobalEntityID(EntityDuck.class, "entity_fucc_a_ducc", EntityRegistry.findGlobalUniqueEntityId(), 0xd0d0d0, 0xFFBF00);
EntityRegistry.registerGlobalEntityID(EntityQuackos.class, "entity_elder_one", EntityRegistry.findGlobalUniqueEntityId(), 0xd0d0d0, 0xFFBF00);
EntityRegistry.registerGlobalEntityID(EntityFBI.class, "entity_ntm_fbi", EntityRegistry.findGlobalUniqueEntityId(), 0x008000, 0x404040);
// EntityRegistry.registerGlobalEntityID(EntityBOTPrimeHead.class,
// "entity_balls_o_tron_mk0", EntityRegistry.findGlobalUniqueEntityId(),

View File

@ -21,7 +21,6 @@ import com.hbm.entity.mob.EntityQuackos;
import com.hbm.entity.mob.EntityTaintedCreeper;
import com.hbm.entity.projectile.EntityBurningFOEQ;
import com.hbm.entity.projectile.EntityMeteor;
import com.hbm.handler.ArmorUtil;
import com.hbm.handler.BossSpawnHandler;
import com.hbm.handler.RadiationWorldHandler;
import com.hbm.handler.HTTPHandler;
@ -35,6 +34,7 @@ import com.hbm.packet.PlayerInformPacket;
import com.hbm.packet.RadSurveyPacket;
import com.hbm.saveddata.AuxSavedData;
import com.hbm.saveddata.RadiationSavedData;
import com.hbm.util.ArmorUtil;
import com.hbm.util.ContaminationUtil;
import com.hbm.world.generator.TimedGenerator;

View File

@ -0,0 +1,21 @@
package com.hbm.render.entity.mob;
import com.hbm.lib.RefStrings;
import com.hbm.render.model.ModelFBI;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
public class RenderFBI extends RenderBiped {
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":" + "textures/entity/fbi.png");
public RenderFBI() {
super(new ModelFBI(), 0.5F, 1.0F);
}
protected ResourceLocation getEntityTexture(EntityLiving entity) {
return texture;
}
}

View File

@ -0,0 +1,13 @@
package com.hbm.render.model;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
public class ModelFBI extends ModelBiped {
public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) {
this.aimedBow = true;
super.render(p_78088_1_, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_);
}
}

View File

@ -5,7 +5,6 @@ import java.util.List;
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.handler.ArmorUtil;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
@ -23,6 +22,7 @@ import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.saveddata.SatelliteSavedData;
import com.hbm.saveddata.satellites.SatelliteResonator;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;

View File

@ -2,6 +2,7 @@ package com.hbm.tileentity.machine;
import com.hbm.calc.Location;
import com.hbm.interfaces.IConsumer;
import com.hbm.tileentity.TileEntityMachineBase;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyHandler;
@ -10,8 +11,17 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityConverterHeRf extends TileEntity implements IConsumer, IEnergyHandler {
public class TileEntityConverterHeRf extends TileEntityMachineBase implements IConsumer, IEnergyHandler {
public TileEntityConverterHeRf() {
super(0);
}
@Override
public String getName() {
return "";
}
public long power;
public final long maxPower = 1000000;
public EnergyStorage storage = new EnergyStorage(4000000, 2500000, 2500000);
@ -46,9 +56,19 @@ public class TileEntityConverterHeRf extends TileEntity implements IConsumer, IE
storage.extractEnergy(energyTransferred, false);
}
}
NBTTagCompound data = new NBTTagCompound();
data.setInteger("rf", storage.getEnergyStored());
data.setLong("he", power);
this.networkPack(data, 25);
}
}
public void networkUnpack(NBTTagCompound nbt) {
storage.setEnergyStored(nbt.getInteger("rf"));
power = nbt.getLong("he");
}
@Override
public boolean canConnectEnergy(ForgeDirection from) {
return true;
@ -112,5 +132,4 @@ public class TileEntityConverterHeRf extends TileEntity implements IConsumer, IE
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
return 0;
}
}

View File

@ -6,14 +6,14 @@ import java.util.List;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.ISource;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyHandler;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityConverterRfHe extends TileEntity implements ISource, IEnergyHandler {
public class TileEntityConverterRfHe extends TileEntityMachineBase implements ISource, IEnergyHandler {
public long power;
public final long maxPower = 1000000;
@ -21,6 +21,15 @@ public class TileEntityConverterRfHe extends TileEntity implements ISource, IEne
public int age = 0;
public EnergyStorage storage = new EnergyStorage(4000000, 2500000, 2500000);
public TileEntityConverterRfHe() {
super(0);
}
@Override
public String getName() {
return "";
}
@Override
public void updateEntity() {
@ -33,16 +42,26 @@ public class TileEntityConverterRfHe extends TileEntity implements ISource, IEne
if(convert > 0)
this.markDirty();
}
age++;
if(age >= 20)
{
age = 0;
age++;
if(age >= 20)
{
age = 0;
}
if(age == 9 || age == 19)
ffgeuaInit();
NBTTagCompound data = new NBTTagCompound();
data.setInteger("rf", storage.getEnergyStored());
data.setLong("he", power);
this.networkPack(data, 25);
}
if(age == 9 || age == 19)
ffgeuaInit();
}
public void networkUnpack(NBTTagCompound nbt) {
storage.setEnergyStored(nbt.getInteger("rf"));
power = nbt.getLong("he");
}
@Override

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.handler.ArmorUtil;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
@ -12,6 +11,7 @@ import com.hbm.items.machine.ItemCatalyst;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.ArmorUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -1,12 +1,26 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
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.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.TileEntityMachineBase;
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.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -16,7 +30,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
public static final long maxPower = 1000000000;
public boolean isOn = false;
public boolean analysis = true;
public boolean analysisOnly = true;
public TileEntityHadron() {
super(3);
@ -33,21 +47,47 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
if(!worldObj.isRemote) {
drawPower();
if(particles.isEmpty() && slots[0] != null) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
particles.add(new Particle(slots[0].getItem(), dir, xCoord, yCoord, zCoord));
this.decrStackSize(0, 1);
}
if(!particles.isEmpty())
updateParticles();
for(Particle p : particlesToRemove) {
particles.remove(p);
}
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("isOn", isOn);
data.setLong("power", power);
data.setBoolean("analysis", analysisOnly);
this.networkPack(data, 50);
}
}
@Override
public void networkUnpack(NBTTagCompound data) {
this.isOn = data.getBoolean("isOn");
this.power = data.getLong("power");
this.analysisOnly = data.getBoolean("analysis");
}
@Override
public void handleButtonPacket(int value, int meta) {
if(meta == 0)
this.isOn = !this.isOn;
if(meta == 1)
this.analysis = !this.analysis;
this.analysisOnly = !this.analysisOnly;
}
private void drawPower() {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
for(ForgeDirection dir : getRandomDirs()) {
if(power == maxPower)
return;
@ -69,10 +109,16 @@ 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);
}
static final int maxParticles = 1;
List<Particle> particles = new ArrayList();
List<Particle> particlesToRemove = new ArrayList();
private void updateParticle() {
private void updateParticles() {
for(Particle particle : particles) {
particle.update();
@ -95,7 +141,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
return maxPower;
}
public static class Particle {
public class Particle {
//Starting values
Item item;
@ -107,6 +153,11 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
//Progressing values
int momentum;
int charge;
int analysis;
static final int maxCharge = 10;
boolean isCheckExempt = false;
boolean expired = false;
public Particle(Item item, ForgeDirection dir, int posX, int posY, int posZ) {
this.item = item;
@ -115,12 +166,382 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
this.posY = posY;
this.posZ = posZ;
this.charge = 10;
this.charge = maxCharge;
this.momentum = 0;
}
public void expire() {
if(expired)
return;
this.expired = true;
particlesToRemove.add(this);
worldObj.newExplosion(null, posX + 0.5, posY + 0.5, posZ + 0.5, 10, false, false);
System.out.println("Last dir: " + dir.name());
System.out.println("Last pos: " + posX + " " + posY + " " + posZ);
Thread.currentThread().dumpStack();
}
public boolean isExpired() {
return this.expired;
}
public void update() {
if(expired) //just in case
return;
this.charge--;
changeDirection(this);
makeSteppy(this);
checkSegment(this);
isCheckExempt = false; //clearing up the exemption we might have held from the previous turn, AFTER stepping
if(charge <= 0)
this.expire();
}
}
/**
* Moves the particle and does all the checks required to do so
* Handles diode entering behavior and whatnot
* @param p
*/
public void makeSteppy(Particle p) {
ForgeDirection dir = p.dir;
p.posX += dir.offsetX;
p.posY += dir.offsetY;
p.posZ += dir.offsetZ;
int x = p.posX;
int y = p.posY;
int z = p.posZ;
Block block = worldObj.getBlock(x, y, z);
TileEntity te = worldObj.getTileEntity(x, y, z);
if(te instanceof TileEntityHadron) {
if(p.analysis != 3)
p.expire();
else
this.finishParticle(p, false);
return;
}
if(block.getMaterial() != Material.air && block != ModBlocks.hadron_diode)
p.expire();
if(coilValue(worldObj.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) > 0)
p.isCheckExempt = true;
}
/**
* All the checks done *after* the particle moves one tile
* @param p
*/
public void checkSegment(Particle p) {
ForgeDirection dir = p.dir;
int x = p.posX;
int y = p.posY;
int z = p.posZ;
//we make a set of axis where the directional axis is 0 and the normals are 1
//that allows us to easily iterate through a rectangle that is normal to our moving direction
int dX = 1 - Math.abs(dir.offsetX);
int dY = 1 - Math.abs(dir.offsetY);
int dZ = 1 - Math.abs(dir.offsetZ);
//whether the particle has entered an analysis chamber
//-> all coils have to be air
//-> all platings have to be analysis chamber walls
boolean analysis = true;
for(int a = x - dX * 2; a <= x + dX * 2; a++) {
for(int b = y - dY * 2; b <= y + dY * 2; b++) {
for(int c = z - dZ * 2; c <= z + dZ * 2;c++) {
Block block = worldObj.getBlock(a, b, c);
/** ignore the center for now */
if(a == x && b == y && c == z) {
//we are either in a diode or the core - no analysis for you now
if(block.getMaterial() != Material.air)
analysis = false;
continue;
}
int ix = Math.abs(x - a);
int iy = Math.abs(y - b);
int iz = Math.abs(z - c);
/** check coils, all abs deltas are 1 or less */
if(ix <= 1 && iy <= 1 && iz <= 1) {
//are we exempt from the coil examination? nice, skip checks only for inner magnets, not the corners!
if(p.isCheckExempt && ix + iy + iz == 1) {
continue;
}
//coil is air, analysis can remain true
if(block.getMaterial() == Material.air && analysis) {
continue;
}
//not air -> not an analysis chamber
analysis = false;
int coilVal = coilValue(block);
//not a valid coil: kablam!
if(coilVal == 0) {
p.expire();
} else {
p.momentum += coilVal;
}
continue;
}
/** now we check the plating, sum of all local positions being 3 or less gives us the outer plating without corners */
if(ix + iy + iz <= 3) {
//if the plating is for the analysis chamber, continue no matter what
if(isAnalysis(block))
continue;
//no analysis chamber -> turn off analysis and proceed
analysis = false;
//a plating? good, continue
if(isPlating(block))
continue;
TileEntity te = worldObj.getTileEntity(a, b, c);
//power plugs are also ok, might as well succ some energy when passing
if(te instanceof TileEntityHadronPower) {
TileEntityHadronPower plug = (TileEntityHadronPower)te;
int req = p.maxCharge - p.charge; //how many "charge points" the particle needs to be fully charged
long bit = plug.maxPower / p.maxCharge; //how much HE one "charge point" is
int times = (int) (plug.getPower() / bit); //how many charges the plug has to offer
int total = Math.min(req, times); //whichever is less, the charges in the plug or the required charges
p.charge += total;
plug.setPower(plug.getPower() - total * bit);
continue;
}
//Are we exempt from checking the plating? skip all the plating blocks where branches could be
if(p.isCheckExempt && ix + iy + iz == 2) {
continue;
}
System.out.println("Was exempt: " + p.isCheckExempt);
worldObj.setBlock(a, b, c, Blocks.dirt);
p.expire();
}
}
}
}
if(analysis) {
p.analysis++;
//if the analysis chamber is too big, destroy
if(p.analysis > 3)
p.expire();
if(p.analysis == 2) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "hadron");
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5), new TargetPoint(worldObj.provider.dimensionId, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5, 25));
}
//if operating in line accelerator mode, halt after 2 blocks and staart the reading
if(this.analysisOnly && p.analysis == 2) {
this.finishParticle(p, true);
}
} else {
//if the analysis stops despite being short of 3 steps in the analysis chamber, destroy
if(p.analysis > 0 && p.analysis < 3)
p.expire();
}
}
/**
* Checks whether we can go forward or if we might want to do a turn
* Handles the better part of the diode behavior
* @param p
*/
public void changeDirection(Particle p) {
ForgeDirection dir = p.dir;
int x = p.posX;
int y = p.posY;
int z = p.posZ;
int nx = x + dir.offsetX;
int ny = y + dir.offsetY;
int nz = z + dir.offsetZ;
Block next = worldObj.getBlock(nx, ny, nz);
TileEntity te = worldObj.getTileEntity(nx, ny, nz);
//the next block appears to be a diode, let's see if we can enter
if(te instanceof TileEntityHadronDiode) {
TileEntityHadronDiode diode = (TileEntityHadronDiode)te;
if(diode.getConfig(p.dir.getOpposite().ordinal()) != DiodeConfig.IN) {
//it appears as if we have slammed into the side of a diode, ouch
p.expire();
}
//there's a diode ahead, turn off checks so we can make the curve
p.isCheckExempt = true;
//the *next* block is a diode, we are not in it yet, which means no turning and no check exemption. too bad kiddo.
return;
}
//instead of the next TE, we are looking at the current one - the diode (maybe)
te = worldObj.getTileEntity(x, y, z);
//if we are currently in a diode, we might want to consider changing dirs
if(te instanceof TileEntityHadronDiode) {
//since we are *in* a diode, we might want to call the warrant officer for
//an exemption for the coil check, because curves NEED holes to turn into, and
//checking for coils in spaces where there cannot be coils is quite not-good
p.isCheckExempt = true;
TileEntityHadronDiode diode = (TileEntityHadronDiode)te;
//the direction in which we were going anyway is an output, so we will keep going
if(diode.getConfig(dir.ordinal()) == DiodeConfig.OUT) {
return;
//well then, iterate through some random directions and hope a valid output shows up
} else {
List<ForgeDirection> dirs = getRandomDirs();
for(ForgeDirection d : dirs) {
if(d == dir || d == dir.getOpposite())
continue;
//looks like we can leave!
if(diode.getConfig(d.ordinal()) == DiodeConfig.OUT) {
//set the direction and leave this hellhole
p.dir = d;
return;
}
}
}
}
//next step is air or the core, proceed
if(next.getMaterial() == Material.air || next == ModBlocks.hadron_core)
return;
//so, the next block is most certainly a wall. not good. perhaps we could try turning?
if(coilValue(next) > 0) {
ForgeDirection validDir = ForgeDirection.UNKNOWN;
List<ForgeDirection> dirs = getRandomDirs();
System.out.println("Starting as " + dir.name());
//let's look at every direction we could go in
for(ForgeDirection d : dirs) {
if(d == dir || d == dir.getOpposite())
continue;
System.out.println("Trying " + d.name());
//there is air! we can pass!
if(worldObj.getBlock(x + d.offsetX, y + d.offsetY, z + d.offsetZ).getMaterial() == Material.air) {
if(validDir == ForgeDirection.UNKNOWN) {
validDir = d;
System.out.println("yes");
//it seems like there are two or more possible ways, which is not allowed without a diode
//sorry kid, nothing personal
} else {
System.out.println("what");
p.expire();
return;
}
}
}
//set the new direction
p.dir = validDir;
p.isCheckExempt = true;
return;
}
p.expire();
}
/**
* Dear god please grant me the gift of death and end my eternal torment
* @return
*/
private List<ForgeDirection> getRandomDirs() {
List<Integer> rands = Arrays.asList(new Integer[] {0, 1, 2, 3, 4, 5} );
Collections.shuffle(rands);
List<ForgeDirection> dirs = new ArrayList();
for(Integer i : rands) {
dirs.add(ForgeDirection.getOrientation(i));
}
return dirs;
}
public int coilValue(Block b) {
if(b instanceof BlockHadronCoil)
return ((BlockHadronCoil)b).factor;
return 0;
}
public boolean isPlating(Block b) {
return b instanceof BlockHadronPlating ||
b instanceof BlockHadronCoil ||
b == ModBlocks.hadron_plating_glass ||
b == ModBlocks.hadron_analysis_glass ||
b == ModBlocks.hadron_access;
}
public boolean isAnalysis(Block b) {
return b == ModBlocks.hadron_analysis ||
b == ModBlocks.hadron_analysis_glass;
}
}

View File

@ -1,9 +1,9 @@
package com.hbm.tileentity.machine;
import com.hbm.handler.ArmorUtil;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemKey;
import com.hbm.main.MainRegistry;
import com.hbm.util.ArmorUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View File

@ -8,11 +8,11 @@ import com.hbm.entity.mob.EntityCyberCrab;
import com.hbm.entity.mob.EntityNuclearCreeper;
import com.hbm.entity.mob.EntityTaintCrab;
import com.hbm.entity.mob.EntityTeslaCrab;
import com.hbm.handler.ArmorUtil;
import com.hbm.interfaces.IConsumer;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.ArmorUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View File

@ -1,5 +1,6 @@
package com.hbm.handler;
package com.hbm.util;
import com.hbm.handler.HazmatRegistry;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.potion.HbmPotion;
@ -107,10 +108,10 @@ public class ArmorUtil {
if(armor[0] == null || armor[1] == null || armor[2] == null || armor[3] == null) return false;
if(isFaradayArmor(armor[0].getItem()) &&
isFaradayArmor(armor[1].getItem()) &&
isFaradayArmor(armor[2].getItem()) &&
isFaradayArmor(armor[3].getItem()))
if(isFaradayArmor(armor[0]) &&
isFaradayArmor(armor[1]) &&
isFaradayArmor(armor[2]) &&
isFaradayArmor(armor[3]))
return true;
return false;
@ -141,7 +142,7 @@ public class ArmorUtil {
"spacesuit"
};
public static boolean isFaradayArmor(Item item) {
public static boolean isFaradayArmor(ItemStack item) {
String name = item.getUnlocalizedName();
@ -151,6 +152,9 @@ public class ArmorUtil {
return true;
}
if(HazmatRegistry.getCladding(item) > 0)
return true;
return false;
}